#include "config.h"
#include <glib.h>
+
+#include <wsutil/eax.h>
+
#include <epan/conversation.h>
#include <epan/expert.h>
#include <epan/packet.h>
#include <epan/dissectors/packet-ber.h>
#include <epan/dissectors/packet-tcp.h>
#include <epan/uat.h>
-#include <epan/crypt/eax.h>
#include <stdio.h>
#include <string.h>
static int hf_c1222_write_offset = -1;
static int hf_c1222_write_size = -1;
static int hf_c1222_write_data = -1;
+static int hf_c1222_procedure_num = -1;
static int hf_c1222_write_chksum = -1;
static int hf_c1222_wait_secs = -1;
static int hf_c1222_neg_pkt_size = -1;
static const value_string procflags[] = {
{ 0x00, "SF" },
- { 0x01, "MF" },
+ { 0x08, "MF" },
{ 0, NULL }
};
guint8 wait_seconds = 0;
int numrates = 0;
guint16 packet_size;
+ guint16 procedure_num = 0;
guint8 nbr_packet;
/* timing setup parameters */
guint8 traffic;
*offset += 2;
*length -= 2;
if (*length >= tblsize+1U) {
+ if (table == 7) {/* is it a procedure call? */
+ procedure_num = tvb_get_letohs(tvb, *offset);
+ proto_tree_add_uint(tree, hf_c1222_procedure_num, tvb, *offset, 2, procedure_num);
+ *offset += 2;
+ *length -= 2;
+ tblsize -= 2;
+ }
proto_tree_add_item(tree, hf_c1222_write_data, tvb, *offset, tblsize, ENC_NA);
*offset += tblsize;
*length -= tblsize;
chksum = tvb_get_guint8(tvb, *offset);
item = proto_tree_add_uint(tree, hf_c1222_write_chksum, tvb, *offset, 1, chksum);
- calcsum = c1222_cksum(tvb, (*offset)-tblsize, tblsize);
+ if (table == 7) {/* is it a procedure call? */
+ calcsum = c1222_cksum(tvb, (*offset)-tblsize-2, tblsize+2);
+ } else {
+ calcsum = c1222_cksum(tvb, (*offset)-tblsize, tblsize);
+ }
if (chksum != calcsum) {
expert_add_info_format_text(pinfo, item, &ei_c1222_bad_checksum, "Bad checksum [should be 0x%02x]", calcsum);
}
- proto_item_set_text(tree, "C12.22 EPSEM: %s (%s-%d)",
- val_to_str(cmd,commandnames,"Unknown (0x%02x)"),
- val_to_str((table >> 8) & 0xF8, tableflags,"Unknown (0x%04x)"), table & 0x7FF);
+ if (table == 7) {/* is it a procedure call? */
+ proto_item_set_text(tree, "C12.22 EPSEM: %s (%s-%d, %s-%d)",
+ val_to_str(cmd,commandnames,"Unknown (0x%02x)"),
+ val_to_str((table >> 8) & 0xF8, tableflags,"Unknown (0x%04x)"), table & 0x7FF,
+ val_to_str((procedure_num >> 8) & 0xF8, procflags,"Unknown (0x%04x)"), procedure_num & 0x7FF);
+ } else {
+ proto_item_set_text(tree, "C12.22 EPSEM: %s (%s-%d)",
+ val_to_str(cmd,commandnames,"Unknown (0x%02x)"),
+ val_to_str((table >> 8) & 0xF8, tableflags,"Unknown (0x%04x)"), table & 0x7FF);
+ }
*offset += 1;
*length -= 1;
} else {
/* don't do anything */
proto_item_set_text(tree, "C12.22 EPSEM: %s", val_to_str(cmd, commandnames, "Unknown (0x%02x)"));
if (*length) {
- if (*length >= *length) {
- proto_tree_add_item(tree, hf_c1222_data, tvb, *offset, *length, ENC_NA);
- } else {
- expert_add_info_format_text(pinfo, tree, &ei_c1222_command_truncated, "C12.22 unknown command truncated");
- }
+ proto_tree_add_item(tree, hf_c1222_data, tvb, *offset, *length, ENC_NA);
}
break;
}
if (tree) {
c1222_item = proto_tree_add_item(tree, proto_c1222, tvb, 0, -1, ENC_NA);
c1222_tree = proto_item_add_subtree(c1222_item, ett_c1222);
- dissect_C1222_MESSAGE_PDU(tvb, pinfo, c1222_tree);
+ dissect_MESSAGE_PDU(tvb, pinfo, c1222_tree);
}
}
NULL, 0x0,
NULL, HFILL }
},
+ { &hf_c1222_procedure_num,
+ { "C12.22 Procedure Number", "c1222.procedure.num",
+ FT_UINT16, BASE_DEC,
+ NULL, 0x7ff,
+ NULL, HFILL }
+ },
{ &hf_c1222_neg_pkt_size,
{ "C12.22 Negotiate Packet Size", "c1222.negotiate.pktsize",
FT_UINT16, BASE_DEC,
if( !initialized ) {
c1222_handle = create_dissector_handle(dissect_c1222, proto_c1222);
- c1222_udp_handle = create_dissector_handle(dissect_c1222_common, proto_c1222);
+ c1222_udp_handle = create_dissector_handle(dissect_c1222_common, proto_c1222);
dissector_add_uint("tcp.port", global_c1222_port, c1222_handle);
dissector_add_uint("udp.port", global_c1222_port, c1222_udp_handle);
initialized = TRUE;