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

Function parse_via_param

parser/parse_via.c:118–975  ·  view source on GitHub ↗

entry state must be F_PARAM, or saved_state=F_PARAM and * state=F_{LF,CR,CRLF}! * output state = L_PARAM or F_PARAM or END_OF_HEADER * (and saved_state= last state); everything else => error * WARNING: param->start must be filled before, it's used in param->size * computation. */

Source from the content-addressed store, hash-verified

116 * computation.
117 */
118static /*inline*/ char* parse_via_param(char* p, char* end,
119 unsigned char* pstate,
120 unsigned char* psaved_state,
121 struct via_param* param)
122{
123 char* tmp;
124 register unsigned char state;
125 unsigned char saved_state;
126
127 state=*pstate;
128
129 saved_state=*psaved_state;
130 param->type=PARAM_ERROR;
131
132 for (tmp=p;tmp<end;tmp++){
133 switch(*tmp){
134 case ' ':
135 case '\t':
136 switch(state){
137 case FIN_HIDDEN:
138 case FIN_ALIAS:
139 param->type=state;
140 param->name.len=tmp-param->name.s;
141 state=L_PARAM;
142 goto endofparam;
143 case FIN_BRANCH:
144 case FIN_TTL:
145 case FIN_MADDR:
146 case FIN_RECEIVED:
147 case FIN_RPORT:
148 case FIN_I:
149 param->type=state;
150 param->name.len=tmp-param->name.s;
151 state=L_VALUE;
152 goto find_value;
153 case F_PARAM:
154 break;
155 case F_LF:
156 case F_CR:
157 case F_CRLF:
158 state=saved_state;
159 break;
160 case GEN_PARAM:
161 default:
162 param->type=GEN_PARAM;
163 param->name.len=tmp-param->name.s;
164 state=L_VALUE;
165 goto find_value;
166 }
167 break;
168 /* \n and \r*/
169 case '\n':
170 switch(state){
171 case FIN_HIDDEN:
172 case FIN_ALIAS:
173 param->type=state;
174 param->name.len=tmp-param->name.s;
175 param->size=tmp-param->start;

Callers 1

parse_viaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected