MCPcopy Create free account
hub / github.com/RangeNetworks/openbts / str2MethodType

Method str2MethodType

SIP/SIPUtility.cpp:77–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75typedef std::map<string,SIPMethodType> SipMethodMap;
76static SipMethodMap gMethodMap;
77SIPMethodType SipMessage::str2MethodType(string &methodname)
78{
79 if (gMethodMap.size() == 0) {
80 // init the map
81#define HELPER_ONE_SIP_METHOD(name) gMethodMap.insert(SipMethodPair(#name, Method##name));
82 HELPER_ONE_SIP_METHOD(ACK)
83 HELPER_ONE_SIP_METHOD(BYE)
84 HELPER_ONE_SIP_METHOD(CANCEL)
85 HELPER_ONE_SIP_METHOD(INVITE)
86 HELPER_ONE_SIP_METHOD(MESSAGE)
87 HELPER_ONE_SIP_METHOD(OPTIONS)
88 HELPER_ONE_SIP_METHOD(INFO)
89 HELPER_ONE_SIP_METHOD(REFER)
90 HELPER_ONE_SIP_METHOD(NOTIFY)
91 HELPER_ONE_SIP_METHOD(SUBSCRIBE)
92 HELPER_ONE_SIP_METHOD(PRACK)
93 HELPER_ONE_SIP_METHOD(UPDATE)
94 HELPER_ONE_SIP_METHOD(REGISTER)
95 HELPER_ONE_SIP_METHOD(PUBLISH)
96 gMethodMap.insert(SipMethodPair("",MethodUndefined)); // empty string maps to Undefined method.
97 }
98 //for (SipMethodMap::iterator i = gMethodMap.begin(); i != gMethodMap.end(); ++i) {
99 // printf("SipMethodMap %s = %d\n",i->first,i->second);
100 //}
101
102 if (methodname == NULL) { return MethodUndefined; }
103 SipMethodMap::iterator it = gMethodMap.find(methodname);
104 if (it == gMethodMap.end()) { printf("MethodMap %s not found\n",methodname); }
105 return it == gMethodMap.end() ? MethodUndefined : it->second;
106}
107SIPMethodType SipMessage::smGetMethod() const
108{
109 if (omsg()->sip_method == NULL) {

Callers

nothing calls this directly

Calls 4

insertMethod · 0.80
findMethod · 0.80
sizeMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected