xref: /netbsd-src/external/bsd/tcpdump/dist/print-sip.c (revision 26ba0b503b498a5194a71ac319838b7f5497f3fe)
10f74e101Schristos /*
20f74e101Schristos  * Redistribution and use in source and binary forms, with or without
30f74e101Schristos  * modification, are permitted provided that: (1) source code
40f74e101Schristos  * distributions retain the above copyright notice and this paragraph
50f74e101Schristos  * in its entirety, and (2) distributions including binary code include
60f74e101Schristos  * the above copyright notice and this paragraph in its entirety in
70f74e101Schristos  * the documentation or other materials provided with the distribution.
80f74e101Schristos  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
90f74e101Schristos  * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
100f74e101Schristos  * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
110f74e101Schristos  * FOR A PARTICULAR PURPOSE.
120f74e101Schristos  *
1372c96ff3Schristos  * Original code by Hannes Gredler (hannes@gredler.at)
14ba2ff121Schristos  * Turned into common "text protocol" code, which this uses, by
15ba2ff121Schristos  * Guy Harris.
160f74e101Schristos  */
170f74e101Schristos 
1811b3aaa1Schristos #include <sys/cdefs.h>
190f74e101Schristos #ifndef lint
20*26ba0b50Schristos __RCSID("$NetBSD: print-sip.c,v 1.10 2024/09/02 16:15:33 christos Exp $");
210f74e101Schristos #endif
220f74e101Schristos 
23dc860a36Sspz /* \summary: Session Initiation Protocol (SIP) printer */
24dc860a36Sspz 
25c74ad251Schristos #include <config.h>
260f74e101Schristos 
27c74ad251Schristos #include "netdissect-stdinc.h"
280f74e101Schristos 
29fdccd7e4Schristos #include "netdissect.h"
300f74e101Schristos 
31ba2ff121Schristos static const char *sipcmds[] = {
32ba2ff121Schristos 	"ACK",
33ba2ff121Schristos 	"BYE",
34ba2ff121Schristos 	"CANCEL",
35ba2ff121Schristos 	"DO",
36ba2ff121Schristos 	"INFO",
37ba2ff121Schristos 	"INVITE",
38ba2ff121Schristos 	"MESSAGE",
39ba2ff121Schristos 	"NOTIFY",
40ba2ff121Schristos 	"OPTIONS",
41ba2ff121Schristos 	"PRACK",
42ba2ff121Schristos 	"QAUTH",
43ba2ff121Schristos 	"REFER",
44ba2ff121Schristos 	"REGISTER",
45ba2ff121Schristos 	"SPRACK",
46ba2ff121Schristos 	"SUBSCRIBE",
47ba2ff121Schristos 	"UPDATE",
48ba2ff121Schristos 	"PUBLISH",
49ba2ff121Schristos 	NULL
50ba2ff121Schristos };
51ba2ff121Schristos 
520f74e101Schristos void
53ba2ff121Schristos sip_print(netdissect_options *ndo, const u_char *pptr, u_int len)
540f74e101Schristos {
55c74ad251Schristos 	ndo->ndo_protocol = "sip";
56c74ad251Schristos 	txtproto_print(ndo, pptr, len, sipcmds, RESP_CODE_SECOND_TOKEN);
570f74e101Schristos }
58