2 * Dissector for Open IPTV Forum protocols
3 * Copyright 2012, Martin Kaiser <martin@kaiser.cx>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 /* This dissector supports the CI+ Content and Service Protection Gateway
27 (CSPG-CI+) as defined in in Open IPTV Forum Specification Volume 7 V2.1
28 http://www.openiptvforum.org/release_2.html */
33 #include <epan/packet.h>
35 static int proto_oipf_ciplus
= -1;
37 static gint ett_oipf_ciplus
= -1;
39 static int hf_oipf_ciplus_cmd_id
= -1;
40 static int hf_oipf_ciplus_ca_sys_id
= -1;
41 static int hf_oipf_ciplus_trx_id
= -1;
42 static int hf_oipf_ciplus_send_datatype_nbr
= -1;
43 static int hf_oipf_ciplus_dat_id
= -1;
44 static int hf_oipf_ciplus_dat_len
= -1;
45 static int hf_oipf_ciplus_data
= -1;
47 /* the application id for this protocol in the CI+ SAS resource
48 this is actually a 64bit hex number, we can't use a 64bit number as a key
49 for the dissector table directly, we have to process it as a string
50 (the string must not be a local variable as glib stores a pointer to
51 it in the hash table) */
52 static const gchar sas_app_id_str_oipf
[] = "0x0108113101190000";
54 static const value_string oipf_ciplus_cmd_id
[] = {
56 { 0x02, "reply_msg" },
57 { 0x03, "parental_control_info" },
58 { 0x04, "rights_info" },
59 { 0x05, "system_info" },
63 static const value_string oipf_ciplus_dat_id
[] = {
64 { 0x01, "oipf_ca_vendor_specific_information" },
65 { 0x02, "oipf_country_code" },
66 { 0x03, "oipf_parental_control_url" },
67 { 0x04, "oipf_rating_type" },
68 { 0x05, "oipf_rating_value" },
69 { 0x06, "oipf_rights_issuer_url" },
70 { 0x07, "oipf_access_status" },
71 { 0x08, "oipf_status" },
77 dissect_oipf_ciplus(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, void *data _U_
)
81 proto_tree
*oipf_ciplus_tree
;
83 guint8 i
, send_datatype_nbr
;
86 /* an OIPF CI+ message minimally contains command_id (1 byte),
87 ca sys id (2 bytes), transaction id (4 bytes) and
88 number of sent datatypes (1 byte) */
89 msg_len
= tvb_reported_length(tvb
);
93 ti
= proto_tree_add_text(tree
, tvb
, 0, msg_len
, "Open IPTV Forum CSPG-CI+");
94 oipf_ciplus_tree
= proto_item_add_subtree(ti
, ett_oipf_ciplus
);
96 proto_tree_add_item(oipf_ciplus_tree
, hf_oipf_ciplus_cmd_id
,
97 tvb
, offset
, 1, ENC_BIG_ENDIAN
);
99 proto_tree_add_item(oipf_ciplus_tree
, hf_oipf_ciplus_ca_sys_id
,
100 tvb
, offset
, 2, ENC_BIG_ENDIAN
);
102 proto_tree_add_item(oipf_ciplus_tree
, hf_oipf_ciplus_trx_id
,
103 tvb
, offset
, 4, ENC_BIG_ENDIAN
);
106 send_datatype_nbr
= tvb_get_guint8(tvb
, offset
);
107 proto_tree_add_item(oipf_ciplus_tree
, hf_oipf_ciplus_send_datatype_nbr
,
108 tvb
, offset
, 1, ENC_BIG_ENDIAN
);
111 for (i
=0; i
<send_datatype_nbr
; i
++) {
112 proto_tree_add_item(oipf_ciplus_tree
, hf_oipf_ciplus_dat_id
,
113 tvb
, offset
, 1, ENC_BIG_ENDIAN
);
116 dat_len
= tvb_get_ntohs(tvb
, offset
);
117 proto_tree_add_item(oipf_ciplus_tree
, hf_oipf_ciplus_dat_len
,
118 tvb
, offset
, 2, ENC_BIG_ENDIAN
);
121 proto_tree_add_item(oipf_ciplus_tree
, hf_oipf_ciplus_data
,
122 tvb
, offset
, dat_len
, ENC_BIG_ENDIAN
);
130 proto_register_oipf(void)
132 static gint
*ett
[] = {
136 static hf_register_info hf
[] = {
137 { &hf_oipf_ciplus_cmd_id
,
138 { "Command ID", "oipf.ciplus.cmd_id", FT_UINT8
, BASE_HEX
,
139 VALS(oipf_ciplus_cmd_id
), 0, NULL
, HFILL
} },
140 { &hf_oipf_ciplus_ca_sys_id
,
141 { "CA system ID", "oipf.ciplus.ca_system_id", FT_UINT16
, BASE_HEX
,
142 NULL
, 0, NULL
, HFILL
} },
143 { &hf_oipf_ciplus_trx_id
,
144 { "Transaction ID", "oipf.ciplus.transaction_id",
145 FT_UINT32
, BASE_HEX
, NULL
, 0, NULL
, HFILL
} },
146 { &hf_oipf_ciplus_send_datatype_nbr
,
147 { "Number of data items", "oipf.ciplus.num_items", FT_UINT8
,
148 BASE_DEC
, NULL
, 0, NULL
, HFILL
} },
149 { &hf_oipf_ciplus_dat_id
,
150 { "Datatype ID", "oipf.ciplus.datatype_id", FT_UINT8
, BASE_HEX
,
151 VALS(oipf_ciplus_dat_id
), 0, NULL
, HFILL
} },
152 { &hf_oipf_ciplus_dat_len
,
153 { "Datatype length", "oipf.ciplus.datatype_len", FT_UINT16
,
154 BASE_DEC
, NULL
, 0, NULL
, HFILL
} },
155 { &hf_oipf_ciplus_data
,
156 { "Data", "oipf.ciplus.data", FT_BYTES
, BASE_NONE
,
157 NULL
, 0, NULL
, HFILL
} }
160 proto_oipf_ciplus
= proto_register_protocol(
161 "Open IPTV Forum CSPG-CI+", "OIPF CI+", "oipf.ciplus");
162 proto_register_field_array(proto_oipf_ciplus
, hf
, array_length(hf
));
163 proto_register_subtree_array(ett
, array_length(ett
));
169 proto_reg_handoff_oipf(void)
171 dissector_handle_t oipf_ciplus_handle
;
174 new_create_dissector_handle(dissect_oipf_ciplus
, proto_oipf_ciplus
);
176 dissector_add_string("dvb-ci.sas.app_id_str",
177 sas_app_id_str_oipf
, oipf_ciplus_handle
);
181 * Editor modelines - http://www.wireshark.org/tools/modelines.html
186 * indent-tabs-mode: nil
189 * vi: set shiftwidth=4 tabstop=8 expandtab:
190 * :indentSize=4:tabSize=8:noTabs=true: