void ProtocolManager::onLocalInterfaceUp(Event *e)
{
	if (!e)
		return;

	InterfaceRef iface = e->getInterface();

	if (!iface)
		return;

	const Addresses *adds = iface->getAddresses();
	
	for (Addresses::const_iterator it = adds->begin() ; it != adds->end() ; it++) {
		switch((*it)->getType()) {
		case Address::TYPE_IPV4:
#if defined(ENABLE_IPv6)
		case Address::TYPE_IPV6:
#endif
			getServerProtocol(Protocol::TYPE_TCP, iface);
			return;			
#if defined(ENABLE_BLUETOOTH)
		case Address::TYPE_BLUETOOTH:
			getServerProtocol(Protocol::TYPE_RFCOMM, iface);
			return;
#endif			
#if defined(ENABLE_MEDIA)
			// FIXME: should probably separate loop interfaces from media interfaces somehow...
		case Address::TYPE_FILEPATH:
			getServerProtocol(Protocol::TYPE_MEDIA, iface);
			return;
#endif
			
		default:
			break;
		}
	}
	
	HAGGLE_DBG("Interface with no known address type - no server started\n");
}
示例#2
0
void CGI::logCGIData(const QString& filename)
{
	// create a QFile object to do the file I/O
	QFile file(filename);

	// open the file
	if (file.open(QIODevice::WriteOnly))
	{
		// create a QTextStream object on the file
		Q3TextStream textFile(&file);

		// get the environment
		textFile << "REQUEST_METHOD=" << getenv("REQUEST_METHOD") << endl;
		textFile << "CONTENT_LENGTH=" << getenv("CONTENT_LENGTH") << endl;

		// write the query string to the file
		textFile << "QUERY_STRING=" << query_string << endl;

		// write misc. CGI environment pieces
		textFile << "AUTH_TYPE=" << getAuthType() << endl;
		textFile << "GATEWAY_INTERFACE=" << getGatewayInterface() << endl;
		textFile << "HTTP_ACCEPT=" << getHTTPAccept() << endl;
		textFile << "HTTP_ACCEPT_ENCODING=" << getHTTPAcceptEncoding() << endl;
		textFile << "HTTP_ACCEPT_LANGUAGE=" << getHTTPAcceptLanguage() << endl;
		textFile << "HTTP_CONNECTION=" << getHTTPConnection() << endl;
		textFile << "HTTP_REFERER=" << getHTTPReferer() << endl;
		textFile << "HTTP_USER_AGENT=" << getHTTPUserAgent() << endl;
		textFile << "REMOTE_HOST=" << getRemoteHost() << endl;
		textFile << "REMOTE_ADDRESS=" << getRemoteAddress() << endl;
		textFile << "REMOTE_PORT=" << getRemotePort() << endl;
		textFile << "REQUEST_URI=" << getRequestURI() << endl;
		textFile << "SCRIPT_NAME=" << getScriptName() << endl;
		textFile << "SERVER_ADMIN=" << getServerAdmin() << endl;
		textFile << "SERVER_NAME=" << getServerName() << endl;
		textFile << "SERVER_PORT=" << getServerPort() << endl;
		textFile << "SERVER_PROTOCOL=" << getServerProtocol() << endl;
		textFile << "SERVER_SOFTWARE=" << getServerSoftware() << endl;
	}

	// close the file
	file.close();

}