guint16 reason;
reason = tvb_get_letohs(tvb, offset);
- proto_tree_add_item(tree, hf_btamp_rej_reason, tvb, offset, 2, TRUE);
+ proto_tree_add_item(tree, hf_btamp_rej_reason, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset+=2;
switch(reason){
static int
dissect_discoverrequest(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- proto_tree_add_item(tree, hf_btamp_mtu, tvb, offset, 2, TRUE);
+ proto_tree_add_item(tree, hf_btamp_mtu, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset+=2;
- proto_tree_add_item(tree, hf_btamp_extfeatures, tvb, offset, 2, TRUE);
+ proto_tree_add_item(tree, hf_btamp_extfeatures, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset+=2;
return offset;
"Entry: %u", idx);
btamp_controller_entry_tree=proto_item_add_subtree(ti_controller_entry, ett_btamp_controller_entry);
- proto_tree_add_item(btamp_controller_entry_tree, hf_btamp_controller_id, tvb, offset, 1, TRUE);
+ proto_tree_add_item(btamp_controller_entry_tree, hf_btamp_controller_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset+=1;
- proto_tree_add_item(btamp_controller_entry_tree, hf_btamp_controller_type, tvb, offset, 1, TRUE);
+ proto_tree_add_item(btamp_controller_entry_tree, hf_btamp_controller_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset+=1;
- proto_tree_add_item(btamp_controller_entry_tree, hf_btamp_controller_status, tvb, offset, 1, TRUE);
+ proto_tree_add_item(btamp_controller_entry_tree, hf_btamp_controller_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset+=1;
return offset;
proto_tree *btamp_controller_list_tree=NULL;
proto_item *ti_controller_list=NULL;
- proto_tree_add_item(tree, hf_btamp_mtu, tvb, offset, 2, TRUE);
+ proto_tree_add_item(tree, hf_btamp_mtu, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset+=2;
- proto_tree_add_item(tree, hf_btamp_extfeatures, tvb, offset, 2, TRUE);
+ proto_tree_add_item(tree, hf_btamp_extfeatures, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset+=2;
length = tvb_length_remaining(tvb, offset);
"Controller list");
btamp_controller_list_tree=proto_item_add_subtree(ti_controller_list, ett_btamp_controller_list);
- while ((length = tvb_length_remaining(tvb, offset)) >= 3) {
+ while (tvb_length_remaining(tvb, offset) >= 3) {
offset = dissect_controller_entry(tvb, offset, pinfo, btamp_controller_list_tree, idx);
++idx;
}
"Controller list");
btamp_controller_list_tree=proto_item_add_subtree(ti_controller_list, ett_btamp_controller_list);
- while ((length = tvb_length_remaining(tvb, offset)) >= 3) {
+ while (tvb_length_remaining(tvb, offset) >= 3) {
offset = dissect_controller_entry(tvb, offset, pinfo, btamp_controller_list_tree, idx);
++idx;
}
static int
dissect_getinforequest(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- proto_tree_add_item(tree, hf_btamp_controller_id, tvb, offset, 1, TRUE);
+ proto_tree_add_item(tree, hf_btamp_controller_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset+=1;
return offset;
proto_tree *btamp_controller_tree=NULL;
proto_item *ti_controller=NULL;
- proto_tree_add_item(tree, hf_btamp_controller_id, tvb, offset, 1, TRUE);
+ proto_tree_add_item(tree, hf_btamp_controller_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset+=1;
- proto_tree_add_item(tree, hf_btamp_status, tvb, offset, 1, TRUE);
+ proto_tree_add_item(tree, hf_btamp_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset+=1;
- proto_tree_add_item(tree, hf_btamp_total_bw, tvb, offset, 4, TRUE);
+ proto_tree_add_item(tree, hf_btamp_total_bw, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset+=4;
- proto_tree_add_item(tree, hf_btamp_max_guaran_bw, tvb, offset, 4, TRUE);
+ proto_tree_add_item(tree, hf_btamp_max_guaran_bw, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset+=4;
- proto_tree_add_item(tree, hf_btamp_min_latency, tvb, offset, 4, TRUE);
+ proto_tree_add_item(tree, hf_btamp_min_latency, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset+=4;
ti_controller=proto_tree_add_none_format(tree,
offset, 2,
"PAL Capabilities");
btamp_controller_tree=proto_item_add_subtree(ti_controller, ett_btamp_caps);
- proto_tree_add_item(btamp_controller_tree, hf_btamp_pal_caps_guaranteed, tvb, offset, 2, TRUE);
+ proto_tree_add_item(btamp_controller_tree, hf_btamp_pal_caps_guaranteed, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset+=2;
- proto_tree_add_item(tree, hf_btamp_amp_assoc_size, tvb, offset, 2, TRUE);
+ proto_tree_add_item(tree, hf_btamp_amp_assoc_size, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset+=2;
return offset;
static int
dissect_getampassocrequest(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- proto_tree_add_item(tree, hf_btamp_controller_id, tvb, offset, 1, TRUE);
+ proto_tree_add_item(tree, hf_btamp_controller_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset+=1;
return offset;
static int
dissect_ampassoc(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- proto_tree_add_item(tree, hf_btamp_amp_assoc, tvb, offset, tvb_length_remaining(tvb, offset), TRUE);
+ proto_tree_add_item(tree, hf_btamp_amp_assoc, tvb, offset, tvb_length_remaining(tvb, offset), ENC_NA);
offset+=tvb_length_remaining(tvb, offset);
return offset;
static int
dissect_getampassocresponse(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
- proto_tree_add_item(tree, hf_btamp_controller_id, tvb, offset, 1, TRUE);
+ proto_tree_add_item(tree, hf_btamp_controller_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset+=1;
- proto_tree_add_item(tree, hf_btamp_status, tvb, offset, 1, TRUE);
+ proto_tree_add_item(tree, hf_btamp_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset+=1;
offset=dissect_ampassoc(tvb, offset, pinfo, tree);
static int
dissect_createphysicalrequest(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
- proto_tree_add_item(tree, hf_btamp_lcontroller_id, tvb, offset, 1, TRUE);
+ proto_tree_add_item(tree, hf_btamp_lcontroller_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset+=1;
- proto_tree_add_item(tree, hf_btamp_rcontroller_id, tvb, offset, 1, TRUE);
+ proto_tree_add_item(tree, hf_btamp_rcontroller_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset+=1;
offset=dissect_ampassoc(tvb, offset, pinfo, tree);
static int
dissect_createphysicalresponse(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- proto_tree_add_item(tree, hf_btamp_lcontroller_id, tvb, offset, 1, TRUE);
+ proto_tree_add_item(tree, hf_btamp_lcontroller_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset+=1;
- proto_tree_add_item(tree, hf_btamp_rcontroller_id, tvb, offset, 1, TRUE);
+ proto_tree_add_item(tree, hf_btamp_rcontroller_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset+=1;
- proto_tree_add_item(tree, hf_btamp_status, tvb, offset, 1, TRUE);
+ proto_tree_add_item(tree, hf_btamp_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset+=1;
return offset;
static int
dissect_discphysicalchanrequest(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- proto_tree_add_item(tree, hf_btamp_lcontroller_id, tvb, offset, 1, TRUE);
+ proto_tree_add_item(tree, hf_btamp_lcontroller_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset+=1;
- proto_tree_add_item(tree, hf_btamp_rcontroller_id, tvb, offset, 1, TRUE);
+ proto_tree_add_item(tree, hf_btamp_rcontroller_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset+=1;
return offset;
static int
dissect_discphysicalchanresponse(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- proto_tree_add_item(tree, hf_btamp_lcontroller_id, tvb, offset, 1, TRUE);
+ proto_tree_add_item(tree, hf_btamp_lcontroller_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset+=1;
- proto_tree_add_item(tree, hf_btamp_rcontroller_id, tvb, offset, 1, TRUE);
+ proto_tree_add_item(tree, hf_btamp_rcontroller_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset+=1;
- proto_tree_add_item(tree, hf_btamp_controller_status, tvb, offset, 1, TRUE);
+ proto_tree_add_item(tree, hf_btamp_controller_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset+=1;
return offset;
}
-static void dissect_btamp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_btamp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
int offset=0;
proto_item *ti=NULL;
guint16 cmd_length;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "AMP");
- col_clear(pinfo->cinfo, COL_INFO);
- col_set_str(pinfo->cinfo, COL_INFO, pinfo->p2p_dir == P2P_DIR_SENT ? "Sent " : "Rcvd ");
+ switch (pinfo->p2p_dir) {
+
+ case P2P_DIR_SENT:
+ col_add_str(pinfo->cinfo, COL_INFO, "Sent ");
+ break;
+
+ case P2P_DIR_RECV:
+ col_add_str(pinfo->cinfo, COL_INFO, "Rcvd ");
+ break;
+
+ case P2P_DIR_UNKNOWN:
+ col_clear(pinfo->cinfo, COL_INFO);
+ break;
+
+ default:
+ col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown direction %d ",
+ pinfo->p2p_dir);
+ break;
+ }
if(tree){
- ti=proto_tree_add_item(tree, proto_btamp, tvb, offset, -1, FALSE);
+ ti=proto_tree_add_item(tree, proto_btamp, tvb, offset, -1, ENC_NA);
btamp_tree=proto_item_add_subtree(ti, ett_btamp);
}
btamp_cmd_tree=proto_item_add_subtree(ti_command, ett_btamp_cmd);
cmd_code=tvb_get_guint8(tvb, offset);
- proto_tree_add_item(btamp_cmd_tree, hf_btamp_cmd_code, tvb, offset, 1, TRUE);
+ proto_tree_add_item(btamp_cmd_tree, hf_btamp_cmd_code, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
- proto_tree_add_item(btamp_cmd_tree, hf_btamp_cmd_ident, tvb, offset, 1, TRUE);
+ proto_tree_add_item(btamp_cmd_tree, hf_btamp_cmd_ident, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
cmd_length=tvb_get_letohs(tvb, offset);
- proto_tree_add_item(btamp_cmd_tree, hf_btamp_cmd_length, tvb, offset, 2, TRUE);
+ proto_tree_add_item(btamp_cmd_tree, hf_btamp_cmd_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
proto_item_set_len(ti_command, cmd_length+4);
offset+=2;
break;
default:
- proto_tree_add_item(btamp_cmd_tree, hf_btamp_cmd_data, tvb, offset, -1, TRUE);
+ proto_tree_add_item(btamp_cmd_tree, hf_btamp_cmd_data, tvb, offset, -1, ENC_NA);
offset+=tvb_length_remaining(tvb, offset);
break;
}
proto_item_append_text(ti_command, "%s", val_to_str(cmd_code, command_code_vals, "Unknown PDU (%u)"));
col_append_str(pinfo->cinfo, COL_INFO, val_to_str(cmd_code, command_code_vals, "Unknown PDU (%u)"));
+return offset;
}
/* Register the protocol with Wireshark */
"L2CAP Command Data", HFILL }
},
{ &hf_btamp_rej_reason,
- { "Reason", "btl2cap.rej_reason",
+ { "Reason", "btamp.rej_reason",
FT_UINT16, BASE_HEX, VALS(reason_vals), 0x0,
NULL, HFILL }
},
/* Register the protocol name and description */
proto_btamp = proto_register_protocol("Bluetooth AMP Packet", "AMP", "btamp");
- register_dissector("btamp", dissect_btamp, proto_btamp);
+ new_register_dissector("btamp", dissect_btamp, proto_btamp);
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_btamp, hf, array_length(hf));
dissector_handle_t btamp_handle;
btamp_handle = find_dissector("btamp");
- dissector_add("btl2cap.cid", BTL2CAP_FIXED_CID_AMP_MAN, btamp_handle);
+ dissector_add_uint("btl2cap.cid", BTL2CAP_FIXED_CID_AMP_MAN, btamp_handle);
}