From 0e95d4dbf5f64ae734c1d75e833eede0e2ff15ce Mon Sep 17 00:00:00 2001 From: Bill Meier Date: Mon, 11 Apr 2011 15:17:22 +0000 Subject: Don't assign to a proto_item * if the value won't be used: Coverity 1036; Fix what appears to be a use of an incorrect tree: Coverity 1037; Also: - Remove uneeded #includes & re-order #includes; - Do indentation and whitespace cleanup (e.g., "4 space tabs"). svn path=/trunk/; revision=36558 --- epan/dissectors/packet-sip.c | 746 +++++++++++++++++++++---------------------- 1 file changed, 369 insertions(+), 377 deletions(-) (limited to 'epan/dissectors/packet-sip.c') diff --git a/epan/dissectors/packet-sip.c b/epan/dissectors/packet-sip.c index eb1c9b482e..3f6dcea651 100644 --- a/epan/dissectors/packet-sip.c +++ b/epan/dissectors/packet-sip.c @@ -36,31 +36,26 @@ # include "config.h" #endif -#include -#include -#include - -#include - #include -#include +#include #include +#include #include #include #include - -#include - -#include "packet-isup.h" -#include "packet-sip.h" #include #include +#include + #include "packet-tcp.h" #include "packet-ssl.h" +#include "packet-isup.h" +#include "packet-sip.h" + #define TCP_PORT_SIP 5060 #define UDP_PORT_SIP 5060 #define TLS_PORT_SIP 5061 @@ -70,7 +65,7 @@ static dissector_handle_t sip_tcp_handle; static gint sip_tap = -1; static dissector_handle_t sigcomp_handle; -static dissector_handle_t sip_diag_handle = NULL; +static dissector_handle_t sip_diag_handle; /* Initialize the protocol and registered fields */ static gint proto_sip = -1; @@ -236,332 +231,332 @@ typedef struct { 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 */ - { "Accept", NULL }, /* 1 */ -#define POS_ACCEPT 1 - { "Accept-Contact", "a" }, /* 2 RFC3841 */ -#define POS_ACCEPT_CONTACT 2 - { "Accept-Encoding", NULL }, /* 3 */ -#define POS_ACCEPT_ENCODING 3 - { "Accept-Language", NULL }, /* 4 */ -#define POS_ACCEPT_LANGUAGE 4 - { "Accept-Resource-Priority", NULL }, /* 5 RFC4412 */ -#define POS_ACCEPT_RESOURCE_PRIORITY 5 - { "Alert-Info", NULL }, -#define POS_ALERT_INFO 6 - { "Allow", NULL }, -#define POS_ALLOW 7 - { "Allow-Events", "u" }, /* 8 RFC3265 */ -#define POS_ALLOW_EVENTS 8 - { "Answer-Mode", NULL }, /* 9 RFC5373 */ -#define POS_ANSWER_MODE 9 - { "Authentication-Info", NULL }, -#define POS_AUTHENTICATION_INFO 10 - { "Authorization", NULL }, /* 11 */ -#define POS_AUTHORIZATION 11 - { "Call-ID", "i" }, -#define POS_CALL_ID 12 - { "Call-Info", NULL }, -#define POS_CALL_INFO 13 - { "Contact", "m" }, -#define POS_CONTACT 14 - { "Content-Disposition", NULL }, -#define POS_CONTENT_DISPOSITION 15 - { "Content-Encoding", "e" }, /* 16 */ -#define POS_CONTENT_ENCODING 16 - { "Content-Language", NULL }, -#define POS_CONTENT_LANGUAGE 17 - { "Content-Length", "l" }, -#define POS_CONTENT_LENGTH 18 - { "Content-Type", "c" }, -#define POS_CONTENT_TYPE 19 - { "CSeq", NULL }, -#define POS_CSEQ 20 - { "Date", NULL }, /* 21 */ -#define POS_DATE 21 -/* Encryption (Deprecated) [RFC3261] */ - { "Error-Info", NULL }, /* 22 */ -#define POS_ERROR_INFO 22 - { "Event", "o" }, /* 23 */ -#define POS_EVENT 23 - { "Expires", NULL }, /* 24 */ -#define POS_EXPIRES 24 - { "Flow-Timer", NULL }, /* 25 RFC5626 */ -#define POS_FLOW_TIMER 25 - { "From", "f" }, /* 26 */ -#define POS_FROM 26 -/* Hide [RFC3261] (deprecated)*/ - { "History-Info", NULL }, /* 27 RFC4244 */ -#define POS_HISTORY_INFO 27 - { "Identity", "y" }, /* 28 RFC4474 */ -#define POS_IDENTITY 28 - { "Identity-Info", "n" }, /* 29 RFC4474 */ -#define POS_IDENTITY_INFO 29 - { "Info-Package", NULL }, /* 30 RFC-ietf-sipcore-info-events-10.txt */ -#define POS_INFO_PKG 30 - { "In-Reply-To", NULL }, /* 31 RFC3261 */ -#define POS_IN_REPLY_TO 31 - { "Join", NULL }, /* 32 RFC3911 */ -#define POS_JOIN 32 - { "Max-Breadth", NULL }, /* 33 RFC5393*/ -#define POS_MAX_BREADTH 33 - { "Max-Forwards", NULL }, /* 34 */ -#define POS_MAX_FORWARDS 34 - { "MIME-Version", NULL }, /* 35 */ -#define POS_MIME_VERSION 35 - { "Min-Expires", NULL }, /* 36 */ -#define POS_MIN_EXPIRES 36 - { "Min-SE", NULL }, /* 37 RFC4028 */ -#define POS_MIN_SE 37 - { "Organization", NULL }, /* 38 RFC3261 */ -#define POS_ORGANIZATION 38 - { "P-Access-Network-Info", NULL }, /* 39 RFC3455 */ -#define POS_P_ACCESS_NETWORK_INFO 39 - { "P-Answer-State", NULL }, /* 40 RFC4964 */ -#define POS_P_ANSWER_STATE 40 - { "P-Asserted-Identity", NULL }, /* 41 RFC3325 */ -#define POS_P_ASSERTED_IDENTITY 41 - { "P-Asserted-Service", NULL }, /* 42 RFC-drage-sipping-service-identification-05.txt */ -#define POS_P_ASSERTED_SERV 42 - { "P-Associated-URI", NULL }, /* 43 RFC3455 */ -#define POS_P_ASSOCIATED_URI 43 - { "P-Called-Party-ID", NULL }, /* 44 RFC3455 */ -#define POS_P_CALLED_PARTY_ID 44 - { "P-Charging-Function-Addresses", NULL },/* 45 RFC3455 */ -#define POS_P_CHARGING_FUNC_ADDRESSES 45 - { "P-Charging-Vector", NULL }, /* 46 RFC3455 */ -#define POS_P_CHARGING_VECTOR 46 - { "P-DCS-Trace-Party-ID", NULL }, /* 47 RFC5503 */ -#define POS_P_DCS_TRACE_PARTY_ID 47 - { "P-DCS-OSPS", NULL }, /* 48 RFC5503 */ -#define POS_P_DCS_OSPS 48 - { "P-DCS-Billing-Info", NULL }, /* 49 RFC5503 */ -#define POS_P_DCS_BILLING_INFO 49 - { "P-DCS-LAES", NULL }, /* 50 RFC5503 */ -#define POS_P_DCS_LAES 50 - { "P-DCS-Redirect", NULL }, /* 51 RFC5503 */ -#define POS_P_DCS_REDIRECT 51 - { "P-Early-Media", NULL }, /* 52 RFC5009 */ -#define POS_P_EARLY_MEDIA 52 - { "P-Media-Authorization", NULL }, /* 53 RFC3313 */ -#define POS_P_MEDIA_AUTHORIZATION 53 - { "P-Preferred-Identity", NULL }, /* 54 RFC3325 */ -#define POS_P_PREFERRED_IDENTITY 54 - { "P-Preferred-Service", NULL }, /* 55 RFC-drage-sipping-service-identification-05.txt */ -#define POS_P_PREFERRED_SERV 55 - { "P-Profile-Key", NULL }, /* 56 RFC5002 */ -#define POS_P_PROFILE_KEY 56 - { "P-Refused-URI-List", NULL }, /* 57 RFC5318 */ -#define POS_P_REFUSED_URI_LST 57 - { "P-Served-User", NULL }, /* 58 RFC5502 */ -#define POS_P_SERVED_USER 58 - { "P-User-Database", NULL }, /* 59 RFC4457 */ -#define POS_P_USER_DATABASE 59 - { "P-Visited-Network-ID", NULL }, /* 60 RFC3455 */ -#define POS_P_VISITED_NETWORK_ID 60 - { "Path", NULL }, /* 61 RFC3327 */ -#define POS_PATH 61 - { "Permission-Missing", NULL }, /* 62 RFC5360 */ -#define POS_PERMISSION_MISSING 62 - { "Priority", NULL }, /* 63 RFC3261 */ -#define POS_PRIORITY 63 - { "Priv-Answer-Mode", NULL }, /* 64 RFC5373 */ -#define POS_PRIV_ANSWER_MODE 64 - { "Privacy", NULL }, /* 65 RFC3323 */ -#define POS_PRIVACY 65 - { "Proxy-Authenticate", NULL }, /* 66 */ -#define POS_PROXY_AUTHENTICATE 66 - { "Proxy-Authorization", NULL }, /* 67 */ -#define POS_PROXY_AUTHORIZATION 67 - { "Proxy-Require", NULL }, /* 68 */ -#define POS_PROXY_REQUIRE 68 - { "RAck", NULL }, /* 69 RFC3262 */ -#define POS_RACK 69 - { "Reason", NULL }, /* 70 RFC3326 */ -#define POS_REASON 70 - { "Record-Route", NULL }, /* 71 */ -#define POS_RECORD_ROUTE 71 - { "Recv-Info", NULL }, /* 72 RFC-ietf-sipcore-info-events-10.txt*/ -#define POS_RECV_INFO 72 - { "Refer-Sub", NULL }, /* 68 RFC4488 */ -#define POS_REFER_SUB 73 - { "Refer-To", "r" }, /* 69 RFC3515 */ -#define POS_REFER_TO 74 - { "Referred-By", "b" }, /* 70 RFC3892 */ -#define POS_REFERED_BY 75 - { "Reject-Contact", "j" }, /* 71 RFC3841 */ -#define POS_REJECT_CONTACT 76 - { "Replaces", NULL }, /* 72 RFC3891 */ -#define POS_REPLACES 77 - { "Reply-To", NULL }, /* 73 RFC3261 */ -#define POS_REPLY_TO 78 - { "Request-Disposition", "d" }, /* 74 RFC3841 */ -#define POS_REQUEST_DISPOSITION 79 - { "Require", NULL }, /* 75 RFC3261 */ -#define POS_REQUIRE 80 - { "Resource-Priority", NULL }, /* 76 RFC4412 */ -#define POS_RESOURCE_PRIORITY 81 + { "Unknown-header", NULL }, /* 0 Pad so that the real headers start at index 1 */ + { "Accept", NULL }, /* 1 */ +#define POS_ACCEPT 1 + { "Accept-Contact", "a" }, /* 2 RFC3841 */ +#define POS_ACCEPT_CONTACT 2 + { "Accept-Encoding", NULL }, /* 3 */ +#define POS_ACCEPT_ENCODING 3 + { "Accept-Language", NULL }, /* 4 */ +#define POS_ACCEPT_LANGUAGE 4 + { "Accept-Resource-Priority", NULL }, /* 5 RFC4412 */ +#define POS_ACCEPT_RESOURCE_PRIORITY 5 + { "Alert-Info", NULL }, +#define POS_ALERT_INFO 6 + { "Allow", NULL }, +#define POS_ALLOW 7 + { "Allow-Events", "u" }, /* 8 RFC3265 */ +#define POS_ALLOW_EVENTS 8 + { "Answer-Mode", NULL }, /* 9 RFC5373 */ +#define POS_ANSWER_MODE 9 + { "Authentication-Info", NULL }, +#define POS_AUTHENTICATION_INFO 10 + { "Authorization", NULL }, /* 11 */ +#define POS_AUTHORIZATION 11 + { "Call-ID", "i" }, +#define POS_CALL_ID 12 + { "Call-Info", NULL }, +#define POS_CALL_INFO 13 + { "Contact", "m" }, +#define POS_CONTACT 14 + { "Content-Disposition", NULL }, +#define POS_CONTENT_DISPOSITION 15 + { "Content-Encoding", "e" }, /* 16 */ +#define POS_CONTENT_ENCODING 16 + { "Content-Language", NULL }, +#define POS_CONTENT_LANGUAGE 17 + { "Content-Length", "l" }, +#define POS_CONTENT_LENGTH 18 + { "Content-Type", "c" }, +#define POS_CONTENT_TYPE 19 + { "CSeq", NULL }, +#define POS_CSEQ 20 + { "Date", NULL }, /* 21 */ +#define POS_DATE 21 +/* Encryption (Deprecated) [RFC3261] */ + { "Error-Info", NULL }, /* 22 */ +#define POS_ERROR_INFO 22 + { "Event", "o" }, /* 23 */ +#define POS_EVENT 23 + { "Expires", NULL }, /* 24 */ +#define POS_EXPIRES 24 + { "Flow-Timer", NULL }, /* 25 RFC5626 */ +#define POS_FLOW_TIMER 25 + { "From", "f" }, /* 26 */ +#define POS_FROM 26 +/* Hide [RFC3261] (deprecated)*/ + { "History-Info", NULL }, /* 27 RFC4244 */ +#define POS_HISTORY_INFO 27 + { "Identity", "y" }, /* 28 RFC4474 */ +#define POS_IDENTITY 28 + { "Identity-Info", "n" }, /* 29 RFC4474 */ +#define POS_IDENTITY_INFO 29 + { "Info-Package", NULL }, /* 30 RFC-ietf-sipcore-info-events-10.txt */ +#define POS_INFO_PKG 30 + { "In-Reply-To", NULL }, /* 31 RFC3261 */ +#define POS_IN_REPLY_TO 31 + { "Join", NULL }, /* 32 RFC3911 */ +#define POS_JOIN 32 + { "Max-Breadth", NULL }, /* 33 RFC5393*/ +#define POS_MAX_BREADTH 33 + { "Max-Forwards", NULL }, /* 34 */ +#define POS_MAX_FORWARDS 34 + { "MIME-Version", NULL }, /* 35 */ +#define POS_MIME_VERSION 35 + { "Min-Expires", NULL }, /* 36 */ +#define POS_MIN_EXPIRES 36 + { "Min-SE", NULL }, /* 37 RFC4028 */ +#define POS_MIN_SE 37 + { "Organization", NULL }, /* 38 RFC3261 */ +#define POS_ORGANIZATION 38 + { "P-Access-Network-Info", NULL }, /* 39 RFC3455 */ +#define POS_P_ACCESS_NETWORK_INFO 39 + { "P-Answer-State", NULL }, /* 40 RFC4964 */ +#define POS_P_ANSWER_STATE 40 + { "P-Asserted-Identity", NULL }, /* 41 RFC3325 */ +#define POS_P_ASSERTED_IDENTITY 41 + { "P-Asserted-Service", NULL }, /* 42 RFC-drage-sipping-service-identification-05.txt */ +#define POS_P_ASSERTED_SERV 42 + { "P-Associated-URI", NULL }, /* 43 RFC3455 */ +#define POS_P_ASSOCIATED_URI 43 + { "P-Called-Party-ID", NULL }, /* 44 RFC3455 */ +#define POS_P_CALLED_PARTY_ID 44 + { "P-Charging-Function-Addresses", NULL },/* 45 RFC3455 */ +#define POS_P_CHARGING_FUNC_ADDRESSES 45 + { "P-Charging-Vector", NULL }, /* 46 RFC3455 */ +#define POS_P_CHARGING_VECTOR 46 + { "P-DCS-Trace-Party-ID", NULL }, /* 47 RFC5503 */ +#define POS_P_DCS_TRACE_PARTY_ID 47 + { "P-DCS-OSPS", NULL }, /* 48 RFC5503 */ +#define POS_P_DCS_OSPS 48 + { "P-DCS-Billing-Info", NULL }, /* 49 RFC5503 */ +#define POS_P_DCS_BILLING_INFO 49 + { "P-DCS-LAES", NULL }, /* 50 RFC5503 */ +#define POS_P_DCS_LAES 50 + { "P-DCS-Redirect", NULL }, /* 51 RFC5503 */ +#define POS_P_DCS_REDIRECT 51 + { "P-Early-Media", NULL }, /* 52 RFC5009 */ +#define POS_P_EARLY_MEDIA 52 + { "P-Media-Authorization", NULL }, /* 53 RFC3313 */ +#define POS_P_MEDIA_AUTHORIZATION 53 + { "P-Preferred-Identity", NULL }, /* 54 RFC3325 */ +#define POS_P_PREFERRED_IDENTITY 54 + { "P-Preferred-Service", NULL }, /* 55 RFC-drage-sipping-service-identification-05.txt */ +#define POS_P_PREFERRED_SERV 55 + { "P-Profile-Key", NULL }, /* 56 RFC5002 */ +#define POS_P_PROFILE_KEY 56 + { "P-Refused-URI-List", NULL }, /* 57 RFC5318 */ +#define POS_P_REFUSED_URI_LST 57 + { "P-Served-User", NULL }, /* 58 RFC5502 */ +#define POS_P_SERVED_USER 58 + { "P-User-Database", NULL }, /* 59 RFC4457 */ +#define POS_P_USER_DATABASE 59 + { "P-Visited-Network-ID", NULL }, /* 60 RFC3455 */ +#define POS_P_VISITED_NETWORK_ID 60 + { "Path", NULL }, /* 61 RFC3327 */ +#define POS_PATH 61 + { "Permission-Missing", NULL }, /* 62 RFC5360 */ +#define POS_PERMISSION_MISSING 62 + { "Priority", NULL }, /* 63 RFC3261 */ +#define POS_PRIORITY 63 + { "Priv-Answer-Mode", NULL }, /* 64 RFC5373 */ +#define POS_PRIV_ANSWER_MODE 64 + { "Privacy", NULL }, /* 65 RFC3323 */ +#define POS_PRIVACY 65 + { "Proxy-Authenticate", NULL }, /* 66 */ +#define POS_PROXY_AUTHENTICATE 66 + { "Proxy-Authorization", NULL }, /* 67 */ +#define POS_PROXY_AUTHORIZATION 67 + { "Proxy-Require", NULL }, /* 68 */ +#define POS_PROXY_REQUIRE 68 + { "RAck", NULL }, /* 69 RFC3262 */ +#define POS_RACK 69 + { "Reason", NULL }, /* 70 RFC3326 */ +#define POS_REASON 70 + { "Record-Route", NULL }, /* 71 */ +#define POS_RECORD_ROUTE 71 + { "Recv-Info", NULL }, /* 72 RFC-ietf-sipcore-info-events-10.txt*/ +#define POS_RECV_INFO 72 + { "Refer-Sub", NULL }, /* 68 RFC4488 */ +#define POS_REFER_SUB 73 + { "Refer-To", "r" }, /* 69 RFC3515 */ +#define POS_REFER_TO 74 + { "Referred-By", "b" }, /* 70 RFC3892 */ +#define POS_REFERED_BY 75 + { "Reject-Contact", "j" }, /* 71 RFC3841 */ +#define POS_REJECT_CONTACT 76 + { "Replaces", NULL }, /* 72 RFC3891 */ +#define POS_REPLACES 77 + { "Reply-To", NULL }, /* 73 RFC3261 */ +#define POS_REPLY_TO 78 + { "Request-Disposition", "d" }, /* 74 RFC3841 */ +#define POS_REQUEST_DISPOSITION 79 + { "Require", NULL }, /* 75 RFC3261 */ +#define POS_REQUIRE 80 + { "Resource-Priority", NULL }, /* 76 RFC4412 */ +#define POS_RESOURCE_PRIORITY 81 /*{ "Response-Key (Deprecated) [RFC3261]*/ - { "Retry-After", NULL }, /* 77 RFC3261 */ -#define POS_RETRY_AFTER 82 - { "Route", NULL }, /* 78 RFC3261 */ -#define POS_ROUTE 83 - { "RSeq", NULL }, /* 79 RFC3262 */ -#define POS_RSEQ 84 - { "Security-Client", NULL }, /* 80 RFC3329 */ -#define POS_SECURITY_CLIENT 85 - { "Security-Server", NULL }, /* 81 RFC3329 */ -#define POS_SECURITY_SERVER 86 - { "Security-Verify", NULL }, /* 82 RFC3329 */ -#define POS_SECURITY_VERIFY 87 - { "Server", NULL }, /* 83 RFC3261 */ -#define POS_SERVER 88 - { "Service-Route", NULL }, /* 84 RFC3608 */ -#define POS_SERVICE_ROUTE 89 - { "Session-Expires", "x" }, /* 85 RFC4028 */ -#define POS_SESSION_EXPIRES 90 - { "SIP-ETag", NULL }, /* 86 RFC3903 */ -#define POS_SIP_ETAG 91 - { "SIP-If-Match", NULL }, /* 87 RFC3903 */ -#define POS_SIP_IF_MATCH 92 - { "Subject", "s" }, /* 88 RFC3261 */ -#define POS_SUBJECT 93 - { "Subscription-State", NULL }, /* 89 RFC3265 */ -#define POS_SUBSCRIPTION_STATE 94 - { "Supported", "k" }, /* 90 RFC3261 */ -#define POS_SUPPORTED 95 - { "Target-Dialog", NULL }, /* 81 RFC4538 */ -#define POS_TARGET_DALOG 96 - { "Timestamp", NULL }, /* 92 RFC3261 */ -#define POS_TIMESTAMP 97 - { "To", "t" }, /* 93 RFC3261 */ -#define POS_TO 98 - { "Trigger-Consent", NULL }, /* 94 RFC5360 */ -#define POS_TRIGGER_CONSENT 99 - { "Unsupported", NULL }, /* 95 RFC3261 */ -#define POS_UNSUPPORTED 100 - { "User-Agent", NULL }, /* 96 RFC3261 */ -#define POS_USER_AGENT 101 - { "Via", "v" }, /* 97 RFC3261 */ -#define POS_VIA 102 - { "Warning", NULL }, /* 98 RFC3261 */ -#define POS_WARNING 103 - { "WWW-Authenticate", NULL }, /* 99 RFC3261 */ -#define POS_WWW_AUTHENTICATE 104 - { "Diversion", NULL }, /* 105 RFC5806 */ -#define POS_DIVERSION 105 + { "Retry-After", NULL }, /* 77 RFC3261 */ +#define POS_RETRY_AFTER 82 + { "Route", NULL }, /* 78 RFC3261 */ +#define POS_ROUTE 83 + { "RSeq", NULL }, /* 79 RFC3262 */ +#define POS_RSEQ 84 + { "Security-Client", NULL }, /* 80 RFC3329 */ +#define POS_SECURITY_CLIENT 85 + { "Security-Server", NULL }, /* 81 RFC3329 */ +#define POS_SECURITY_SERVER 86 + { "Security-Verify", NULL }, /* 82 RFC3329 */ +#define POS_SECURITY_VERIFY 87 + { "Server", NULL }, /* 83 RFC3261 */ +#define POS_SERVER 88 + { "Service-Route", NULL }, /* 84 RFC3608 */ +#define POS_SERVICE_ROUTE 89 + { "Session-Expires", "x" }, /* 85 RFC4028 */ +#define POS_SESSION_EXPIRES 90 + { "SIP-ETag", NULL }, /* 86 RFC3903 */ +#define POS_SIP_ETAG 91 + { "SIP-If-Match", NULL }, /* 87 RFC3903 */ +#define POS_SIP_IF_MATCH 92 + { "Subject", "s" }, /* 88 RFC3261 */ +#define POS_SUBJECT 93 + { "Subscription-State", NULL }, /* 89 RFC3265 */ +#define POS_SUBSCRIPTION_STATE 94 + { "Supported", "k" }, /* 90 RFC3261 */ +#define POS_SUPPORTED 95 + { "Target-Dialog", NULL }, /* 81 RFC4538 */ +#define POS_TARGET_DALOG 96 + { "Timestamp", NULL }, /* 92 RFC3261 */ +#define POS_TIMESTAMP 97 + { "To", "t" }, /* 93 RFC3261 */ +#define POS_TO 98 + { "Trigger-Consent", NULL }, /* 94 RFC5360 */ +#define POS_TRIGGER_CONSENT 99 + { "Unsupported", NULL }, /* 95 RFC3261 */ +#define POS_UNSUPPORTED 100 + { "User-Agent", NULL }, /* 96 RFC3261 */ +#define POS_USER_AGENT 101 + { "Via", "v" }, /* 97 RFC3261 */ +#define POS_VIA 102 + { "Warning", NULL }, /* 98 RFC3261 */ +#define POS_WARNING 103 + { "WWW-Authenticate", NULL }, /* 99 RFC3261 */ +#define POS_WWW_AUTHENTICATE 104 + { "Diversion", NULL }, /* 105 RFC5806 */ +#define POS_DIVERSION 105 }; static gint hf_header_array[] = { - -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 */ - -1, /* 6"Alert-Info", */ - -1, /* 7"Allow", */ - -1, /* 8"Allow-Events", RFC3265 */ - -1, /* 9"Answer-Mode" RFC5373 */ - -1, /* 10"Authentication-Info" */ - -1, /* 11"Authorization", */ - -1, /* 12"Call-ID", */ - -1, /* 13"Call-Info" */ - -1, /* 14"Contact", */ - -1, /* 15"Content-Disposition", */ - -1, /* 16"Content-Encoding", */ - -1, /* 17"Content-Language", */ - -1, /* 18"Content-Length", */ - -1, /* 19"Content-Type", */ - -1, /* 20"CSeq", */ - -1, /* 21"Date", */ - -1, /* 22"Error-Info", */ - -1, /* 23"Event", */ - -1, /* 24"Expires", */ - -1, /* 25"From", */ - -1, /* 26"Flow-Timer", RFC5626 */ - -1, /* 27"History-Info", RFC4244 */ - -1, /* 28"Identity", */ - -1, /* 29"Identity-Info", RFC4474 */ - -1, /* 30"Info-Package", RFC-ietf-sipcore-info-events-10.txt */ - -1, /* 31"In-Reply-To", RFC3261 */ - -1, /* 32"Join", RFC3911 */ - -1, /* 33"Max-Breadth" RFC5393 */ - -1, /* 34"Max-Forwards", */ - -1, /* 35"MIME-Version", */ - -1, /* 36"Min-Expires", */ - -1, /* 37"Min-SE", RFC4028 */ - -1, /* 38"Organization", */ - -1, /* 39"P-Access-Network-Info", RFC3455 */ - -1, /* 40"P-Answer-State", RFC4964 */ - -1, /* 41"P-Asserted-Identity", RFC3325 */ - -1, /* 42"P-Asserted-Service", RFC-drage-sipping-service-identification-05.txt */ - -1, /* 43"P-Associated-URI", RFC3455 */ - -1, /* 44"P-Called-Party-ID", RFC3455 */ - -1, /* 45"P-Charging-Function-Addresses", RFC3455 */ - -1, /* 46"P-Charging-Vector", RFC3455 */ - -1, /* 47"P-DCS-Trace-Party-ID", RFC3603 */ - -1, /* 48"P-DCS-OSPS", RFC3603 */ - -1, /* 49"P-DCS-Billing-Info", RFC3603 */ - -1, /* 50"P-DCS-LAES", RFC3603 */ - -1, /* 51"P-DCS-Redirect", RFC3603 */ - -1, /* 52"P-Early-Media", */ - -1, /* 53"P-Media-Authorization", RFC3313 */ - -1, /* 54"P-Preferred-Identity", RFC3325 */ - -1, /* 55"P-Preferred-Service", RFC-drage-sipping-service-identification-05.txt */ - -1, /* 56"P-Profile-Key", */ - -1, /* 57"P-Refused-URI-List", RFC5318 */ - -1, /* 58"P-Served-User", RFC5502 */ - -1, /* 59"P-User-Database RFC4457 */ - -1, /* 60"P-Visited-Network-ID", RFC3455 */ - -1, /* 61"Path", RFC3327 */ - -1, /* 62"Permission-Missing" RFC5360 */ - -1, /* 63"Priority" */ - -1, /* 64"Priv-Answer-mode" RFC5373 */ - -1, /* 65"Privacy", RFC3323 */ - -1, /* 66"Proxy-Authenticate", */ - -1, /* 67"Proxy-Authorization", */ - -1, /* 68"Proxy-Require", */ - -1, /* 69"RAck", RFC3262 */ - -1, /* 70"Reason", RFC3326 */ - -1, /* 71"Record-Route", */ - -1, /* 72"Recv-Info", RFC-ietf-sipcore-info-events-10.txt */ - -1, /* 73"Refer-Sub",", RFC4488 */ - -1, /* 74"Refer-To", RFC3515 */ - -1, /* 75"Referred-By", */ - -1, /* 76"Reject-Contact", RFC3841 */ - -1, /* 77"Replaces", RFC3891 */ - -1, /* 78"Reply-To", RFC3261 */ - -1, /* 79"Request-Disposition", RFC3841 */ - -1, /* 80"Require", RFC3261 */ - -1, /* 81"Resource-Priority", RFC4412 */ - -1, /* 82"Retry-After", RFC3261 */ - -1, /* 83"Route", RFC3261 */ - -1, /* 84"RSeq", RFC3262 */ - -1, /* 85"Security-Client", RFC3329 */ - -1, /* 86"Security-Server", RFC3329 */ - -1, /* 87"Security-Verify", RFC3329 */ - -1, /* 88"Server", RFC3261 */ - -1, /* 89"Service-Route", RFC3608 */ - -1, /* 90"Session-Expires", RFC4028 */ - -1, /* 91"SIP-ETag", RFC3903 */ - -1, /* 92"SIP-If-Match", RFC3903 */ - -1, /* 93"Subject", RFC3261 */ - -1, /* 94"Subscription-State", RFC3265 */ - -1, /* 95"Supported", RFC3261 */ - -1, /* 96"Target-Dialog", RFC4538 */ - -1, /* 97"Timestamp", RFC3261 */ - -1, /* 98"To", RFC3261 */ - -1, /* 99"Trigger-Consent" RFC5380 */ - -1, /* 100"Unsupported", RFC3261 */ - -1, /* 101"User-Agent", RFC3261 */ - -1, /* 102"Via", RFC3261 */ - -1, /* 103"Warning", RFC3261 */ - -1, /* 104"WWW-Authenticate", RFC3261 */ - -1, /* 105"Diversion", RFC5806 */ + -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 */ + -1, /* 6"Alert-Info", */ + -1, /* 7"Allow", */ + -1, /* 8"Allow-Events", RFC3265 */ + -1, /* 9"Answer-Mode" RFC5373 */ + -1, /* 10"Authentication-Info" */ + -1, /* 11"Authorization", */ + -1, /* 12"Call-ID", */ + -1, /* 13"Call-Info" */ + -1, /* 14"Contact", */ + -1, /* 15"Content-Disposition", */ + -1, /* 16"Content-Encoding", */ + -1, /* 17"Content-Language", */ + -1, /* 18"Content-Length", */ + -1, /* 19"Content-Type", */ + -1, /* 20"CSeq", */ + -1, /* 21"Date", */ + -1, /* 22"Error-Info", */ + -1, /* 23"Event", */ + -1, /* 24"Expires", */ + -1, /* 25"From", */ + -1, /* 26"Flow-Timer", RFC5626 */ + -1, /* 27"History-Info", RFC4244 */ + -1, /* 28"Identity", */ + -1, /* 29"Identity-Info", RFC4474 */ + -1, /* 30"Info-Package", RFC-ietf-sipcore-info-events-10.txt */ + -1, /* 31"In-Reply-To", RFC3261 */ + -1, /* 32"Join", RFC3911 */ + -1, /* 33"Max-Breadth" RFC5393 */ + -1, /* 34"Max-Forwards", */ + -1, /* 35"MIME-Version", */ + -1, /* 36"Min-Expires", */ + -1, /* 37"Min-SE", RFC4028 */ + -1, /* 38"Organization", */ + -1, /* 39"P-Access-Network-Info", RFC3455 */ + -1, /* 40"P-Answer-State", RFC4964 */ + -1, /* 41"P-Asserted-Identity", RFC3325 */ + -1, /* 42"P-Asserted-Service", RFC-drage-sipping-service-identification-05.txt */ + -1, /* 43"P-Associated-URI", RFC3455 */ + -1, /* 44"P-Called-Party-ID", RFC3455 */ + -1, /* 45"P-Charging-Function-Addresses", RFC3455 */ + -1, /* 46"P-Charging-Vector", RFC3455 */ + -1, /* 47"P-DCS-Trace-Party-ID", RFC3603 */ + -1, /* 48"P-DCS-OSPS", RFC3603 */ + -1, /* 49"P-DCS-Billing-Info", RFC3603 */ + -1, /* 50"P-DCS-LAES", RFC3603 */ + -1, /* 51"P-DCS-Redirect", RFC3603 */ + -1, /* 52"P-Early-Media", */ + -1, /* 53"P-Media-Authorization", RFC3313 */ + -1, /* 54"P-Preferred-Identity", RFC3325 */ + -1, /* 55"P-Preferred-Service", RFC-drage-sipping-service-identification-05.txt */ + -1, /* 56"P-Profile-Key", */ + -1, /* 57"P-Refused-URI-List", RFC5318 */ + -1, /* 58"P-Served-User", RFC5502 */ + -1, /* 59"P-User-Database RFC4457 */ + -1, /* 60"P-Visited-Network-ID", RFC3455 */ + -1, /* 61"Path", RFC3327 */ + -1, /* 62"Permission-Missing" RFC5360 */ + -1, /* 63"Priority" */ + -1, /* 64"Priv-Answer-mode" RFC5373 */ + -1, /* 65"Privacy", RFC3323 */ + -1, /* 66"Proxy-Authenticate", */ + -1, /* 67"Proxy-Authorization", */ + -1, /* 68"Proxy-Require", */ + -1, /* 69"RAck", RFC3262 */ + -1, /* 70"Reason", RFC3326 */ + -1, /* 71"Record-Route", */ + -1, /* 72"Recv-Info", RFC-ietf-sipcore-info-events-10.txt */ + -1, /* 73"Refer-Sub",", RFC4488 */ + -1, /* 74"Refer-To", RFC3515 */ + -1, /* 75"Referred-By", */ + -1, /* 76"Reject-Contact", RFC3841 */ + -1, /* 77"Replaces", RFC3891 */ + -1, /* 78"Reply-To", RFC3261 */ + -1, /* 79"Request-Disposition", RFC3841 */ + -1, /* 80"Require", RFC3261 */ + -1, /* 81"Resource-Priority", RFC4412 */ + -1, /* 82"Retry-After", RFC3261 */ + -1, /* 83"Route", RFC3261 */ + -1, /* 84"RSeq", RFC3262 */ + -1, /* 85"Security-Client", RFC3329 */ + -1, /* 86"Security-Server", RFC3329 */ + -1, /* 87"Security-Verify", RFC3329 */ + -1, /* 88"Server", RFC3261 */ + -1, /* 89"Service-Route", RFC3608 */ + -1, /* 90"Session-Expires", RFC4028 */ + -1, /* 91"SIP-ETag", RFC3903 */ + -1, /* 92"SIP-If-Match", RFC3903 */ + -1, /* 93"Subject", RFC3261 */ + -1, /* 94"Subscription-State", RFC3265 */ + -1, /* 95"Supported", RFC3261 */ + -1, /* 96"Target-Dialog", RFC4538 */ + -1, /* 97"Timestamp", RFC3261 */ + -1, /* 98"To", RFC3261 */ + -1, /* 99"Trigger-Consent" RFC5380 */ + -1, /* 100"Unsupported", RFC3261 */ + -1, /* 101"User-Agent", RFC3261 */ + -1, /* 102"Via", RFC3261 */ + -1, /* 103"Warning", RFC3261 */ + -1, /* 104"WWW-Authenticate", RFC3261 */ + -1, /* 105"Diversion", RFC5806 */ }; @@ -695,7 +690,7 @@ static range_t *global_sip_tcp_port_range; /* the raw text of the SIP message, much like the MEGACO dissector does. */ static gboolean global_sip_raw_text = FALSE; /* 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'. */ +/* the raw text of the SIP message with or without the '\r\n'. */ static gboolean global_sip_raw_text_without_crlf = FALSE; /* strict_sip_version determines whether the SIP dissector enforces * the SIP version to be "SIP/2.0". */ @@ -1913,8 +1908,8 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr "%s line: %s", descr, tvb_format_text(tvb, offset, linelen)); reqresp_tree = proto_item_add_subtree(ti_a, ett_sip_reqresp); - proto_tree_add_text(sip_tree, tvb, offset, -1, - "Continuation data"); + /* XXX: Is adding to 'reqresp_tree as intended ? Changed from original 'sip_tree' */ + proto_tree_add_text(reqresp_tree, tvb, offset, -1, "Continuation data"); } return tvb_length_remaining(tvb, offset); } @@ -1954,9 +1949,6 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr char *value; gboolean is_no_header_termination = FALSE; proto_item *cause; - proto_tree *pai_uri_item_tree = NULL; - proto_tree *pmiss_uri_item_tree = NULL; - proto_tree *ppi_uri_item_tree = NULL; proto_tree *tc_uri_item_tree = NULL; uri_offset_info uri_offsets; @@ -2164,7 +2156,7 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr */ sip_uri_offset_init(&uri_offsets); if((dissect_sip_name_addr_or_addr_spec(tvb, pinfo, value_offset, line_end_offset+2, &uri_offsets)) != -1) - pai_uri_item_tree = display_sip_uri(tvb, sip_element_tree, &uri_offsets, &sip_pai_uri); + display_sip_uri(tvb, sip_element_tree, &uri_offsets, &sip_pai_uri); } break; @@ -2200,7 +2192,7 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr */ sip_uri_offset_init(&uri_offsets); if((dissect_sip_name_addr_or_addr_spec(tvb, pinfo, value_offset, line_end_offset+2, &uri_offsets)) != -1) - ppi_uri_item_tree = display_sip_uri(tvb, sip_element_tree, &uri_offsets, &sip_ppi_uri); + display_sip_uri(tvb, sip_element_tree, &uri_offsets, &sip_ppi_uri); } break; @@ -2224,7 +2216,7 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr */ sip_uri_offset_init(&uri_offsets); if((dissect_sip_name_addr_or_addr_spec(tvb, pinfo, value_offset, line_end_offset+2, &uri_offsets)) != -1) - pmiss_uri_item_tree = display_sip_uri(tvb, sip_element_tree, &uri_offsets, &sip_pmiss_uri); + display_sip_uri(tvb, sip_element_tree, &uri_offsets, &sip_pmiss_uri); } break; @@ -2275,7 +2267,7 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr } } } - break; + break; case POS_CSEQ : /* Store the sequence number */ @@ -2493,7 +2485,7 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr content_type_parameter_str_len); } media_type_str_lower_case = ascii_strdown_inplace( - (gchar *)tvb_get_ephemeral_string(tvb, value_offset, content_type_len)); + (gchar *)tvb_get_ephemeral_string(tvb, value_offset, content_type_len)); /* Debug code proto_tree_add_text(hdr_tree, tvb, value_offset,content_type_len, @@ -2509,10 +2501,10 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr offset, next_offset - offset, content_length, "%s", tvb_format_text(tvb, offset, linelen)); - } + } break; - case POS_MAX_BREADTH : + case POS_MAX_BREADTH : case POS_MAX_FORWARDS : case POS_RSEQ : if(hdr_tree) { @@ -2736,19 +2728,19 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr } if ( found_match != TRUE ) { - if (!(dissector_try_heuristic(heur_subdissector_list, - next_tvb, pinfo, message_body_tree))) { - int tmp_offset = 0; - while (tvb_offset_exists(next_tvb, tmp_offset)) { - tvb_find_line_end(next_tvb, tmp_offset, -1, &next_offset, FALSE); - linelen = next_offset - tmp_offset; - if(message_body_tree) { - proto_tree_add_text(message_body_tree, next_tvb, - tmp_offset, linelen, "%s", - tvb_format_text(next_tvb, tmp_offset, linelen)); - } - tmp_offset = next_offset; - }/* end while */ + if (!(dissector_try_heuristic(heur_subdissector_list, + next_tvb, pinfo, message_body_tree))) { + int tmp_offset = 0; + while (tvb_offset_exists(next_tvb, tmp_offset)) { + tvb_find_line_end(next_tvb, tmp_offset, -1, &next_offset, FALSE); + linelen = next_offset - tmp_offset; + if(message_body_tree) { + proto_tree_add_text(message_body_tree, next_tvb, + tmp_offset, linelen, "%s", + tvb_format_text(next_tvb, tmp_offset, linelen)); + } + tmp_offset = next_offset; + }/* end while */ } } offset += datalen; @@ -2909,8 +2901,8 @@ dfilter_sip_status_line(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int /* Add response code for sending to tap */ stat_info->response_code = response_code; - - /* Skip past the responce code and possible trailing space */ + + /* Skip past the responce code and possible trailing space */ offset = SIP2_HDR_LEN + 1 + 3 + 1; /* Check for diagnostics */ @@ -3055,23 +3047,23 @@ sip_parse_line(tvbuff_t *tvb, int offset, gint linelen, guint *token_1_lenp) } static gboolean sip_is_known_request(tvbuff_t *tvb, int meth_offset, - guint meth_len, guint *meth_idx) + guint meth_len, guint *meth_idx) { - guint i; - gchar *meth_name; + guint i; + gchar *meth_name; - meth_name = tvb_get_ephemeral_string(tvb, meth_offset, meth_len); + meth_name = tvb_get_ephemeral_string(tvb, meth_offset, meth_len); - for (i = 1; i < array_length(sip_methods); i++) { - if (meth_len == strlen(sip_methods[i]) && - strncmp(meth_name, sip_methods[i], meth_len) == 0) - { - *meth_idx = i; - return TRUE; - } - } + for (i = 1; i < array_length(sip_methods); i++) { + if (meth_len == strlen(sip_methods[i]) && + strncmp(meth_name, sip_methods[i], meth_len) == 0) + { + *meth_idx = i; + return TRUE; + } + } - return FALSE; + return FALSE; } /* @@ -3097,7 +3089,7 @@ static gint sip_is_known_sip_header(gchar *header_name, guint header_len) return pos; } - return -1; + return -1; } /* @@ -3901,12 +3893,12 @@ void proto_register_sip(void) FT_STRING, BASE_NONE,NULL,0x0, "RFC 3265: Event Header", HFILL } }, - { &hf_header_array[POS_EXPIRES], + { &hf_header_array[POS_EXPIRES], { "Expires", "sip.Expires", FT_UINT32, BASE_DEC,NULL,0x0, "RFC 3261: Expires Header", HFILL } }, - { &hf_header_array[POS_FLOW_TIMER], + { &hf_header_array[POS_FLOW_TIMER], { "Flow-Timer", "sip.Flow-Timer", FT_STRING, BASE_NONE,NULL,0x0, "RFC 5626: Flow-Timer", HFILL } @@ -4632,7 +4624,7 @@ void proto_register_sip(void) "the body of a request spanning multiple TCP segments, " "and reassemble chunked data spanning multiple TCP segments. " "To use this option, you must also enable " - "\"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.", + "\"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.", &sip_desegment_body); prefs_register_bool_preference(sip_module, "retrans_the_same_sport", "Retransmissions always use the same source port", -- cgit v1.2.3