xref: /aosp_15_r20/external/tcpdump/print-sip.c (revision 05b00f6010a2396e3db2409989fc67270046269f)
1*05b00f60SXin Li /*
2*05b00f60SXin Li  * Redistribution and use in source and binary forms, with or without
3*05b00f60SXin Li  * modification, are permitted provided that: (1) source code
4*05b00f60SXin Li  * distributions retain the above copyright notice and this paragraph
5*05b00f60SXin Li  * in its entirety, and (2) distributions including binary code include
6*05b00f60SXin Li  * the above copyright notice and this paragraph in its entirety in
7*05b00f60SXin Li  * the documentation or other materials provided with the distribution.
8*05b00f60SXin Li  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
9*05b00f60SXin Li  * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
10*05b00f60SXin Li  * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
11*05b00f60SXin Li  * FOR A PARTICULAR PURPOSE.
12*05b00f60SXin Li  *
13*05b00f60SXin Li  * Original code by Hannes Gredler ([email protected])
14*05b00f60SXin Li  * Turned into common "text protocol" code, which this uses, by
15*05b00f60SXin Li  * Guy Harris.
16*05b00f60SXin Li  */
17*05b00f60SXin Li 
18*05b00f60SXin Li /* \summary: Session Initiation Protocol (SIP) printer */
19*05b00f60SXin Li 
20*05b00f60SXin Li #ifdef HAVE_CONFIG_H
21*05b00f60SXin Li #include <config.h>
22*05b00f60SXin Li #endif
23*05b00f60SXin Li 
24*05b00f60SXin Li #include "netdissect-stdinc.h"
25*05b00f60SXin Li 
26*05b00f60SXin Li #include "netdissect.h"
27*05b00f60SXin Li 
28*05b00f60SXin Li static const char *sipcmds[] = {
29*05b00f60SXin Li 	"ACK",
30*05b00f60SXin Li 	"BYE",
31*05b00f60SXin Li 	"CANCEL",
32*05b00f60SXin Li 	"DO",
33*05b00f60SXin Li 	"INFO",
34*05b00f60SXin Li 	"INVITE",
35*05b00f60SXin Li 	"MESSAGE",
36*05b00f60SXin Li 	"NOTIFY",
37*05b00f60SXin Li 	"OPTIONS",
38*05b00f60SXin Li 	"PRACK",
39*05b00f60SXin Li 	"QAUTH",
40*05b00f60SXin Li 	"REFER",
41*05b00f60SXin Li 	"REGISTER",
42*05b00f60SXin Li 	"SPRACK",
43*05b00f60SXin Li 	"SUBSCRIBE",
44*05b00f60SXin Li 	"UPDATE",
45*05b00f60SXin Li 	"PUBLISH",
46*05b00f60SXin Li 	NULL
47*05b00f60SXin Li };
48*05b00f60SXin Li 
49*05b00f60SXin Li void
sip_print(netdissect_options * ndo,const u_char * pptr,u_int len)50*05b00f60SXin Li sip_print(netdissect_options *ndo, const u_char *pptr, u_int len)
51*05b00f60SXin Li {
52*05b00f60SXin Li 	ndo->ndo_protocol = "sip";
53*05b00f60SXin Li 	txtproto_print(ndo, pptr, len, sipcmds, RESP_CODE_SECOND_TOKEN);
54*05b00f60SXin Li }
55