aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-hdcp.c
diff options
context:
space:
mode:
authorMartin Kaiser <wireshark@kaiser.cx>2014-01-23 18:10:27 +0100
committerMartin Kaiser <wireshark@kaiser.cx>2014-02-02 17:41:35 +0000
commit06510129bb697a586334996215a4be63aef137c4 (patch)
treec9eddc64d04e303f6e2abd2ae525da9994306015 /epan/dissectors/packet-hdcp.c
parent3ea0cd742433b42367d01e71201b2c87a97c713c (diff)
dissector for HDMI (High-Definition Multimedia Interface)
messages on the Data Display Channel (DDC) this dissector is available as an option for I2C messages it handles EDID messages (Extended Display Identification Data) and passes HDCP messages on to the HDCP dissector Change-Id: Ia8d8e73c36e2a1ad560b911dd4c1c9f34997b5c2 Reviewed-on: https://code.wireshark.org/review/63 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Martin Kaiser <wireshark@kaiser.cx>
Diffstat (limited to 'epan/dissectors/packet-hdcp.c')
-rw-r--r--epan/dissectors/packet-hdcp.c52
1 files changed, 8 insertions, 44 deletions
diff --git a/epan/dissectors/packet-hdcp.c b/epan/dissectors/packet-hdcp.c
index 8ce0a2bd5d..cbf84a3a65 100644
--- a/epan/dissectors/packet-hdcp.c
+++ b/epan/dissectors/packet-hdcp.c
@@ -1,6 +1,6 @@
/* packet-hdcp.c
* Routines for HDCP dissection
- * Copyright 2011-2012, Martin Kaiser <martin@kaiser.cx>
+ * Copyright 2011-2014, Martin Kaiser <martin@kaiser.cx>
*
* $Id$
*
@@ -38,7 +38,6 @@
#include <epan/ptvcursor.h>
#include <epan/expert.h>
#include <epan/wmem/wmem.h>
-#include "packet-hdcp.h"
void proto_register_hdcp(void);
@@ -48,7 +47,6 @@ static wmem_tree_t *transactions = NULL;
static gint ett_hdcp = -1;
-static int hf_hdcp_addr = -1;
static int hf_hdcp_reg = -1;
static int hf_hdcp_resp_in = -1;
static int hf_hdcp_resp_to = -1;
@@ -68,16 +66,6 @@ static int hf_hdcp_max_devs_exc = -1;
static int hf_hdcp_downstream = -1;
static int hf_hdcp_link_vfy = -1;
-/* the addresses used by this dissector are 8bit, including the direction bit
- (to be in line with the HDCP specification) */
-#define ADDR8_HDCP_WRITE 0x74 /* transmitter->receiver */
-#define ADDR8_HDCP_READ 0x75 /* receiver->transmitter */
-
-#define HDCP_ADDR8(x) (x==ADDR8_HDCP_WRITE || x==ADDR8_HDCP_READ)
-
-#define ADDR8_RCV "Receiver"
-#define ADDR8_TRX "Transmitter"
-
#define REG_BKSV 0x0
#define REG_AKSV 0x10
#define REG_AN 0x18
@@ -90,12 +78,6 @@ typedef struct _hdcp_transaction_t {
guint8 rqst_type;
} hdcp_transaction_t;
-static const value_string hdcp_addr[] = {
- { ADDR8_HDCP_WRITE, "transmitter writes data for receiver" },
- { ADDR8_HDCP_READ, "transmitter reads data from receiver" },
- { 0, NULL }
-};
-
static const value_string hdcp_reg[] = {
{ REG_BKSV, "B_ksv" },
{ REG_AKSV, "A_ksv" },
@@ -105,22 +87,14 @@ static const value_string hdcp_reg[] = {
{ 0, NULL }
};
-gboolean
-sub_check_hdcp(packet_info *pinfo _U_)
-{
- /* by looking at the i2c_phdr only, we can't decide if this packet is HDCPv1
- this function is called when the user explicitly selected HDCPv1
- in the preferences
- therefore, we always return TRUE and hand the data to the (new
- style) dissector who will check if the packet is HDCPv1 */
-
- return TRUE;
-}
+/* the input tvb contains an HDCP message without the leading address byte
+ (the address byte is handled by the HDMI dissector)
+ the caller must set the direction in pinfo */
static int
dissect_hdcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
- guint8 addr, reg;
+ guint8 reg;
proto_item *pi;
ptvcursor_t *cursor;
proto_tree *hdcp_tree;
@@ -128,9 +102,7 @@ dissect_hdcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
proto_item *it;
guint64 a_ksv, b_ksv;
- addr = tvb_get_guint8(tvb, 0);
- if (!HDCP_ADDR8(addr))
- return 0;
+ /* XXX check if the packet is really HDCP? */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "HDCP");
col_clear(pinfo->cinfo, COL_INFO);
@@ -140,15 +112,12 @@ dissect_hdcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
hdcp_tree = proto_item_add_subtree(pi, ett_hdcp);
cursor = ptvcursor_new(hdcp_tree, tvb, 0);
- /* all values in HDCP are little endian */
- ptvcursor_add(cursor, hf_hdcp_addr, 1, ENC_LITTLE_ENDIAN);
- if (addr==ADDR8_HDCP_WRITE) {
+ if (pinfo->p2p_dir==P2P_DIR_SENT) {
/* transmitter sends data to the receiver */
- SET_ADDRESS(&pinfo->src, AT_STRINGZ, (int)strlen(ADDR8_TRX)+1, ADDR8_TRX);
- SET_ADDRESS(&pinfo->dst, AT_STRINGZ, (int)strlen(ADDR8_RCV)+1, ADDR8_RCV);
reg = tvb_get_guint8(tvb, ptvcursor_current_offset(cursor));
+ /* all values in HDCP are little endian */
ptvcursor_add(cursor, hf_hdcp_reg, 1, ENC_LITTLE_ENDIAN);
if (tvb_reported_length_remaining(tvb,
@@ -209,8 +178,6 @@ dissect_hdcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
}
else {
/* transmitter reads from receiver */
- SET_ADDRESS(&pinfo->src, AT_STRINGZ, (int)strlen(ADDR8_RCV)+1, ADDR8_RCV);
- SET_ADDRESS(&pinfo->dst, AT_STRINGZ, (int)strlen(ADDR8_TRX)+1, ADDR8_TRX);
if (transactions) {
hdcp_trans = (hdcp_transaction_t *)wmem_tree_lookup32_le(
@@ -296,9 +263,6 @@ void
proto_register_hdcp(void)
{
static hf_register_info hf[] = {
- { &hf_hdcp_addr,
- { "8bit I2C address", "hdcp.addr", FT_UINT8, BASE_HEX,
- VALS(hdcp_addr), 0, NULL, HFILL } },
{ &hf_hdcp_reg,
{ "Register offset", "hdcp.reg", FT_UINT8, BASE_HEX,
VALS(hdcp_reg), 0, NULL, HFILL } },