text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2013.12.05 at 10:55:21 PM EAT
//

package org.akomantoso.schema.v3.csd06;

import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for ForceMods.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *

 *

 * <simpleType name="ForceMods">
 *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
 *     <enumeration value="entryIntoForce"/>
 *     <enumeration value="endOfEnactment"/>
 *     <enumeration value="postponementOfEntryIntoForce"/>
 *     <enumeration value="prorogationOfForce"/>
 *     <enumeration value="reEnactment"/>
 *     <enumeration value="uncostitutionality"/>
 *   </restriction>
 * </simpleType>
 *

 *
 */
@XmlType(name = "ForceMods")
@XmlEnum
public enum ForceMods {

    @XmlEnumValue("entryIntoForce")
    ENTRY_INTO_FORCE("entryIntoForce"),
    @XmlEnumValue("endOfEnactment")
    END_OF_ENACTMENT("endOfEnactment"),
    @XmlEnumValue("postponementOfEntryIntoForce")
    POSTPONEMENT_OF_ENTRY_INTO_FORCE("postponementOfEntryIntoForce"),
    @XmlEnumValue("prorogationOfForce")
    PROROGATION_OF_FORCE("prorogationOfForce"),
    @XmlEnumValue("reEnactment")
    RE_ENACTMENT("reEnactment"),
    @XmlEnumValue("uncostitutionality")
    UNCOSTITUTIONALITY("uncostitutionality");
    private final String value;

    ForceMods(String v) {
        value = v;
    }

    public String value() {
        return value;
    }

    public static ForceMods fromValue(String v) {
        for (ForceMods c: ForceMods.values()) {
            if (c.value.equals(v)) {
                return c;
            }
        }
        throw new IllegalArgumentException(v);
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
  -->

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
    <display-name>Apache Jackrabbit</display-name>

    <!-- ====================================================================== -->
    <!-- R E P O S I T O R Y   S E R V L E T                                    -->
    <!-- ====================================================================== -->
    <servlet>
        <servlet-name>Repository</servlet-name>
        <servlet-class>org.apache.jackrabbit.j2ee.RepositoryAccessServlet</servlet-class>

        <init-param>
          <param-name>repository.context.attribute.name</param-name>
          <param-value>javax.jcr.Repository</param-value>
        </init-param>

        <load-on-startup>2</load-on-startup>
    </servlet>

    <!-- ====================================================================== -->
    <!-- W E B D A V  S E R V L E T                                              -->
    <!-- ====================================================================== -->
    <servlet>
        <servlet-name>Webdav</servlet-name>
        <description>
            The webdav servlet that connects HTTP request to the repository.
        </description>
        <servlet-class>org.apache.jackrabbit.j2ee.SimpleWebdavServlet</servlet-class>
        <init-param>
            <param-name>resource-path-prefix</param-name>
            <param-value>/repository</param-value>
            <description>
                defines the prefix for spooling resources out of the repository.
            </description>
        </init-param>
        <init-param>
            <param-name>resource-config</param-name>
            <param-value>/WEB-INF/config.xml</param-value>
            <description>
                Defines various dav-resource configuration parameters.
            </description>
        </init-param>
        <!--
            Optional parameter to define the behaviour of the referrer-based CSRF protection
        -->
        <!--
        <init-param>
            <param-name>csrf-protection</param-name>
            <param-value>host1.domain.com,host2.domain.org</param-value>
            <description>
                Defines the behaviour of the referrer based CSRF protection
                1) If omitted or left empty the (default) behaviour is to allow only requests with
                   an empty referrer header or a referrer host equal to the server host
                2) May also contain a comma separated list of additional allowed referrer hosts
                3) If set to 'disabled' no referrer checking will be performed at all
            </description>
        </init-param>
        -->
        <load-on-startup>3</load-on-startup>
    </servlet>

    <!-- ====================================================================== -->
    <!-- W E B D A V  S E R V E R  S E R V L E T                                  -->
    <!-- ====================================================================== -->
    <servlet>
        <servlet-name>JCRWebdavServer</servlet-name>
        <description>
            The servlet used to remote JCR calls over HTTP.
        </description>
        <servlet-class>org.apache.jackrabbit.j2ee.JcrRemotingServlet</servlet-class>
        <init-param>
            <param-name>missing-auth-mapping</param-name>
            <param-value></param-value>
            <description>
                Defines how a missing authorization header should be handled.
                1) If this init-param is missing, a 401 response is generated.
                   This is suitable for clients (eg. WebDAV clients) for which
                   sending a proper authorization header is not possible if the
                   server never sent a 401.
                2) If this init-param is present with an empty value,
                   null-credentials are returned, thus forcing an null login
                   on the repository.
                3) If this init-param is present with the value 'guestcredentials'
                   java.jcr.GuestCredentials are used to login to the repository.
                4) If this init-param has a 'user:password' value, the respective
                   simple credentials are generated.
            </description>
        </init-param>
        <!--
            Optional parameter to define the value of the 'WWW-Authenticate' header
        -->
        <!--
        <init-param>
            <param-name>authenticate-header</param-name>
            <param-value>Basic realm="Jackrabbit Webdav Server"</param-value>
            <description>
                Defines the value of the 'WWW-Authenticate' header.
            </description>
        </init-param>
        -->
        <init-param>
            <param-name>resource-path-prefix</param-name>
            <param-value>/server</param-value>
            <description>
                defines the prefix for spooling resources out of the repository.
            </description>
        </init-param>
        <!--
            Init parameters specific for JcrRemotingServlet
        -->
        <!--
        <init-param>
            <param-name>home</param-name>
            <param-value></param-value>
            <description>JcrRemotingServlet: Optional home directory for JcrRemotingServlet temporary files (default: "jackrabbit")</description>
        </init-param>
        <init-param>
            <param-name>temp-directory</param-name>
            <param-value></param-value>
            <description>JcrRemotingServlet: Optional temporary directory name (under home, default: "tmp")</description>
        </init-param>
        <init-param>
            <param-name>batchread-config</param-name>
            <param-value>/WEB-INF/batchread.properties</param-value>
            <description>JcrRemotingServlet: Optional mapping from node type names to default depth.</description>
        </init-param>
        <init-param>
        	<param-name>concurrency-level</param-name>
        	<param-value>50</param-value>
        	<description>Number of concurrent requests expected. Default value is 50.</description>
        </init-param>
        -->
        <!--
            Optional parameter to define the behaviour of the referrer-based CSRF protection
        -->
        <!--
        <init-param>
            <param-name>csrf-protection</param-name>
            <param-value>host1.domain.com,host2.domain.org</param-value>
            <description>
                Defines the behaviour of the referrer based CSRF protection
                1) If omitted or left empty the (default) behaviour is to allow only requests with
                   an empty referrer header or a referrer host equal to the server host
                2) May also contain a comma separated list of additional allowed referrer hosts
                3) If set to 'disabled' no referrer checking will be performed at all
            </description>
        </init-param>
        -->
        <load-on-startup>5</load-on-startup>
    </servlet>

    <!-- ====================================================================== -->
    <!-- R M I   B I N D I N G   S E R V L E T                                  -->
    <!-- ====================================================================== -->
    <servlet>
      <servlet-name>RMI</servlet-name>
      <servlet-class>org.apache.jackrabbit.servlet.remote.RemoteBindingServlet</servlet-class>
    </servlet>

    <!-- ====================================================================== -->
    <!-- S E R V L E T   M A P P I N G                                          -->
    <!-- ====================================================================== -->
    <servlet-mapping>
        <servlet-name>Webdav</servlet-name>
        <url-pattern>/repository/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>JCRWebdavServer</servlet-name>
        <url-pattern>/server/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>RMI</servlet-name>
        <url-pattern>/rmi</url-pattern>
    </servlet-mapping>

    <!-- ====================================================================== -->
    <!-- W E L C O M E   F I L E S                                              -->
    <!-- ====================================================================== -->
    <welcome-file-list>
      <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    <error-page>
        <exception-type>org.apache.jackrabbit.j2ee.JcrApiNotFoundException</exception-type>
        <location>/error/classpath.jsp</location>
    </error-page>
    <error-page>
        <exception-type>javax.jcr.RepositoryException</exception-type>
        <location>/error/repository.jsp</location>
    </error-page>

</web-app>

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

  <meta charset="utf-8">
	<title>Buses</title>

	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<link rel="icon" type="image/png" sizes="174x174" href="./style/favicon.png">

	<link rel="stylesheet" type="text/css" href="./style/examples.css">

Buses

			Buses make it easy to share effects across many instruments. send
			audio to a named bus from an instrument and then receive that
			channel on your effect. The gain values are all in decibels.

			Docs on send and
			receive.


text:
Ziggeo C# Server SDK
=========================

Ziggeo API (http://ziggeo.com) allows you to integrate video recording and playback with only
two lines of code in your site, service or app. This is the C# SDK repository. It's open source,
so if you want to improve on it, feel free to add a pull request.

Copyright (c) 2015 Ziggeo

Apache 2.0 License

Dependencies:
- Newtonsoft.Json


text:
package uk.gov.hmrc.releaser.domain

import java.io.File
import java.nio.file.Files

import org.scalatest._

import scala.xml.XML

class IvyTransformerSpecs extends WordSpec with Matchers with BeforeAndAfterEach with OptionValues with TryValues {

  val bobbyIvyFile = new File(this.getClass.getResource("/sbt-bobby/ivy.xml").toURI).toPath

  var transformer: IvyTransformer = _

  override def beforeEach() {
    transformer = new IvyTransformer
  }

  "the ivy transformer" should {

    "re-write the ivy with a new version 1.4.0" in {
      val dir = Files.createTempDirectory("test-release")
      val outFile = transformer(bobbyIvyFile, ReleaseVersion("1.4.0"), dir.resolve("ivy.xml")).success.get

      val ivyVersionText = (XML.loadFile(outFile.toFile) \ "info" \ "@revision").text

      ivyVersionText shouldBe "1.4.0"
    }
  }

}


text:
namespace Microsoft.Azure.Management.AlertsManagement.Models
{

    /// <summary>
    /// Defines values for AlertsSummaryGroupByFields.
    /// </summary>
    public static class AlertsSummaryGroupByFields
    {
        public const string Severity = "severity";
        public const string AlertState = "alertState";
        public const string MonitorCondition = "monitorCondition";
        public const string MonitorService = "monitorService";
        public const string SignalType = "signalType";
        public const string AlertRule = "alertRule";
    }
}


text:
/*
 * tcp.c
 *
 *  Created on: Mar 25, 2016
 *      Author: markus
 */

#include "tcp.h"

void tcpWorker(UArg arg0, UArg arg1){

	int  clientfd = (int)arg0;
	Mailbox_Handle mbox = (Mailbox_Handle)arg1;
	int  bytesRcvd;
	char buffer[TCPPACKETSIZE];
	uint8_t type;
	uint8_t compLen;
	uint16_t numVectors;
	int i;

	//struct ledMatrix matrix;

	System_printf("tcpWorker: start clientfd = 0x%x\n", clientfd);

	while ((bytesRcvd = recv(clientfd, buffer, TCPPACKETSIZE-1, 0)) > 0) {
		buffer[bytesRcvd]='\0';

		//System_printf("%s",buffer);
		//System_flush();
		if (buffer[0]== '\0'){
			break;
		}
	}

	type = (uint8_t)buffer[0];
	compLen = (uint8_t)buffer[1];
	numVectors = (uint16_t)(buffer[2] | (buffer[3] << 8));

	//System_printf("type: %d\ncompLen: %d\nnumVectors: %d\n", type, compLen, numVectors);
	//System_flush();

	for (i = 0; i < numVectors; i++)
	{
		_matrix.matrix[i].x = buffer[4 + i * 3];
		_matrix.matrix[i].y = buffer[5 + i * 3];
		_matrix.matrix[i].z = 8;
	}

	_matrix.size = numVectors;

	/*
	_matrix.size = 4;

	_matrix.matrix[0].x = 3;
	_matrix.matrix[0].y = 3;
	_matrix.matrix[0].z = 8;

	_matrix.matrix[1].x = 3;
	_matrix.matrix[1].y = 4;
	_matrix.matrix[1].z = 8;

	_matrix.matrix[2].x = 3;
	_matrix.matrix[2].y = 5;
	_matrix.matrix[2].z = 8;

	_matrix.matrix[3].x = 4;
	_matrix.matrix[3].y = 5;
	_matrix.matrix[3].z = 8;
*/

	Semaphore_post(_sem);

	//Mailbox_post(mbox, NULL, BIOS_NO_WAIT);

	System_printf("tcpWorker stop clientfd = 0x%x\n", clientfd);

	close(clientfd);

}

void netOpenHook(Mailbox_Handle mbox)
{
	Task_Handle taskHandle;
	Task_Params taskParams;
	Error_Block eb;

	/* Make sure Error_Block is initialized */
	Error_init(&eb);

	/*
	 *  Create the Task that farms out incoming TCP connections.
	 *  arg0 will be the port that this task listens to.
	 */
	Task_Params_init(&taskParams);
	taskParams.stackSize = 1800;
	taskParams.priority = 1;
	taskParams.arg0 = TCPPORT;
	taskParams.arg1 = mbox;

	taskHandle = Task_create((Task_FuncPtr)tcpHandler, &taskParams, &eb);
	if (taskHandle == NULL) {
		System_printf("netOpenHook: Failed to create tcpHandler Task\n");
	}

	System_flush();
}

void tcpHandler(UArg arg0, UArg arg1)
{
	int                status;
	int                clientfd;
	int                server;
	struct sockaddr_in localAddr;
	struct sockaddr_in clientAddr;
	int                optval;
	int                optlen = sizeof(optval);
	socklen_t          addrlen = sizeof(clientAddr);
	Task_Handle        taskHandle;
	Task_Params        taskParams;
	Error_Block        eb;

	server = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
	if (server == -1) {
		System_printf("Error: socket not created.\n");
		shutdown(server);
	}

	memset(&localAddr, 0, sizeof(localAddr));
	localAddr.sin_family = AF_INET;
	localAddr.sin_addr.s_addr = htonl(INADDR_ANY);
	localAddr.sin_port = htons(arg0);

	status = bind(server, (struct sockaddr *)&localAddr, sizeof(localAddr));
	if (status == -1) {
		System_printf("Error: bind failed.\n");
		shutdown(server);
		return;
	}

	status = listen(server, NUMTCPWORKERS);
	if (status == -1) {
		System_printf("Error: listen failed.\n");
		shutdown(server);
		return;
	}

	optval = 1;
	if (setsockopt(server, SOL_SOCKET, SO_KEEPALIVE, &optval, optlen) < 0) {
		System_printf("Error: setsockopt failed\n");
		shutdown(server);
		return;
	}

	while ((clientfd =
			accept(server, (struct sockaddr *)&clientAddr, &addrlen)) != -1) {

		System_printf("tcpHandler: Creating thread clientfd = %d\n", clientfd);

		/* Init the Error_Block */
		Error_init(&eb);

		/* Initialize the defaults and set the parameters. */
		Task_Params_init(&taskParams);
		taskParams.arg0 = (UArg)clientfd;
		taskParams.arg1 = arg1;
		taskParams.stackSize = 2046;
		taskHandle = Task_create((Task_FuncPtr)tcpWorker, &taskParams, &eb);
		if (taskHandle == NULL) {
			System_printf("Error: Failed to create new Task\n");
			close(clientfd);
		}

		/* addrlen is a value-result param, must reset for next accept call */
		addrlen = sizeof(clientAddr);
	}

	System_printf("Error: accept failed.\n");

	shutdown(server);
}
void shutdown(int serverfd){
	if (serverfd > 0) {
		close(serverfd);
	}
}


text:
This lightweight library only serves to make formatted console output code more readable.

Instead of:
```php
echo "\033[0;31Foo:\033[0m Bar";
```
We can do:
```php
$console->writeLn("<red>Foo:</red> Bar");
```

####Usage
```php
$console = new Console();
$console->write('This');
$console->write('is');
$console->write('a');
$console->writeLn('<blue>Test</blue>');
$console->writeLn('Hello world!');
```
will output

![Example output](http://i.imgur.com/jmJe8vu.png)

####Colors

| Color Code | Info              |
|------------|-------------------|
| black      | Black             |
| red        | Red               |
| green      | Green             |
| yellow     | Yellow            |
| blue       | Blue              |
| purple     | Purple            |
| cyan       | Cyan              |
| white      | White             |
| blackB     | Black Bold        |
| redB       | Red Bold          |
| greenB     | Black Bold        |
| yellowB    | Yellow Bold       |
| blueB      | Blue Bold         |
| purpleB    | Purple Bold       |
| cyanB      | Cyan Bold         |
| whiteB     | White Bold        |
| blackU     | Black Underlined  |
| redU       | Red Underlined    |
| greenU     | Black Underlined  |
| yellowU    | Yellow Underlined |
| blueU      | Blue Underlined   |
| purpleU    | Purple Underlined |
| cyanU      | Cyan Underlined   |
| whiteU     | White Underlined  |

####License
MIT


text:
static WORKING_AREA(waBlink, 32);

static msg_t blink(void *arg) {
  // blink twice per second
  pinMode(13, OUTPUT);
  while (1) {
    digitalWrite(13, HIGH);
    chThdSleepMilliseconds(100);
    digitalWrite(13, LOW);
    chThdSleepMilliseconds(400);
  }
  return 0;
}
//------------------------------------------------------------------------------
void setup() {
  Serial.begin(9600);
  // wait for USB Serial
  while (!Serial) {}

  // start kernel and continue main thread as loop
  chBegin(mainThread);
  while(1);
}
//------------------------------------------------------------------------------
// main thread and runs at NORMALPRIO
void mainThread() {
  uint32_t m = 1 + millis()/1000;

  // start blink thead
  chThdCreateStatic(waBlink, sizeof(waBlink), NORMALPRIO, blink, NULL);

  // print time every second
  while (1) {
    Serial.println(m++);

    // sleep until next second
    chThdSleepMilliseconds(1000*m - millis());
  }
}
//------------------------------------------------------------------------------
void loop() {
  // not used
}


text:
#include <srs_app_rtmp_conn.hpp>

#include <stdlib.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netinet/tcp.h>

using namespace std;

#include <srs_kernel_error.hpp>
#include <srs_kernel_log.hpp>
#include <srs_rtmp_stack.hpp>
#include <srs_core_autofree.hpp>
#include <srs_app_source.hpp>
#include <srs_app_server.hpp>
#include <srs_app_pithy_print.hpp>
#include <srs_app_config.hpp>
#include <srs_app_refer.hpp>
#include <srs_app_hls.hpp>
#include <srs_app_bandwidth.hpp>
#include <srs_app_st.hpp>
#include <srs_app_http_hooks.hpp>
#include <srs_app_edge.hpp>
#include <srs_app_utility.hpp>
#include <srs_rtmp_msg_array.hpp>
#include <srs_rtmp_amf0.hpp>
#include <srs_app_recv_thread.hpp>
#include <srs_core_performance.hpp>
#include <srs_kernel_utility.hpp>
#include <srs_app_security.hpp>
#include <srs_app_statistic.hpp>

// when stream is busy, for example, streaming is already
// publishing, when a new client to request to publish,
// sleep a while and close the connection.
#define SRS_STREAM_BUSY_SLEEP_US (int64_t)(3*1000*1000LL)

// the timeout to wait encoder to republish
// if timeout, close the connection.
#define SRS_REPUBLISH_SEND_TIMEOUT_US (int64_t)(3*60*1000*1000LL)
// if timeout, close the connection.
#define SRS_REPUBLISH_RECV_TIMEOUT_US (int64_t)(3*60*1000*1000LL)

// the timeout to wait client data, when client paused
// if timeout, close the connection.
#define SRS_PAUSED_SEND_TIMEOUT_US (int64_t)(30*60*1000*1000LL)
// if timeout, close the connection.
#define SRS_PAUSED_RECV_TIMEOUT_US (int64_t)(30*60*1000*1000LL)

// when edge timeout, retry next.
#define SRS_EDGE_TOKEN_TRAVERSE_TIMEOUT_US (int64_t)(3*1000*1000LL)

SrsRtmpConn::SrsRtmpConn(SrsServer* svr, st_netfd_t c)
    : SrsConnection(svr, c)
{
    server = svr;
    req = new SrsRequest();
    res = new SrsResponse();
    skt = new SrsStSocket(c);
    rtmp = new SrsRtmpServer(skt);
    refer = new SrsRefer();
    bandwidth = new SrsBandwidth();
    security = new SrsSecurity();
    duration = 0;
    kbps = new SrsKbps();
    kbps->set_io(skt, skt);
    wakable = NULL;

    mw_sleep = SRS_PERF_MW_SLEEP;
    mw_enabled = false;
    realtime = SRS_PERF_MIN_LATENCY_ENABLED;
    send_min_interval = 0;
    tcp_nodelay = false;

    _srs_config->subscribe(this);
}

SrsRtmpConn::~SrsRtmpConn()
{
    _srs_config->unsubscribe(this);

    srs_freep(req);
    srs_freep(res);
    srs_freep(rtmp);
    srs_freep(skt);
    srs_freep(refer);
    srs_freep(bandwidth);
    srs_freep(security);
    srs_freep(kbps);
}

void SrsRtmpConn::dispose()
{
    SrsConnection::dispose();

    // wakeup the handler which need to notice.
    if (wakable) {
        wakable->wakeup();
    }
}

// TODO: return detail message when error for client.
int SrsRtmpConn::do_cycle()
{
    int ret = ERROR_SUCCESS;

    srs_trace("RTMP client ip=%s", ip.c_str());

    rtmp->set_recv_timeout(SRS_CONSTS_RTMP_RECV_TIMEOUT_US);
    rtmp->set_send_timeout(SRS_CONSTS_RTMP_SEND_TIMEOUT_US);

    if ((ret = rtmp->handshake()) != ERROR_SUCCESS) {
        srs_error("rtmp handshake failed. ret=%d", ret);
        return ret;
    }
    srs_verbose("rtmp handshake success");

    if ((ret = rtmp->connect_app(req)) != ERROR_SUCCESS) {
        srs_error("rtmp connect vhost/app failed. ret=%d", ret);
        return ret;
    }
    srs_verbose("rtmp connect app success");

    // set client ip to request.
    req->ip = ip;

    // discovery vhost, resolve the vhost from config
    SrsConfDirective* parsed_vhost = _srs_config->get_vhost(req->vhost);
    if (parsed_vhost) {
        req->vhost = parsed_vhost->arg0();
    }

    srs_info("discovery app success. schema=%s, vhost=%s, port=%s, app=%s",
        req->schema.c_str(), req->vhost.c_str(), req->port.c_str(), req->app.c_str());

    if (req->schema.empty() || req->vhost.empty() || req->port.empty() || req->app.empty()) {
        ret = ERROR_RTMP_REQ_TCURL;
        srs_error("discovery tcUrl failed. "
            "tcUrl=%s, schema=%s, vhost=%s, port=%s, app=%s, ret=%d",
            req->tcUrl.c_str(), req->schema.c_str(), req->vhost.c_str(), req->port.c_str(), req->app.c_str(), ret);
        return ret;
    }

    // check vhost
    if ((ret = check_vhost()) != ERROR_SUCCESS) {
        srs_error("check vhost failed. ret=%d", ret);
        return ret;
    }
    srs_verbose("check vhost success.");

    srs_trace("connect app, "
        "tcUrl=%s, pageUrl=%s, swfUrl=%s, schema=%s, vhost=%s, port=%s, app=%s, args=%s",
        req->tcUrl.c_str(), req->pageUrl.c_str(), req->swfUrl.c_str(),
        req->schema.c_str(), req->vhost.c_str(), req->port.c_str(),
        req->app.c_str(), (req->args? "(obj)":"null"));

    // show client identity
    if(req->args) {
        std::string srs_version;
        std::string srs_server_ip;
        int srs_pid = 0;
        int srs_id = 0;

        SrsAmf0Any* prop = NULL;
        if ((prop = req->args->ensure_property_string("srs_version")) != NULL) {
            srs_version = prop->to_str();
        }
        if ((prop = req->args->ensure_property_string("srs_server_ip")) != NULL) {
            srs_server_ip = prop->to_str();
        }
        if ((prop = req->args->ensure_property_number("srs_pid")) != NULL) {
            srs_pid = (int)prop->to_number();
        }
        if ((prop = req->args->ensure_property_number("srs_id")) != NULL) {
            srs_id = (int)prop->to_number();
        }

        srs_info("edge-srs ip=%s, version=%s, pid=%d, id=%d",
            srs_server_ip.c_str(), srs_version.c_str(), srs_pid, srs_id);
        if (srs_pid > 0) {
            srs_trace("edge-srs ip=%s, version=%s, pid=%d, id=%d",
                srs_server_ip.c_str(), srs_version.c_str(), srs_pid, srs_id);
        }
    }

    ret = service_cycle();

    http_hooks_on_close();

    return ret;
}

int SrsRtmpConn::on_reload_vhost_removed(string vhost)
{
    int ret = ERROR_SUCCESS;

    if (req->vhost != vhost) {
        return ret;
    }

    // if the vhost connected is removed, disconnect the client.
    srs_trace("vhost %s removed/disabled, close client url=%s",
        vhost.c_str(), req->get_stream_url().c_str());

    srs_close_stfd(stfd);

    return ret;
}

int SrsRtmpConn::on_reload_vhost_mw(string vhost)
{
    int ret = ERROR_SUCCESS;

    if (req->vhost != vhost) {
        return ret;
    }

    int sleep_ms = _srs_config->get_mw_sleep_ms(req->vhost);

    // when mw_sleep changed, resize the socket send buffer.
    change_mw_sleep(sleep_ms);

    return ret;
}

int SrsRtmpConn::on_reload_vhost_smi(string vhost)
{
    int ret = ERROR_SUCCESS;

    if (req->vhost != vhost) {
        return ret;
    }

    double smi = _srs_config->get_send_min_interval(vhost);
    if (smi != send_min_interval) {
        srs_trace("apply smi %.2f=>%.2f", send_min_interval, smi);
        send_min_interval = smi;
    }

    return ret;
}

int SrsRtmpConn::on_reload_vhost_tcp_nodelay(string vhost)
{
    int ret = ERROR_SUCCESS;

    if (req->vhost != vhost) {
        return ret;
    }

    set_sock_options();

    return ret;
}

int SrsRtmpConn::on_reload_vhost_realtime(string vhost)
{
    int ret = ERROR_SUCCESS;

    if (req->vhost != vhost) {
        return ret;
    }

    bool realtime_enabled = _srs_config->get_realtime_enabled(req->vhost);
    if (realtime_enabled != realtime) {
        srs_trace("realtime changed %d=>%d", realtime, realtime_enabled);
        realtime = realtime_enabled;
    }

    return ret;
}

int SrsRtmpConn::on_reload_vhost_p1stpt(string vhost)
{
    int ret = ERROR_SUCCESS;

    if (req->vhost != vhost) {
        return ret;
    }

    int p1stpt = _srs_config->get_publish_1stpkt_timeout(req->vhost);
    if (p1stpt != publish_1stpkt_timeout) {
        srs_trace("p1stpt changed %d=>%d", publish_1stpkt_timeout, p1stpt);
        publish_1stpkt_timeout = p1stpt;
    }

    return ret;
}

int SrsRtmpConn::on_reload_vhost_pnt(string vhost)
{
    int ret = ERROR_SUCCESS;

    if (req->vhost != vhost) {
        return ret;
    }

    int pnt = _srs_config->get_publish_normal_timeout(req->vhost);
    if (pnt != publish_normal_timeout) {
        srs_trace("p1stpt changed %d=>%d", publish_normal_timeout, pnt);
        publish_normal_timeout = pnt;
    }

    return ret;
}

void SrsRtmpConn::resample()
{
    kbps->resample();
}

int64_t SrsRtmpConn::get_send_bytes_delta()
{
    return kbps->get_send_bytes_delta();
}

int64_t SrsRtmpConn::get_recv_bytes_delta()
{
    return kbps->get_recv_bytes_delta();
}

void SrsRtmpConn::cleanup()
{
    kbps->cleanup();
}

int SrsRtmpConn::service_cycle()
{
    int ret = ERROR_SUCCESS;

    if ((ret = rtmp->set_window_ack_size((int)(2.5 * 1000 * 1000))) != ERROR_SUCCESS) {
        srs_error("set window acknowledgement size failed. ret=%d", ret);
        return ret;
    }
    srs_verbose("set window acknowledgement size success");

    if ((ret = rtmp->set_peer_bandwidth((int)(2.5 * 1000 * 1000), 2)) != ERROR_SUCCESS) {
        srs_error("set peer bandwidth failed. ret=%d", ret);
        return ret;
    }
    srs_verbose("set peer bandwidth success");

    // get the ip which client connected.
    std::string local_ip = srs_get_local_ip(st_netfd_fileno(stfd));

    // do bandwidth test if connect to the vhost which is for bandwidth check.
    if (_srs_config->get_bw_check_enabled(req->vhost)) {
        return bandwidth->bandwidth_check(rtmp, skt, req, local_ip);
    }

    // do token traverse before serve it.
    // @see https://github.com/ossrs/srs/pull/239
    if (true) {
        bool vhost_is_edge = _srs_config->get_vhost_is_edge(req->vhost);
        bool edge_traverse = _srs_config->get_vhost_edge_token_traverse(req->vhost);
        if (vhost_is_edge && edge_traverse) {
            if ((ret = check_edge_token_traverse_auth()) != ERROR_SUCCESS) {
                srs_warn("token auth failed, ret=%d", ret);
                return ret;
            }
        }
    }

    // set chunk size to larger.
    // set the chunk size before any larger response greater than 128,
    // to make OBS happy, @see https://github.com/ossrs/srs/issues/454
    int chunk_size = _srs_config->get_chunk_size(req->vhost);
    if ((ret = rtmp->set_chunk_size(chunk_size)) != ERROR_SUCCESS) {
        srs_error("set chunk_size=%d failed. ret=%d", chunk_size, ret);
        return ret;
    }
    srs_info("set chunk_size=%d success", chunk_size);

    // response the client connect ok.
    if ((ret = rtmp->response_connect_app(req, local_ip.c_str())) != ERROR_SUCCESS) {
        srs_error("response connect app failed. ret=%d", ret);
        return ret;
    }
    srs_verbose("response connect app success");

    if ((ret = rtmp->on_bw_done()) != ERROR_SUCCESS) {
        srs_error("on_bw_done failed. ret=%d", ret);
        return ret;
    }
    srs_verbose("on_bw_done success");

    while (!disposed) {
        ret = stream_service_cycle();

        // stream service must terminated with error, never success.
        // when terminated with success, it's user required to stop.
        if (ret == ERROR_SUCCESS) {
            continue;
        }

        // when not system control error, fatal error, return.
        if (!srs_is_system_control_error(ret)) {
            if (ret != ERROR_SOCKET_TIMEOUT && !srs_is_client_gracefully_close(ret)) {
                srs_error("stream service cycle failed. ret=%d", ret);
            }
            return ret;
        }

        // for republish, continue service
        if (ret == ERROR_CONTROL_REPUBLISH) {
            // set timeout to a larger value, wait for encoder to republish.
            rtmp->set_send_timeout(SRS_REPUBLISH_RECV_TIMEOUT_US);
            rtmp->set_recv_timeout(SRS_REPUBLISH_SEND_TIMEOUT_US);

            srs_trace("control message(unpublish) accept, retry stream service.");
            continue;
        }

        // for "some" system control error,
        // logical accept and retry stream service.
        if (ret == ERROR_CONTROL_RTMP_CLOSE) {
            // TODO: FIXME: use ping message to anti-death of socket.
            // @see: https://github.com/ossrs/srs/issues/39
            // set timeout to a larger value, for user paused.
            rtmp->set_recv_timeout(SRS_PAUSED_RECV_TIMEOUT_US);
            rtmp->set_send_timeout(SRS_PAUSED_SEND_TIMEOUT_US);

            srs_trace("control message(close) accept, retry stream service.");
            continue;
        }

        // for other system control message, fatal error.
        srs_error("control message(%d) reject as error. ret=%d", ret, ret);
        return ret;
    }

    return ret;
}

int SrsRtmpConn::stream_service_cycle()
{
    int ret = ERROR_SUCCESS;

    SrsRtmpConnType type;
    if ((ret = rtmp->identify_client(res->stream_id, type, req->stream, req->duration)) != ERROR_SUCCESS) {
        if (!srs_is_client_gracefully_close(ret)) {
            srs_error("identify client failed. ret=%d", ret);
        }
        return ret;
    }
    req->strip();
    srs_trace("client identified, type=%s, stream_name=%s, duration=%.2f",
        srs_client_type_string(type).c_str(), req->stream.c_str(), req->duration);

    // security check
    if ((ret = security->check(type, ip, req)) != ERROR_SUCCESS) {
        srs_error("security check failed. ret=%d", ret);
        return ret;
    }
    srs_info("security check ok");

    // client is identified, set the timeout to service timeout.
    rtmp->set_recv_timeout(SRS_CONSTS_RTMP_RECV_TIMEOUT_US);
    rtmp->set_send_timeout(SRS_CONSTS_RTMP_SEND_TIMEOUT_US);

    // find a source to serve.
    SrsSource* source = SrsSource::fetch(req);
    if (!source) {
        if ((ret = SrsSource::create(req, server, server, &source)) != ERROR_SUCCESS) {
            return ret;
        }
    }
    srs_assert(source != NULL);

    // update the statistic when source disconveried.
    SrsStatistic* stat = SrsStatistic::instance();
    if ((ret = stat->on_client(_srs_context->get_id(), req, this, type)) != ERROR_SUCCESS) {
        srs_error("stat client failed. ret=%d", ret);
        return ret;
    }

    bool vhost_is_edge = _srs_config->get_vhost_is_edge(req->vhost);
    bool enabled_cache = _srs_config->get_gop_cache(req->vhost);
    srs_trace("source url=%s, ip=%s, cache=%d, is_edge=%d, source_id=%d[%d]",
        req->get_stream_url().c_str(), ip.c_str(), enabled_cache, vhost_is_edge,
        source->source_id(), source->source_id());
    source->set_cache(enabled_cache);

    switch (type) {
        case SrsRtmpConnPlay: {
            srs_verbose("start to play stream %s.", req->stream.c_str());

            // response connection start play
            if ((ret = rtmp->start_play(res->stream_id)) != ERROR_SUCCESS) {
                srs_error("start to play stream failed. ret=%d", ret);
                return ret;
            }
            if ((ret = http_hooks_on_play()) != ERROR_SUCCESS) {
                srs_error("http hook on_play failed. ret=%d", ret);
                return ret;
            }

            srs_info("start to play stream %s success", req->stream.c_str());
            ret = playing(source);
            http_hooks_on_stop();

            return ret;
        }
        case SrsRtmpConnFMLEPublish: {
            srs_verbose("FMLE start to publish stream %s.", req->stream.c_str());

            if ((ret = rtmp->start_fmle_publish(res->stream_id)) != ERROR_SUCCESS) {
                srs_error("start to publish stream failed. ret=%d", ret);
                return ret;
            }

            return publishing(source);
        }
        case SrsRtmpConnFlashPublish: {
            srs_verbose("flash start to publish stream %s.", req->stream.c_str());

            if ((ret = rtmp->start_flash_publish(res->stream_id)) != ERROR_SUCCESS) {
                srs_error("flash start to publish stream failed. ret=%d", ret);
                return ret;
            }

            return publishing(source);
        }
        default: {
            ret = ERROR_SYSTEM_CLIENT_INVALID;
            srs_info("invalid client type=%d. ret=%d", type, ret);
            return ret;
        }
    }

    return ret;
}

int SrsRtmpConn::check_vhost()
{
    int ret = ERROR_SUCCESS;

    srs_assert(req != NULL);

    SrsConfDirective* vhost = _srs_config->get_vhost(req->vhost);
    if (vhost == NULL) {
        ret = ERROR_RTMP_VHOST_NOT_FOUND;
        srs_error("vhost %s not found. ret=%d", req->vhost.c_str(), ret);
        return ret;
    }

    if (!_srs_config->get_vhost_enabled(req->vhost)) {
        ret = ERROR_RTMP_VHOST_NOT_FOUND;
        srs_error("vhost %s disabled. ret=%d", req->vhost.c_str(), ret);
        return ret;
    }

    if (req->vhost != vhost->arg0()) {
        srs_trace("vhost change from %s to %s", req->vhost.c_str(), vhost->arg0().c_str());
        req->vhost = vhost->arg0();
    }

    if ((ret = refer->check(req->pageUrl, _srs_config->get_refer(req->vhost))) != ERROR_SUCCESS) {
        srs_error("check refer failed. ret=%d", ret);
        return ret;
    }
    srs_verbose("check refer success.");

    if ((ret = http_hooks_on_connect()) != ERROR_SUCCESS) {
        return ret;
    }

    return ret;
}

int SrsRtmpConn::playing(SrsSource* source)
{
    int ret = ERROR_SUCCESS;

    // create consumer of souce.
    SrsConsumer* consumer = NULL;
    if ((ret = source->create_consumer(consumer)) != ERROR_SUCCESS) {
        srs_error("create consumer failed. ret=%d", ret);
        return ret;
    }
    SrsAutoFree(SrsConsumer, consumer);
    srs_verbose("consumer created success.");

    // use isolate thread to recv,
    // @see: https://github.com/ossrs/srs/issues/217
    SrsQueueRecvThread trd(consumer, rtmp, SRS_PERF_MW_SLEEP);

    // start isolate recv thread.
    if ((ret = trd.start()) != ERROR_SUCCESS) {
        srs_error("start isolate recv thread failed. ret=%d", ret);
        return ret;
    }

    // delivery messages for clients playing stream.
    wakable = consumer;
    ret = do_playing(source, consumer, &trd);
    wakable = NULL;

    // stop isolate recv thread
    trd.stop();

    // warn for the message is dropped.
    if (!trd.empty()) {
        srs_warn("drop the received %d messages", trd.size());
    }

    return ret;
}

int SrsRtmpConn::do_playing(SrsSource* source, SrsConsumer* consumer, SrsQueueRecvThread* trd)
{
    int ret = ERROR_SUCCESS;

    srs_assert(consumer != NULL);

    if ((ret = refer->check(req->pageUrl, _srs_config->get_refer_play(req->vhost))) != ERROR_SUCCESS) {
        srs_error("check play_refer failed. ret=%d", ret);
        return ret;
    }
    srs_verbose("check play_refer success.");

    // initialize other components
    SrsPithyPrint* pprint = SrsPithyPrint::create_rtmp_play();
    SrsAutoFree(SrsPithyPrint, pprint);

    SrsMessageArray msgs(SRS_PERF_MW_MSGS);
    bool user_specified_duration_to_stop = (req->duration > 0);
    int64_t starttime = -1;

    // setup the realtime.
    realtime = _srs_config->get_realtime_enabled(req->vhost);
    // setup the mw config.
    // when mw_sleep changed, resize the socket send buffer.
    mw_enabled = true;
    change_mw_sleep(_srs_config->get_mw_sleep_ms(req->vhost));
    // initialize the send_min_interval
    send_min_interval = _srs_config->get_send_min_interval(req->vhost);

    // set the sock options.
    set_sock_options();

    srs_trace("start play smi=%.2f, mw_sleep=%d, mw_enabled=%d, realtime=%d, tcp_nodelay=%d",
        send_min_interval, mw_sleep, mw_enabled, realtime, tcp_nodelay);

    while (!disposed) {
        // collect elapse for pithy print.
        pprint->elapse();

        // when source is set to expired, disconnect it.
        if (expired) {
            ret = ERROR_USER_DISCONNECT;
            srs_error("connection expired. ret=%d", ret);
            return ret;
        }

        // to use isolate thread to recv, can improve about 33% performance.
        // @see: https://github.com/ossrs/srs/issues/196
        // @see: https://github.com/ossrs/srs/issues/217
        while (!trd->empty()) {
            SrsCommonMessage* msg = trd->pump();
            srs_verbose("pump client message to process.");

            if ((ret = process_play_control_msg(consumer, msg)) != ERROR_SUCCESS) {
                if (!srs_is_system_control_error(ret) && !srs_is_client_gracefully_close(ret)) {
                    srs_error("process play control message failed. ret=%d", ret);
                }
                return ret;
            }
        }

        // quit when recv thread error.
        if ((ret = trd->error_code()) != ERROR_SUCCESS) {
            if (!srs_is_client_gracefully_close(ret) && !srs_is_system_control_error(ret)) {
                srs_error("recv thread failed. ret=%d", ret);
            }
            return ret;
        }

#ifdef SRS_PERF_QUEUE_COND_WAIT
        // for send wait time debug
        srs_verbose("send thread now=%"PRId64"us, wait %dms", srs_update_system_time_ms(), mw_sleep);

        // wait for message to incoming.
        // @see https://github.com/ossrs/srs/issues/251
        // @see https://github.com/ossrs/srs/issues/257
        if (realtime) {
            // for realtime, min required msgs is 0, send when got one+ msgs.
            consumer->wait(0, mw_sleep);
        } else {
            // for no-realtime, got some msgs then send.
            consumer->wait(SRS_PERF_MW_MIN_MSGS, mw_sleep);
        }

        // for send wait time debug
        srs_verbose("send thread now=%"PRId64"us wakeup", srs_update_system_time_ms());
#endif

        // get messages from consumer.
        // each msg in msgs.msgs must be free, for the SrsMessageArray never free them.
        // @remark when enable send_min_interval, only fetch one message a time.
        int count = (send_min_interval > 0)? 1 : 0;
        if ((ret = consumer->dump_packets(&msgs, count)) != ERROR_SUCCESS) {
            srs_error("get messages from consumer failed. ret=%d", ret);
            return ret;
        }

        // reportable
        if (pprint->can_print()) {
            kbps->sample();
            srs_trace("-> "SRS_CONSTS_LOG_PLAY
                " time=%"PRId64", msgs=%d, okbps=%d,%d,%d, ikbps=%d,%d,%d, mw=%d",
                pprint->age(), count,
                kbps->get_send_kbps(), kbps->get_send_kbps_30s(), kbps->get_send_kbps_5m(),
                kbps->get_recv_kbps(), kbps->get_recv_kbps_30s(), kbps->get_recv_kbps_5m(),
                mw_sleep
            );
        }

        // we use wait timeout to get messages,
        // for min latency event no message incoming,
        // so the count maybe zero.
        if (count > 0) {
            srs_verbose("mw wait %dms and got %d msgs %d(%"PRId64"-%"PRId64")ms",
                mw_sleep, count,
                (count > 0? msgs.msgs[count - 1]->timestamp - msgs.msgs[0]->timestamp : 0),
                (count > 0? msgs.msgs[0]->timestamp : 0),
                (count > 0? msgs.msgs[count - 1]->timestamp : 0));
        }

        if (count <= 0) {
#ifndef SRS_PERF_QUEUE_COND_WAIT
            srs_info("mw sleep %dms for no msg", mw_sleep);
            st_usleep(mw_sleep * 1000);
#else
            srs_verbose("mw wait %dms and got nothing.", mw_sleep);
#endif
            // ignore when nothing got.
            continue;
        }
        srs_info("got %d msgs, min=%d, mw=%d", count, SRS_PERF_MW_MIN_MSGS, mw_sleep);

        // only when user specifies the duration,
        // we start to collect the durations for each message.
        if (user_specified_duration_to_stop) {
            for (int i = 0; i < count; i++) {
                SrsSharedPtrMessage* msg = msgs.msgs[i];

                // foreach msg, collect the duration.
                // @remark: never use msg when sent it, for the protocol sdk will free it.
                if (starttime < 0 || starttime > msg->timestamp) {
                    starttime = msg->timestamp;
                }
                duration += msg->timestamp - starttime;
                starttime = msg->timestamp;
            }
        }

        // sendout messages, all messages are freed by send_and_free_messages().
        // no need to assert msg, for the rtmp will assert it.
        if (count > 0 && (ret = rtmp->send_and_free_messages(msgs.msgs, count, res->stream_id)) != ERROR_SUCCESS) {
            if (!srs_is_client_gracefully_close(ret)) {
                srs_error("send messages to client failed. ret=%d", ret);
            }
            return ret;
        }

        // if duration specified, and exceed it, stop play live.
        // @see: https://github.com/ossrs/srs/issues/45
        if (user_specified_duration_to_stop) {
            if (duration >= (int64_t)req->duration) {
                ret = ERROR_RTMP_DURATION_EXCEED;
                srs_trace("stop live for duration exceed. ret=%d", ret);
                return ret;
            }
        }

        // apply the minimal interval for delivery stream in ms.
        if (send_min_interval > 0) {
            st_usleep((int64_t)(send_min_interval * 1000));
        }
    }

    return ret;
}

int SrsRtmpConn::publishing(SrsSource* source)
{
    int ret = ERROR_SUCCESS;

    if ((ret = refer->check(req->pageUrl, _srs_config->get_refer_publish(req->vhost))) != ERROR_SUCCESS) {
        srs_error("check publish_refer failed. ret=%d", ret);
        return ret;
    }
    srs_verbose("check publish_refer success.");

    if ((ret = http_hooks_on_publish()) != ERROR_SUCCESS) {
        srs_error("http hook on_publish failed. ret=%d", ret);
        return ret;
    }

    bool vhost_is_edge = _srs_config->get_vhost_is_edge(req->vhost);
    if ((ret = acquire_publish(source, vhost_is_edge)) == ERROR_SUCCESS) {
        // use isolate thread to recv,
        // @see: https://github.com/ossrs/srs/issues/237
        SrsPublishRecvThread trd(rtmp, req,
            st_netfd_fileno(stfd), 0, this, source, true, vhost_is_edge);

        srs_info("start to publish stream %s success", req->stream.c_str());
        ret = do_publishing(source, &trd);

        // stop isolate recv thread
        trd.stop();
    }

    // whatever the acquire publish, always release publish.
    // when the acquire error in the midlle-way, the publish state changed,
    // but failed, so we must cleanup it.
    // @see https://github.com/ossrs/srs/issues/474
    // @remark when stream is busy, should never release it.
    if (ret != ERROR_SYSTEM_STREAM_BUSY) {
        release_publish(source, vhost_is_edge);
    }

    http_hooks_on_unpublish();

    return ret;
}

int SrsRtmpConn::do_publishing(SrsSource* source, SrsPublishRecvThread* trd)
{
    int ret = ERROR_SUCCESS;

    SrsPithyPrint* pprint = SrsPithyPrint::create_rtmp_publish();
    SrsAutoFree(SrsPithyPrint, pprint);

    // start isolate recv thread.
    if ((ret = trd->start()) != ERROR_SUCCESS) {
        srs_error("start isolate recv thread failed. ret=%d", ret);
        return ret;
    }

    // change the isolate recv thread context id,
    // merge its log to current thread.
    int receive_thread_cid = trd->get_cid();
    trd->set_cid(_srs_context->get_id());

    // initialize the publish timeout.
    publish_1stpkt_timeout = _srs_config->get_publish_1stpkt_timeout(req->vhost);
    publish_normal_timeout = _srs_config->get_publish_1stpkt_timeout(req->vhost);

    // set the sock options.
    set_sock_options();

    if (true) {
        bool mr = _srs_config->get_mr_enabled(req->vhost);
        int mr_sleep = _srs_config->get_mr_sleep_ms(req->vhost);
        srs_trace("start publish mr=%d/%d, p1stpt=%d, pnt=%d, tcp_nodelay=%d, rtcid=%d",
                  mr, mr_sleep, publish_1stpkt_timeout, publish_normal_timeout, tcp_nodelay, receive_thread_cid);
    }

    int64_t nb_msgs = 0;
    while (!disposed) {
        pprint->elapse();

        // when source is set to expired, disconnect it.
        if (expired) {
            ret = ERROR_USER_DISCONNECT;
            srs_error("connection expired. ret=%d", ret);
            return ret;
        }

        // cond wait for timeout.
        if (nb_msgs == 0) {
            // when not got msgs, wait for a larger timeout.
            // @see https://github.com/ossrs/srs/issues/441
            trd->wait(publish_1stpkt_timeout);
        } else {
            trd->wait(publish_normal_timeout);
        }

        // check the thread error code.
        if ((ret = trd->error_code()) != ERROR_SUCCESS) {
            if (!srs_is_system_control_error(ret) && !srs_is_client_gracefully_close(ret)) {
                srs_error("recv thread failed. ret=%d", ret);
            }
            return ret;
        }

        // when not got any messages, timeout.
        if (trd->nb_msgs() <= nb_msgs) {
            ret = ERROR_SOCKET_TIMEOUT;
            srs_warn("publish timeout %dms, nb_msgs=%"PRId64", ret=%d",
                nb_msgs? publish_normal_timeout : publish_1stpkt_timeout, nb_msgs, ret);
            break;
        }
        nb_msgs = trd->nb_msgs();

        // reportable
        if (pprint->can_print()) {
            kbps->sample();
            bool mr = _srs_config->get_mr_enabled(req->vhost);
            int mr_sleep = _srs_config->get_mr_sleep_ms(req->vhost);
            srs_trace("<- "SRS_CONSTS_LOG_CLIENT_PUBLISH
                " time=%"PRId64", okbps=%d,%d,%d, ikbps=%d,%d,%d, mr=%d/%d, p1stpt=%d, pnt=%d", pprint->age(),
                kbps->get_send_kbps(), kbps->get_send_kbps_30s(), kbps->get_send_kbps_5m(),
                kbps->get_recv_kbps(), kbps->get_recv_kbps_30s(), kbps->get_recv_kbps_5m(),
                mr, mr_sleep, publish_1stpkt_timeout, publish_normal_timeout
            );
        }
    }

    return ret;
}

int SrsRtmpConn::acquire_publish(SrsSource* source, bool is_edge)
{
    int ret = ERROR_SUCCESS;

    if (!source->can_publish(is_edge)) {
        ret = ERROR_SYSTEM_STREAM_BUSY;
        srs_warn("stream %s is already publishing. ret=%d",
            req->get_stream_url().c_str(), ret);
        return ret;
    }

    // when edge, ignore the publish event, directly proxy it.
    if (is_edge) {
        if ((ret = source->on_edge_start_publish()) != ERROR_SUCCESS) {
            srs_error("notice edge start publish stream failed. ret=%d", ret);
            return ret;
        }
    } else {
        if ((ret = source->on_publish()) != ERROR_SUCCESS) {
            srs_error("notify publish failed. ret=%d", ret);
            return ret;
        }
    }

    return ret;
}

void SrsRtmpConn::release_publish(SrsSource* source, bool is_edge)
{
    // when edge, notice edge to change state.
    // when origin, notice all service to unpublish.
    if (is_edge) {
        source->on_edge_proxy_unpublish();
    } else {
        source->on_unpublish();
    }
}

int SrsRtmpConn::handle_publish_message(SrsSource* source, SrsCommonMessage* msg, bool is_fmle, bool vhost_is_edge)
{
    int ret = ERROR_SUCCESS;

    // process publish event.
    if (msg->header.is_amf0_command() || msg->header.is_amf3_command()) {
        SrsPacket* pkt = NULL;
        if ((ret = rtmp->decode_message(msg, &pkt)) != ERROR_SUCCESS) {
            srs_error("fmle decode unpublish message failed. ret=%d", ret);
            return ret;
        }
        SrsAutoFree(SrsPacket, pkt);

        // for flash, any packet is republish.
        if (!is_fmle) {
            // flash unpublish.
            // TODO: maybe need to support republish.
            srs_trace("flash flash publish finished.");
            return ERROR_CONTROL_REPUBLISH;
        }

        // for fmle, drop others except the fmle start packet.
        if (dynamic_cast<SrsFMLEStartPacket*>(pkt)) {
            SrsFMLEStartPacket* unpublish = dynamic_cast<SrsFMLEStartPacket*>(pkt);
            if ((ret = rtmp->fmle_unpublish(res->stream_id, unpublish->transaction_id)) != ERROR_SUCCESS) {
                return ret;
            }
            return ERROR_CONTROL_REPUBLISH;
        }

        srs_trace("fmle ignore AMF0/AMF3 command message.");
        return ret;
    }

    // video, audio, data message
    if ((ret = process_publish_message(source, msg, vhost_is_edge)) != ERROR_SUCCESS) {
        srs_error("fmle process publish message failed. ret=%d", ret);
        return ret;
    }

    return ret;
}

int SrsRtmpConn::process_publish_message(SrsSource* source, SrsCommonMessage* msg, bool vhost_is_edge)
{
    int ret = ERROR_SUCCESS;

    // for edge, directly proxy message to origin.
    if (vhost_is_edge) {
        if ((ret = source->on_edge_proxy_publish(msg)) != ERROR_SUCCESS) {
            srs_error("edge publish proxy msg failed. ret=%d", ret);
            return ret;
        }
        return ret;
    }

    // process audio packet
    if (msg->header.is_audio()) {
        if ((ret = source->on_audio(msg)) != ERROR_SUCCESS) {
            srs_error("source process audio message failed. ret=%d", ret);
            return ret;
        }
        return ret;
    }
    // process video packet
    if (msg->header.is_video()) {
        if ((ret = source->on_video(msg)) != ERROR_SUCCESS) {
            srs_error("source process video message failed. ret=%d", ret);
            return ret;
        }
        return ret;
    }

    // process aggregate packet
    if (msg->header.is_aggregate()) {
        if ((ret = source->on_aggregate(msg)) != ERROR_SUCCESS) {
            srs_error("source process aggregate message failed. ret=%d", ret);
            return ret;
        }
        return ret;
    }

    // process onMetaData
    if (msg->header.is_amf0_data() || msg->header.is_amf3_data()) {
        SrsPacket* pkt = NULL;
        if ((ret = rtmp->decode_message(msg, &pkt)) != ERROR_SUCCESS) {
            srs_error("decode onMetaData message failed. ret=%d", ret);
            return ret;
        }
        SrsAutoFree(SrsPacket, pkt);

        if (dynamic_cast<SrsOnMetaDataPacket*>(pkt)) {
            SrsOnMetaDataPacket* metadata = dynamic_cast<SrsOnMetaDataPacket*>(pkt);
            if ((ret = source->on_meta_data(msg, metadata)) != ERROR_SUCCESS) {
                srs_error("source process onMetaData message failed. ret=%d", ret);
                return ret;
            }
            srs_info("process onMetaData message success.");
            return ret;
        }

        srs_info("ignore AMF0/AMF3 data message.");
        return ret;
    }

    return ret;
}

int SrsRtmpConn::process_play_control_msg(SrsConsumer* consumer, SrsCommonMessage* msg)
{
    int ret = ERROR_SUCCESS;

    if (!msg) {
        srs_verbose("ignore all empty message.");
        return ret;
    }
    SrsAutoFree(SrsCommonMessage, msg);

    if (!msg->header.is_amf0_command() && !msg->header.is_amf3_command()) {
        srs_info("ignore all message except amf0/amf3 command.");
        return ret;
    }

    SrsPacket* pkt = NULL;
    if ((ret = rtmp->decode_message(msg, &pkt)) != ERROR_SUCCESS) {
        srs_error("decode the amf0/amf3 command packet failed. ret=%d", ret);
        return ret;
    }
    srs_info("decode the amf0/amf3 command packet success.");

    SrsAutoFree(SrsPacket, pkt);

    // for jwplayer/flowplayer, which send close as pause message.
    // @see https://github.com/ossrs/srs/issues/6
    SrsCloseStreamPacket* close = dynamic_cast<SrsCloseStreamPacket*>(pkt);
    if (close) {
        ret = ERROR_CONTROL_RTMP_CLOSE;
        srs_trace("system control message: rtmp close stream. ret=%d", ret);
        return ret;
    }

    // call msg,
    // support response null first,
    // @see https://github.com/ossrs/srs/issues/106
    // TODO: FIXME: response in right way, or forward in edge mode.
    SrsCallPacket* call = dynamic_cast<SrsCallPacket*>(pkt);
    if (call) {
        // only response it when transaction id not zero,
        // for the zero means donot need response.
        if (call->transaction_id > 0) {
            SrsCallResPacket* res = new SrsCallResPacket(call->transaction_id);
            res->command_object = SrsAmf0Any::null();
            res->response = SrsAmf0Any::null();
            if ((ret = rtmp->send_and_free_packet(res, 0)) != ERROR_SUCCESS) {
                if (!srs_is_system_control_error(ret) && !srs_is_client_gracefully_close(ret)) {
                    srs_warn("response call failed. ret=%d", ret);
                }
                return ret;
            }
        }
        return ret;
    }

    // pause
    SrsPausePacket* pause = dynamic_cast<SrsPausePacket*>(pkt);
    if (pause) {
        if ((ret = rtmp->on_play_client_pause(res->stream_id, pause->is_pause)) != ERROR_SUCCESS) {
            srs_error("rtmp process play client pause failed. ret=%d", ret);
            return ret;
        }

        if ((ret = consumer->on_play_client_pause(pause->is_pause)) != ERROR_SUCCESS) {
            srs_error("consumer process play client pause failed. ret=%d", ret);
            return ret;
        }
        srs_info("process pause success, is_pause=%d, time=%d.", pause->is_pause, pause->time_ms);
        return ret;
    }

    // other msg.
    srs_info("ignore all amf0/amf3 command except pause and video control.");
    return ret;
}

void SrsRtmpConn::change_mw_sleep(int sleep_ms)
{
    if (!mw_enabled) {
        return;
    }

    // get the sock buffer size.
    int fd = st_netfd_fileno(stfd);
    int onb_sbuf = 0;
    socklen_t sock_buf_size = sizeof(int);
    getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &onb_sbuf, &sock_buf_size);

#ifdef SRS_PERF_MW_SO_SNDBUF
    // the bytes:
    //      4KB=4096, 8KB=8192, 16KB=16384, 32KB=32768, 64KB=65536,
    //      128KB=131072, 256KB=262144, 512KB=524288
    // the buffer should set to sleep*kbps/8,
    // for example, your system delivery stream in 1000kbps,
    // sleep 800ms for small bytes, the buffer should set to:
    //      800*1000/8=100000B(about 128KB).
    // other examples:
    //      2000*3000/8=750000B(about 732KB).
    //      2000*5000/8=1250000B(about 1220KB).
    int kbps = 5000;
    int socket_buffer_size = sleep_ms * kbps / 8;

    // socket send buffer, system will double it.
    int nb_sbuf = socket_buffer_size / 2;

    // override the send buffer by macro.
    #ifdef SRS_PERF_SO_SNDBUF_SIZE
    nb_sbuf = SRS_PERF_SO_SNDBUF_SIZE / 2;
    #endif

    // set the socket send buffer when required larger buffer
    if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &nb_sbuf, sock_buf_size) < 0) {
        srs_warn("set sock SO_SENDBUF=%d failed.", nb_sbuf);
    }
    getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &nb_sbuf, &sock_buf_size);

    srs_trace("mw changed sleep %d=>%d, max_msgs=%d, esbuf=%d, sbuf %d=>%d, realtime=%d",
        mw_sleep, sleep_ms, SRS_PERF_MW_MSGS, socket_buffer_size,
        onb_sbuf, nb_sbuf, realtime);
#else
    srs_trace("mw changed sleep %d=>%d, max_msgs=%d, sbuf %d, realtime=%d",
        mw_sleep, sleep_ms, SRS_PERF_MW_MSGS, onb_sbuf, realtime);
#endif

    mw_sleep = sleep_ms;
}

void SrsRtmpConn::set_sock_options()
{
    bool nvalue = _srs_config->get_tcp_nodelay(req->vhost);
    if (nvalue != tcp_nodelay) {
        tcp_nodelay = nvalue;
#ifdef SRS_PERF_TCP_NODELAY
        int fd = st_netfd_fileno(stfd);

        socklen_t nb_v = sizeof(int);

        int ov = 0;
        getsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &ov, &nb_v);

        int v = tcp_nodelay;
        // set the socket send buffer when required larger buffer
        if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &v, nb_v) < 0) {
            srs_warn("set sock TCP_NODELAY=%d failed.", v);
        }
        getsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &v, &nb_v);

        srs_trace("set TCP_NODELAY %d=>%d", ov, v);
#else
        srs_warn("SRS_PERF_TCP_NODELAY is disabled but tcp_nodelay configed.");
#endif
    }
}

int SrsRtmpConn::check_edge_token_traverse_auth()
{
    int ret = ERROR_SUCCESS;

    srs_assert(req);

    st_netfd_t stsock = NULL;
    SrsConfDirective* conf = _srs_config->get_vhost_edge_origin(req->vhost);
    for (int i = 0; i < (int)conf->args.size(); i++) {
        if ((ret = connect_server(i, &stsock)) == ERROR_SUCCESS) {
            break;
        }
    }
    if (ret != ERROR_SUCCESS) {
        srs_warn("token traverse connect failed. ret=%d", ret);
        return ret;
    }

    srs_assert(stsock);
    SrsStSocket* io = new SrsStSocket(stsock);
    SrsRtmpClient* client = new SrsRtmpClient(io);

    ret = do_token_traverse_auth(client);

    srs_freep(client);
    srs_freep(io);
    srs_close_stfd(stsock);

    return ret;
}

int SrsRtmpConn::connect_server(int origin_index, st_netfd_t* pstsock)
{
    int ret = ERROR_SUCCESS;

    SrsConfDirective* conf = _srs_config->get_vhost_edge_origin(req->vhost);
    srs_assert(conf);

    // select the origin.
    std::string server = conf->args.at(origin_index % conf->args.size());
    origin_index = (origin_index + 1) % conf->args.size();

    std::string s_port = SRS_CONSTS_RTMP_DEFAULT_PORT;
    int port = ::atoi(SRS_CONSTS_RTMP_DEFAULT_PORT);
    size_t pos = server.find(":");
    if (pos != std::string::npos) {
        s_port = server.substr(pos + 1);
        server = server.substr(0, pos);
        port = ::atoi(s_port.c_str());
    }

    // open socket.
    st_netfd_t stsock = NULL;
    int64_t timeout = SRS_EDGE_TOKEN_TRAVERSE_TIMEOUT_US;
    if ((ret = srs_socket_connect(server, port, timeout, &stsock)) != ERROR_SUCCESS) {
        srs_warn("edge token traverse failed, tcUrl=%s to server=%s, port=%d, timeout=%"PRId64", ret=%d",
            req->tcUrl.c_str(), server.c_str(), port, timeout, ret);
        return ret;
    }
    srs_info("edge token auth connected, url=%s/%s, server=%s:%d", req->tcUrl.c_str(), req->stream.c_str(), server.c_str(), port);

    *pstsock = stsock;
    return ret;
}

int SrsRtmpConn::do_token_traverse_auth(SrsRtmpClient* client)
{
    int ret = ERROR_SUCCESS;

    srs_assert(client);

    client->set_recv_timeout(SRS_CONSTS_RTMP_RECV_TIMEOUT_US);
    client->set_send_timeout(SRS_CONSTS_RTMP_SEND_TIMEOUT_US);

    if ((ret = client->handshake()) != ERROR_SUCCESS) {
        srs_error("handshake with server failed. ret=%d", ret);
        return ret;
    }

    // for token tranverse, always take the debug info(which carries token).
    if ((ret = client->connect_app(req->app, req->tcUrl, req, true)) != ERROR_SUCCESS) {
        srs_error("connect with server failed, tcUrl=%s. ret=%d", req->tcUrl.c_str(), ret);
        return ret;
    }

    srs_trace("edge token auth ok, tcUrl=%s", req->tcUrl.c_str());

    return ret;
}

int SrsRtmpConn::http_hooks_on_connect()
{
    int ret = ERROR_SUCCESS;

#ifdef SRS_AUTO_HTTP_CALLBACK
    if (!_srs_config->get_vhost_http_hooks_enabled(req->vhost)) {
        return ret;
    }

    // the http hooks will cause context switch,
    // so we must copy all hooks for the on_connect may freed.
    // @see https://github.com/ossrs/srs/issues/475
    vector<string> hooks;

    if (true) {
        SrsConfDirective* conf = _srs_config->get_vhost_on_connect(req->vhost);

        if (!conf) {
            srs_info("ignore the empty http callback: on_connect");
            return ret;
        }

        hooks = conf->args;
    }

    for (int i = 0; i < (int)hooks.size(); i++) {
        std::string url = hooks.at(i);
        if ((ret = SrsHttpHooks::on_connect(url, req)) != ERROR_SUCCESS) {
            srs_error("hook client on_connect failed. url=%s, ret=%d", url.c_str(), ret);
            return ret;
        }
    }
#endif

    return ret;
}

void SrsRtmpConn::http_hooks_on_close()
{
#ifdef SRS_AUTO_HTTP_CALLBACK
    if (!_srs_config->get_vhost_http_hooks_enabled(req->vhost)) {
        return;
    }

    // the http hooks will cause context switch,
    // so we must copy all hooks for the on_connect may freed.
    // @see https://github.com/ossrs/srs/issues/475
    vector<string> hooks;

    if (true) {
        SrsConfDirective* conf = _srs_config->get_vhost_on_close(req->vhost);

        if (!conf) {
            srs_info("ignore the empty http callback: on_close");
            return;
        }

        hooks = conf->args;
    }

    for (int i = 0; i < (int)hooks.size(); i++) {
        std::string url = hooks.at(i);
        SrsHttpHooks::on_close(url, req, kbps->get_send_bytes(), kbps->get_recv_bytes());
    }
#endif
}

int SrsRtmpConn::http_hooks_on_publish()
{
    int ret = ERROR_SUCCESS;

#ifdef SRS_AUTO_HTTP_CALLBACK
    if (!_srs_config->get_vhost_http_hooks_enabled(req->vhost)) {
        return ret;
    }

    // the http hooks will cause context switch,
    // so we must copy all hooks for the on_connect may freed.
    // @see https://github.com/ossrs/srs/issues/475
    vector<string> hooks;

    if (true) {
        SrsConfDirective* conf = _srs_config->get_vhost_on_publish(req->vhost);

        if (!conf) {
            srs_info("ignore the empty http callback: on_publish");
            return ret;
        }

        hooks = conf->args;
    }

    for (int i = 0; i < (int)hooks.size(); i++) {
        std::string url = hooks.at(i);
        if ((ret = SrsHttpHooks::on_publish(url, req)) != ERROR_SUCCESS) {
            srs_error("hook client on_publish failed. url=%s, ret=%d", url.c_str(), ret);
            return ret;
        }
    }
#endif

    return ret;
}

void SrsRtmpConn::http_hooks_on_unpublish()
{
#ifdef SRS_AUTO_HTTP_CALLBACK
    if (!_srs_config->get_vhost_http_hooks_enabled(req->vhost)) {
        return;
    }

    // the http hooks will cause context switch,
    // so we must copy all hooks for the on_connect may freed.
    // @see https://github.com/ossrs/srs/issues/475
    vector<string> hooks;

    if (true) {
        SrsConfDirective* conf = _srs_config->get_vhost_on_unpublish(req->vhost);

        if (!conf) {
            srs_info("ignore the empty http callback: on_unpublish");
            return;
        }

        hooks = conf->args;
    }

    for (int i = 0; i < (int)hooks.size(); i++) {
        std::string url = hooks.at(i);
        SrsHttpHooks::on_unpublish(url, req);
    }
#endif
}

int SrsRtmpConn::http_hooks_on_play()
{
    int ret = ERROR_SUCCESS;

#ifdef SRS_AUTO_HTTP_CALLBACK
    if (!_srs_config->get_vhost_http_hooks_enabled(req->vhost)) {
        return ret;
    }

    // the http hooks will cause context switch,
    // so we must copy all hooks for the on_connect may freed.
    // @see https://github.com/ossrs/srs/issues/475
    vector<string> hooks;

    if (true) {
        SrsConfDirective* conf = _srs_config->get_vhost_on_play(req->vhost);

        if (!conf) {
            srs_info("ignore the empty http callback: on_play");
            return ret;
        }

        hooks = conf->args;
    }

    for (int i = 0; i < (int)hooks.size(); i++) {
        std::string url = hooks.at(i);
        if ((ret = SrsHttpHooks::on_play(url, req)) != ERROR_SUCCESS) {
            srs_error("hook client on_play failed. url=%s, ret=%d", url.c_str(), ret);
            return ret;
        }
    }
#endif

    return ret;
}

void SrsRtmpConn::http_hooks_on_stop()
{
#ifdef SRS_AUTO_HTTP_CALLBACK
    if (!_srs_config->get_vhost_http_hooks_enabled(req->vhost)) {
        return;
    }

    // the http hooks will cause context switch,
    // so we must copy all hooks for the on_connect may freed.
    // @see https://github.com/ossrs/srs/issues/475
    vector<string> hooks;

    if (true) {
        SrsConfDirective* conf = _srs_config->get_vhost_on_stop(req->vhost);

        if (!conf) {
            srs_info("ignore the empty http callback: on_stop");
            return;
        }

        hooks = conf->args;
    }

    for (int i = 0; i < (int)hooks.size(); i++) {
        std::string url = hooks.at(i);
        SrsHttpHooks::on_stop(url, req);
    }
#endif

    return;
}


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Eesti NSV Tead. Akad. Toim. , Biol. seer 14(2): 230 (1965)

#### Original name
Sistotrema estonicum Parmasto, 1965

### Remarks
null


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Beih. bot. Zbl. 35(1): 140 (1918)

#### Original name
Peronospora thlaspeos-perfoliati Gäum., 1918

### Remarks
null


text:
pepper-jam-revenue-report
=========================

This library gives the commission per program from Pepper Jam given the start date and end date


text:
Model classes used to describe the lobby state of init data of {@link hu.scelight.sc2.rep.model.Replay} objects.

	@author Andras Belicza


text:
<!DOCTYPE html>

<meta charset="utf-8">
<title>TwinklingStars</title>
<link rel="stylesheet" href="css/twinklingStars.css">

可编辑

不可编辑


text:
namespace {

// Constants used to indicate exceptional error conditions.
const char kNoResponseError[] = "org.chromium.Error.NoResponse";
const char kUnexpectedResponse[] = "org.chromium.Error.UnexpectedResponse";

}  // namespace

namespace bluez {

// static
const char BluetoothMediaTransportClient::kDeviceProperty[] = "Device";
const char BluetoothMediaTransportClient::kUUIDProperty[] = "UUID";
const char BluetoothMediaTransportClient::kCodecProperty[] = "Codec";
const char BluetoothMediaTransportClient::kConfigurationProperty[] =
    "Configuration";
const char BluetoothMediaTransportClient::kStateProperty[] = "State";
const char BluetoothMediaTransportClient::kDelayProperty[] = "Delay";
const char BluetoothMediaTransportClient::kVolumeProperty[] = "Volume";

// static
const char BluetoothMediaTransportClient::kStateIdle[] = "idle";
const char BluetoothMediaTransportClient::kStatePending[] = "pending";
const char BluetoothMediaTransportClient::kStateActive[] = "active";

BluetoothMediaTransportClient::Properties::Properties(
    dbus::ObjectProxy* object_proxy,
    const std::string& interface_name,
    const PropertyChangedCallback& callback)
    : dbus::PropertySet(object_proxy, interface_name, callback) {
  RegisterProperty(kDeviceProperty, &device);
  RegisterProperty(kUUIDProperty, &uuid);
  RegisterProperty(kCodecProperty, &codec);
  RegisterProperty(kConfigurationProperty, &configuration);
  RegisterProperty(kStateProperty, &state);
  RegisterProperty(kDelayProperty, &delay);
  RegisterProperty(kVolumeProperty, &volume);
}

BluetoothMediaTransportClient::Properties::~Properties() = default;

class BluetoothMediaTransportClientImpl
    : public BluetoothMediaTransportClient,
      public dbus::ObjectManager::Interface {
 public:
  BluetoothMediaTransportClientImpl() : object_manager_(nullptr) {}

  ~BluetoothMediaTransportClientImpl() override {
    object_manager_->UnregisterInterface(
        bluetooth_media_transport::kBluetoothMediaTransportInterface);
  }

  // dbus::ObjectManager::Interface overrides.

  dbus::PropertySet* CreateProperties(
      dbus::ObjectProxy* object_proxy,
      const dbus::ObjectPath& object_path,
      const std::string& interface_name) override {
    return new Properties(
        object_proxy, interface_name,
        base::BindRepeating(
            &BluetoothMediaTransportClientImpl::OnPropertyChanged,
            weak_ptr_factory_.GetWeakPtr(), object_path));
  }

  void ObjectAdded(const dbus::ObjectPath& object_path,
                   const std::string& interface_name) override {
    DVLOG(1) << "Remote Media Transport added: " << object_path.value();
    for (auto& observer : observers_)
      observer.MediaTransportAdded(object_path);
  }

  void ObjectRemoved(const dbus::ObjectPath& object_path,
                     const std::string& interface_name) override {
    DVLOG(1) << "Remote Media Transport removed: " << object_path.value();
    for (auto& observer : observers_)
      observer.MediaTransportRemoved(object_path);
  }

  // BluetoothMediaTransportClient overrides.

  void AddObserver(BluetoothMediaTransportClient::Observer* observer) override {
    DCHECK(observer);
    observers_.AddObserver(observer);
  }

  void RemoveObserver(
      BluetoothMediaTransportClient::Observer* observer) override {
    DCHECK(observer);
    observers_.RemoveObserver(observer);
  }

  Properties* GetProperties(const dbus::ObjectPath& object_path) override {
    DCHECK(object_manager_);
    return static_cast<Properties*>(object_manager_->GetProperties(
        object_path,
        bluetooth_media_transport::kBluetoothMediaTransportInterface));
  }

  void Acquire(const dbus::ObjectPath& object_path,
               const AcquireCallback& callback,
               const ErrorCallback& error_callback) override {
    DVLOG(1) << "Acquire - transport: " << object_path.value();

    DCHECK(object_manager_);

    dbus::MethodCall method_call(
        bluetooth_media_transport::kBluetoothMediaTransportInterface,
        bluetooth_media_transport::kAcquire);

    // Get object proxy.
    scoped_refptr<dbus::ObjectProxy> object_proxy(
        object_manager_->GetObjectProxy(object_path));

    // Call Acquire method of Media Transport interface.
    object_proxy->CallMethodWithErrorCallback(
        &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
        base::BindOnce(&BluetoothMediaTransportClientImpl::OnAcquireSuccess,
                       weak_ptr_factory_.GetWeakPtr(), callback,
                       error_callback),
        base::BindOnce(&BluetoothMediaTransportClientImpl::OnError,
                       weak_ptr_factory_.GetWeakPtr(), error_callback));
  }

  void TryAcquire(const dbus::ObjectPath& object_path,
                  const AcquireCallback& callback,
                  const ErrorCallback& error_callback) override {
    DVLOG(1) << "TryAcquire - transport: " << object_path.value();

    DCHECK(object_manager_);

    dbus::MethodCall method_call(
        bluetooth_media_transport::kBluetoothMediaTransportInterface,
        bluetooth_media_transport::kTryAcquire);

    // Get object proxy.
    scoped_refptr<dbus::ObjectProxy> object_proxy(
        object_manager_->GetObjectProxy(object_path));

    // Call TryAcquire method of Media Transport interface.
    object_proxy->CallMethodWithErrorCallback(
        &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
        base::BindOnce(&BluetoothMediaTransportClientImpl::OnAcquireSuccess,
                       weak_ptr_factory_.GetWeakPtr(), callback,
                       error_callback),
        base::BindOnce(&BluetoothMediaTransportClientImpl::OnError,
                       weak_ptr_factory_.GetWeakPtr(), error_callback));
  }

  void Release(const dbus::ObjectPath& object_path,
               const base::Closure& callback,
               const ErrorCallback& error_callback) override {
    DVLOG(1) << "Release - transport: " << object_path.value();

    DCHECK(object_manager_);

    dbus::MethodCall method_call(
        bluetooth_media_transport::kBluetoothMediaTransportInterface,
        bluetooth_media_transport::kRelease);

    // Get object proxy.
    scoped_refptr<dbus::ObjectProxy> object_proxy(
        object_manager_->GetObjectProxy(object_path));

    // Call TryAcquire method of Media Transport interface.
    object_proxy->CallMethodWithErrorCallback(
        &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
        base::BindOnce(&BluetoothMediaTransportClientImpl::OnSuccess,
                       weak_ptr_factory_.GetWeakPtr(), callback),
        base::BindOnce(&BluetoothMediaTransportClientImpl::OnError,
                       weak_ptr_factory_.GetWeakPtr(), error_callback));
  }

 protected:
  void Init(dbus::Bus* bus,
            const std::string& bluetooth_service_name) override {
    DCHECK(bus);
    object_manager_ = bus->GetObjectManager(
        bluetooth_service_name,
        dbus::ObjectPath(
            bluetooth_object_manager::kBluetoothObjectManagerServicePath));
    object_manager_->RegisterInterface(
        bluetooth_media_transport::kBluetoothMediaTransportInterface, this);
  }

 private:
  // Called by dbus::PropertySet when a property value is changed.
  void OnPropertyChanged(const dbus::ObjectPath& object_path,
                         const std::string& property_name) {
    DVLOG(1) << "Name of the changed property: " << property_name;

    // Dispatches the change to the corresponding property-changed handler.
    for (auto& observer : observers_)
      observer.MediaTransportPropertyChanged(object_path, property_name);
  }

  // Called when a response for successful method call is received.
  void OnSuccess(const base::Closure& callback, dbus::Response* response) {
    DCHECK(response);
    callback.Run();
  }

  // Called when a response for |Acquire|/|TryAcquire| method call is received.
  void OnAcquireSuccess(const AcquireCallback& callback,
                        const ErrorCallback& error_callback,
                        dbus::Response* response) {
    DCHECK(response);

    base::ScopedFD fd;
    uint16_t read_mtu;
    uint16_t write_mtu;

    // Parse the response.
    dbus::MessageReader reader(response);
    if (reader.PopFileDescriptor(&fd) && reader.PopUint16(&read_mtu) &&
        reader.PopUint16(&write_mtu)) {
      DCHECK(fd.is_valid());

      DVLOG(1) << "OnAcquireSuccess - fd: " << fd.get()
               << ", read MTU: " << read_mtu << ", write MTU: " << write_mtu;

      // The ownership of the file descriptor is transferred to the user
      // application.
      callback.Run(std::move(fd), read_mtu, write_mtu);
      return;
    }

    error_callback.Run(
        kUnexpectedResponse,
        "Failed to retrieve file descriptor, read MTU and write MTU.");
  }

  // Called when a response for a failed method call is received.
  void OnError(const ErrorCallback& error_callback,
               dbus::ErrorResponse* response) {
    DCHECK(response);

    // Error response has optional error message argument.
    std::string error_name;
    std::string error_message;
    if (response) {
      dbus::MessageReader reader(response);
      error_name = response->GetErrorName();
      reader.PopString(&error_message);
    } else {
      error_name = kNoResponseError;
    }
    error_callback.Run(error_name, error_message);
  }

  dbus::ObjectManager* object_manager_;

  // List of observers interested in event notifications from us.
  base::ObserverList<BluetoothMediaTransportClient::Observer>::Unchecked
      observers_;

  base::WeakPtrFactory<BluetoothMediaTransportClientImpl> weak_ptr_factory_{
      this};

  DISALLOW_COPY_AND_ASSIGN(BluetoothMediaTransportClientImpl);
};

BluetoothMediaTransportClient::BluetoothMediaTransportClient() = default;

BluetoothMediaTransportClient::~BluetoothMediaTransportClient() = default;

BluetoothMediaTransportClient* BluetoothMediaTransportClient::Create() {
  return new BluetoothMediaTransportClientImpl();
}

}  // namespace bluez


text:
import {
  SELECT_EMPLOYEE_INDEX,
} from './constants';

// selectIndex :: Int -> {Action}
export const selectIndex = (index) => ({
  type: SELECT_EMPLOYEE_INDEX,
  index,
});

// selectEmployeeIndex :: Int -> Func -> {Action}
export const selectEmployeeIndex = (index) =>
  (dispatch) => {
    dispatch(
      selectIndex(parseInt(index, 10))
    );
  };


text:
package registry

import (
	"testing"

	"github.com/gogo/protobuf/proto"
	"github.com/hyperledger/burrow/binary"
	"github.com/hyperledger/burrow/crypto"
	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
)

func TestEncodeProtobuf(t *testing.T) {
	entry := &NodeIdentity{
		Moniker:          "test",
		TendermintNodeID: crypto.Address{},
		ValidatorPublicKey: &crypto.PublicKey{
			CurveType: crypto.CurveTypeEd25519,
			PublicKey: binary.HexBytes{1, 2, 3, 4, 5},
		},
		NetworkAddress: "localhost",
	}
	encoded, err := proto.Marshal(entry)
	require.NoError(t, err)
	entryOut := new(NodeIdentity)
	err = proto.Unmarshal(encoded, entryOut)
	require.NoError(t, err)
	assert.Equal(t, entry, entryOut)
}


text:
from numpy import arange
from numpy.testing import TestCase, assert_

from scipy.weave import standard_array_spec

def remove_whitespace(in_str):
    out = in_str.replace(" ","")
    out = out.replace("\t","")
    out = out.replace("\n","")
    return out

class TestArrayConverter(TestCase):

    def test_type_match_string(self):
        s = standard_array_spec.array_converter()
        assert_( not s.type_match('string') )

    def test_type_match_int(self):
        s = standard_array_spec.array_converter()
        assert_(not s.type_match(5))

    def test_type_match_array(self):
        s = standard_array_spec.array_converter()
        assert_(s.type_match(arange(4)))

if __name__ == "__main__":
    import nose
    nose.run(argv=['', __file__])


text:
package gov.nasa.worldwind.ogc.collada;

/**
 * Represents the COLLADA source element and provides access to its contents.
 *
 * @author pabercrombie
 * @version $Id: ColladaSource.java 654 2012-06-25 04:15:52Z pabercrombie $
 */
public class ColladaSource extends ColladaAbstractObject
{
    /**
     * Construct an instance.
     *
     * @param ns the qualifying namespace URI. May be null to indicate no namespace qualification.
     */
    public ColladaSource(String ns)
    {
        super(ns);
    }

    /**
     * Indicates the value of the accessor field of the technique_common field.
     *
     * @return The value of the accessor field, or null if either the accessor or technique_common
     *         is not set.
     */
    public ColladaAccessor getAccessor()
    {
        // Handles only the COLLADA Common profile
        ColladaTechniqueCommon technique = (ColladaTechniqueCommon) this.getField("technique_common");
        if (technique == null)
            return null;

        return (ColladaAccessor) technique.getField("accessor");
    }
}


text:
cpNewProject::cpNewProject(QWidget *parent):
    m_parent(parent) {

    setWindowTitle("New Project");
    Qt::WindowFlags flags(Qt::Dialog | Qt::WindowCloseButtonHint | Qt::WindowTitleHint);
    setWindowFlags(flags);

    // //--------------------------------
    // // Destination Name
    // //--------------------------------
    QLabel *LName = new QLabel(tr("Name    "));
    LName->setToolTip("Enter a name for the new project");
    m_LEName = new QLineEdit;
    m_LEName->setEchoMode(QLineEdit::Normal);
    m_HlayoutName = new QHBoxLayout;
    m_HlayoutName->addWidget(LName);
    m_HlayoutName->addWidget(m_LEName);

    // =================================================P
    // Destination File
    // =================================================
    QLabel *m_lFolder = new QLabel;
    m_lFolder->setText("Location");
    m_lFolder->setToolTip("Set the project location");
    m_DestinationFolder = new QLineEdit;
    m_PBDestFileFolder  = new QPushButton("...",this);
    m_PBDestFileFolder->setAutoDefault(true);
    m_PBDestFileFolder->setToolTip("Open file browser");
    m_PBDestFileFolder->setMaximumWidth(30);
    QObject::connect(m_PBDestFileFolder, SIGNAL(clicked()), this, SLOT(onDestFileFolder()));

    m_HlayoutDestination = new QHBoxLayout;
    m_HlayoutDestination->addWidget(m_lFolder);
    m_HlayoutDestination->addWidget(m_DestinationFolder);
    m_HlayoutDestination->addWidget(m_PBDestFileFolder);

    //================
    // Buttons
    //================
    m_PBOk = new QPushButton("Ok");
    m_PBCancel = new QPushButton("Cancel");
    m_PBOk->setAutoDefault(true);
    m_PBCancel->setAutoDefault(true);
    QObject::connect(m_PBOk, SIGNAL(clicked()), this, SLOT(onPBOk()));
    QObject::connect(m_PBCancel, SIGNAL(clicked()), this, SLOT(onPBCancel()));

    m_HlayoutButtons = new QHBoxLayout;
    m_HlayoutButtons->addStretch();
    m_HlayoutButtons->addWidget(m_PBOk);
    m_HlayoutButtons->addWidget(m_PBCancel);

    m_VlayoutWindow = new QVBoxLayout;
    m_VlayoutWindow->addLayout(m_HlayoutName);
    m_VlayoutWindow->addLayout(m_HlayoutDestination);
    m_VlayoutWindow->addLayout(m_HlayoutButtons);

    setLayout(m_VlayoutWindow);
    resize(400, 80);
}

void cpNewProject::keyPressEvent(QKeyEvent *event) {
    if(event->key() == Qt::Key_Escape) {
        this->close();
    }
    if (event->modifiers().testFlag(Qt::AltModifier)) {
        m_LEName->clearFocus();
        m_DestinationFolder->clearFocus();
        if (event->key() == Qt::Key_O) {
            onPBOk();
        }
        if (event->key() == Qt::Key_C) {
            onPBCancel();
        }
    }
    //enter is detected as Key_Return
    if (event->key() == Qt::Key_Return) {
        this->onPBOk();
    }
}

void cpNewProject::GetNewFilePathName(QString OldFilePathName) {
    m_LEName->setText("");

    // Strip old project name and get path only
    QFileInfo FilePathName(OldFilePathName);
    QDir dir(FilePathName.absoluteDir());

    // Geth the Project Dir
    QString ProjectFilePath = dir.absolutePath();
    ProjectFilePath.replace("/", "\\");
    m_DestinationFolder->setText(ProjectFilePath);

    m_LEName->setFocus();
    show();
}

void cpNewProject::onPBCancel() {
    hide();
}

void cpNewProject::onPBOk() {
    // Get file name as enetered by the user
    QString FileName = m_LEName->text();

    // Remove cprj extension from file name
    if (FileName.contains(".cprj")) {
        QFileInfo FileInfo(FileName);
        FileName = FileInfo.baseName();
    }

    // Check if we have a name
    if (FileName.size() == 0) {
        QMessageBox msgBox;
        msgBox.setText("Please enter a project name");
        msgBox.exec();
        return;
    }

    // Get the Destination folder
    QString Destination = m_DestinationFolder->text();
    if (Destination.size() == 0)
        Destination = "./";

    // Cover any cononical setting such as ./ and ../ to full path
    QFileInfo FilePathInfo(Destination);
    if (FilePathInfo.canonicalFilePath().size() > 0)
        Destination = FilePathInfo.canonicalFilePath();

    QCharRef c = Destination[Destination.length() - 1];

    if ((c != '/') || (c != '\\')) Destination.append("/");

    // now add the filename
    Destination.append(FileName);

    // check for pre-existing project that will get replaced with this new one
    QFile fileexist(Destination +".cprj");
    if (fileexist.exists()) {
        if (QMessageBox::question(this, "Project", "File already exists\nDo you want to continue?", QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
            return;
    }

    emit OnSetNewProject(Destination);
    hide();
}

void cpNewProject::onDestFileFolder() {
    QString fileFolder = QFileDialog::getExistingDirectory(this, tr("Destination Folder"), m_DestinationFolder->text());
    if (fileFolder.length() > 0) {
        m_DestinationFolder->setText(fileFolder);
    }
}


text:
const program = (function() {
  'use strict';

  const stdin = document.getElementById('stdin');
  const stdout = document.getElementById('stdout');
  const history = []; // history of inputs

  smoothScroll.init({
    speed: 300, // Integer. How fast to complete the scroll in milliseconds
    easing: 'easeInOutCubic' // Easing pattern to use
  });
  scrollBottom();
  setTimeout(() => {
    prompt(['What\'s happening today?', 'Can\'t wait to chill soon.', 'What\'s your favorite number?']);
  }, 2000);

  // --- Functions ---

  // Get data from the user on return
  function getInput () {
    let e = event;
    let code = e.keyCode || e.which;
    if (code === 13) { // Enter keycode
      let x = stdin.value.trim(); // remove whitespace
      if (x !== null && typeof x !== 'undefined' && x !== '') { // exists
        isNaN(x) ? history.push(x) : history.push(parseFloat(x)); // save to history (as number if applicable)
        let arr = [history[history.length - 1]]; // set what we just saved as new msg for prompt
        prompt(arr, true);  // I used true; you can alternatively pass any string you want, but just don't use false
        stdin.value = ''; // clear input for next response
      }
    }
  }

  // Display information to user, including echoing input
  function prompt (msg, isInput) { // 'msg' is an array of strings
    let condClass = () => {
      return isInput ? ' class="userinput"' : ''; // add userinput class if applicable
    };
    let el = document.createElement('div'); // create div
    for (var i = 0; i < msg.length; i++) {
      el.insertAdjacentHTML('beforeend', '<p' + condClass() + '>' + msg[i] + '</p>'); // create paragraph for each message message in array
    }
    stdout.insertAdjacentElement('beforeend', el); // insert div
    scrollBottom();
  }

  // Scroll to bottom of output/page
  function scrollBottom () {
    // window.scrollTo(0, document.body.scrollHeight);
    smoothScroll.animateScroll(document.body.scrollHeight);
  }

  // --- Event listeners ---

  stdin.addEventListener('focus', () => {
    if (stdin.placeholder) {
      stdin.removeAttribute('placeholder');
    }
  });
  stdin.addEventListener('blur', () => {
    stdin.placeholder = '>';
  });
  stdin.addEventListener('keyup', getInput);
  document.getElementById('stdout-clear').firstChild.addEventListener('click', scrollBottom);

  // --- Expose ---

  return {
    getInput: getInput,
    history: history,
    prompt: prompt
  };

}());


text:
package com.horsefire.filecabinet;

import junit.framework.TestCase;

public class MimeTypesTest extends TestCase {

	public void testPng() {
		assertEquals(MimeType.PNG, MimeType.guessByFilename("test.png"));
		assertEquals(MimeType.PNG, MimeType.guessByFilename("test.PNG"));
	}

	public void testPdf() {
		assertEquals(MimeType.PDF, MimeType.guessByFilename("test.pdf"));
		assertEquals(MimeType.PDF, MimeType.guessByFilename("test.PDF"));
	}
}


text:
package org.springframework.core.metrics;

/**
 * Instruments the application startup phase using {@link StartupStep steps}.
 *
The core container and its infrastructure components can use the {@code ApplicationStartup}
 * to mark steps during the application startup and collect data about the execution context
 * or their processing time.
 *
 * @author Brian Clozel
 * @since 5.3
 */
public interface ApplicationStartup {

	/**
	 * Default "no op" {@code ApplicationStartup} implementation.
	 *
This variant is designed for minimal overhead and does not record data.
	 */
	ApplicationStartup DEFAULT = new DefaultApplicationStartup();

	/**
	 * Create a new step and marks its beginning.
	 *
A step name describes the current action or phase. This technical
	 * name should be "." namespaced and can be reused to describe other instances of
	 * the same step during application startup.
	 * @param name the step name
	 */
	StartupStep start(String name);

}


text:
'use strict';

var express = require('express');
var ledstrip = require('./../lib/ledstrip');
var router = express.Router();
var config = require('./../lib/config');

router.post('/test', function (req, res) {
  var len = Number(req.param('length')),
    start = Number(req.param('start')) || 0,
    end = Number(req.param('end')) || len,
    animation = req.param('animation'),
    speed = Number(req.param('speed')),
    colour = req.param('colour');

  if (start < 1) {
    start = 0;
  }

  if (end > len) {
    end = len - 1;
  }

  if (start > end) {
    res.send(500);
  }

  ledstrip.connect(start, end);
  var intervalId = ledstrip.animate({
    animation: animation,
    speed: speed,
    colour: colour
  });

  setTimeout(function () {
    ledstrip.disconnect();
    clearInterval(intervalId);
  }, 5000);

  res.send();
});

router.get('/', function (req, res) {
  res.json(config.get('leds'));
});

router.put('/', function (req, res) {
  var payload = req.body;
  config.merge('leds', payload);
  config.save(function (err) {
    if (err) {
      res.send(500);
    }
  });
  res.json('Configuration saved successfully.');
});

module.exports = router;


text:
package com.jgeppert.struts2.jquery.components.util;

public class ObjectParameter {
    private String key;
    private String value;
    private boolean quotedKey = false;
    private boolean quotedValue = true;

    public ObjectParameter(final String key, final String value) {
        this(key, value, false, true);
    }

    public ObjectParameter(final String key, final String value, final boolean quotedValue) {
        this(key, value, false, quotedValue);
    }

    public ObjectParameter(final String key, final String value, final boolean quotedKey, final boolean quotedValue) {
        this.key = key;
        this.value = value;
        this.quotedKey = quotedKey;
        this.quotedValue = quotedValue;
    }

    @Override
    public String toString() {
        if(quotedKey && quotedValue) {
            return String.format("'%s': '%s'", key, value);
        } else if (quotedKey && !quotedValue) {
            return String.format("'%s': %s", key, value);
        } else if (!quotedKey && quotedValue) {
            return String.format("%s: '%s'", key, value);
        } else {
            return String.format("%s: %s", key, value);
        }
    }
}


text:
.class public final Landroid/service/carrier/CarrierMessagingService$SendMmsResult;
.super Ljava/lang/Object;
.source "CarrierMessagingService.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/service/carrier/CarrierMessagingService;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x19
    name = "SendMmsResult"
.end annotation

# instance fields
.field private mSendConfPdu:[B

.field private mSendStatus:I

# direct methods
.method public constructor <init>(I[B)V
    .locals 0
    .param p1, "sendStatus"    # I
    .param p2, "sendConfPdu"    # [B

    .prologue
    .line 285
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 286
    iput p1, p0, Landroid/service/carrier/CarrierMessagingService$SendMmsResult;->mSendStatus:I

    .line 287
    iput-object p2, p0, Landroid/service/carrier/CarrierMessagingService$SendMmsResult;->mSendConfPdu:[B

    .line 285
    return-void
.end method

# virtual methods
.method public getSendConfPdu()[B
    .locals 1

    .prologue
    .line 306
    iget-object v0, p0, Landroid/service/carrier/CarrierMessagingService$SendMmsResult;->mSendConfPdu:[B

    return-object v0
.end method

.method public getSendStatus()I
    .locals 1

    .prologue
    .line 297
    iget v0, p0, Landroid/service/carrier/CarrierMessagingService$SendMmsResult;->mSendStatus:I

    return v0
.end method


text:
/*=========================================================================
 *
 *  Portions of this file are subject to the VTK Toolkit Version 3 copyright.
 *
 *  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
 *
 *  For complete copyright, license and disclaimer of warranty information
 *  please refer to the NOTICE file at the top of the ITK source tree.
 *
 *=========================================================================*/
#ifndef itkIndent_h
#define itkIndent_h

#include "itkMacro.h"
#include <iostream>

namespace itk
{
/** \class Indent
 * \brief Control indentation during Print() invocation.
 *
 * Indent is used to control indentation during the chaining print
 * process. This way nested objects can correctly indent themselves.
 * This class works with the print methods defined in Object (i.e.,
 * the public method Print() and the protected methods PrintSelf(),
 * PrintHeader(), and PrintTrailer().
 *
 * \ingroup OSSystemObjects
 * \ingroup ITKCommon
 */

class ITKCommon_EXPORT Indent
{
public:
  /** Standard class type aliases. */
  using Self = Indent;

  /** Method for creation through the object factory. */
  static Self *
  New();

  /** Destroy this instance. */
  void
  Delete()
  {
    delete this;
  }

  /** Construct the object with an initial indentation level. */
  Indent(int ind = 0) { m_Indent = ind; }

  /** Return the name of the class. */
  static const char *
  GetNameOfClass()
  {
    return "Indent";
  }

  /** Determine the next indentation level. Keep indenting by two until the
   * a maximum of forty spaces is reached.  */
  Indent
  GetNextIndent() const;

  /** Print out the indentation. Basically output a bunch of spaces.  */
  friend ITKCommon_EXPORT std::ostream &
                          operator<<(std::ostream & os, const Indent & ind);

private:
  int m_Indent;
};
} // end namespace itk

#endif


text:
<?php

namespace mageekguy\atoum\scripts\treemap;

interface analyzer
{
	public function getMetricName();
	public function getMetricLabel();
	public function getMetricFromFile(\splFileInfo $file);
}