Example #1
0
int main(int argc, char** argv)
{
	String hostName = SocketAddress::hostName();

	if (argc == 2)
		hostName = argv[1];
	
	print("hostName = \"%%\"\n", hostName);
	
	String canonicalName;
	Ref<SocketAddressList, Owner> list = SocketAddress::resolve(hostName, "", AF_UNSPEC, SOCK_STREAM, &canonicalName);
	
	print("canonicalName = \"%%\"\n", canonicalName);
	
	for (SocketAddressList::Index i = list->first(); list->def(i); ++i)
	{
		Ref<SocketAddress> address = list->at(i);
		bool failed;
		
		print("%% : %% : %% : %% : %% : %% : %%\n"
			, familyToString(address->family())
			, address->toString()
			, address->port()
			, socketTypeToString(address->socketType())
			, protocolToString(address->protocol())
			, address->lookupHostName(&failed)
			, address->lookupServiceName()
		);
	}
	
	return 0;
}
Example #2
0
std::string packetToString(const NetherPacket &packet)
{
	std::stringstream stream;
	stream << "ID=";
	stream << packet.id;
	stream << " SECCTX=";
	stream << packet.securityContext;
	stream << " OUTDEV=";
	stream << packet.outdevName;
	stream << " UID=";
	stream << packet.uid;
	stream << " GID=";
	stream << packet.gid;
	stream << " PROTO=";
	stream << protocolToString(packet.protocolType);
	stream << " TRANSPORT=";
	stream << transportToString(packet.transportType);
	stream << " SADDR=";
	stream << ipAddressToString(&packet.localAddress[0], packet.protocolType);
	stream << ":";
	stream << packet.localPort;
	stream << " DADDR=";
	stream << ipAddressToString(&packet.remoteAddress[0], packet.protocolType);
	stream << ":";
	stream << packet.remotePort;
	return (stream.str());
}
Example #3
0
std::vector<QString> AppSettings::protocolKeys() {
    std::vector<QString> keys(std::size_t(EProtocolType::MAX), QString(""));
    for (uint32_t i = 0; i < keys.size(); ++i) {
        QString key = protocolToString(EProtocolType(i));
        key += "InUse";
        keys[i] = key;
    }
    return keys;
}
    void CatalogEntry::generateString ( )
    {
        std::string proto, type;
        protocolToString ( mproto, proto );
        typeToString ( mtype, type );

        std::ostringstream ss;
        ss
            << "Object "
            << "ID=" << mid << " "
            << "name=" << mname << " "
            << "type=" << type << " "
            << "address=" << maddr << " "
            << "port=" << mport << " "
            << "protocol=" << proto << " "
            << "ips=" << mips << "\r\n";

        mstr = ss.str ( );
    }