Add parser for card reader identifier objects
authorYang Gu <yang.gu@intel.com>
Tue, 6 Apr 2010 10:06:46 +0000 (18:06 +0800)
committerDenis Kenzior <denkenz@gmail.com>
Wed, 14 Apr 2010 17:52:09 +0000 (12:52 -0500)
src/stkutil.c
src/stkutil.h

index 67317ae..7f3adaf 100644 (file)
@@ -1168,6 +1168,24 @@ static gboolean parse_dataobj_channel_status(
        return TRUE;
 }
 
+/* Defined in TS 102.223 Section 8.57 */
+static gboolean parse_dataobj_card_reader_id(
+                       struct comprehension_tlv_iter *iter, void *user)
+{
+       struct stk_card_reader_id *cr_id = user;
+       const unsigned char *data;
+       unsigned int len = comprehension_tlv_iter_get_length(iter);
+
+       if (len < 1)
+               return FALSE;
+
+       data = comprehension_tlv_iter_get_data(iter);
+       cr_id->len = len;
+       memcpy(cr_id->id, data, len);
+
+       return TRUE;
+}
+
 /* Defined in TS 102.223 Section 8.72 */
 static gboolean parse_dataobj_text_attr(struct comprehension_tlv_iter *iter,
                                        void *user)
@@ -1310,6 +1328,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
                return parse_dataobj_buffer_size;
        case STK_DATA_OBJECT_TYPE_CHANNEL_STATUS:
                return parse_dataobj_channel_status;
+       case STK_DATA_OBJECT_TYPE_CARD_READER_ID:
+               return parse_dataobj_card_reader_id;
        case STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE:
                return parse_dataobj_text_attr;
        case STK_DATA_OBJECT_TYPE_FRAME_ID:
index c1b9af0..511b912 100644 (file)
@@ -544,6 +544,15 @@ struct stk_bearer_description {
 };
 
 /*
+ * According to 102.223 Section 8.57 the length of CTLV is 1 byte. This means
+ * that the maximum size is 127 according to the rules of CTLVs.
+ */
+struct stk_card_reader_id {
+       unsigned char id[127];
+       unsigned char len;
+};
+
+/*
  * According to 102.223 Section 8.72 the length of text attribute CTLV is 1
  * byte.  This means that the maximum size is 127 according to the rules
  * of CTLVs.  Empty attribute options will have len of 0.