xref: /netbsd-src/external/bsd/tcpdump/dist/print-http.c (revision cc576e1d8e4f4078fd4e81238abca9fca216f6ec)
1 /*
2  * Redistribution and use in source and binary forms, with or without
3  * modification, are permitted provided that: (1) source code
4  * distributions retain the above copyright notice and this paragraph
5  * in its entirety, and (2) distributions including binary code include
6  * the above copyright notice and this paragraph in its entirety in
7  * the documentation or other materials provided with the distribution.
8  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
9  * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
10  * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
11  * FOR A PARTICULAR PURPOSE.
12  */
13 
14 #include <sys/cdefs.h>
15 #ifndef lint
16 __RCSID("$NetBSD: print-http.c,v 1.2 2017/01/24 23:29:14 christos Exp $");
17 #endif
18 
19 #ifndef lint
20 static const char rcsid[] _U_ =
21     "@(#) Header";
22 #endif
23 
24 #ifdef HAVE_CONFIG_H
25 #include "config.h"
26 #endif
27 
28 #include <netdissect-stdinc.h>
29 
30 #include <stdio.h>
31 #include <stdlib.h>
32 
33 #include "netdissect.h"
34 #include "extract.h"
35 
36 /*
37  * Includes WebDAV requests.
38  */
39 static const char *httpcmds[] = {
40 	"GET",
41 	"PUT",
42 	"COPY",
43 	"HEAD",
44 	"LOCK",
45 	"MOVE",
46 	"POLL",
47 	"POST",
48 	"BCOPY",
49 	"BMOVE",
50 	"MKCOL",
51 	"TRACE",
52 	"LABEL",
53 	"MERGE",
54 	"DELETE",
55 	"SEARCH",
56 	"UNLOCK",
57 	"REPORT",
58 	"UPDATE",
59 	"NOTIFY",
60 	"BDELETE",
61 	"CONNECT",
62 	"OPTIONS",
63 	"CHECKIN",
64 	"PROPFIND",
65 	"CHECKOUT",
66 	"CCM_POST",
67 	"SUBSCRIBE",
68 	"PROPPATCH",
69 	"BPROPFIND",
70 	"BPROPPATCH",
71 	"UNCHECKOUT",
72 	"MKACTIVITY",
73 	"MKWORKSPACE",
74 	"UNSUBSCRIBE",
75 	"RPC_CONNECT",
76 	"VERSION-CONTROL",
77 	"BASELINE-CONTROL",
78 	NULL
79 };
80 
81 void
82 http_print(netdissect_options *ndo, const u_char *pptr, u_int len)
83 {
84 	txtproto_print(ndo, pptr, len, "http", httpcmds, RESP_CODE_SECOND_TOKEN);
85 }
86