MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / event_parser

Function event_parser

parser/parse_event.c:98–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96
97
98int event_parser(char* _s, int _l, event_t* _e)
99{
100 str tmp;
101 char* end;
102 param_hooks_t phooks;
103
104 tmp.s = _s;
105 tmp.len = _l;
106
107 trim_leading(&tmp);
108
109 if (tmp.len == 0) {
110 LM_ERR("empty body\n");
111 goto parse_error;
112 }
113
114 _e->text.s = tmp.s;
115
116 end = skip_token(tmp.s, tmp.len);
117
118 _e->text.len = end - tmp.s;
119
120 if ((_e->text.len == PRES_STR_LEN) &&
121 !strncasecmp(PRES_STR, tmp.s, _e->text.len)) {
122 _e->parsed = EVENT_PRESENCE;
123 } else if ((_e->text.len == PRES_XCAP_DIFF_STR_LEN) &&
124 !strncasecmp(PRES_XCAP_DIFF_STR, tmp.s, _e->text.len)) {
125 _e->parsed = EVENT_XCAP_DIFF;
126 } else if ((_e->text.len == PRES_WINFO_STR_LEN) &&
127 !strncasecmp(PRES_WINFO_STR, tmp.s, _e->text.len)) {
128 _e->parsed = EVENT_PRESENCE_WINFO;
129 } else if ((_e->text.len == PRES_SIP_PROFILE_STR_LEN) &&
130 !strncasecmp(PRES_SIP_PROFILE_STR, tmp.s, _e->text.len)) {
131 _e->parsed = EVENT_SIP_PROFILE;
132 } else if ((_e->text.len == DIALOG_STR_LEN) &&
133 !strncasecmp(DIALOG_STR, tmp.s, _e->text.len)) {
134 _e->parsed = EVENT_DIALOG;
135 } else if ((_e->text.len == MWI_STR_LEN) &&
136 !strncasecmp(MWI_STR, tmp.s, _e->text.len)) {
137 _e->parsed = EVENT_MWI;
138 } else if ((_e->text.len == CALL_INFO_STR_LEN) &&
139 !strncasecmp(CALL_INFO_STR, tmp.s, _e->text.len)) {
140 _e->parsed = EVENT_CALL_INFO;
141 } else if ((_e->text.len == LINE_SEIZE_STR_LEN) &&
142 !strncasecmp(LINE_SEIZE_STR, tmp.s, _e->text.len)) {
143 _e->parsed = EVENT_LINE_SEIZE;
144 } else if ((_e->text.len == AS_FEATURE_LEN) &&
145 !strncasecmp(AS_FEATURE_STR, tmp.s, _e->text.len)) {
146 _e->parsed = EVENT_AS_FEATURE;
147 } else if ((_e->text.len == REFER_STR_LEN) &&
148 !strncasecmp(REFER_STR, tmp.s, _e->text.len)) {
149 _e->parsed = EVENT_REFER;
150 } else if ((_e->text.len == REG_STR_LEN) &&
151 !strncasecmp(REG_STR, tmp.s, _e->text.len)) {
152 _e->parsed = EVENT_REG;
153 } else {
154 _e->parsed = EVENT_OTHER;
155 }

Callers 7

add_rls_eventFunction · 0.85
contains_eventFunction · 0.85
init_pres_clusteringFunction · 0.85
handle_presentity_queryFunction · 0.85
pres_htable_restoreFunction · 0.85
parse_eventFunction · 0.85

Calls 3

trim_leadingFunction · 0.85
parse_paramsFunction · 0.85
skip_tokenFunction · 0.70

Tested by

no test coverage detected