stkutil: Refactor struct stk_other_address

This commit is contained in:
Andrzej Zaborowski 2010-06-11 12:39:48 +02:00 committed by Denis Kenzior
parent dda6692d7d
commit 6e4277eef8
4 changed files with 9 additions and 3 deletions

View File

@ -26,6 +26,7 @@
#define _GNU_SOURCE #define _GNU_SOURCE
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <stdint.h>
#include <glib.h> #include <glib.h>
#include <gdbus.h> #include <gdbus.h>

View File

@ -25,6 +25,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h>
#include <glib.h> #include <glib.h>
@ -1210,8 +1211,10 @@ static gboolean parse_dataobj_other_address(
const unsigned char *data; const unsigned char *data;
unsigned char len = comprehension_tlv_iter_get_length(iter); unsigned char len = comprehension_tlv_iter_get_length(iter);
if (len == 0) if (len == 0) {
oa->type = STK_ADDRESS_AUTO;
return TRUE; return TRUE;
}
if ((len != 5) && (len != 17)) if ((len != 5) && (len != 17))
return FALSE; return FALSE;

View File

@ -404,6 +404,7 @@ enum stk_bearer_type {
}; };
enum stk_address_type { enum stk_address_type {
STK_ADDRESS_AUTO = -1,
STK_ADDRESS_IPV4 = 0x21, STK_ADDRESS_IPV4 = 0x21,
STK_ADDRESS_IPV6 = 0x57 STK_ADDRESS_IPV6 = 0x57
}; };
@ -692,10 +693,10 @@ struct stk_card_reader_id {
struct stk_other_address { struct stk_other_address {
union { union {
/* Network Byte Order */ /* Network Byte Order */
unsigned int ipv4; uint32_t ipv4;
unsigned char ipv6[16]; unsigned char ipv6[16];
} addr; } addr;
unsigned char type; enum stk_address_type type;
}; };
/* Defined in TS 102.223 Section 8.59 */ /* Defined in TS 102.223 Section 8.59 */

View File

@ -27,6 +27,7 @@
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdint.h>
#include <glib.h> #include <glib.h>
#include <glib/gprintf.h> #include <glib/gprintf.h>