本文整理汇总了C++中protocol函数的典型用法代码示例。如果您正苦于以下问题:C++ protocol函数的具体用法?C++ protocol怎么用?C++ protocol使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了protocol函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: socket
LucidaServiceClient *TClient::creatLucidaClient(string host, int port) {
boost::shared_ptr<TTransport> socket(new TSocket(host, port));
boost::shared_ptr<TTransport> transport(new TBufferedTransport(socket));
boost::shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));
LucidaServiceClient *client = new LucidaServiceClient(protocol);
transport->open();
return client;
}
示例2: MOZ_ASSERT
already_AddRefed<nsITransportProvider>
HttpServer::Connection::HandleAcceptWebSocket(const Optional<nsAString>& aProtocol,
ErrorResult& aRv)
{
MOZ_ASSERT(mPendingWebSocketRequest);
RefPtr<InternalResponse> response =
new InternalResponse(101, NS_LITERAL_CSTRING("Switching Protocols"));
InternalHeaders* headers = response->Headers();
headers->Set(NS_LITERAL_CSTRING("Upgrade"),
NS_LITERAL_CSTRING("websocket"),
aRv);
headers->Set(NS_LITERAL_CSTRING("Connection"),
NS_LITERAL_CSTRING("Upgrade"),
aRv);
if (aProtocol.WasPassed()) {
NS_ConvertUTF16toUTF8 protocol(aProtocol.Value());
nsAutoCString reqProtocols;
mPendingWebSocketRequest->Headers()->
GetFirst(NS_LITERAL_CSTRING("Sec-WebSocket-Protocol"), reqProtocols, aRv);
if (!ContainsToken(reqProtocols, protocol)) {
// Should throw a better error here
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
headers->Set(NS_LITERAL_CSTRING("Sec-WebSocket-Protocol"),
protocol, aRv);
}
nsAutoCString key, hash;
mPendingWebSocketRequest->Headers()->
GetFirst(NS_LITERAL_CSTRING("Sec-WebSocket-Key"), key, aRv);
nsresult rv = mozilla::net::CalculateWebSocketHashedSecret(key, hash);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return nullptr;
}
headers->Set(NS_LITERAL_CSTRING("Sec-WebSocket-Accept"), hash, aRv);
nsAutoCString extensions, negotiatedExtensions;
mPendingWebSocketRequest->Headers()->
GetFirst(NS_LITERAL_CSTRING("Sec-WebSocket-Extensions"), extensions, aRv);
mozilla::net::ProcessServerWebSocketExtensions(extensions,
negotiatedExtensions);
if (!negotiatedExtensions.IsEmpty()) {
headers->Set(NS_LITERAL_CSTRING("Sec-WebSocket-Extensions"),
negotiatedExtensions, aRv);
}
RefPtr<TransportProvider> result = new TransportProvider();
mWebSocketTransportProvider = result;
QueueResponse(response);
return result.forget();
}
示例3: complexThrift_6
inline void complexThrift_6()
{
boost::timer::auto_cpu_timer t;
thriftPerformance::complexThrift_6 input = thriftPerformance::complexThrift_6(), output;
input.__set_att1(1);
input.__set_att2(2);
input.__set_att3(3);
input.__set_att4(4);
input.__set_att5(5);
input.__set_att6(6);
input.__set_att1(0);
input.__set_att2(1);
input.__set_att3(2);
input.__set_att4(3);
input.__set_att5(4);
input.__set_att6(5);
input.__set_att7(0);
input.__set_att8(1);
input.__set_att9(2);
input.__set_att10(3);
input.__set_att11(4);
input.__set_att12(5);
input.__set_att13("TEST 0");
input.__set_att14("TEST 1");
input.__set_att15("TEST 2");
input.__set_att16("TEST 3");
input.__set_att17("TEST 4");
input.__set_att18("TEST 5");
input.__set_att19(2.0);
input.__set_att20(3.1);
input.__set_att21(4.2);
input.__set_att22(5.3);
input.__set_att23(6.4);
input.__set_att24(7.5);
input.__set_att25(8.5);
input.__set_att26(9.6);
input.__set_att27(10.7);
input.__set_att28(11.8);
input.__set_att29(12.9);
input.__set_att30(13.10);
input.__set_att31(true);
input.__set_att32(true);
input.__set_att33(true);
input.__set_att34(true);
input.__set_att35(true);
input.__set_att36(true);
boost::shared_ptr<TMemoryBuffer> mb(new TMemoryBuffer(500));
boost::shared_ptr<TBinaryProtocol> protocol(new TBinaryProtocol(mb));
for(int i = 0; i < NUMBER_OF_LOOPS; ++i)
{
mb->resetBuffer();
input.write(protocol.get());
output.read(protocol.get());
}
}
示例4: onlineStatus
void AIMContact::updateSSIItem()
{
if ( m_ssiItem.type() != 0xFFFF && m_ssiItem.waitingAuth() == false &&
onlineStatus() == Kopete::OnlineStatus::Unknown )
{
//make sure they're offline
setOnlineStatus( static_cast<AIMProtocol*>( protocol() )->statusOffline );
}
}
示例5: innercomplexThrift_2
inline void innercomplexThrift_2()
{
boost::timer::auto_cpu_timer t;
thriftPerformance::innercomplexThrift_2 inner1 = thriftPerformance::innercomplexThrift_2();
inner1.__set_att1(1);
inner1.__set_att2(2);
inner1.__set_att3(3);
inner1.__set_att4(4);
inner1.__set_att5("TEST 5");
inner1.__set_att6("TEST 6");
inner1.__set_att7(2.5);
inner1.__set_att8(3.6);
inner1.__set_att9(6.2);
inner1.__set_att10(7.3);
inner1.__set_att11(true);
inner1.__set_att12(true);
thriftPerformance::innercomplexThrift_2 inner2 = thriftPerformance::innercomplexThrift_2();
inner2.__set_att1(1);
inner2.__set_att2(2);
inner2.__set_att3(3);
inner2.__set_att4(4);
inner2.__set_att5("TEST 5");
inner2.__set_att6("TEST 6");
inner2.__set_att7(2.5);
inner2.__set_att8(3.6);
inner2.__set_att9(6.2);
inner2.__set_att10(7.3);
inner2.__set_att11(true);
inner2.__set_att12(true);
thriftPerformance::outercomplexThrift_2 input = thriftPerformance::outercomplexThrift_2(), output = thriftPerformance::outercomplexThrift_2();
input.__set_att1(1);
input.__set_att2(2);
input.__set_att3("OUTER TEST 3");
input.__set_att4(inner1);
input.__set_att5(3.6);
input.__set_att6(7.3);
input.__set_att7(true);
input.__set_att8(8);
input.__set_att9("OUTER TEST 9");
input.__set_att10(inner2);
input.__set_att11(4.7);
input.__set_att12(8.4);
input.__set_att13(true);
boost::shared_ptr<TMemoryBuffer> mb(new TMemoryBuffer(500));
boost::shared_ptr<TBinaryProtocol> protocol(new TBinaryProtocol(mb));
for(int i = 0; i < NUMBER_OF_LOOPS; ++i)
{
mb->resetBuffer();
input.write(protocol.get());
output.read(protocol.get());
}
}
示例6: findChatSession
Kopete::ChatSession *
WlmContact::manager (Kopete::Contact::CanCreateFlags canCreate)
{
Kopete::ContactPtrList chatmembers;
chatmembers.append (this);
Kopete::ChatSession * _manager =
Kopete::ChatSessionManager::self ()->
findChatSession (account ()->myself (), chatmembers, protocol ());
WlmChatSession *manager = qobject_cast <WlmChatSession *>(_manager);
if (!manager && canCreate == Kopete::Contact::CanCreate)
{
manager =
new WlmChatSession (protocol (), account ()->myself (),
chatmembers);
}
return manager;
}
示例7: protocol
boost::tuple<std::string, std::string, std::string, std::string>
HttpRequest::ParseUrl(const std::string & url)
{
//for remove regex lib
size_t pos_protocol = url.find("://");
std::string protocol("http");
if (pos_protocol != std::string::npos)
{
protocol = url.substr(0, pos_protocol);
}
size_t pos_host_beg = (pos_protocol == std::string::npos ? 0 : pos_protocol +3);
size_t pos_path_beg = -1;
std::string host_str("");
std::string port_str("80");
size_t pos_host = url.find_first_of(':', pos_host_beg);
size_t pos_slash = url.find_first_of('/', pos_host_beg);
if (pos_host != std::string::npos && pos_host < pos_slash)
{
host_str = url.substr(pos_host_beg, pos_host - pos_host_beg);
size_t pos_port_beg = pos_host + 1;
size_t pos_port = url.find_first_of('/', pos_port_beg);
if (pos_port != std::string ::npos)
{
port_str = url.substr(pos_port_beg, pos_port - pos_port_beg);
pos_path_beg = pos_port;
}
}
else {
pos_host = url.find_first_of('/', pos_host_beg);
if (pos_host != std::string::npos)
{
host_str = url.substr(pos_host_beg, pos_host - pos_host_beg);
pos_path_beg = pos_host;
}
}
std::string path_str("");
if (pos_path_beg > 0)
path_str = url.substr(pos_path_beg);
//boost::regex reg("^(([A-Za-z]+)://)?([^:/]+)(:([0-9]+))?(.*)");
//boost::smatch sm;
//if (false == boost::regex_match(url, sm, reg))
//{
// return boost::make_tuple("", "", "", "");
//}
//std::string protocol(sm[2].matched ? std::string(sm[2].first, sm[2].second) : "http");
//std::string host_str(sm[3].first, sm[3].second);
//std::string port_str(sm[5].matched ? std::string(sm[5].first, sm[5].second) : "");
//std::string path_str(sm[6].matched ? std::string(sm[6].first, sm[6].second) : "/");
if (path_str.empty()) path_str = "/";
return boost::make_tuple(protocol, host_str, port_str, path_str);
}
示例8: socket
SchedulerServiceClient *TClient::creatSchedulerClient(string host, int port) {
boost::shared_ptr<TSocket> socket(new TSocket(host, port));
boost::shared_ptr<TTransport> transport(new TFramedTransport(socket));
boost::shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));
SchedulerServiceClient *client = new SchedulerServiceClient(protocol);
this->transport = transport;
transport->open();
return client;
}
示例9: simpleThrift_40
inline void simpleThrift_40()
{
thriftPerformance::simpleThrift_40 input = thriftPerformance::simpleThrift_40(), output;
input.__set_att1(1);
input.__set_att2(2);
input.__set_att3(3);
input.__set_att4(4);
input.__set_att5(5);
input.__set_att6(6);
input.__set_att7(7);
input.__set_att8(8);
input.__set_att9(9);
input.__set_att10(10);
input.__set_att11(11);
input.__set_att12(12);
input.__set_att13(13);
input.__set_att14(14);
input.__set_att15(15);
input.__set_att16(16);
input.__set_att17(17);
input.__set_att18(18);
input.__set_att19(19);
input.__set_att20(20);
input.__set_att21(21);
input.__set_att22(22);
input.__set_att23(23);
input.__set_att24(24);
input.__set_att25(25);
input.__set_att26(26);
input.__set_att27(27);
input.__set_att28(28);
input.__set_att29(29);
input.__set_att30(30);
input.__set_att31(31);
input.__set_att32(32);
input.__set_att33(33);
input.__set_att34(34);
input.__set_att35(35);
input.__set_att36(36);
input.__set_att37(37);
input.__set_att38(38);
input.__set_att39(39);
input.__set_att40(40);
boost::shared_ptr<TMemoryBuffer> mb(new TMemoryBuffer(500));
boost::shared_ptr<TBinaryProtocol> protocol(new TBinaryProtocol(mb));
boost::timer::auto_cpu_timer t;
for(int i = 0; i < NUMBER_OF_LOOPS; ++i)
{
mb->resetBuffer();
input.write(protocol.get());
output.read(protocol.get());
}
}
示例10: iapID
void ut_cstunbinding::SetupL( )
{
iCallbackCalled = EFalse;
TUint iapID( 6 );
TInt retransmitInterval( 10 );
TBufC8<13> serveraddress( KServerAddress );
TUint serverport( 2000 );
TBufC8<4> protocol( KStun );
TBool obtainsharedsecret( EFalse );
TBool failifnoSRVrecordfound( EFalse );
iDeltatimer = CDeltaTimer::NewL( 1 );
User::LeaveIfError( iSocketServ.Connect() );
iStreamId = 1;
iSubstreamId = 1;
TBool icmpUsed( EFalse );
iMux = CNcmConnectionMultiplexer::NewL( *this );
TCommDbConnPref pref;
pref.SetDialogPreference( ECommDbDialogPrefDoNotPrompt );
pref.SetIapId( iapID );
User::LeaveIfError( iConnection.Open( iSocketServ ) );
iConnection.Start( pref, iStatus );
User::WaitForRequest( iStatus );
User::LeaveIfError( iStatus.Int() );
iStunclient = CSTUNClient::NewL( retransmitInterval,
serveraddress,
serverport,
protocol,
iSocketServ,
iConnection,
*iDeltatimer,
*this,
obtainsharedsecret,
failifnoSRVrecordfound,
icmpUsed,
iMux );
if ( ut_cstunbinding::iActiveSchedulerWait.IsStarted() )
{
ut_cstunbinding::iActiveSchedulerWait.AsyncStop();
}
ut_cstunbinding::iActiveSchedulerWait.Start();
if ( !iCallbackCalled )
{
// Callback not called because of memory running out inside callback execution
User::Leave( KErrNoMemory );
}
User::LeaveIfError( iSocket.Open( iSocketServ, KAfInet, KSockDatagram,
KProtocolInetUdp ));
iBinding = CSTUNBinding::NewL( *iStunclient, iSocket );
}
示例11: client_try
NOEXPORT void client_try(CLI *c) {
init_local(c);
if(!c->opt->option.client && c->opt->protocol<0
#ifndef OPENSSL_NO_TLSEXT
&& !c->opt->servername_list_head
#endif
) {
/* server mode and no protocol negotiation needed */
init_ssl(c);
init_remote(c);
} else { /* client mode or protocol negotiation enabled */
protocol(c, PROTOCOL_PRE_CONNECT);
init_remote(c);
protocol(c, PROTOCOL_PRE_SSL);
init_ssl(c);
protocol(c, PROTOCOL_POST_SSL);
}
transfer(c);
}
示例12: getUrl
KURL NetworkAccount::getUrl() const
{
KURL url;
url.setProtocol(protocol());
url.setUser(login());
url.setPass(passwd());
url.setHost(host());
url.setPort(port());
return url;
}
示例13: do_GetService
NS_IMETHODIMP
nsGNOMEShellService::SetDefaultClient(bool aForAllUsers,
bool aClaimAllTypes, uint16_t aApps)
{
nsresult rv;
nsCOMPtr<nsIGIOMimeApp> app;
nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
if (giovfs) {
nsCString brandName;
rv = GetBrandName(brandName);
NS_ENSURE_SUCCESS(rv, rv);
rv = giovfs->CreateAppFromCommand(mAppPath, brandName, getter_AddRefs(app));
NS_ENSURE_SUCCESS(rv, rv);
for (unsigned i = 0; i < mozilla::ArrayLength(gMimeTypes); i++) {
if (aApps & gMimeTypes[i].app) {
rv = app->SetAsDefaultForMimeType(nsDependentCString(gMimeTypes[i].mimeType));
NS_ENSURE_SUCCESS(rv, rv);
rv = app->SetAsDefaultForFileExtensions(nsDependentCString(gMimeTypes[i].extensions));
NS_ENSURE_SUCCESS(rv, rv);
}
}
}
nsCString appKeyValue;
nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
if (gconf) {
if (!mAppIsInPath)
appKeyValue = mAppPath;
else {
gchar* basename = g_path_get_basename(mAppPath.get());
appKeyValue = basename;
g_free(basename);
}
appKeyValue.AppendLiteral(" %s");
}
for (unsigned i = 0; i < mozilla::ArrayLength(gProtocols); i++) {
if (aApps & gProtocols[i].app) {
nsDependentCString protocol(gProtocols[i].protocol);
if (app) {
rv = app->SetAsDefaultForURIScheme(protocol);
NS_ENSURE_SUCCESS(rv, rv);
}
if (gconf) {
rv = gconf->SetAppForProtocol(protocol, appKeyValue);
NS_ENSURE_SUCCESS(rv, rv);
}
}
}
return NS_OK;
}
示例14: erase
void WirelessNode_Impl::erase()
{
//call the node_erase command from the parent BaseStation
bool success = m_baseStation.node_erase(protocol(), m_address);
//if the erase command failed
if(!success)
{
throw Error_NodeCommunication(m_address, "Failed to erase the Node.");
}
}
示例15: toStringWithPort
QString CEndPoint::toStringWithPort() const
{
if ( protocol() == QAbstractSocket::IPv4Protocol )
{
return toString().append( QString( ":%1" ).arg( m_nPort ) );
}
else
{
return QString( "[%1]:%2" ).arg( toString() ).arg( m_nPort );
}
}