*
* Srishylam Simharajan simha@netapp.com
*
- * packet-icap.c Mon Aug 13 17:50:19 PDT 2001 simha
+ * $Id: packet-icap.c,v 1.12 2002/08/28 21:00:17 jmayer Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
- *
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "config.h"
#endif
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
#include <string.h>
#include <ctype.h>
static dissector_handle_t data_handle;
#define TCP_PORT_ICAP 1344
-static int is_icap_message(const u_char *data, int linelen, icap_type_t *type);
+static int is_icap_message(const guchar *data, int linelen, icap_type_t *type);
static void
dissect_icap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_tree *icap_tree = NULL;
proto_item *ti = NULL;
gint offset = 0;
- const u_char *line;
+ const guchar *line;
gint next_offset;
- const u_char *linep, *lineend;
+ const guchar *linep, *lineend;
int linelen;
- u_char c;
+ guchar c;
icap_type_t icap_type;
int datalen;
* is not longer than what's in the buffer, so the
* "tvb_get_ptr()" call won't throw an exception.
*/
- linelen = tvb_find_line_end(tvb, offset, -1, &next_offset);
+ linelen = tvb_find_line_end(tvb, offset, -1, &next_offset,
+ FALSE);
line = tvb_get_ptr(tvb, offset, linelen);
icap_type = ICAP_OTHER; /* type not known yet */
if (is_icap_message(line, linelen, &icap_type))
/*
* Find the end of the line.
*/
- linelen = tvb_find_line_end(tvb, offset, -1, &next_offset);
+ linelen = tvb_find_line_end(tvb, offset, -1, &next_offset,
+ FALSE);
/*
* Get a buffer that refers to the line.
}
}
-
+
static int
-is_icap_message(const u_char *data, int linelen, icap_type_t *type)
+is_icap_message(const guchar *data, int linelen, icap_type_t *type)
{
#define ICAP_COMPARE(string, length, msgtype) { \
if (strncmp(data, string, length) == 0) { \
*/
if (linelen >= 5) {
ICAP_COMPARE("ICAP/", 5, ICAP_RESPONSE); /* response */
- }
+ }
if (linelen >= 7) {
ICAP_COMPARE("REQMOD ", 7, ICAP_REQMOD); /* request mod */
- }
+ }
if (linelen >= 8) {
ICAP_COMPARE("OPTIONS ", 8, ICAP_OPTIONS); /* options */
ICAP_COMPARE("RESPMOD ", 8, ICAP_RESPMOD); /* response mod */
{
static hf_register_info hf[] = {
{ &hf_icap_response,
- { "Response", "icap.response",
+ { "Response", "icap.response",
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
"TRUE if ICAP response", HFILL }},
{ &hf_icap_reqmod,
};
proto_icap = proto_register_protocol(
- "Internet Content Adaptation Protocol",
+ "Internet Content Adaptation Protocol",
"ICAP", "icap");
proto_register_field_array(proto_icap, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));