xref: /freebsd/contrib/tcpdump/print-http.c (revision 0a7e5f1f02aad2ff5fff1c60f44c6975fd07e1d9)
18bdc5a62SPatrick Kelsey /*
28bdc5a62SPatrick Kelsey  * Redistribution and use in source and binary forms, with or without
38bdc5a62SPatrick Kelsey  * modification, are permitted provided that: (1) source code
48bdc5a62SPatrick Kelsey  * distributions retain the above copyright notice and this paragraph
58bdc5a62SPatrick Kelsey  * in its entirety, and (2) distributions including binary code include
68bdc5a62SPatrick Kelsey  * the above copyright notice and this paragraph in its entirety in
78bdc5a62SPatrick Kelsey  * the documentation or other materials provided with the distribution.
88bdc5a62SPatrick Kelsey  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
98bdc5a62SPatrick Kelsey  * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
108bdc5a62SPatrick Kelsey  * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
118bdc5a62SPatrick Kelsey  * FOR A PARTICULAR PURPOSE.
128bdc5a62SPatrick Kelsey  */
138bdc5a62SPatrick Kelsey 
143340d773SGleb Smirnoff /* \summary: Hypertext Transfer Protocol (HTTP) printer */
158bdc5a62SPatrick Kelsey 
16*ee67461eSJoseph Mingrone #include <config.h>
178bdc5a62SPatrick Kelsey 
18*ee67461eSJoseph Mingrone #include "netdissect-stdinc.h"
198bdc5a62SPatrick Kelsey 
203340d773SGleb Smirnoff #include "netdissect.h"
218bdc5a62SPatrick Kelsey 
228bdc5a62SPatrick Kelsey /*
238bdc5a62SPatrick Kelsey  * Includes WebDAV requests.
248bdc5a62SPatrick Kelsey  */
258bdc5a62SPatrick Kelsey static const char *httpcmds[] = {
268bdc5a62SPatrick Kelsey 	"GET",
278bdc5a62SPatrick Kelsey 	"PUT",
288bdc5a62SPatrick Kelsey 	"COPY",
298bdc5a62SPatrick Kelsey 	"HEAD",
308bdc5a62SPatrick Kelsey 	"LOCK",
318bdc5a62SPatrick Kelsey 	"MOVE",
328bdc5a62SPatrick Kelsey 	"POLL",
338bdc5a62SPatrick Kelsey 	"POST",
348bdc5a62SPatrick Kelsey 	"BCOPY",
358bdc5a62SPatrick Kelsey 	"BMOVE",
368bdc5a62SPatrick Kelsey 	"MKCOL",
378bdc5a62SPatrick Kelsey 	"TRACE",
388bdc5a62SPatrick Kelsey 	"LABEL",
398bdc5a62SPatrick Kelsey 	"MERGE",
408bdc5a62SPatrick Kelsey 	"DELETE",
418bdc5a62SPatrick Kelsey 	"SEARCH",
428bdc5a62SPatrick Kelsey 	"UNLOCK",
438bdc5a62SPatrick Kelsey 	"REPORT",
448bdc5a62SPatrick Kelsey 	"UPDATE",
458bdc5a62SPatrick Kelsey 	"NOTIFY",
468bdc5a62SPatrick Kelsey 	"BDELETE",
478bdc5a62SPatrick Kelsey 	"CONNECT",
488bdc5a62SPatrick Kelsey 	"OPTIONS",
498bdc5a62SPatrick Kelsey 	"CHECKIN",
508bdc5a62SPatrick Kelsey 	"PROPFIND",
518bdc5a62SPatrick Kelsey 	"CHECKOUT",
528bdc5a62SPatrick Kelsey 	"CCM_POST",
538bdc5a62SPatrick Kelsey 	"SUBSCRIBE",
548bdc5a62SPatrick Kelsey 	"PROPPATCH",
558bdc5a62SPatrick Kelsey 	"BPROPFIND",
568bdc5a62SPatrick Kelsey 	"BPROPPATCH",
578bdc5a62SPatrick Kelsey 	"UNCHECKOUT",
588bdc5a62SPatrick Kelsey 	"MKACTIVITY",
598bdc5a62SPatrick Kelsey 	"MKWORKSPACE",
608bdc5a62SPatrick Kelsey 	"UNSUBSCRIBE",
618bdc5a62SPatrick Kelsey 	"RPC_CONNECT",
628bdc5a62SPatrick Kelsey 	"VERSION-CONTROL",
638bdc5a62SPatrick Kelsey 	"BASELINE-CONTROL",
648bdc5a62SPatrick Kelsey 	NULL
658bdc5a62SPatrick Kelsey };
668bdc5a62SPatrick Kelsey 
678bdc5a62SPatrick Kelsey void
http_print(netdissect_options * ndo,const u_char * pptr,u_int len)688bdc5a62SPatrick Kelsey http_print(netdissect_options *ndo, const u_char *pptr, u_int len)
698bdc5a62SPatrick Kelsey {
70*ee67461eSJoseph Mingrone 	ndo->ndo_protocol = "http";
71*ee67461eSJoseph Mingrone 	txtproto_print(ndo, pptr, len, httpcmds, RESP_CODE_SECOND_TOKEN);
728bdc5a62SPatrick Kelsey }
73