packet-sip.c 317 KB
Newer Older
1
2
/* packet-sip.c
 * Routines for the Session Initiation Protocol (SIP) dissection.
Jörg Mayer's avatar
Jörg Mayer committed
3
 * RFCs 3261-3264
4
 *
Anders Broman's avatar
Anders Broman committed
5
 * TODO:
6
 *      hf_ display filters for headers of SIP extension RFCs (ongoing)
7
8
 *
 * Copyright 2000, Heikki Vatiainen <hessu@cs.tut.fi>
9
 * Copyright 2001, Jean-Francois Mule <jfm@cablelabs.com>
10
 * Copyright 2004, Anders Broman <anders.broman@ericsson.com>
Anders Broman's avatar
Anders Broman committed
11
 * Copyright 2011, Anders Broman <anders.broman@ericsson.com>, Johan Wahl <johan.wahl@ericsson.com>
12
 * Copyright 2018, Anders Broman <anders.broman@ericsson.com>
13
 * Copyright 2020, Atul Sharma <asharm37@ncsu.edu>
14
 *
15
16
 * Wireshark - Network traffic analyzer
 * By Gerald Combs <gerald@wireshark.org>
17
18
 * Copyright 1998 Gerald Combs
 *
19
 * SPDX-License-Identifier: GPL-2.0-or-later
20
 *
21
22
 */

23
#include "config.h"
24

25
#include <epan/packet.h>
26

27
#include <epan/exceptions.h>
28
29
#include <epan/exported_pdu.h>
#include <epan/expert.h>
30
#include <epan/prefs.h>
31
#include <epan/req_resp_hdrs.h>
32
#include <epan/stat_tap_ui.h>
33
#include <epan/tap.h>
34
#include <epan/proto_data.h>
35
#include <epan/uat.h>
36
37
#include <epan/strutil.h>
#include <epan/to_str.h>
38
39
40
41
#include <epan/follow.h>
#include <epan/conversation.h>
#include <epan/addr_resolv.h>
#include <epan/epan_dissect.h>
42

43
#include <wsutil/str_util.h>
Dario Lombardo's avatar
Dario Lombardo committed
44
#include <wsutil/strtoi.h>
45
#include <wsutil/wsgcrypt.h>
46

47
#include "packet-tls.h"
48

49
#include "packet-isup.h"
50
#include "packet-e164.h"
51
52
#include "packet-sip.h"

53
#include "packet-http.h"
54
#include "packet-acdr.h"
55

mmann78's avatar
mmann78 committed
56
57
#include "packet-sdp.h"  /* SDP needs a transport layer to determine request/response */

58
59
60
61
/* un-comment the following as well as this line in conversation.c, to enable debug printing */
/* #define DEBUG_CONVERSATION */
#include "conversation_debug.h"

62
#define TLS_PORT_SIP 5061
63
64
#define DEFAULT_SIP_PORT_RANGE "5060"

Anders Broman's avatar
Anders Broman committed
65
66
void proto_register_sip(void);

67
static gint sip_tap = -1;
68
static gint sip_follow_tap = -1;
69
static gint exported_pdu_tap = -1;
70
71
static dissector_handle_t sip_handle;
static dissector_handle_t sip_tcp_handle;
72
static dissector_handle_t sigcomp_handle;
73
static dissector_handle_t sip_diag_handle;
74
static dissector_handle_t sip_uri_userinfo_handle;
75
static dissector_handle_t sip_via_branch_handle;
76
static dissector_handle_t sip_via_be_route_handle;
77
78
/* Dissector to dissect the text part of an reason code */
static dissector_handle_t sip_reason_code_handle;
79

80
/* Initialize the protocol and registered fields */
81
82
static gint proto_sip                     = -1;
static gint proto_raw_sip                 = -1;
Anders Broman's avatar
Anders Broman committed
83
84
static gint hf_sip_raw_line               = -1;
static gint hf_sip_msg_hdr                = -1;
85
static gint hf_sip_Method                 = -1;
86
static gint hf_Request_Line               = -1;
87
static gint hf_sip_ruri_display           = -1;
88
89
90
91
static gint hf_sip_ruri                   = -1;
static gint hf_sip_ruri_user              = -1;
static gint hf_sip_ruri_host              = -1;
static gint hf_sip_ruri_port              = -1;
Anders Broman's avatar
Anders Broman committed
92
static gint hf_sip_ruri_param             = -1;
Anders Broman's avatar
Anders Broman committed
93
94
static gint hf_sip_Status_Code            = -1;
static gint hf_sip_Status_Line            = -1;
95
static gint hf_sip_display                = -1;
96
static gint hf_sip_to_display             = -1;
97
98
99
100
static gint hf_sip_to_addr                = -1;
static gint hf_sip_to_user                = -1;
static gint hf_sip_to_host                = -1;
static gint hf_sip_to_port                = -1;
Anders Broman's avatar
Anders Broman committed
101
static gint hf_sip_to_param               = -1;
102
static gint hf_sip_to_tag                 = -1;
103
static gint hf_sip_from_display           = -1;
104
105
106
107
static gint hf_sip_from_addr              = -1;
static gint hf_sip_from_user              = -1;
static gint hf_sip_from_host              = -1;
static gint hf_sip_from_port              = -1;
Anders Broman's avatar
Anders Broman committed
108
static gint hf_sip_from_param             = -1;
109
static gint hf_sip_from_tag               = -1;
110
static gint hf_sip_tag                    = -1;
111
static gint hf_sip_pai_display            = -1;
112
113
114
115
static gint hf_sip_pai_addr               = -1;
static gint hf_sip_pai_user               = -1;
static gint hf_sip_pai_host               = -1;
static gint hf_sip_pai_port               = -1;
Anders Broman's avatar
Anders Broman committed
116
static gint hf_sip_pai_param              = -1;
117
static gint hf_sip_pmiss_display          = -1;
118
119
120
121
static gint hf_sip_pmiss_addr             = -1;
static gint hf_sip_pmiss_user             = -1;
static gint hf_sip_pmiss_host             = -1;
static gint hf_sip_pmiss_port             = -1;
Anders Broman's avatar
Anders Broman committed
122
static gint hf_sip_pmiss_param            = -1;
123
static gint hf_sip_ppi_display            = -1;
124
125
126
127
static gint hf_sip_ppi_addr               = -1;
static gint hf_sip_ppi_user               = -1;
static gint hf_sip_ppi_host               = -1;
static gint hf_sip_ppi_port               = -1;
Anders Broman's avatar
Anders Broman committed
128
static gint hf_sip_ppi_param              = -1;
129
static gint hf_sip_tc_display             = -1;
130
131
132
133
static gint hf_sip_tc_addr                = -1;
static gint hf_sip_tc_user                = -1;
static gint hf_sip_tc_host                = -1;
static gint hf_sip_tc_port                = -1;
Anders Broman's avatar
Anders Broman committed
134
static gint hf_sip_tc_param               = -1;
135
static gint hf_sip_tc_turi                = -1;
136
static gint hf_sip_contact_param          = -1;
137
138
static gint hf_sip_resend                 = -1;
static gint hf_sip_original_frame         = -1;
139
static gint hf_sip_matching_request_frame = -1;
140
141
static gint hf_sip_response_time          = -1;
static gint hf_sip_release_time           = -1;
142
static gint hf_sip_curi_display           = -1;
143
144
145
146
static gint hf_sip_curi                   = -1;
static gint hf_sip_curi_user              = -1;
static gint hf_sip_curi_host              = -1;
static gint hf_sip_curi_port              = -1;
Anders Broman's avatar
Anders Broman committed
147
static gint hf_sip_curi_param             = -1;
148
static gint hf_sip_route_display          = -1;
Anders Broman's avatar
Anders Broman committed
149
150
151
152
153
static gint hf_sip_route                  = -1;
static gint hf_sip_route_user             = -1;
static gint hf_sip_route_host             = -1;
static gint hf_sip_route_port             = -1;
static gint hf_sip_route_param            = -1;
154
static gint hf_sip_record_route_display   = -1;
Anders Broman's avatar
Anders Broman committed
155
156
157
158
159
static gint hf_sip_record_route           = -1;
static gint hf_sip_record_route_user      = -1;
static gint hf_sip_record_route_host      = -1;
static gint hf_sip_record_route_port      = -1;
static gint hf_sip_record_route_param     = -1;
160
static gint hf_sip_service_route_display  = -1;
AndersBroman's avatar
AndersBroman committed
161
162
163
164
165
static gint hf_sip_service_route          = -1;
static gint hf_sip_service_route_user     = -1;
static gint hf_sip_service_route_host     = -1;
static gint hf_sip_service_route_port     = -1;
static gint hf_sip_service_route_param    = -1;
166
static gint hf_sip_path_display           = -1;
Johan Wahl's avatar
Johan Wahl committed
167
168
169
170
171
static gint hf_sip_path                   = -1;
static gint hf_sip_path_user              = -1;
static gint hf_sip_path_host              = -1;
static gint hf_sip_path_port              = -1;
static gint hf_sip_path_param             = -1;
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205

static gint hf_sip_auth                   = -1;
static gint hf_sip_auth_scheme            = -1;
static gint hf_sip_auth_digest_response   = -1;
static gint hf_sip_auth_nc                = -1;
static gint hf_sip_auth_username          = -1;
static gint hf_sip_auth_realm             = -1;
static gint hf_sip_auth_nonce             = -1;
static gint hf_sip_auth_algorithm         = -1;
static gint hf_sip_auth_opaque            = -1;
static gint hf_sip_auth_qop               = -1;
static gint hf_sip_auth_cnonce            = -1;
static gint hf_sip_auth_uri               = -1;
static gint hf_sip_auth_domain            = -1;
static gint hf_sip_auth_stale             = -1;
static gint hf_sip_auth_auts              = -1;
static gint hf_sip_auth_rspauth           = -1;
static gint hf_sip_auth_nextnonce         = -1;
static gint hf_sip_auth_ik                = -1;
static gint hf_sip_auth_ck                = -1;

static gint hf_sip_cseq_seq_no            = -1;
static gint hf_sip_cseq_method            = -1;

static gint hf_sip_via_transport          = -1;
static gint hf_sip_via_sent_by_address    = -1;
static gint hf_sip_via_sent_by_port       = -1;
static gint hf_sip_via_branch             = -1;
static gint hf_sip_via_maddr              = -1;
static gint hf_sip_via_rport              = -1;
static gint hf_sip_via_received           = -1;
static gint hf_sip_via_ttl                = -1;
static gint hf_sip_via_comp               = -1;
static gint hf_sip_via_sigcomp_id         = -1;
206
static gint hf_sip_via_oc                 = -1;
207
static gint hf_sip_via_oc_val             = -1;
208
209
210
static gint hf_sip_via_oc_algo            = -1;
static gint hf_sip_via_oc_validity        = -1;
static gint hf_sip_via_oc_seq             = -1;
211
static gint hf_sip_oc_seq_timestamp       = -1;
212
static gint hf_sip_via_be_route           = -1;
213
214
215
216
217

static gint hf_sip_rack_rseq_no           = -1;
static gint hf_sip_rack_cseq_no           = -1;
static gint hf_sip_rack_cseq_method       = -1;

218
static gint hf_sip_reason_protocols       = -1;
219
220
221
222
static gint hf_sip_reason_cause_q850      = -1;
static gint hf_sip_reason_cause_sip       = -1;
static gint hf_sip_reason_cause_other     = -1;
static gint hf_sip_reason_text            = -1;
223

224
static gint hf_sip_msg_body               = -1;
Pascal Quantin's avatar
Pascal Quantin committed
225
226
227
228
229
230
static gint hf_sip_sec_mechanism          = -1;
static gint hf_sip_sec_mechanism_alg      = -1;
static gint hf_sip_sec_mechanism_ealg     = -1;
static gint hf_sip_sec_mechanism_prot     = -1;
static gint hf_sip_sec_mechanism_spi_c    = -1;
static gint hf_sip_sec_mechanism_spi_s    = -1;
231
232
233
234
static gint hf_sip_sec_mechanism_port1    = -1;
static gint hf_sip_sec_mechanism_port_c   = -1;
static gint hf_sip_sec_mechanism_port2    = -1;
static gint hf_sip_sec_mechanism_port_s   = -1;
235
236
237
238
static gint hf_sip_session_id_sess_id     = -1;
static gint hf_sip_session_id_param       = -1;
static gint hf_sip_session_id_local_uuid  = -1;
static gint hf_sip_session_id_remote_uuid = -1;
239
static gint hf_sip_session_id_logme       = -1;
240
static gint hf_sip_continuation           = -1;
241
static gint hf_sip_feature_cap            = -1;
242

243
244
245
static gint hf_sip_p_acc_net_i_acc_type   = -1;
static gint hf_sip_p_acc_net_i_ucid_3gpp  = -1;

246
static gint hf_sip_service_priority = -1;
247
248
static gint hf_sip_icid_value = -1;
static gint hf_sip_icid_gen_addr = -1;
249
static gint hf_sip_call_id_gen = -1;
250

251
/* Initialize the subtree pointers */
252
253
254
255
256
257
static gint ett_sip                       = -1;
static gint ett_sip_reqresp               = -1;
static gint ett_sip_hdr                   = -1;
static gint ett_sip_ext_hdr               = -1;
static gint ett_raw_text                  = -1;
static gint ett_sip_element               = -1;
258
static gint ett_sip_hist                  = -1;
259
260
261
262
263
264
static gint ett_sip_uri                   = -1;
static gint ett_sip_contact_item          = -1;
static gint ett_sip_message_body          = -1;
static gint ett_sip_cseq                  = -1;
static gint ett_sip_via                   = -1;
static gint ett_sip_reason                = -1;
Pascal Quantin's avatar
Pascal Quantin committed
265
266
267
static gint ett_sip_security_client       = -1;
static gint ett_sip_security_server       = -1;
static gint ett_sip_security_verify       = -1;
268
static gint ett_sip_rack                  = -1;
Anders Broman's avatar
Anders Broman committed
269
270
static gint ett_sip_route                 = -1;
static gint ett_sip_record_route          = -1;
AndersBroman's avatar
AndersBroman committed
271
static gint ett_sip_service_route         = -1;
Johan Wahl's avatar
Johan Wahl committed
272
static gint ett_sip_path                  = -1;
273
274
static gint ett_sip_ruri                  = -1;
static gint ett_sip_to_uri                = -1;
275
static gint ett_sip_curi                  = -1;
276
277
278
279
280
static gint ett_sip_from_uri              = -1;
static gint ett_sip_pai_uri               = -1;
static gint ett_sip_pmiss_uri             = -1;
static gint ett_sip_ppi_uri               = -1;
static gint ett_sip_tc_uri                = -1;
281
static gint ett_sip_session_id            = -1;
282
static gint ett_sip_p_access_net_info     = -1;
283
static gint ett_sip_p_charging_vector     = -1;
284
static gint ett_sip_feature_caps          = -1;
285
static gint ett_sip_via_be_route          = -1;
286

mmann78's avatar
mmann78 committed
287
static expert_field ei_sip_unrecognized_header = EI_INIT;
288
static expert_field ei_sip_header_no_colon = EI_INIT;
mmann78's avatar
mmann78 committed
289
static expert_field ei_sip_header_not_terminated = EI_INIT;
290
#if 0
291
static expert_field ei_sip_odd_register_response = EI_INIT;
292
#endif
293
static expert_field ei_sip_sipsec_malformed = EI_INIT;
Dario Lombardo's avatar
Dario Lombardo committed
294
295
static expert_field ei_sip_via_sent_by_port = EI_INIT;
static expert_field ei_sip_content_length_invalid = EI_INIT;
296
static expert_field ei_sip_retry_after_invalid = EI_INIT;
Dario Lombardo's avatar
Dario Lombardo committed
297
static expert_field ei_sip_Status_Code_invalid = EI_INIT;
298
static expert_field ei_sip_authorization_invalid = EI_INIT;
mmann78's avatar
mmann78 committed
299
static expert_field ei_sip_session_id_sess_id = EI_INIT;
mmann78's avatar
mmann78 committed
300

301
302
303
304
305
306
307
308
309
/* patterns used for tvb_ws_mempbrk_pattern_guint8 */
static ws_mempbrk_pattern pbrk_comma_semi;
static ws_mempbrk_pattern pbrk_whitespace;
static ws_mempbrk_pattern pbrk_param_end;
static ws_mempbrk_pattern pbrk_param_end_colon_brackets;
static ws_mempbrk_pattern pbrk_header_end_dquote;
static ws_mempbrk_pattern pbrk_tab_sp_fslash;
static ws_mempbrk_pattern pbrk_addr_end;
static ws_mempbrk_pattern pbrk_via_param_end;
310
311


312
/* PUBLISH method added as per https://tools.ietf.org/html/draft-ietf-sip-publish-01 */
313
static const char *sip_methods[] = {
314
#define SIP_METHOD_INVALID  0
315
        "<Invalid method>",      /* Pad so that the real methods start at index 1 */
316
#define SIP_METHOD_ACK      1
317
        "ACK",
318
#define SIP_METHOD_BYE      2
319
        "BYE",
320
#define SIP_METHOD_CANCEL   3
321
        "CANCEL",
322
#define SIP_METHOD_DO       4
323
        "DO",
324
#define SIP_METHOD_INFO     5
325
        "INFO",
326
#define SIP_METHOD_INVITE   6
327
        "INVITE",
328
#define SIP_METHOD_MESSAGE  7
329
        "MESSAGE",
330
#define SIP_METHOD_NOTIFY   8
331
        "NOTIFY",
332
#define SIP_METHOD_OPTIONS  9
333
        "OPTIONS",
334
#define SIP_METHOD_PRACK    10
335
        "PRACK",
336
#define SIP_METHOD_QAUTH    11
337
        "QAUTH",
338
#define SIP_METHOD_REFER    12
339
        "REFER",
340
#define SIP_METHOD_REGISTER 13
341
        "REGISTER",
342
#define SIP_METHOD_SPRACK   14
343
        "SPRACK",
344
#define SIP_METHOD_SUBSCRIBE    15
Guy Harris's avatar
Guy Harris committed
345
        "SUBSCRIBE",
346
#define SIP_METHOD_UPDATE   16
347
        "UPDATE",
348
#define SIP_METHOD_PUBLISH  17
349
        "PUBLISH"
350
351
};

352
/* from RFC 3261
353
 * Updated with info from https://www.iana.org/assignments/sip-parameters
354
 * (last updated 2009-11-11)
355
 * Updated with: https://tools.ietf.org/html/draft-ietf-sip-resource-priority-05
356
357
358
359
360
361
362
 */
typedef struct {
        const char *name;
        const char *compact_name;
} sip_header_t;
static const sip_header_t sip_headers[] = {
    { "Unknown-header",                 NULL }, /* 0 Pad so that the real headers start at index 1 */
363
    { "Accept",                         NULL }, /*  */
364
#define POS_ACCEPT                       1
365
    { "Accept-Contact",                 "a"  }, /* RFC3841  */
366
#define POS_ACCEPT_CONTACT               2
367
    { "Accept-Encoding",                NULL }, /* */
368
#define POS_ACCEPT_ENCODING              3
369
    { "Accept-Language",                NULL }, /* */
370
#define POS_ACCEPT_LANGUAGE              4
371
    { "Accept-Resource-Priority",       NULL }, /* RFC4412 */
372
#define POS_ACCEPT_RESOURCE_PRIORITY     5
373
374
    { "Additional-Identity",            NULL }, /* 3GPP TS 24.229 v16.7.0 */
#define POS_ADDITIONAL_IDENTITY          6
375
    { "Alert-Info",                     NULL },
376
#define POS_ALERT_INFO                   7
377
    { "Allow",                          NULL },
378
379
380
381
382
383
384
#define POS_ALLOW                        8
    { "Allow-Events",                   "u"  }, /* RFC3265  */
#define POS_ALLOW_EVENTS                 9
    { "Answer-Mode",                    NULL }, /* RFC5373 */
#define POS_ANSWER_MODE                 10
    { "Attestation-Info",               NULL }, /* [3GPP TS 24.229 v15.11.0] */
#define POS_ATTESTATION_INFO            11
385
    { "Authentication-Info",            NULL },
386
387
388
#define POS_AUTHENTICATION_INFO         12
    { "Authorization",                  NULL }, /*  */
#define POS_AUTHORIZATION               13
389
    { "Call-ID",                        "i"  },
390
#define POS_CALL_ID                     14
391
    { "Call-Info",                      NULL },
392
393
394
#define POS_CALL_INFO                   15
    { "Cellular-Network-Info",          NULL }, /* [3GPP TS 24.229 v13.9.0] */
#define POS_CELLULAR_NETWORK_INFO       16
395
    { "Contact",                        "m"  },
396
#define POS_CONTACT                     17
397
    { "Content-Disposition",            NULL },
398
399
400
#define POS_CONTENT_DISPOSITION         18
    { "Content-Encoding",               "e"  },  /*   */
#define POS_CONTENT_ENCODING            19
401
    { "Content-Language",               NULL },
402
#define POS_CONTENT_LANGUAGE            20
403
    { "Content-Length",                 "l"  },
404
#define POS_CONTENT_LENGTH              21
405
    { "Content-Type",                   "c"  },
406
#define POS_CONTENT_TYPE                22
407
    { "CSeq",                           NULL },
408
409
410
#define POS_CSEQ                        23
    { "Date",                           NULL },  /*   */
#define POS_DATE                        24
411
/*              Encryption (Deprecated)       [RFC3261] */
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
    { "Error-Info",                     NULL },  /*   */
#define POS_ERROR_INFO                  25
    { "Event",                          "o"  },  /*   */
#define POS_EVENT                       26
    { "Expires",                        NULL },  /*   */
#define POS_EXPIRES                     27
    { "Feature-Caps",                   NULL },  /*  RFC6809 */
#define POS_FEATURE_CAPS                28
    { "Flow-Timer",                     NULL },  /*  RFC5626  */
#define POS_FLOW_TIMER                  29
    { "From",                           "f"  },  /*   */
#define POS_FROM                        30

    { "Geolocation",                   NULL  },  /*   */
#define POS_GEOLOCATION                 31
    { "Geolocation-Error",             NULL  },  /*   */
#define POS_GEOLOCATION_ERROR           32
    { "Geolocation-Routing",           NULL  },  /*   */
#define POS_GEOLOCATION_ROUTING         33

/*              Hide                          RFC3261 (deprecated)*/
    { "History-Info",                   NULL },  /*  RFC4244  */
#define POS_HISTORY_INFO                34
    { "Identity",                       "y"  },  /*  RFC4474  */
#define POS_IDENTITY                    35
    { "Identity-Info",                  "n"  },  /*  RFC4474  */
#define POS_IDENTITY_INFO               36
    { "Info-Package",                   NULL },  /*  RFC-ietf-sipcore-info-events-10.txt  */
#define POS_INFO_PKG                    37
    { "In-Reply-To",                    NULL },  /*  RFC3261  */
#define POS_IN_REPLY_TO                 38
    { "Join",                           NULL },  /*  RFC3911  */
#define POS_JOIN                        39
    { "Max-Breadth",                    NULL },  /*  RFC5393*/
#define POS_MAX_BREADTH                 40
    { "Max-Forwards",                   NULL },  /*   */
#define POS_MAX_FORWARDS                41
    { "MIME-Version",                   NULL },  /*   */
#define POS_MIME_VERSION                42
    { "Min-Expires",                    NULL },  /*   */
#define POS_MIN_EXPIRES                 43
    { "Min-SE",                         NULL },  /*  RFC4028  */
#define POS_MIN_SE                      44
    { "Organization",                   NULL },  /*  RFC3261  */
#define POS_ORGANIZATION                45
    { "Origination-Id",                 NULL },  /*  [3GPP TS 24.229 v15.11.0]  */
#define POS_ORIGINATION_ID              46
    { "P-Access-Network-Info",          NULL },  /*  RFC3455  */
#define POS_P_ACCESS_NETWORK_INFO       47
    { "P-Answer-State",                 NULL },  /*  RFC4964  */
#define POS_P_ANSWER_STATE              48
    { "P-Asserted-Identity",            NULL },  /*  RFC3325  */
#define POS_P_ASSERTED_IDENTITY         49
    { "P-Asserted-Service",             NULL },  /*  RFC6050  */
#define POS_P_ASSERTED_SERV             50
    { "P-Associated-URI",               NULL },  /*  RFC3455  */
#define POS_P_ASSOCIATED_URI            51
    { "P-Called-Party-ID",              NULL },  /*  RFC3455  */
#define POS_P_CALLED_PARTY_ID           52
    { "P-Charge-Info",                  NULL },  /*  RFC8496  */
#define POS_P_CHARGE_INFO               53
    { "P-Charging-Function-Addresses",  NULL },  /*  RFC3455  */
#define POS_P_CHARGING_FUNC_ADDRESSES   54
    { "P-Charging-Vector",              NULL },  /*  RFC3455  */
#define POS_P_CHARGING_VECTOR           55
    { "P-DCS-Trace-Party-ID",           NULL },  /*  RFC5503  */
#define POS_P_DCS_TRACE_PARTY_ID        56
    { "P-DCS-OSPS",                     NULL },  /*  RFC5503  */
#define POS_P_DCS_OSPS                  57
    { "P-DCS-Billing-Info",             NULL },  /*  RFC5503  */
#define POS_P_DCS_BILLING_INFO          58
    { "P-DCS-LAES",                     NULL },  /*  RFC5503  */
#define POS_P_DCS_LAES                  59
    { "P-DCS-Redirect",                 NULL },  /*  RFC5503  */
#define POS_P_DCS_REDIRECT              60
    { "P-Early-Media",                  NULL },  /*  RFC5009  */
#define POS_P_EARLY_MEDIA               61
    { "P-Media-Authorization",          NULL },  /*  RFC3313  */
#define POS_P_MEDIA_AUTHORIZATION       62
    { "P-Preferred-Identity",           NULL },  /*  RFC3325  */
#define POS_P_PREFERRED_IDENTITY        63
    { "P-Preferred-Service",            NULL },  /*  RFC6050  */
#define POS_P_PREFERRED_SERV            64
    { "P-Profile-Key",                  NULL },  /*  RFC5002  */
#define POS_P_PROFILE_KEY               65
    { "P-Refused-URI-List",             NULL },  /*  RFC5318  */
#define POS_P_REFUSED_URI_LST           66
    { "P-Served-User",                  NULL },  /*  RFC5502  */
#define POS_P_SERVED_USER               67
    { "P-User-Database",                NULL },  /*  RFC4457  */
#define POS_P_USER_DATABASE             68
    { "P-Visited-Network-ID",           NULL },  /*  RFC3455  */
#define POS_P_VISITED_NETWORK_ID        69
    { "Path",                           NULL },  /*  RFC3327  */
#define POS_PATH                        70
    { "Permission-Missing",             NULL },  /*  RFC5360  */
#define POS_PERMISSION_MISSING          71
    { "Policy-Contact",                 NULL },  /*  RFC3261  */
#define POS_POLICY_CONTACT              72
    { "Policy-ID",                      NULL },  /*  RFC3261  */
#define POS_POLICY_ID                   73
    { "Priority",                       NULL },  /*  RFC3261  */
#define POS_PRIORITY                    74
    { "Priority-Share",                 NULL },  /*  [3GPP TS 24.229 v13.16.0]  */
#define POS_PRIORITY_SHARE              75
    { "Priv-Answer-Mode",               NULL },  /*  RFC5373  */
#define POS_PRIV_ANSWER_MODE            76
    { "Privacy",                        NULL },  /*  RFC3323  */
#define POS_PRIVACY                     77
    { "Proxy-Authenticate",             NULL },  /*  */
#define POS_PROXY_AUTHENTICATE          78
    { "Proxy-Authorization",            NULL },  /*  */
#define POS_PROXY_AUTHORIZATION         79
    { "Proxy-Require",                  NULL },  /*  */
#define POS_PROXY_REQUIRE               80
    { "RAck",                           NULL },  /*  RFC3262  */
#define POS_RACK                        81
    { "Reason",                         NULL },  /*  RFC3326  */
#define POS_REASON                      82
    { "Reason-Phrase",                  NULL },  /*  RFC3326  */
#define POS_REASON_PHRASE               83
    { "Record-Route",                   NULL },  /*   */
#define POS_RECORD_ROUTE                84
    { "Recv-Info",                      NULL },  /*  RFC6086 */
#define POS_RECV_INFO                   85
    { "Refer-Sub",                      NULL },  /*  RFC4488  */
#define POS_REFER_SUB                   86
    { "Refer-To",                       "r"  },  /*  RFC3515  */
#define POS_REFER_TO                    87
    { "Referred-By",                    "b"  },  /*  RFC3892  */
#define POS_REFERRED_BY                 88
    { "Reject-Contact",                 "j"  },  /*  RFC3841  */
#define POS_REJECT_CONTACT              89
    { "Relayed-Charge",                 NULL },   /*  [3GPP TS 24.229 v12.14.0]   */
#define POS_RELAYED_CHARGE              90
    { "Replaces",                       NULL },  /*  RFC3891  */
#define POS_REPLACES                    91
    { "Reply-To",                       NULL },  /*  RFC3261  */
#define POS_REPLY_TO                    92
    { "Request-Disposition",            "d"  },  /*  RFC3841  */
#define POS_REQUEST_DISPOSITION         93
    { "Require",                        NULL },  /*  RFC3261  */
#define POS_REQUIRE                     94
    { "Resource-Priority",              NULL },  /*  RFC4412  */
#define POS_RESOURCE_PRIORITY           95
    { "Resource-Share",                 NULL },  /*  [3GPP TS 24.229 v13.7.0]  */
#define POS_RESOURCE_SHARE              96
559
    /*{ "Response-Key (Deprecated)     [RFC3261]*/
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
    { "Response-Source",                NULL },  /*  [3GPP TS 24.229 v15.11.0]  */
#define POS_RESPONSE_SOURCE             97
    { "Restoration-Info",               NULL },  /*  [3GPP TS 24.229 v12.14.0]  */
#define POS_RESTORATION_INFO            98
    { "Retry-After",                    NULL },  /*  RFC3261  */
#define POS_RETRY_AFTER                 99
    { "Route",                          NULL },  /*  RFC3261  */
#define POS_ROUTE                      100
    { "RSeq",                           NULL },  /*  RFC3262  */
#define POS_RSEQ                       101
    { "Security-Client",                NULL },  /*  RFC3329  */
#define POS_SECURITY_CLIENT            102
    { "Security-Server",                NULL },  /*  RFC3329  */
#define POS_SECURITY_SERVER            103
    { "Security-Verify",                NULL },  /*  RFC3329  */
#define POS_SECURITY_VERIFY            104
    { "Server",                         NULL },  /*  RFC3261  */
#define POS_SERVER                     105
    { "Service-Interact-Info",          NULL },  /*  [3GPP TS 24.229 v13.18.0]  */
#define POS_SERVICE_INTERACT_INFO      106
    { "Service-Route",                  NULL },  /*  RFC3608  */
#define POS_SERVICE_ROUTE              107
    { "Session-Expires",                "x"  },  /*  RFC4028  */
#define POS_SESSION_EXPIRES            108
    { "Session-ID",                     NULL },  /*  RFC7329  */
#define POS_SESSION_ID                 109
    { "SIP-ETag",                       NULL },  /*  RFC3903  */
#define POS_SIP_ETAG                   110
    { "SIP-If-Match",                   NULL },  /*  RFC3903  */
#define POS_SIP_IF_MATCH               111
    { "Subject",                        "s"  },  /*  RFC3261  */
#define POS_SUBJECT                    112
    { "Subscription-State",             NULL },  /*  RFC3265  */
#define POS_SUBSCRIPTION_STATE         113
    { "Supported",                      "k"  },  /*  RFC3261  */
#define POS_SUPPORTED                  114
    { "Suppress-If-Match",              NULL },  /*  RFC5839  */
#define POS_SUPPRESS_IF_MATCH          115
    { "Target-Dialog",                  NULL },  /*  RFC4538  */
#define POS_TARGET_DIALOG              116
    { "Timestamp",                      NULL },  /*  RFC3261  */
#define POS_TIMESTAMP                  117
    { "To",                             "t"  },  /*  RFC3261  */
#define POS_TO                         118
    { "Trigger-Consent",                NULL },  /*  RFC5360  */
#define POS_TRIGGER_CONSENT            119
    { "Unsupported",                    NULL },  /*  RFC3261  */
#define POS_UNSUPPORTED                120
    { "User-Agent",                     NULL },  /*  RFC3261  */
#define POS_USER_AGENT                 121
    { "Via",                            "v"  },  /*  RFC3261  */
#define POS_VIA                        122
    { "Warning",                        NULL },  /*  RFC3261  */
#define POS_WARNING                    123
    { "WWW-Authenticate",               NULL },  /*  RFC3261  */
#define POS_WWW_AUTHENTICATE           124
    { "Diversion",                      NULL },  /*  RFC5806  */
#define POS_DIVERSION                  125
    { "User-to-User",                   NULL },  /*  RFC7433   */
#define POS_USER_TO_USER               126
620
621
622
623
624
};




625
static gint hf_header_array[] = {
626
627
628
629
630
631
    -1, /* 0"Unknown-header" - Pad so that the real headers start at index 1 */
    -1, /* 1"Accept"                                    */
    -1, /* 2"Accept-Contact"                    RFC3841 */
    -1, /* 3"Accept-Encoding"                           */
    -1, /* 4"Accept-Language"                           */
    -1, /* 5"Accept-Resource-Priority"          RFC4412 */
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
    -1, /* 6"Additional-Identity		[3GPP TS 24.229 v16.7.0]  */
    -1, /* 7"Alert-Info",                               */
    -1, /* 8"Allow",                                    */
    -1, /* 9"Allow-Events",                     RFC3265 */
    -1, /* 10"Answer-Mode"                      RFC5373 */
    -1, /* 11"Attestation-Info		[3GPP TS 24.229 v15.11.0] */
    -1, /* 12"Authentication-Info"                      */
    -1, /* 13"Authorization",                           */
    -1, /* 14"Call-ID",                                 */
    -1, /* 15"Call-Info"                                */
    -1, /* 16"Cellular-Network-Info		[3GPP TS 24.229 v13.9.0] */
    -1, /* 17"Contact",                                 */
    -1, /* 18"Content-Disposition",                     */
    -1, /* 19"Content-Encoding",                        */
    -1, /* 20"Content-Language",                        */
    -1, /* 21"Content-Length",                          */
    -1, /* 22"Content-Type",                            */
    -1, /* 23"CSeq",                                    */
    -1, /* 24"Date",                                    */
    -1, /* 25"Error-Info",                              */
    -1, /* 26"Event",                                   */
    -1, /* 27"Expires",                                 */
    -1, /* 28"Feature-Caps",                            */
    -1, /* 29"Flow-Timer",                      RFC5626 */
    -1, /* 30"From",                                    */
    -1, /* 31"Geolocation",                             */
    -1, /* 32"Geolocation-Error",                       */
    -1, /* 33"Geolocation-Routing",                     */
    -1, /* 34"History-Info",                    RFC4244 */
    -1, /* 35"Identity",                                */
    -1, /* 36"Identity-Info",                   RFC4474 */
    -1, /* 37"Info-Package", RFC-ietf-sipcore-info-events-10.txt */
    -1, /* 38"In-Reply-To",                     RFC3261 */
    -1, /* 39"Join",                            RFC3911 */
    -1, /* 40"Max-Breadth"                      RFC5393 */
    -1, /* 41"Max-Forwards",                            */
    -1, /* 42"MIME-Version",                            */
    -1, /* 43"Min-Expires",                             */
    -1, /* 44"Min-SE",                          RFC4028 */
    -1, /* 45"Organization",                            */
    -1, /* 46"Origination-Id		[3GPP TS 24.229 v15.11.0] */
    -1, /* 47"P-Access-Network-Info",           RFC3455 */
    -1, /* 48"P-Answer-State",                  RFC4964 */
    -1, /* 49"P-Asserted-Identity",             RFC3325 */
    -1, /* 50"P-Asserted-Service",  RFC-drage-sipping-service-identification-05.txt */
    -1, /* 51"P-Associated-URI",                RFC3455 */
    -1, /* 52"P-Charge-Info",                   RFC8496 */
    -1, /* 53"P-Called-Party-ID",               RFC3455 */
    -1, /* 54"P-Charging-Function-Addresses",   RFC3455 */
    -1, /* 55"P-Charging-Vector",               RFC3455 */
    -1, /* 56"P-DCS-Trace-Party-ID",            RFC3603 */
    -1, /* 57"P-DCS-OSPS",                      RFC3603 */
    -1, /* 58"P-DCS-Billing-Info",              RFC3603 */
    -1, /* 59"P-DCS-LAES",                      RFC3603 */
    -1, /* 60"P-DCS-Redirect",                  RFC3603 */
    -1, /* 61"P-Early-Media",                           */
    -1, /* 62"P-Media-Authorization",           RFC3313 */
    -1, /* 63"P-Preferred-Identity",            RFC3325 */
    -1, /* 64"P-Preferred-Service",  RFC-drage-sipping-service-identification-05.txt */
    -1, /* 65"P-Profile-Key",                           */
    -1, /* 66"P-Refused-URI-List",              RFC5318 */
    -1, /* 67"P-Served-User",                   RFC5502 */
    -1, /* 68"P-User-Database                   RFC4457 */
    -1, /* 69"P-Visited-Network-ID",            RFC3455 */
    -1, /* 70"Path",                            RFC3327 */
    -1, /* 71"Permission-Missing"               RFC5360 */
    -1, /* 72"Policy-Contact"                   RFC5360 */
    -1, /* 73"Policy-ID"                        RFC5360 */
    -1, /* 74"Priority"                                 */
    -1, /* 75"Priority-Share		[3GPP TS 24.229 v13.16.0] */
    -1, /* 76"Priv-Answer-mode"                 RFC5373 */
    -1, /* 77"Privacy",                         RFC3323 */
    -1, /* 78"Proxy-Authenticate",                      */
    -1, /* 79"Proxy-Authorization",                     */
    -1, /* 80"Proxy-Require",                           */
    -1, /* 81"RAck",                            RFC3262 */
    -1, /* 82"Reason",                          RFC3326 */
    -1, /* 83"Reason-Phrase",                   RFC3326 */
    -1, /* 84"Record-Route",                            */
    -1, /* 85"Recv-Info",                       RFC6086 */
    -1, /* 86"Refer-Sub",",                     RFC4488 */
    -1, /* 87"Refer-To",                        RFC3515 */
    -1, /* 88"Referred-By",                             */
    -1, /* 89"Reject-Contact",                  RFC3841 */
    -1, /* 90"Relayed-Charge		[3GPP TS 24.229 v12.14.0] */
    -1, /* 91"Replaces",                        RFC3891 */
    -1, /* 92"Reply-To",                        RFC3261 */
    -1, /* 93"Request-Disposition",             RFC3841 */
    -1, /* 94"Require",                         RFC3261 */
    -1, /* 95"Resource-Priority",               RFC4412 */
    -1, /* 96"Resource-Share		[3GPP TS 24.229 v13.7.0] */
    -1, /* 97"Response-Source		[3GPP TS 24.229 v15.11.0] */
    -1, /* 98"Restoration-Info		[3GPP TS 24.229 v12.14.0] */
    -1, /* 99"Retry-After",                     RFC3261 */
    -1, /* 100"Route",                          RFC3261 */
    -1, /* 101"RSeq",                           RFC3262 */
    -1, /* 102"Security-Client",                RFC3329 */
    -1, /* 103"Security-Server",                RFC3329 */
    -1, /* 104"Security-Verify",                RFC3329 */
    -1, /* 105"Server",                         RFC3261 */
    -1, /* 106"Service-Interact-Info		[3GPP TS 24.229 v13.18.0] */
    -1, /* 107"Service-Route",                  RFC3608 */
    -1, /* 108"Session-Expires",                RFC4028 */
    -1, /* 109"Session-ID",                     RFC7329 */
    -1, /* 110"SIP-ETag",                       RFC3903 */
    -1, /* 111"SIP-If-Match",                   RFC3903 */
    -1, /* 112"Subject",                        RFC3261 */
    -1, /* 113"Subscription-State",             RFC3265 */
    -1, /* 114"Supported",                      RFC3261 */
    -1, /* 115"Suppress-If-Match",              RFC4538 */
    -1, /* 116"Target-Dialog",                  RFC4538 */
    -1, /* 117"Timestamp",                      RFC3261 */
    -1, /* 118"To",                             RFC3261 */
    -1, /* 119"Trigger-Consent"                 RFC5380 */
    -1, /* 120"Unsupported",                    RFC3261 */
    -1, /* 121"User-Agent",                     RFC3261 */
    -1, /* 122"Via",                            RFC3261 */
    -1, /* 123"Warning",                        RFC3261 */
    -1, /* 124"WWW-Authenticate",               RFC3261 */
    -1, /* 125"Diversion",                      RFC5806 */
    -1, /* 126"User-to-User",  draft-johnston-sipping-cc-uui-09 */
753
754
};

755
756
/* Track associations between parameter name and hf item */
typedef struct {
757
758
    const char  *param_name;
    const gint  *hf_item;
Martin Mathieson's avatar
Martin Mathieson committed
759
} header_parameter_t;
760

Martin Mathieson's avatar
Martin Mathieson committed
761
static header_parameter_t auth_parameters_hf_array[] =
762
{
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
    {"response",        &hf_sip_auth_digest_response},
    {"nc",              &hf_sip_auth_nc},
    {"username",        &hf_sip_auth_username},
    {"realm",           &hf_sip_auth_realm},
    {"nonce",           &hf_sip_auth_nonce},
    {"algorithm",       &hf_sip_auth_algorithm},
    {"opaque",          &hf_sip_auth_opaque},
    {"qop",             &hf_sip_auth_qop},
    {"cnonce",          &hf_sip_auth_cnonce},
    {"uri",             &hf_sip_auth_uri},
    {"domain",          &hf_sip_auth_domain},
    {"stale",           &hf_sip_auth_stale},
    {"auts",            &hf_sip_auth_auts},
    {"rspauth",         &hf_sip_auth_rspauth},
    {"nextnonce",       &hf_sip_auth_nextnonce},
    {"ik",              &hf_sip_auth_ik},
    {"ck",              &hf_sip_auth_ck}
Martin Mathieson's avatar
Martin Mathieson committed
780
781
782
783
};

static header_parameter_t via_parameters_hf_array[] =
{
784
785
786
787
788
789
    {"branch",        &hf_sip_via_branch},
    {"maddr",         &hf_sip_via_maddr},
    {"rport",         &hf_sip_via_rport},
    {"received",      &hf_sip_via_received},
    {"ttl",           &hf_sip_via_ttl},
    {"comp",          &hf_sip_via_comp},
790
791
792
793
    {"sigcomp-id",    &hf_sip_via_sigcomp_id},
    {"oc",            &hf_sip_via_oc},
    {"oc-validity",   &hf_sip_via_oc_validity },
    {"oc-seq",        &hf_sip_via_oc_seq},
794
795
    {"oc-algo",       &hf_sip_via_oc_algo},
    {"be-route",      &hf_sip_via_be_route}
796
797
};

798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
typedef enum {
    MECH_PARA_STRING = 0,
    MECH_PARA_UINT = 1,
} mech_parameter_type_t;

/* Track associations between parameter name and hf item for security mechanism*/
typedef struct {
    const char  *param_name;
    const gint  para_type;
    const gint  *hf_item;
} mech_parameter_t;

static mech_parameter_t sec_mechanism_parameters_hf_array[] =
{
    {"alg",     MECH_PARA_STRING,    &hf_sip_sec_mechanism_alg},
    {"ealg",    MECH_PARA_STRING,    &hf_sip_sec_mechanism_ealg},
    {"prot",    MECH_PARA_STRING,    &hf_sip_sec_mechanism_prot},
    {"spi-c",   MECH_PARA_UINT,      &hf_sip_sec_mechanism_spi_c},
    {"spi-s",   MECH_PARA_UINT,      &hf_sip_sec_mechanism_spi_s},
    {"port1",   MECH_PARA_UINT,      &hf_sip_sec_mechanism_port1},
    {"port-c",  MECH_PARA_UINT,      &hf_sip_sec_mechanism_port_c},
    {"port2",   MECH_PARA_UINT,      &hf_sip_sec_mechanism_port2},
    {"port-s",  MECH_PARA_UINT,      &hf_sip_sec_mechanism_port_s},
    {NULL, 0, 0}
};
Anders Broman's avatar
Anders Broman committed
823

Anders Broman's avatar
Anders Broman committed
824
typedef struct {
825
    gint *hf_sip_display;
826
827
828
829
830
831
    gint *hf_sip_addr;
    gint *hf_sip_user;
    gint *hf_sip_host;
    gint *hf_sip_port;
    gint *hf_sip_param;
    gint *ett_uri;
Anders Broman's avatar
Anders Broman committed
832
833
834
} hf_sip_uri_t;

static hf_sip_uri_t sip_pai_uri = {
835
    &hf_sip_pai_display,
836
837
838
839
840
841
    &hf_sip_pai_addr,
    &hf_sip_pai_user,
    &hf_sip_pai_host,
    &hf_sip_pai_port,
    &hf_sip_pai_param,
    &ett_sip_pai_uri
Anders Broman's avatar
Anders Broman committed
842
843
844
};

static hf_sip_uri_t sip_ppi_uri = {
845
    &hf_sip_ppi_display,
846
847
848
849
850
851
    &hf_sip_ppi_addr,
    &hf_sip_ppi_user,
    &hf_sip_ppi_host,
    &hf_sip_ppi_port,
    &hf_sip_ppi_param,
    &ett_sip_ppi_uri
Anders Broman's avatar
Anders Broman committed
852
853
854
};

static hf_sip_uri_t sip_pmiss_uri = {
855
    &hf_sip_pmiss_display,
856
857
858
859
860
861
    &hf_sip_pmiss_addr,
    &hf_sip_pmiss_user,
    &hf_sip_pmiss_host,
    &hf_sip_pmiss_port,
    &hf_sip_pmiss_param,
    &ett_sip_pmiss_uri
Anders Broman's avatar
Anders Broman committed
862
863
864
};

static hf_sip_uri_t sip_tc_uri = {
865
    &hf_sip_tc_display,
866
867
868
869
870
871
    &hf_sip_tc_addr,
    &hf_sip_tc_user,
    &hf_sip_tc_host,
    &hf_sip_tc_port,
    &hf_sip_tc_param,
    &ett_sip_tc_uri
Anders Broman's avatar
Anders Broman committed
872
873
};

874
static hf_sip_uri_t sip_to_uri = {
875
    &hf_sip_to_display,
876
877
878
879
880
881
    &hf_sip_to_addr,
    &hf_sip_to_user,
    &hf_sip_to_host,
    &hf_sip_to_port,
    &hf_sip_to_param,
    &ett_sip_to_uri
882
};
Anders Broman's avatar
Anders Broman committed
883

884
static hf_sip_uri_t sip_from_uri = {
885
    &hf_sip_from_display,
886
887
888
889
890
891
    &hf_sip_from_addr,
    &hf_sip_from_user,
    &hf_sip_from_host,
    &hf_sip_from_port,
    &hf_sip_from_param,
    &ett_sip_from_uri
892
};
893
894

static hf_sip_uri_t sip_req_uri = {
895
    &hf_sip_ruri_display,
896
897
898
899
900
901
    &hf_sip_ruri,
    &hf_sip_ruri_user,
    &hf_sip_ruri_host,
    &hf_sip_ruri_port,
    &hf_sip_ruri_param,
    &ett_sip_ruri
902
};
903
904

static hf_sip_uri_t sip_contact_uri = {
905
    &hf_sip_curi_display,
906
907
908
909
910
911
    &hf_sip_curi,
    &hf_sip_curi_user,
    &hf_sip_curi_host,
    &hf_sip_curi_port,
    &hf_sip_curi_param,
    &ett_sip_curi
912
913
};

Anders Broman's avatar
Anders Broman committed
914
static hf_sip_uri_t sip_route_uri = {
915
    &hf_sip_route_display,
916
917
918
919
920
921
    &hf_sip_route,
    &hf_sip_route_user,
    &hf_sip_route_host,
    &hf_sip_route_port,
    &hf_sip_route_param,
    &ett_sip_route
Anders Broman's avatar
Anders Broman committed
922
923
924
};

static hf_sip_uri_t sip_record_route_uri = {
925
    &hf_sip_record_route_display,
926
927
928
929
930
931
    &hf_sip_record_route,
    &hf_sip_record_route_user,
    &hf_sip_record_route_host,
    &hf_sip_record_route_port,
    &hf_sip_record_route_param,
    &ett_sip_record_route
Anders Broman's avatar
Anders Broman committed
932
933
};

AndersBroman's avatar
AndersBroman committed
934
static hf_sip_uri_t sip_service_route_uri = {
935
    &hf_sip_service_route_display,
AndersBroman's avatar
AndersBroman committed
936
937
938
939
940
941
942
943
    &hf_sip_service_route,
    &hf_sip_service_route_user,
    &hf_sip_service_route_host,
    &hf_sip_service_route_port,
    &hf_sip_service_route_param,
    &ett_sip_service_route
};

Johan Wahl's avatar
Johan Wahl committed
944
static hf_sip_uri_t sip_path_uri = {
945
    &hf_sip_path_display,
Johan Wahl's avatar
Johan Wahl committed
946
947
948
949
950
951
952
953
    &hf_sip_path,
    &hf_sip_path_user,
    &hf_sip_path_host,
    &hf_sip_path_port,
    &hf_sip_path_param,
    &ett_sip_path
};

954
955
956
957
958
/*
 * Type of line.  It's either a SIP Request-Line, a SIP Status-Line, or
 * another type of line.
 */
typedef enum {
959
960
961
    REQUEST_LINE,
    STATUS_LINE,
    OTHER_LINE
962
963
} line_type_t;

964
965
966
/* Preferences */
static guint sip_tls_port = TLS_PORT_SIP;

967
968
/* global_sip_raw_text determines whether we are going to display       */
/* the raw text of the SIP message, much like the MEGACO dissector does.    */
969
static gboolean global_sip_raw_text = FALSE;
970
971
/* global_sip_raw_text_without_crlf determines whether we are going to display  */
/* the raw text of the SIP message with or without the '\r\n'.          */
972
static gboolean global_sip_raw_text_without_crlf = FALSE;
973
974
975
/* strict_sip_version determines whether the SIP dissector enforces
 * the SIP version to be "SIP/2.0". */
static gboolean strict_sip_version = TRUE;
976

977
978
979
980
/*
 * desegmentation of SIP headers
 * (when we are over TCP or another protocol providing the desegmentation API)
 */
981
static gboolean sip_desegment_headers = TRUE;
982
983
984
985
986

/*
 * desegmentation of SIP bodies
 * (when we are over TCP or another protocol providing the desegmentation API)
 */
987
static gboolean sip_desegment_body = TRUE;
988

Jaap Keuter's avatar
Jaap Keuter committed
989
990
991
992
993
/*
 * same source port for retransmissions
 */
static gboolean sip_retrans_the_same_sport = TRUE;

994
995
996
/* whether we hold off tracking RTP conversations until an SDP answer is received */
static gboolean sip_delay_sdp_changes = FALSE;

997
998
999
/* Hide the generated Call IDs or not */
static gboolean sip_hide_generatd_call_ids = FALSE;

1000
/* Extension header subdissectors */