Prepare libsdp(3) for the upcoming sdpd import
Also while i'm here s/u_int/uint Reviewed by: imp (mentor), ru
This commit is contained in:
parent
c8885b4b8f
commit
6aae6f7e7a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=124305
@ -34,25 +34,22 @@
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define SDP_UNSOCK_PATH "/var/run/sdp"
|
||||
#define SDP_UNSOCK_MTU 2048
|
||||
|
||||
/*
|
||||
* SDP session
|
||||
*/
|
||||
|
||||
struct sdp_session {
|
||||
u_int16_t flags;
|
||||
uint16_t flags;
|
||||
#define SDP_SESSION_LOCAL (1 << 0)
|
||||
u_int16_t tid; /* current session transaction ID (tid) */
|
||||
u_int16_t omtu; /* outgoing MTU (req buffer size) */
|
||||
u_int16_t imtu; /* incoming MTU (rsp buffer size) */
|
||||
u_int8_t *req; /* request buffer (start) */
|
||||
u_int8_t *req_e; /* request buffer (end) */
|
||||
u_int8_t *rsp; /* response buffer (start) */
|
||||
u_int8_t *rsp_e; /* response buffer (end) */
|
||||
u_int32_t cslen; /* continuation state length */
|
||||
u_int8_t cs[16];/* continuation state */
|
||||
uint16_t tid; /* current session transaction ID (tid) */
|
||||
uint16_t omtu; /* outgoing MTU (req buffer size) */
|
||||
uint16_t imtu; /* incoming MTU (rsp buffer size) */
|
||||
uint8_t *req; /* request buffer (start) */
|
||||
uint8_t *req_e; /* request buffer (end) */
|
||||
uint8_t *rsp; /* response buffer (start) */
|
||||
uint8_t *rsp_e; /* response buffer (end) */
|
||||
uint32_t cslen; /* continuation state length */
|
||||
uint8_t cs[16];/* continuation state */
|
||||
int32_t s; /* L2CAP socket */
|
||||
int32_t error; /* last error code */
|
||||
};
|
||||
|
@ -79,11 +79,11 @@
|
||||
.Ft int32_t
|
||||
.Fn sdp_error "void *xs"
|
||||
.Ft int32_t
|
||||
.Fn sdp_search "void *xs" "u_int32_t plen" "u_int16_t const *pp" "u_int32_t alen" "u_int32_t const *ap" "u_int32_t vlen" "sdp_attr_t *vp"
|
||||
.Fn sdp_search "void *xs" "uint32_t plen" "uint16_t const *pp" "uint32_t alen" "uint32_t const *ap" "uint32_t vlen" "sdp_attr_t *vp"
|
||||
.Ft char const * const
|
||||
.Fn sdp_attr2desc "u_int16_t attr"
|
||||
.Fn sdp_attr2desc "uint16_t attr"
|
||||
.Ft char const * const
|
||||
.Fn sdp_uuid2desc "u_int16_t uuid"
|
||||
.Fn sdp_uuid2desc "uint16_t uuid"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn SDP_GET8 ,
|
||||
@ -204,13 +204,13 @@ Each
|
||||
structure describes single SDP attribute and defined as follows:
|
||||
.Bd -literal -offset indent
|
||||
struct sdp_attr {
|
||||
u_int16_t flags;
|
||||
uint16_t flags;
|
||||
#define SDP_ATTR_OK (0 << 0)
|
||||
#define SDP_ATTR_INVALID (1 << 0)
|
||||
#define SDP_ATTR_TRUNCATED (1 << 1)
|
||||
u_int16_t attr; /* SDP_ATTR_xxx */
|
||||
u_int32_t vlen; /* length of the value[] in bytes */
|
||||
u_int8_t *value; /* base pointer */
|
||||
uint16_t attr; /* SDP_ATTR_xxx */
|
||||
uint32_t vlen; /* length of the value[] in bytes */
|
||||
uint8_t *value; /* base pointer */
|
||||
};
|
||||
typedef struct sdp_attr sdp_attr_t;
|
||||
typedef struct sdp_attr * sdp_attr_p;
|
||||
@ -258,10 +258,10 @@ attribute for the
|
||||
service from the remote device.
|
||||
.Bd -literal -offset indent
|
||||
bdaddr_t remote;
|
||||
u_int8_t buffer[1024];
|
||||
uint8_t buffer[1024];
|
||||
void *ss = NULL;
|
||||
u_int16_t serv = SDP_SERVICE_CLASS_SERIAL_PORT;
|
||||
u_int32_t attr = SDP_ATTR_RANGE(
|
||||
uint16_t serv = SDP_SERVICE_CLASS_SERIAL_PORT;
|
||||
uint32_t attr = SDP_ATTR_RANGE(
|
||||
SDP_ATTR_PROTOCOL_DESCRIPTOR_LIST,
|
||||
SDP_ATTR_PROTOCOL_DESCRIPTOR_LIST);
|
||||
sdp_attr_t proto = { SDP_ATTR_INVALID,0,sizeof(buffer),buffer };
|
||||
|
173
lib/libsdp/sdp.h
173
lib/libsdp/sdp.h
@ -187,7 +187,7 @@ __BEGIN_DECLS
|
||||
*/
|
||||
|
||||
#define SDP_ATTR_RANGE(lo, hi) \
|
||||
(u_int32_t)(((u_int16_t)(lo) << 16) | ((u_int16_t)(hi)))
|
||||
(uint32_t)(((uint16_t)(lo) << 16) | ((uint16_t)(hi)))
|
||||
|
||||
#define SDP_ATTR_SERVICE_RECORD_HANDLE 0x0000
|
||||
#define SDP_ATTR_SERVICE_CLASS_ID_LIST 0x0001
|
||||
@ -237,6 +237,7 @@ __BEGIN_DECLS
|
||||
* attribute ID for these attributes.
|
||||
*/
|
||||
|
||||
#define SDP_ATTR_PRIMARY_LANGUAGE_BASE_ID 0x0100
|
||||
#define SDP_ATTR_SERVICE_NAME_OFFSET 0x0000
|
||||
#define SDP_ATTR_SERVICE_DESCRIPTION_OFFSET 0x0001
|
||||
#define SDP_ATTR_PROVIDER_NAME_OFFSET 0x0002
|
||||
@ -254,13 +255,24 @@ __BEGIN_DECLS
|
||||
#define SDP_PDU_SERVICE_SEARCH_ATTRIBUTE_RESPONSE 0x07
|
||||
|
||||
struct sdp_pdu {
|
||||
u_int8_t pid; /* PDU ID - SDP_PDU_xxx */
|
||||
u_int16_t tid; /* transaction ID */
|
||||
u_int16_t len; /* parameters length (in bytes) */
|
||||
uint8_t pid; /* PDU ID - SDP_PDU_xxx */
|
||||
uint16_t tid; /* transaction ID */
|
||||
uint16_t len; /* parameters length (in bytes) */
|
||||
} __attribute__ ((packed));
|
||||
typedef struct sdp_pdu sdp_pdu_t;
|
||||
typedef struct sdp_pdu * sdp_pdu_p;
|
||||
|
||||
/*
|
||||
* Error codes for SDP_PDU_ERROR_RESPONSE
|
||||
*/
|
||||
|
||||
#define SDP_ERROR_CODE_INVALID_SDP_VERSION 0x0001
|
||||
#define SDP_ERROR_CODE_INVALID_SERVICE_RECORD_HANDLE 0x0002
|
||||
#define SDP_ERROR_CODE_INVALID_REQUEST_SYNTAX 0x0003
|
||||
#define SDP_ERROR_CODE_INVALID_PDU_SIZE 0x0004
|
||||
#define SDP_ERROR_CODE_INVALID_CONTINUATION_STATE 0x0005
|
||||
#define SDP_ERROR_CODE_INSUFFICIENT_RESOURCES 0x0006
|
||||
|
||||
/*
|
||||
* SDP int128/uint128 parameter
|
||||
*/
|
||||
@ -269,20 +281,20 @@ struct int128 {
|
||||
int8_t b[16];
|
||||
};
|
||||
typedef struct int128 int128_t;
|
||||
typedef struct int128 u_int128_t;
|
||||
typedef struct int128 uint128_t;
|
||||
|
||||
/*
|
||||
* SDP attribute
|
||||
*/
|
||||
|
||||
struct sdp_attr {
|
||||
u_int16_t flags;
|
||||
uint16_t flags;
|
||||
#define SDP_ATTR_OK (0 << 0)
|
||||
#define SDP_ATTR_INVALID (1 << 0)
|
||||
#define SDP_ATTR_TRUNCATED (1 << 1)
|
||||
u_int16_t attr; /* SDP_ATTR_xxx */
|
||||
u_int32_t vlen; /* length of the value[] in bytes */
|
||||
u_int8_t *value; /* base pointer */
|
||||
uint16_t attr; /* SDP_ATTR_xxx */
|
||||
uint32_t vlen; /* length of the value[] in bytes */
|
||||
uint8_t *value; /* base pointer */
|
||||
};
|
||||
typedef struct sdp_attr sdp_attr_t;
|
||||
typedef struct sdp_attr * sdp_attr_p;
|
||||
@ -293,46 +305,46 @@ typedef struct sdp_attr * sdp_attr_p;
|
||||
|
||||
/* Inline versions of get/put byte/short/long. Pointer is advanced */
|
||||
#define SDP_GET8(b, cp) { \
|
||||
register u_int8_t *t_cp = (u_int8_t *)(cp); \
|
||||
register uint8_t *t_cp = (uint8_t *)(cp); \
|
||||
(b) = *t_cp; \
|
||||
(cp) ++; \
|
||||
}
|
||||
|
||||
#define SDP_GET16(s, cp) { \
|
||||
register u_int8_t *t_cp = (u_int8_t *)(cp); \
|
||||
(s) = ((u_int16_t)t_cp[0] << 8) \
|
||||
| ((u_int16_t)t_cp[1]) \
|
||||
register uint8_t *t_cp = (uint8_t *)(cp); \
|
||||
(s) = ((uint16_t)t_cp[0] << 8) \
|
||||
| ((uint16_t)t_cp[1]) \
|
||||
; \
|
||||
(cp) += 2; \
|
||||
}
|
||||
|
||||
#define SDP_GET32(l, cp) { \
|
||||
register u_int8_t *t_cp = (u_int8_t *)(cp); \
|
||||
(l) = ((u_int32_t)t_cp[0] << 24) \
|
||||
| ((u_int32_t)t_cp[1] << 16) \
|
||||
| ((u_int32_t)t_cp[2] << 8) \
|
||||
| ((u_int32_t)t_cp[3]) \
|
||||
register uint8_t *t_cp = (uint8_t *)(cp); \
|
||||
(l) = ((uint32_t)t_cp[0] << 24) \
|
||||
| ((uint32_t)t_cp[1] << 16) \
|
||||
| ((uint32_t)t_cp[2] << 8) \
|
||||
| ((uint32_t)t_cp[3]) \
|
||||
; \
|
||||
(cp) += 4; \
|
||||
}
|
||||
|
||||
#define SDP_GET64(l, cp) { \
|
||||
register u_int8_t *t_cp = (u_int8_t *)(cp); \
|
||||
(l) = ((u_int64_t)t_cp[0] << 56) \
|
||||
| ((u_int64_t)t_cp[1] << 48) \
|
||||
| ((u_int64_t)t_cp[2] << 40) \
|
||||
| ((u_int64_t)t_cp[3] << 32) \
|
||||
| ((u_int64_t)t_cp[4] << 24) \
|
||||
| ((u_int64_t)t_cp[5] << 16) \
|
||||
| ((u_int64_t)t_cp[6] << 8) \
|
||||
| ((u_int64_t)t_cp[7]) \
|
||||
register uint8_t *t_cp = (uint8_t *)(cp); \
|
||||
(l) = ((uint64_t)t_cp[0] << 56) \
|
||||
| ((uint64_t)t_cp[1] << 48) \
|
||||
| ((uint64_t)t_cp[2] << 40) \
|
||||
| ((uint64_t)t_cp[3] << 32) \
|
||||
| ((uint64_t)t_cp[4] << 24) \
|
||||
| ((uint64_t)t_cp[5] << 16) \
|
||||
| ((uint64_t)t_cp[6] << 8) \
|
||||
| ((uint64_t)t_cp[7]) \
|
||||
; \
|
||||
(cp) += 8; \
|
||||
}
|
||||
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
#define SDP_GET128(l, cp) { \
|
||||
register u_int8_t *t_cp = (u_int8_t *)(cp); \
|
||||
register uint8_t *t_cp = (uint8_t *)(cp); \
|
||||
(l)->b[15] = *t_cp++; \
|
||||
(l)->b[14] = *t_cp++; \
|
||||
(l)->b[13] = *t_cp++; \
|
||||
@ -352,7 +364,7 @@ typedef struct sdp_attr * sdp_attr_p;
|
||||
}
|
||||
#else /* BYTE_ORDER != LITTLE_ENDIAN */
|
||||
#define SDP_GET128(l, cp) { \
|
||||
register u_int8_t *t_cp = (u_int8_t *)(cp); \
|
||||
register uint8_t *t_cp = (uint8_t *)(cp); \
|
||||
(l)->b[0] = *t_cp++; \
|
||||
(l)->b[1] = *t_cp++; \
|
||||
(l)->b[2] = *t_cp++; \
|
||||
@ -374,23 +386,23 @@ typedef struct sdp_attr * sdp_attr_p;
|
||||
#endif /* BYTE_ORDER */
|
||||
|
||||
#define SDP_PUT8(b, cp) { \
|
||||
register u_int8_t t_b = (u_int8_t)(b); \
|
||||
register u_int8_t *t_cp = (u_int8_t *)(cp); \
|
||||
register uint8_t t_b = (uint8_t)(b); \
|
||||
register uint8_t *t_cp = (uint8_t *)(cp); \
|
||||
*t_cp = t_b; \
|
||||
(cp) ++; \
|
||||
}
|
||||
|
||||
#define SDP_PUT16(s, cp) { \
|
||||
register u_int16_t t_s = (u_int16_t)(s); \
|
||||
register u_int8_t *t_cp = (u_int8_t *)(cp); \
|
||||
register uint16_t t_s = (uint16_t)(s); \
|
||||
register uint8_t *t_cp = (uint8_t *)(cp); \
|
||||
*t_cp++ = t_s >> 8; \
|
||||
*t_cp = t_s; \
|
||||
(cp) += 2; \
|
||||
}
|
||||
|
||||
#define SDP_PUT32(l, cp) { \
|
||||
register u_int32_t t_l = (u_int32_t)(l); \
|
||||
register u_int8_t *t_cp = (u_int8_t *)(cp); \
|
||||
register uint32_t t_l = (uint32_t)(l); \
|
||||
register uint8_t *t_cp = (uint8_t *)(cp); \
|
||||
*t_cp++ = t_l >> 24; \
|
||||
*t_cp++ = t_l >> 16; \
|
||||
*t_cp++ = t_l >> 8; \
|
||||
@ -399,8 +411,8 @@ typedef struct sdp_attr * sdp_attr_p;
|
||||
}
|
||||
|
||||
#define SDP_PUT64(l, cp) { \
|
||||
register u_int64_t t_l = (u_int64_t)(l); \
|
||||
register u_int8_t *t_cp = (u_int8_t *)(cp); \
|
||||
register uint64_t t_l = (uint64_t)(l); \
|
||||
register uint8_t *t_cp = (uint8_t *)(cp); \
|
||||
*t_cp++ = t_l >> 56; \
|
||||
*t_cp++ = t_l >> 48; \
|
||||
*t_cp++ = t_l >> 40; \
|
||||
@ -414,7 +426,7 @@ typedef struct sdp_attr * sdp_attr_p;
|
||||
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
#define SDP_PUT128(l, cp) { \
|
||||
register u_int8_t *t_cp = (u_int8_t *)(cp); \
|
||||
register uint8_t *t_cp = (uint8_t *)(cp); \
|
||||
*t_cp++ = (l)->b[15]; \
|
||||
*t_cp++ = (l)->b[14]; \
|
||||
*t_cp++ = (l)->b[13]; \
|
||||
@ -435,7 +447,7 @@ typedef struct sdp_attr * sdp_attr_p;
|
||||
}
|
||||
#else /* BYTE_ORDER != LITTLE_ENDIAN */
|
||||
#define SDP_PUT128(l, cp) { \
|
||||
register u_int8_t *t_cp = (u_int8_t *)(cp); \
|
||||
register uint8_t *t_cp = (uint8_t *)(cp); \
|
||||
*t_cp++ = (l)->b[0]; \
|
||||
*t_cp++ = (l)->b[1]; \
|
||||
*t_cp++ = (l)->b[2]; \
|
||||
@ -462,14 +474,83 @@ int32_t sdp_close (void *xs);
|
||||
int32_t sdp_error (void *xs);
|
||||
|
||||
int32_t sdp_search (void *xs,
|
||||
u_int32_t plen, u_int16_t const *pp,
|
||||
u_int32_t alen, u_int32_t const *ap,
|
||||
u_int32_t vlen, sdp_attr_t *vp);
|
||||
uint32_t plen, uint16_t const *pp,
|
||||
uint32_t alen, uint32_t const *ap,
|
||||
uint32_t vlen, sdp_attr_t *vp);
|
||||
|
||||
char const * const sdp_attr2desc (u_int16_t attr);
|
||||
char const * const sdp_uuid2desc (u_int16_t uuid);
|
||||
void sdp_print (u_int32_t level, u_int8_t const *start,
|
||||
u_int8_t const *end);
|
||||
char const * const sdp_attr2desc (uint16_t attr);
|
||||
char const * const sdp_uuid2desc (uint16_t uuid);
|
||||
void sdp_print (uint32_t level, uint8_t const *start,
|
||||
uint8_t const *end);
|
||||
|
||||
/******************************************************************************
|
||||
* sdpd interface and Bluetooth profiles data
|
||||
*****************************************************************************/
|
||||
|
||||
#define SDP_LOCAL_PATH "/var/run/sdp"
|
||||
#define SDP_LOCAL_MTU 4096
|
||||
|
||||
struct sdp_dun_profile
|
||||
{
|
||||
uint8_t server_channel;
|
||||
uint8_t audio_feedback_support;
|
||||
uint8_t reserved[2];
|
||||
};
|
||||
typedef struct sdp_dun_profile sdp_dun_profile_t;
|
||||
typedef struct sdp_dun_profile * sdp_dun_profile_p;
|
||||
|
||||
struct sdp_ftrn_profile
|
||||
{
|
||||
uint8_t server_channel;
|
||||
uint8_t reserved[3];
|
||||
};
|
||||
typedef struct sdp_ftrn_profile sdp_ftrn_profile_t;
|
||||
typedef struct sdp_ftrn_profile * sdp_ftrn_profile_p;
|
||||
|
||||
struct sdp_irmc_profile
|
||||
{
|
||||
uint8_t server_channel;
|
||||
uint8_t supported_formats_size;
|
||||
uint8_t supported_formats[30];
|
||||
};
|
||||
typedef struct sdp_irmc_profile sdp_irmc_profile_t;
|
||||
typedef struct sdp_irmc_profile * sdp_irmc_profile_p;
|
||||
|
||||
struct sdp_irmc_command_profile
|
||||
{
|
||||
uint8_t server_channel;
|
||||
uint8_t reserved[3];
|
||||
};
|
||||
typedef struct sdp_irmc_command_profile sdp_irmc_command_profile_t;
|
||||
typedef struct sdp_irmc_command_profile * sdp_irmc_command_profile_p;
|
||||
|
||||
struct sdp_lan_profile
|
||||
{
|
||||
uint8_t server_channel;
|
||||
uint8_t load_factor;
|
||||
uint8_t reserved;
|
||||
uint8_t ip_subnet_radius;
|
||||
uint32_t ip_subnet;
|
||||
};
|
||||
typedef struct sdp_lan_profile sdp_lan_profile_t;
|
||||
typedef struct sdp_lan_profile * sdp_lan_profile_p;
|
||||
|
||||
struct sdp_opush_profile
|
||||
{
|
||||
uint8_t server_channel;
|
||||
uint8_t supported_formats_size;
|
||||
uint8_t supported_formats[30];
|
||||
};
|
||||
typedef struct sdp_opush_profile sdp_opush_profile_t;
|
||||
typedef struct sdp_opush_profile * sdp_opush_profile_p;
|
||||
|
||||
struct sdp_sp_profile
|
||||
{
|
||||
uint8_t server_channel;
|
||||
uint8_t reserved[3];
|
||||
};
|
||||
typedef struct sdp_sp_profile sdp_sp_profile_t;
|
||||
typedef struct sdp_sp_profile * sdp_sp_profile_p;
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
@ -44,17 +44,17 @@
|
||||
|
||||
int32_t
|
||||
sdp_search(void *xss,
|
||||
u_int32_t plen, u_int16_t const *pp,
|
||||
u_int32_t alen, u_int32_t const *ap,
|
||||
u_int32_t vlen, sdp_attr_t *vp)
|
||||
uint32_t plen, uint16_t const *pp,
|
||||
uint32_t alen, uint32_t const *ap,
|
||||
uint32_t vlen, sdp_attr_t *vp)
|
||||
{
|
||||
struct sdp_xpdu {
|
||||
sdp_pdu_t pdu;
|
||||
u_int16_t len;
|
||||
uint16_t len;
|
||||
} __attribute__ ((packed)) xpdu;
|
||||
|
||||
sdp_session_p ss = (sdp_session_p) xss;
|
||||
u_int8_t *req = NULL, *rsp = NULL, *rsp_tmp = NULL;
|
||||
uint8_t *req = NULL, *rsp = NULL, *rsp_tmp = NULL;
|
||||
int32_t type, len;
|
||||
|
||||
if (ss == NULL)
|
||||
@ -71,11 +71,11 @@ sdp_search(void *xss,
|
||||
plen = plen * (sizeof(pp[0]) + 1);
|
||||
alen = alen * (sizeof(ap[0]) + 1);
|
||||
|
||||
len = plen + sizeof(u_int8_t) + sizeof(u_int16_t) +
|
||||
len = plen + sizeof(uint8_t) + sizeof(uint16_t) +
|
||||
/* ServiceSearchPattern */
|
||||
sizeof(u_int16_t) +
|
||||
sizeof(uint16_t) +
|
||||
/* MaximumAttributeByteCount */
|
||||
alen + sizeof(u_int8_t) + sizeof(u_int16_t);
|
||||
alen + sizeof(uint8_t) + sizeof(uint16_t);
|
||||
/* AttributeIDList */
|
||||
|
||||
if (ss->req_e - req < len) {
|
||||
@ -108,7 +108,7 @@ sdp_search(void *xss,
|
||||
|
||||
do {
|
||||
struct iovec iov[2];
|
||||
u_int8_t *req_cs = req;
|
||||
uint8_t *req_cs = req;
|
||||
|
||||
/* Add continuation state (if any) */
|
||||
if (ss->req_e - req_cs < ss->cslen + 1) {
|
||||
@ -182,7 +182,7 @@ sdp_search(void *xss,
|
||||
*/
|
||||
|
||||
if (ss->rsp_e - rsp <= ss->imtu) {
|
||||
u_int32_t size, offset;
|
||||
uint32_t size, offset;
|
||||
|
||||
size = ss->rsp_e - ss->rsp + ss->imtu;
|
||||
offset = rsp - ss->rsp;
|
||||
@ -295,57 +295,57 @@ sdp_search(void *xss,
|
||||
case SDP_DATA_UINT8:
|
||||
case SDP_DATA_INT8:
|
||||
case SDP_DATA_BOOL:
|
||||
alen = sizeof(u_int8_t);
|
||||
alen = sizeof(uint8_t);
|
||||
break;
|
||||
|
||||
case SDP_DATA_UINT16:
|
||||
case SDP_DATA_INT16:
|
||||
case SDP_DATA_UUID16:
|
||||
alen = sizeof(u_int16_t);
|
||||
alen = sizeof(uint16_t);
|
||||
break;
|
||||
|
||||
case SDP_DATA_UINT32:
|
||||
case SDP_DATA_INT32:
|
||||
case SDP_DATA_UUID32:
|
||||
alen = sizeof(u_int32_t);
|
||||
alen = sizeof(uint32_t);
|
||||
break;
|
||||
|
||||
case SDP_DATA_UINT64:
|
||||
case SDP_DATA_INT64:
|
||||
alen = sizeof(u_int64_t);
|
||||
alen = sizeof(uint64_t);
|
||||
break;
|
||||
|
||||
case SDP_DATA_UINT128:
|
||||
case SDP_DATA_INT128:
|
||||
case SDP_DATA_UUID128:
|
||||
alen = sizeof(u_int128_t);
|
||||
alen = sizeof(uint128_t);
|
||||
break;
|
||||
|
||||
case SDP_DATA_STR8:
|
||||
case SDP_DATA_URL8:
|
||||
case SDP_DATA_SEQ8:
|
||||
case SDP_DATA_ALT8:
|
||||
alen = rsp_tmp[1] + sizeof(u_int8_t);
|
||||
alen = rsp_tmp[1] + sizeof(uint8_t);
|
||||
break;
|
||||
|
||||
case SDP_DATA_STR16:
|
||||
case SDP_DATA_URL16:
|
||||
case SDP_DATA_SEQ16:
|
||||
case SDP_DATA_ALT16:
|
||||
alen = ((u_int16_t)rsp_tmp[1] << 8)
|
||||
| ((u_int16_t)rsp_tmp[2]);
|
||||
alen += sizeof(u_int16_t);
|
||||
alen = ((uint16_t)rsp_tmp[1] << 8)
|
||||
| ((uint16_t)rsp_tmp[2]);
|
||||
alen += sizeof(uint16_t);
|
||||
break;
|
||||
|
||||
case SDP_DATA_STR32:
|
||||
case SDP_DATA_URL32:
|
||||
case SDP_DATA_SEQ32:
|
||||
case SDP_DATA_ALT32:
|
||||
alen = ((u_int32_t)rsp_tmp[1] << 24)
|
||||
| ((u_int32_t)rsp_tmp[2] << 16)
|
||||
| ((u_int32_t)rsp_tmp[3] << 8)
|
||||
| ((u_int32_t)rsp_tmp[4]);
|
||||
alen += sizeof(u_int32_t);
|
||||
alen = ((uint32_t)rsp_tmp[1] << 24)
|
||||
| ((uint32_t)rsp_tmp[2] << 16)
|
||||
| ((uint32_t)rsp_tmp[3] << 8)
|
||||
| ((uint32_t)rsp_tmp[4]);
|
||||
alen += sizeof(uint32_t);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -354,7 +354,7 @@ sdp_search(void *xss,
|
||||
/* NOT REACHED */
|
||||
}
|
||||
|
||||
alen += sizeof(u_int8_t);
|
||||
alen += sizeof(uint8_t);
|
||||
|
||||
if (vp->value != NULL) {
|
||||
if (alen <= vp->vlen) {
|
||||
@ -368,7 +368,7 @@ sdp_search(void *xss,
|
||||
vp->flags = SDP_ATTR_INVALID;
|
||||
|
||||
len -= (
|
||||
sizeof(u_int8_t) + sizeof(u_int16_t) +
|
||||
sizeof(uint8_t) + sizeof(uint16_t) +
|
||||
alen
|
||||
);
|
||||
|
||||
|
@ -118,7 +118,7 @@ sdp_open_local(void)
|
||||
|
||||
sa.sun_len = sizeof(sa);
|
||||
sa.sun_family = AF_UNIX;
|
||||
strlcpy(sa.sun_path, SDP_UNSOCK_PATH, sizeof(sa.sun_path));
|
||||
strlcpy(sa.sun_path, SDP_LOCAL_PATH, sizeof(sa.sun_path));
|
||||
|
||||
if (connect(ss->s, (struct sockaddr *) &sa, sizeof(sa)) < 0) {
|
||||
ss->error = errno;
|
||||
@ -126,7 +126,7 @@ sdp_open_local(void)
|
||||
}
|
||||
|
||||
ss->flags |= SDP_SESSION_LOCAL;
|
||||
ss->imtu = ss->omtu = SDP_UNSOCK_MTU;
|
||||
ss->imtu = ss->omtu = SDP_LOCAL_MTU;
|
||||
|
||||
if ((ss->req = malloc(ss->omtu)) == NULL) {
|
||||
ss->error = ENOMEM;
|
||||
|
@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
struct sdp_attr_desc {
|
||||
u_int32_t attr;
|
||||
uint32_t attr;
|
||||
char const *desc;
|
||||
};
|
||||
typedef struct sdp_attr_desc sdp_attr_desc_t;
|
||||
@ -244,7 +244,7 @@ static sdp_attr_desc_t sdp_attrs_desc[] = {
|
||||
};
|
||||
|
||||
char const * const
|
||||
sdp_attr2desc(u_int16_t attr)
|
||||
sdp_attr2desc(uint16_t attr)
|
||||
{
|
||||
register sdp_attr_desc_p a = sdp_attrs_desc;
|
||||
|
||||
@ -256,7 +256,7 @@ sdp_attr2desc(u_int16_t attr)
|
||||
}
|
||||
|
||||
char const * const
|
||||
sdp_uuid2desc(u_int16_t uuid)
|
||||
sdp_uuid2desc(uint16_t uuid)
|
||||
{
|
||||
register sdp_attr_desc_p a = sdp_uuids_desc;
|
||||
|
||||
@ -268,7 +268,7 @@ sdp_uuid2desc(u_int16_t uuid)
|
||||
}
|
||||
|
||||
void
|
||||
sdp_print(u_int32_t level, u_int8_t const *start, u_int8_t const *end)
|
||||
sdp_print(uint32_t level, uint8_t const *start, uint8_t const *end)
|
||||
{
|
||||
union {
|
||||
int8_t int8;
|
||||
@ -281,8 +281,8 @@ sdp_print(u_int32_t level, u_int8_t const *start, u_int8_t const *end)
|
||||
uint32_t uint32;
|
||||
uint64_t uint64;
|
||||
} value;
|
||||
u_int8_t type;
|
||||
u_int32_t i;
|
||||
uint8_t type;
|
||||
uint32_t i;
|
||||
|
||||
if (start == NULL || end == NULL)
|
||||
return;
|
||||
@ -320,12 +320,12 @@ sdp_print(u_int32_t level, u_int8_t const *start, u_int8_t const *end)
|
||||
case SDP_DATA_UUID128:
|
||||
SDP_GET128(&value.int128, start);
|
||||
printf("int128/uuid128 %#8.8x-%4.4x-%4.4x-%4.4x-%4.4x%8.8x\n",
|
||||
*(u_int32_t *)&value.int128.b[0],
|
||||
*(u_int16_t *)&value.int128.b[4],
|
||||
*(u_int16_t *)&value.int128.b[6],
|
||||
*(u_int16_t *)&value.int128.b[8],
|
||||
*(u_int16_t *)&value.int128.b[10],
|
||||
*(u_int32_t *)&value.int128.b[12]);
|
||||
*(uint32_t *)&value.int128.b[0],
|
||||
*(uint16_t *)&value.int128.b[4],
|
||||
*(uint16_t *)&value.int128.b[6],
|
||||
*(uint16_t *)&value.int128.b[8],
|
||||
*(uint16_t *)&value.int128.b[10],
|
||||
*(uint32_t *)&value.int128.b[12]);
|
||||
break;
|
||||
|
||||
case SDP_DATA_INT8:
|
||||
|
Loading…
Reference in New Issue
Block a user