本文整理汇总了C++中BaseProtocol::Initialize方法的典型用法代码示例。如果您正苦于以下问题:C++ BaseProtocol::Initialize方法的具体用法?C++ BaseProtocol::Initialize怎么用?C++ BaseProtocol::Initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseProtocol
的用法示例。
在下文中一共展示了BaseProtocol::Initialize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BindSSL
bool InboundRTMPSDiscriminatorProtocol::BindSSL(IOBuffer &buffer) {
//1. Create the RTMP protocol
BaseProtocol *pRTMP = new InboundRTMPProtocol();
if (!pRTMP->Initialize(GetCustomParameters())) {
FATAL("Unable to create RTMP protocol");
pRTMP->EnqueueForDelete();
return false;
}
//2. Destroy the link
BaseProtocol *pFar = _pFarProtocol;
pFar->ResetNearProtocol();
ResetFarProtocol();
//3. Create the new links
pFar->SetNearProtocol(pRTMP);
pRTMP->SetFarProtocol(pFar);
//4. Set the application
pRTMP->SetApplication(GetApplication());
//5. Enqueue for delete this protocol
EnqueueForDelete();
//6. Process the data
if (!pRTMP->SignalInputData(buffer)) {
FATAL("Unable to process data");
pRTMP->EnqueueForDelete();
}
return true;
}
示例2: STR
BaseProtocol *InboundHTTP4RTMP::Bind(string sid) {
BaseProtocol *pResult = NULL;
if (_pNearProtocol == NULL) {
//14. This might be a new connection. Do we have that sid generated?
if (!MAP_HAS1(_generatedSids, sid)) {
FATAL("Invalid sid: %s", STR(sid));
return false;
}
//15. See if we have to generate a new connection or we just pick up
//a disconnected one
if (MAP_HAS1(_protocolsBySid, sid)) {
pResult = ProtocolManager::GetProtocol(_protocolsBySid[sid]);
} else {
pResult = new InboundRTMPProtocol();
pResult->Initialize(GetCustomParameters());
pResult->SetApplication(GetApplication());
_protocolsBySid[sid] = pResult->GetId();
SetNearProtocol(pResult);
pResult->SetFarProtocol(this);
}
} else {
pResult = _pNearProtocol;
}
return pResult;
}
示例3: FineTimer
BaseProtocol *ProtocolFactory::SpawnProtocol(uint64_t type, Variant ¶meters) {
BaseProtocol *pResult = NULL;
switch (type) {
#ifdef HAS_MS_TIMER
case PT_FINE_TIMER:
pResult = new FineTimer();
break;
#endif /* HAS_MS_TIMER */
case PT_INBOUND_MASTER_M3U8:
pResult = new MasterM3U8Protocol();
break;
case PT_INBOUND_CHILD_M3U8:
pResult = new ChildM3U8Protocol();
break;
case PT_INBOUND_KEY:
pResult = new InboundKeyProtocol();
break;
case PT_HTTP_BUFF:
pResult = new HTTPBufferProtocol();
break;
case PT_INBOUND_AES:
pResult = new InboundAESProtocol();
break;
default:
FATAL("Spawning protocol %s not yet implemented",
STR(tagToString(type)));
break;
}
if (pResult != NULL) {
if (!pResult->Initialize(parameters)) {
FATAL("Unable to initialize protocol %s",
STR(tagToString(type)));
delete pResult;
pResult = NULL;
}
}
return pResult;
}
示例4: TCPProtocol
//.........这里部分代码省略.........
#ifdef HAS_PROTOCOL_DNS
case PT_INBOUND_DNS:
pResult = new InboundDNSResolverProtocol();
break;
case PT_OUTBOUND_DNS:
pResult = new OutboundDNSResolverProtocol();
break;
#endif /* HAS_PROTOCOL_DNS */
#ifdef HAS_PROTOCOL_RTMP
case PT_INBOUND_RTMP:
pResult = new InboundRTMPProtocol();
break;
case PT_INBOUND_RTMPS_DISC:
pResult = new InboundRTMPSDiscriminatorProtocol();
break;
case PT_OUTBOUND_RTMP:
pResult = new OutboundRTMPProtocol();
break;
#ifdef HAS_PROTOCOL_HTTP
case PT_INBOUND_HTTP_FOR_RTMP:
pResult = new InboundHTTP4RTMP();
break;
#endif /* HAS_PROTOCOL_HTTP */
#endif /* HAS_PROTOCOL_RTMP */
#ifdef HAS_PROTOCOL_TS
case PT_INBOUND_TS:
pResult = new InboundTSProtocol();
break;
#endif /* HAS_PROTOCOL_TS */
#ifdef HAS_PROTOCOL_HTTP
case PT_INBOUND_HTTP:
pResult = new InboundHTTPProtocol();
break;
case PT_OUTBOUND_HTTP:
pResult = new OutboundHTTPProtocol();
break;
#endif /* HAS_PROTOCOL_HTTP */
#ifdef HAS_PROTOCOL_LIVEFLV
case PT_INBOUND_LIVE_FLV:
pResult = new InboundLiveFLVProtocol();
break;
#endif /* HAS_PROTOCOL_LIVEFLV */
#ifdef HAS_PROTOCOL_VAR
case PT_XML_VAR:
pResult = new XmlVariantProtocol();
break;
case PT_BIN_VAR:
pResult = new BinVariantProtocol();
break;
case PT_JSON_VAR:
pResult = new JsonVariantProtocol();
break;
#endif /* HAS_PROTOCOL_VAR */
#ifdef HAS_PROTOCOL_RTP
case PT_RTSP:
pResult = new RTSPProtocol();
break;
case PT_RTCP:
pResult = new RTCPProtocol();
break;
case PT_INBOUND_RTP:
pResult = new InboundRTPProtocol();
break;
case PT_RTP_NAT_TRAVERSAL:
pResult = new NATTraversalProtocol();
break;
#endif /* HAS_PROTOCOL_RTP */
#ifdef HAS_PROTOCOL_CLI
case PT_INBOUND_JSONCLI:
pResult = new InboundJSONCLIProtocol();
break;
case PT_HTTP_4_CLI:
pResult = new HTTP4CLIProtocol();
break;
#endif /* HAS_PROTOCOL_CLI */
#ifdef HAS_PROTOCOL_MMS
case PT_OUTBOUND_MMS:
pResult = new MMSProtocol();
break;
#endif /* HAS_PROTOCOL_MMS */
#ifdef HAS_PROTOCOL_RAWHTTPSTREAM
case PT_INBOUND_RAW_HTTP_STREAM:
pResult = new InboundRawHTTPStreamProtocol();
break;
#endif /* HAS_PROTOCOL_RAWHTTPSTREAM */
default:
FATAL("Spawning protocol %s not yet implemented",
STR(tagToString(type)));
break;
}
if (pResult != NULL) {
if (!pResult->Initialize(parameters)) {
FATAL("Unable to initialize protocol %s",
STR(tagToString(type)));
delete pResult;
pResult = NULL;
}
}
return pResult;
}