2002-10-03 02:56:59 +00:00
|
|
|
/* packet-pcli.c
|
2002-10-08 08:26:31 +00:00
|
|
|
* Routines for Packet Cable Lawful Intercept packet disassembly
|
2002-10-24 23:41:56 +00:00
|
|
|
* Packet Cable Lawful Intercept is detailed at
|
|
|
|
* http://www.packetcable.com/downloads/specs/pkt-sp-esp-I01-991229.pdf
|
|
|
|
* Chapter 4 ( Call Content Connection Interface )
|
2002-10-03 02:56:59 +00:00
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
2002-10-03 02:56:59 +00:00
|
|
|
*
|
|
|
|
* Copyright (c) 2000 by Ed Warnicke <hagbard@physics.rutgers.edu>
|
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2002-10-03 02:56:59 +00:00
|
|
|
* Copyright 1999 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 files */
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <string.h>
|
2006-04-22 20:26:16 +00:00
|
|
|
|
|
|
|
#include <glib.h>
|
2002-10-03 02:56:59 +00:00
|
|
|
#include <epan/packet.h>
|
2004-08-06 19:57:49 +00:00
|
|
|
#include <epan/addr_resolv.h>
|
2004-09-27 22:55:15 +00:00
|
|
|
#include <epan/prefs.h>
|
2002-10-03 02:56:59 +00:00
|
|
|
#include <epan/strutil.h>
|
|
|
|
|
|
|
|
/* Define udp_port for lawful intercept */
|
|
|
|
|
|
|
|
#define UDP_PORT_PCLI 9000
|
|
|
|
|
|
|
|
void proto_reg_handoff_pcli(void);
|
|
|
|
|
|
|
|
/* Define the pcli proto */
|
|
|
|
|
|
|
|
static int proto_pcli = -1;
|
|
|
|
|
|
|
|
/* Define headers for pcli */
|
|
|
|
|
|
|
|
static int hf_pcli_cccid = -1;
|
|
|
|
|
|
|
|
/* Define the tree for pcli */
|
|
|
|
|
|
|
|
static int ett_pcli = -1;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Here are the global variables associated with the preferences
|
|
|
|
* for pcli
|
|
|
|
*/
|
|
|
|
|
|
|
|
static guint global_udp_port_pcli = UDP_PORT_PCLI;
|
|
|
|
|
|
|
|
/* A static handle for the ip dissector */
|
|
|
|
static dissector_handle_t ip_handle;
|
|
|
|
|
|
|
|
static void
|
|
|
|
dissect_pcli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
|
|
|
|
|
|
|
|
guint32 cccid;
|
|
|
|
proto_tree *ti,*pcli_tree;
|
|
|
|
tvbuff_t * next_tvb;
|
|
|
|
|
|
|
|
/* Set the protocol column */
|
2009-09-24 19:50:43 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "PCLI");
|
2002-10-03 02:56:59 +00:00
|
|
|
|
|
|
|
/* Get the CCCID */
|
|
|
|
cccid = tvb_get_ntohl(tvb,0);
|
|
|
|
|
|
|
|
/* Set the info column */
|
|
|
|
if(check_col(pinfo->cinfo,COL_INFO)){
|
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO, "CCCID: %u",cccid);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
*If we have a non-null tree (ie we are building the proto_tree
|
|
|
|
* instead of just filling out the columns ), then add a PLCI
|
2002-10-10 20:36:37 +00:00
|
|
|
* tree node and put a CCCID header element under it.
|
2002-10-03 02:56:59 +00:00
|
|
|
*/
|
|
|
|
if(tree) {
|
|
|
|
ti = proto_tree_add_item(tree,proto_pcli,tvb,0,0,FALSE);
|
|
|
|
pcli_tree = proto_item_add_subtree(ti,ett_pcli);
|
|
|
|
proto_tree_add_uint(pcli_tree,hf_pcli_cccid,tvb,
|
|
|
|
0,4,cccid);
|
|
|
|
}
|
2002-10-10 20:36:37 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Hand off to the IP dissector.
|
|
|
|
*/
|
2009-08-16 12:36:22 +00:00
|
|
|
next_tvb = tvb_new_subset_remaining(tvb,4);
|
2002-10-10 19:06:04 +00:00
|
|
|
call_dissector(ip_handle,next_tvb,pinfo,tree);
|
2002-10-03 02:56:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_pcli(void) {
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_pcli_cccid,
|
|
|
|
{ "CCCID", "pcli.cccid", FT_UINT32, BASE_DEC, NULL, 0x0,
|
|
|
|
"Call Content Connection Identifier", HFILL }},
|
|
|
|
};
|
|
|
|
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_pcli,
|
|
|
|
};
|
|
|
|
|
|
|
|
module_t *pcli_module;
|
|
|
|
|
|
|
|
proto_pcli = proto_register_protocol("Packet Cable Lawful Intercept",
|
|
|
|
"PCLI","pcli");
|
|
|
|
proto_register_field_array(proto_pcli,hf,array_length(hf));
|
|
|
|
proto_register_subtree_array(ett,array_length(ett));
|
|
|
|
|
|
|
|
pcli_module = prefs_register_protocol(proto_pcli,
|
|
|
|
proto_reg_handoff_pcli);
|
2003-01-28 22:27:20 +00:00
|
|
|
prefs_register_uint_preference(pcli_module, "udp_port",
|
2002-10-03 02:56:59 +00:00
|
|
|
"PCLI UDP Port",
|
2003-01-28 22:27:20 +00:00
|
|
|
"The UDP port on which "
|
2003-02-25 18:43:38 +00:00
|
|
|
"Packet Cable Lawful Intercept "
|
2002-10-03 02:56:59 +00:00
|
|
|
"packets will be sent",
|
|
|
|
10,&global_udp_port_pcli);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The registration hand-off routing */
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_pcli(void) {
|
2008-10-25 20:24:31 +00:00
|
|
|
static gboolean pcli_initialized = FALSE;
|
2002-10-03 02:56:59 +00:00
|
|
|
static dissector_handle_t pcli_handle;
|
2008-10-25 20:24:31 +00:00
|
|
|
static guint udp_port_pcli;
|
2002-10-03 02:56:59 +00:00
|
|
|
|
|
|
|
if(!pcli_initialized) {
|
|
|
|
pcli_handle = create_dissector_handle(dissect_pcli,proto_pcli);
|
2008-10-25 20:24:31 +00:00
|
|
|
ip_handle = find_dissector("ip");
|
2002-10-03 02:56:59 +00:00
|
|
|
pcli_initialized = TRUE;
|
|
|
|
} else {
|
|
|
|
dissector_delete("udp.port",udp_port_pcli,pcli_handle);
|
|
|
|
}
|
|
|
|
|
|
|
|
udp_port_pcli = global_udp_port_pcli;
|
|
|
|
|
|
|
|
dissector_add("udp.port",global_udp_port_pcli,pcli_handle);
|
|
|
|
}
|