|
From: Mats F. <ma...@us...> - 2001-02-27 15:31:08
|
The following files were modified in apps/bluetooth/sdp_server: Name Old version New version Comment ---- ----------- ----------- ------- sdp_parser.c 1.8 1.9=20=20=20=20=20=20=20=20=20=20=20=20=20 sdp_server.c 1.16 1.17=20=20=20=20=20=20=20=20=20=20=20=20 sdp_server.h 1.6 1.7=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Fixed problem with to many DES in SA response Fixed problem with multiple services Fixed problem with return of empty attribute in SSA response |
|
From: Peter K. <pk...@us...> - 2001-03-26 11:28:45
|
The following files were modified in apps/bluetooth/sdp_server:
Name Old version New version Comment
---- ----------- ----------- -------
sdp_parser.c 1.14 1.15=20=20=20=20=20=20=20=20=20=20=20=20
sdp_server.c 1.18 1.19=20=20=20=20=20=20=20=20=20=20=20=20
sdp_server.h 1.7 1.8=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Cleaned up debugging.
The diff of the modified file(s):
--- sdp_parser.c 2001/03/23 16:19:36 1.14
+++ sdp_parser.c 2001/03/26 11:28:41 1.15
@@ -64,49 +64,49 @@
#define SDP_DEBUG_MISC 0
#define SDP_DEBUG_MEM 0
#define SDP_DEBUG_PROC 0
-#define SDP_PRINT_DATA 0
+#define SDP_DEBUG_PRINT_DATA 0
=20
#ifdef BTD_USERSTACK
-#define syslog(x, fmt...) printf(fmt)
+#define syslog(x, fmt...) do { fprintf(stderr, __FILE__ "::"); fprintf(std=
err, fmt); fprintf(stderr, "\n"); } while (0)
#endif
=20
#if SDP_DEBUG_XMIT
-#define D_XMIT(fmt...) syslog(LOG_DEBUG, fmt)
+#define D_XMIT(fmt...) syslog(LOG_DEBUG, __FUNCTION__ ": " fmt)
#else
#define D_XMIT(fmt...)
#endif
=20
#if SDP_DEBUG_REC
-#define D_REC(fmt...) syslog(LOG_DEBUG, fmt)
+#define D_REC(fmt...) syslog(LOG_DEBUG, __FUNCTION__ ": " fmt)
#else
#define D_REC(fmt...)
#endif
=20
#if SDP_DEBUG_MISC
-#define D_MISC(fmt...) syslog(LOG_DEBUG, fmt)
+#define D_MISC(fmt...) syslog(LOG_DEBUG, __FUNCTION__ ": " fmt)
#else
#define D_MISC(fmt...)
#endif
=20
#if SDP_DEBUG_MEM
-#define D_MEM(fmt...) syslog(LOG_DEBUG, fmt)
+#define D_MEM(fmt...) syslog(LOG_DEBUG, __FUNCTION__ ": " fmt)
#else
#define D_MEM(fmt...)
#endif
=20
#if SDP_DEBUG_PROC
-#define D_PROC(fmt...) syslog(LOG_DEBUG, fmt)
+#define D_PROC(fmt...) syslog(LOG_DEBUG, __FUNCTION__ ": " fmt)
#else
#define D_PROC(fmt...)
#endif
=20
-#if SDP_PRINT_DATA
-#define PRINTPKT(str, data, len) print_data(str, data, len)
+#if SDP_DEBUG_PRINT_DATA
+#define PRINT_DATA(str, data, len) print_data(str, data, len)
#else
-#define PRINTPKT(str, data, len)
+#define PRINT_DATA(str, data, len)
#endif
=20
-#define D_ERR(fmt...) printf("ERROR :" fmt)
+#define D_ERR(fmt...) do { fprintf(stderr, __FUNCTION__ ": ERROR: " fmt); =
fprintf(stderr, "\n"); } while (0)
=20
#define GET_TYPE(ch) (((ch) >> 3) & 0x1f)
#define GET_SIZE(ch) ((ch) & 0x7)
@@ -156,7 +156,6 @@
void=20
sdp_parse_data(unsigned char* data, unsigned int len)
{
-#define FNC "sdp_parse_data: "
unsigned char id;
unsigned short trans_id;
unsigned short par_len;
@@ -164,7 +163,7 @@
int sdp_con_id;
data_struct *db_hdl;
=20
- PRINTPKT(FNC, data, len);=20=20
+ PRINT_DATA(__FUNCTION__, data, len);
=20
db_hdl =3D (data_struct*)data;
data +=3D sizeof *db_hdl;
@@ -179,12 +178,13 @@
=20
if (par_len > (len - SDP_HDR_SIZE))
{
- D_XMIT(FNC"Packet length does not match received data length par_len %=
d, pkt_len %d\n", par_len, len);
+ D_XMIT("Packet length (%d) does not match received data length (%d)",
+ len - SDP_HDR_SIZE, par_len);
send_error_rsp(sdp_con_id, trans_id, SDP_INVALID_PDU_SIZE);
return;
}
=20
- D_REC(FNC"id:0x%x, trans_id:0x%x, par_len:%d\n", id, trans_id,par_len);
+ D_REC("id: 0x%x, trans_id: 0x%x, par_len: %d", id, trans_id, par_len);
=20
switch (id)
{
@@ -192,73 +192,71 @@
switch (CHAR2INT16(data[5], data[6]))
{
case SDP_INVALID_SDP_VERSION:
- D_ERR(FNC"Got Invalid/unsupported SDP version\n");
+ D_ERR("Got Invalid/unsupported SDP version");
break;
case SDP_INVALID_SERVICE_RECORD_HANDLE:
- D_ERR(FNC"Got Invalid Service Record Handle\n");
+ D_ERR("Got Invalid Service Record Handle");
break;
case SDP_INVALID_REQUEST_SYNTAX:
- D_ERR(FNC"Got Invalid Request Syntax\n");
+ D_ERR("Got Invalid Request Syntax");
break;
case SDP_INVALID_PDU_SIZE:
- D_ERR(FNC"Got Invalid PDU Size\n");
+ D_ERR("Got Invalid PDU Size");
break;
case SDP_INVALID_CONTINUATION_STATE:
- D_ERR(FNC"Got Invalid Continuation State\n");
+ D_ERR("Got Invalid Continuation State");
break;
case SDP_INSUFFICIENT_RESOURCES:
- D_ERR(FNC"Got Insufficient Resources to satisfy Request\n");
+ D_ERR("Got Insufficient Resources to satisfy Request");
break;
default:
- D_ERR(FNC" Error code 0x%04x is not specified\n",
+ D_ERR("Error code 0x%04x is not specified",
CHAR2INT16(data[5], data[6]));
break;
}
break;
=20=09=09
case SDP_SERVICESEARCH_REQ:
- D_REC(FNC"SDP_SERVICESEARCH_REQ %d bytes\n", par_len);
+ D_REC("SDP_SERVICESEARCH_REQ %d bytes", par_len);
process_service_search_req(sdp_con_id, data + 5, par_len, trans_id);
break;
=20=20=20=20=20
case SDP_SERVICESEARCH_RSP:
- D_REC(FNC"SDP_SERVICESEARCH_RSP\n");
+ D_REC("SDP_SERVICESEARCH_RSP");
process_service_search_rsp(sdp_con_id, data + 5);
break;
=20=20=20=20=20
case SDP_SERVICEATTR_REQ:
- D_REC(FNC"SDP_SERVICEATTR_REQ\n");
+ D_REC("SDP_SERVICEATTR_REQ");
process_service_attr_req(sdp_con_id, data + 5, par_len, trans_id);
break;
=20=20=20=20=20
case SDP_SERVICEATTR_RSP:
- D_REC(FNC"SDP_SERVICEATTR_RSP\n");
+ D_REC("SDP_SERVICEATTR_RSP");
process_service_attr_rsp(sdp_con_id, data + 5);
break;
=20=20=20=20=20
case SDP_SERVICESEARCHATTR_REQ:
- D_REC(FNC"SDP_SERVICESEARCHATTR_REQ\n");
+ D_REC("SDP_SERVICESEARCHATTR_REQ");
process_service_search_attr_req(sdp_con_id, data + 5, par_len, trans_i=
d);
break;
=20=20=20=20=20
case SDP_SERVICESEARCHATTR_RSP:
- D_REC(FNC"SDP_SERVICESEARCHATTR_RSP\n");
+ D_REC("SDP_SERVICESEARCHATTR_RSP");
process_service_search_attr_rsp(sdp_con_id, data + 5);
break;
=20=20=20=20=20
default:
- D_REC(FNC"ERROR Invalid pdu type\n");
+ D_REC("ERROR Invalid pdu type");
/* Send an error response with error code Invalid request syntax */
send_error_rsp(sdp_con_id, trans_id, SDP_INVALID_REQUEST_SYNTAX);
break;
}
-#undef FNC
}
=20
void
process_service_search_req(int sdp_con_id, unsigned char *data, unsigned s=
hort len, unsigned int trans_id)
{
-#define FNC "process_service_search_req: "
unsigned int service_search_uuid[12];
int service_search_uuid_cnt;
unsigned char des_len;
@@ -267,10 +265,10 @@
int new_pos[1];
int cont_state_len;
=20=09
- D_REC(FNC"got %d bytes\n", len);
+ D_REC("Got %d bytes", len);
if (GET_TYPE(data[cur_pos]) !=3D DES_TYPE)
{
- D_REC(FNC"Incorrect packet: Data Element Sequence expected\n");
+ D_REC("Incorrect packet: Data Element Sequence expected");
/* Send an error msg with error code Invalid request syntax */
send_error_rsp(sdp_con_id, trans_id, SDP_INVALID_REQUEST_SYNTAX);
return;
@@ -278,11 +276,11 @@
=20
des_len =3D get_size(data + cur_pos, new_pos);
cur_pos +=3D *new_pos;
- D_MISC(FNC"des_len: %d, new_pos:%d\n",des_len, *new_pos);
+ D_MISC("des_len: %d, new_pos: %d", des_len, *new_pos);
=20=09
if (des_len > (len - DES_HDR_LEN))
{
- D_REC(FNC"Incorrect packet: Incorrect length field or whole packet was=
not received\n");
+ D_REC("Incorrect packet: Incorrect length field or whole packet was no=
t received");
/* Send an error msg with error code Invalid request syntax */
send_error_rsp(sdp_con_id, trans_id, SDP_INVALID_REQUEST_SYNTAX);
return;
@@ -294,9 +292,8 @@
{
if (i >=3D 12)
{
- D_REC(FNC"More than 12 UUID in one request\n");
- /* Send an error msg with error code Invalid request
- syntax */
+ D_REC("More than 12 UUID in one request");
+ /* Send an error msg with error code Invalid request syntax */
send_error_rsp(sdp_con_id, trans_id, SDP_INVALID_REQUEST_SYNTAX);
break;
}
@@ -305,8 +302,7 @@
{
service_search_uuid[i] =3D CHAR2INT16(data[cur_pos + 1],
data[cur_pos + 2]);
- D_MISC(FNC"Found UUID16 0x%04x\n",
- service_search_uuid[i]);=20
+ D_MISC("Found UUID16 0x%04x", service_search_uuid[i]);=20
i +=3D 1;
tmp_pos +=3D 3;
cur_pos +=3D 3;
@@ -316,8 +312,7 @@
cur_pos +=3D 2;
service_search_uuid[i] =3D CHAR2INT16(data[cur_pos + 1],
data[cur_pos + 2]);
- D_MISC(FNC"Found UUID32 0x%08x\n",
- service_search_uuid[i]);=20
+ D_MISC("Found UUID32 0x%08x", service_search_uuid[i]);=20
i +=3D 1;
tmp_pos +=3D 5;
cur_pos +=3D 3;
@@ -327,16 +322,15 @@
cur_pos +=3D 2;
service_search_uuid[i] =3D CHAR2INT16(data[cur_pos + 1],
data[cur_pos + 2]);
- D_MISC(FNC"Got Service class 0x%08x\n", service_search_uuid[i]);
+ D_MISC("Got Service class 0x%08x", service_search_uuid[i]);
i +=3D 1;
tmp_pos +=3D 17;
cur_pos +=3D 15;
}
else
{
- D_REC(FNC"Unknown UUID size 0x%02x\n",data[cur_pos]);
- /* Send an error msg with error code Invalid request
- syntax */
+ D_REC("Unknown UUID size 0x%02x", data[cur_pos]);
+ /* Send an error msg with error code Invalid request syntax */
send_error_rsp(sdp_con_id, trans_id, SDP_INVALID_REQUEST_SYNTAX);
return;
}
@@ -344,7 +338,7 @@
service_search_uuid_cnt =3D i;
=20
max_rec_cnt =3D CHAR2INT16(data[cur_pos], data[cur_pos + 1]);
- D_MISC(FNC"max_rec_cnt: %d\n", max_rec_cnt);
+ D_MISC("max_rec_cnt: %d", max_rec_cnt);
cur_pos +=3D 2;
=20
cont_state_len =3D data[cur_pos];
@@ -353,13 +347,13 @@
=20
if (len < cur_pos)
{
- D_ERR(__FUNCTION__", packet len shorter than actual packet lengthlen:%=
d cur_pos:%d\n", len, cur_pos);
+ D_ERR("Packet length (%d) shorter than actual packet length (%d)", len=
, cur_pos);
send_error_rsp(sdp_con_id, trans_id, SDP_INVALID_PDU_SIZE);
return;
}
else if (len > cur_pos)
{
- D_ERR(__FUNCTION__", packet len longer than actual packet length len:%=
d cur_pos:%d\n", len, cur_pos);
+ D_ERR("Packet length (%d) longer than actual packet length (%d)", len,=
cur_pos);
send_error_rsp(sdp_con_id, trans_id, SDP_INVALID_PDU_SIZE);
return;
}
@@ -368,7 +362,7 @@
{
cur_pos +=3D data[cur_pos];
=20=20=20=20=20
- D_MISC(FNC"Sending continuationstate packet\n");
+ D_MISC("Sending continuationstate packet");
send_cont_state_search_rsp(cont_state_len, data + cur_pos, max_rec_cnt,
sdp_con_id, trans_id);
}
@@ -388,13 +382,11 @@
/* Here we ask the database for the requested attributes */
handle_query(&db_hdl.db);
}
-#undef FNC
}
=20
void=20
process_service_attr_req(int sdp_con_id, unsigned char *data, unsigned sho=
rt len, int trans_id)
{
-#define FNC "process_service_attr_req: "
service_attr_struct *db_hdl;
=20=09
int tmp_len, cur_pos =3D 0;
@@ -409,21 +401,21 @@
=20=20=20
int new_pos[1];
=20
- D_REC(FNC"got %d bytes\n", len);
+ D_REC("Got %d bytes", len);
=20
rec_hdl =3D CHAR2INT32(data[cur_pos], data[cur_pos + 1],
data[cur_pos + 2], data[cur_pos + 3]);
=20
- D_MISC(FNC"rec_hdl: 0x%08x\n",rec_hdl);
+ D_MISC("rec_hdl: 0x%08x", rec_hdl);
cur_pos +=3D 4;
=20
max_attr_cnt =3D CHAR2INT16(data[cur_pos], data[cur_pos + 1]);
- D_MISC(FNC"max_attr_cnt: %d\n",max_attr_cnt);
+ D_MISC("max_attr_cnt: %d", max_attr_cnt);
cur_pos +=3D 2;
=20
if (GET_TYPE(data[cur_pos]) !=3D DES_TYPE)
{
- D_REC(FNC"Incorrect packet: Data Element Sequence expected\n");
+ D_REC("Incorrect packet: Data Element Sequence expected");
/* Send an error msg with error code Invalid request syntax */
send_error_rsp(sdp_con_id, trans_id, SDP_INVALID_REQUEST_SYNTAX);
return;
@@ -431,11 +423,11 @@
=20
des_len =3D get_size(data + cur_pos, new_pos);
cur_pos +=3D *new_pos;
- D_MISC(FNC"des_len: %d, new_pos:%d\n",des_len, *new_pos);
+ D_MISC("des_len: %d, new_pos: %d", des_len, *new_pos);
=20=09
if (des_len > (len - DES_HDR_LEN))
{
- D_REC(FNC"Incorrect packet: Incorrect length field or whole packet was=
not received\n");
+ D_REC("Incorrect packet: Incorrect length field or whole packet was no=
t received");
/* Send an error msg with error code Invalid request syntax */
send_error_rsp(sdp_con_id, trans_id, SDP_INVALID_REQUEST_SYNTAX);
return;
@@ -448,7 +440,7 @@
{
/* Get the length of the data element */
tmp_len =3D get_size(data + cur_pos, new_pos);
- D_MISC(FNC"tmp_len: %d, new_pos: %d\n", tmp_len, *new_pos);
+ D_MISC("tmp_len: %d, new_pos: %d", tmp_len, *new_pos);
/* Move the data pointer past the length field to the start of
the data element */
cur_pos +=3D *new_pos;
@@ -456,8 +448,7 @@
{
/* Now we got a range of attributes */
attr_list[attr_list_pos] =3D CHAR2INT32(data[cur_pos], data[cur_pos =
+ 1], data[cur_pos + 2], data[cur_pos + 3]);
- D_MISC(FNC"Found range of attributes: 0x%08x\n",
- attr_list[attr_list_pos]);=20
+ D_MISC("Found range of attributes: 0x%08x", attr_list[attr_list_pos]=
);=20
cur_pos +=3D 4;
attr_list_pos +=3D 1;
}
@@ -467,8 +458,7 @@
attr_list[attr_list_pos] =3D CHAR2INT16(data[cur_pos], data[cur_pos =
+ 1]);
/* We stor all attributes as ranges */
attr_list[attr_list_pos] |=3D attr_list[attr_list_pos] << 16;
- D_MISC(FNC"Found single attributes: 0x%04x\n",
- attr_list[attr_list_pos]);=20
+ D_MISC("Found single attributes: 0x%04x", attr_list[attr_list_pos]);=
=20
cur_pos +=3D 2;
attr_list_pos +=3D 1;=09
}
@@ -480,20 +470,20 @@
=20
if (len < cur_pos)
{
- D_ERR(__FUNCTION__", packet len shorter than actual packet lengthlen:%=
d cur_pos:%d\n", len, cur_pos);
+ D_ERR("Packet length (%d) shorter than actual packet length (%d)", len=
, cur_pos);
send_error_rsp(sdp_con_id, trans_id, SDP_INVALID_PDU_SIZE);
return;
}
else if (len > cur_pos)
{
- D_ERR(__FUNCTION__", packet len longer than actual packet length len:%=
d cur_pos:%d\n", len, cur_pos);
+ D_ERR("Packet length (%d) longer than actual packet length (%d)", len,=
cur_pos);
send_error_rsp(sdp_con_id, trans_id, SDP_INVALID_PDU_SIZE);
return;
}
=20=20=20
if (cont_state_len)
{
- D_MISC(FNC"Sending continuationstate packet\n");
+ D_MISC("Sending continuationstate packet");
send_cont_state_attr_rsp(cont_state_len, data + cur_pos, max_attr_cnt,
sdp_con_id, trans_id);
}
@@ -502,12 +492,12 @@
len =3D sizeof(service_attr_struct) + attr_list_pos * sizeof *attr_lis=
t;
=20=09
if (!(db_hdl =3D malloc(len))) {
- D_ERR(__FUNCTION__ ": malloc failed to allocate %d bytes!\n", =
len);
+ D_ERR("malloc failed to allocate %d bytes!", len);
send_error_rsp(sdp_con_id, trans_id, SDP_INSUFFICIENT_RESOURCE=
S);
return;
}
=20
- D_MEM("---> malloc%d %d bytes at 0x%08x\n", malloc_dbg++, len, (int)db=
_hdl);
+ D_MEM("---> malloc%d %d bytes at 0x%08x", malloc_dbg++, len, (int)db_h=
dl);
=20=20=20=20=20
db_hdl->db.sdp_con_id =3D sdp_con_id;
db_hdl->db.trans_id =3D trans_id;
@@ -522,19 +512,15 @@
=20
handle_query(&db_hdl->db);
=20=20=20=20=20
- D_MEM("<--- free%d 0x%08x\n", malloc_dbg--, (int) db_hdl);
+ D_MEM("<--- free%d 0x%08x", --malloc_dbg, (int) db_hdl);
free(db_hdl);
}
-=09
-#undef FNC
}
=20
void=20
process_service_search_attr_req(int sdp_con_id, unsigned char *data, unsig=
ned short len,int trans_id)
{
-#define FNC "process_service_search_attr_req: "
service_search_attr_struct *db_hdl;
-=09
unsigned int service_search_uuid[12];
int service_search_uuid_cnt;
unsigned char des_len;
@@ -543,14 +529,12 @@
int new_pos[1];
unsigned int attr_list[256];
int attr_list_pos =3D 0;
-
unsigned char cont_state_len;
-
=20
- D_REC(FNC"got %d bytes\n", len);
+ D_REC("Got %d bytes", len);
if (GET_TYPE(data[cur_pos]) !=3D DES_TYPE)
{
- D_REC(FNC"Incorrect packet: Data Element Sequence expected\n");
+ D_REC("Incorrect packet: Data Element Sequence expected");
/* Send an error msg with error code Invalid request syntax */
send_error_rsp(sdp_con_id, trans_id, SDP_INVALID_REQUEST_SYNTAX);
return;
@@ -558,11 +542,11 @@
=20
des_len =3D get_size(data + cur_pos, new_pos);
cur_pos +=3D *new_pos;
- D_MISC(FNC"des_len: %d, new_pos:%d\n",des_len, *new_pos);
+ D_MISC("des_len: %d, new_pos: %d", des_len, *new_pos);
=20=09
if (des_len > (len - DES_HDR_LEN))
{
- D_REC(FNC"Incorrect packet: Incorrect length field or whole packet was=
not received\n");
+ D_REC("Incorrect packet: Incorrect length field or whole packet was no=
t received");
/* Send an error msg with error code Invalid request syntax */
send_error_rsp(sdp_con_id, trans_id, SDP_INVALID_REQUEST_SYNTAX);
return;
@@ -574,7 +558,7 @@
{
if (i >=3D 12)
{
- D_REC(FNC"More than 12 UUID in one request\n");
+ D_REC("More than 12 UUID in one request");
break;
}
=20=09=09
@@ -582,7 +566,7 @@
{
service_search_uuid[i] =3D CHAR2INT16(data[cur_pos + 1],
data[cur_pos + 2]);
- D_MISC(FNC"Got Service class 0x%04x\n", service_search_uuid[i]);
+ D_MISC("Got Service class 0x%04x", service_search_uuid[i]);
i +=3D 1;
tmp_pos +=3D 3;
cur_pos +=3D 3;
@@ -592,7 +576,7 @@
cur_pos +=3D 2;
service_search_uuid[i] =3D CHAR2INT16(data[cur_pos + 1],
data[cur_pos + 2]);
- D_MISC(FNC"Got Service class 0x%08x\n", service_search_uuid[i]);
+ D_MISC("Got Service class 0x%08x", service_search_uuid[i]);
i +=3D 1;
tmp_pos +=3D 5;
cur_pos +=3D 3;
@@ -602,14 +586,14 @@
cur_pos +=3D 2;
service_search_uuid[i] =3D CHAR2INT16(data[cur_pos + 1],
data[cur_pos + 2]);
- D_MISC(FNC"Got Service class 0x%08x\n", service_search_uuid[i]);
+ D_MISC("Got Service class 0x%08x", service_search_uuid[i]);
i +=3D 1;
tmp_pos +=3D 17;
cur_pos +=3D 15;
}
else
{
- D_REC(FNC"Unknown UUID size 0x%02x\n",data[cur_pos]);
+ D_REC("Unknown UUID size 0x%02x", data[cur_pos]);
send_error_rsp(sdp_con_id, trans_id, SDP_INVALID_REQUEST_SYNTAX);
return;
}
@@ -617,12 +601,12 @@
service_search_uuid_cnt =3D i;
=20
max_attr_cnt =3D CHAR2INT16(data[cur_pos], data[cur_pos + 1]);
- D_MISC(FNC"max_attr_cnt: %d\n",max_attr_cnt);
+ D_MISC("max_attr_cnt: %d", max_attr_cnt);
cur_pos +=3D 2;
=20
if (GET_TYPE(data[cur_pos]) !=3D DES_TYPE)
{
- D_REC(FNC"Incorrect packet: Data Element Sequence expected\n");
+ D_REC("Incorrect packet: Data Element Sequence expected");
/* Send an error msg with error code Invalid request syntax */
send_error_rsp(sdp_con_id, trans_id, SDP_INVALID_REQUEST_SYNTAX);
return;
@@ -630,8 +614,7 @@
=20
des_len =3D get_size(data + cur_pos, new_pos);
cur_pos +=3D *new_pos;
- D_MISC(FNC"des_len: %d, new_pos:%d\n",des_len, *new_pos);
-
+ D_MISC("des_len: %d, new_pos: %d", des_len, *new_pos);
=20
/* Now we parses the third parameter which is a data element list. i.e
we have to go through the whole list and pick out one element at
@@ -640,7 +623,7 @@
{
/* Get the length of the data element */
tmp_len =3D get_size(data + cur_pos, new_pos);
- D_MISC(FNC"tmp_len: %d, new_pos: %d\n", tmp_len, *new_pos);
+ D_MISC("tmp_len: %d, new_pos: %d", tmp_len, *new_pos);
/* Move the data pointer past the length field to the start of
the data element */
cur_pos +=3D *new_pos;
@@ -650,8 +633,7 @@
attr_list[attr_list_pos] =3D CHAR2INT32(data[cur_pos], data[cur_pos =
+ 1],
data[cur_pos + 2],
data[cur_pos + 3]);
- D_MISC(FNC"Found range of attributes: 0x%08x\n",
- attr_list[attr_list_pos]);=20
+ D_MISC("Found range of attributes: 0x%08x", attr_list[attr_list_pos]=
);=20
cur_pos +=3D 4;
attr_list_pos +=3D 1;
}
@@ -661,7 +643,7 @@
attr_list[attr_list_pos] =3D CHAR2INT16(data[cur_pos], data[cur_pos =
+ 1]);
/* We stor all attributes as ranges */
attr_list[attr_list_pos] |=3D attr_list[attr_list_pos] << 16;
- D_MISC(FNC"Found single attributes: 0x%04x\n",
+ D_MISC("Found single attributes: 0x%04x",
(attr_list[attr_list_pos]) & 0xffff);=20
cur_pos +=3D 2;
attr_list_pos +=3D 1;=09
@@ -674,20 +656,20 @@
=20
if (len < cur_pos)
{
- D_ERR(__FUNCTION__", packet len shorter than actual packet lengthlen:%=
d cur_pos:%d\n", len, cur_pos);
+ D_ERR("Packet length (%d) shorter than actual packet length (%d)", len=
, cur_pos);
send_error_rsp(sdp_con_id, trans_id, SDP_INVALID_PDU_SIZE);
return;
}
else if (len > cur_pos)
{
- D_ERR(__FUNCTION__", packet len longer than actual packet length len:%=
d cur_pos:%d\n", len, cur_pos);
+ D_ERR("Packet length (%d) longer than actual packet length 8%d)", len,=
cur_pos);
send_error_rsp(sdp_con_id, trans_id, SDP_INVALID_PDU_SIZE);
return;
}
=20=20=20
if (cont_state_len)
{
- D_MISC(FNC"Sending continuationstate packet\n");
+ D_MISC("Sending continuationstate packet");
send_cont_state_attr_rsp(cont_state_len, data + cur_pos, max_attr_cnt,
sdp_con_id, trans_id);
}
@@ -696,12 +678,12 @@
tmp_len =3D sizeof(service_search_attr_struct) + attr_list_pos * sizeo=
f *attr_list;
=20=09
if (!(db_hdl =3D malloc(tmp_len))) {
- D_ERR(__FUNCTION__ ": malloc failed to allocate %d bytes!\n", =
tmp_len);
+ D_ERR("malloc failed to allocate %d bytes!", tmp_len);
send_error_rsp(sdp_con_id, trans_id, SDP_INSUFFICIENT_RESOURCE=
S);
return;
}
=20
- D_MEM("---> malloc%d %d bytes at 0x%08x\n", malloc_dbg++, tmp_len, (in=
t) db_hdl);
+ D_MEM("---> malloc%d %d bytes at 0x%08x", malloc_dbg++, tmp_len, (int)=
db_hdl);
=20=20=20=20=20
db_hdl->db.sdp_con_id =3D sdp_con_id;
db_hdl->db.trans_id =3D trans_id;
@@ -716,41 +698,29 @@
/* Here we ask the database for the requested attributes */
handle_query(&db_hdl->db);
=20
- D_MEM("<--- free%d 0x%08x\n", malloc_dbg--, (int) db_hdl);
+ D_MEM("<--- free%d 0x%08x", --malloc_dbg, (int) db_hdl);
free(db_hdl);
}
-=09=09
-#undef FNC=09
}
=20
void
process_service_search_rsp(int sdp_con_id, unsigned char *data)
{
-#define FNC "process_service_search_rsp: "
-=09
-#undef FNC=09
}
=20
void=20
process_service_attr_rsp(int sdp_con_id, unsigned char *data)
{
-#define FNC "process_service_attr_rsp: "
-=09
-#undef FNC
}
=20
void
process_service_search_attr_rsp(int sdp_con_id, unsigned char *data)
{
-#define FNC "process_service_search_attr_rsp: "
-=09
-#undef FNC=09
}
=20
void
send_error_rsp(int sdp_con_id, unsigned short trans_id, unsigned short err=
_code)
{
-#define FNC "send_error_rsp: "
unsigned char sdp_data[7];
unsigned short pdu_len;
=20
@@ -769,8 +739,6 @@
sdp_data[6] =3D err_code & 0xff;
=20=09
write2stack(sdp_con_id, sdp_data, 7);
-
-#undef FNC
}
=20
/* "Support" functions used by the other functions in this file */
@@ -817,7 +785,7 @@
data_struct db_hdl;
struct iovec vec[2];
=20
- D_XMIT("write2stack: writing %d bytes to sdp_con_id %d\n", len, sdp_con_=
id);
+ D_XMIT("Writing %d bytes to sdp_con_id %d", len, sdp_con_id);
=20=20=20
db_hdl.sdp_con_id =3D sdp_con_id;
db_hdl.len =3D len;
@@ -852,7 +820,7 @@
}
else if (len =3D=3D 0)
{
- syslog(LOG_DEBUG, "No data was read\n");
+ syslog(LOG_DEBUG, "No data was read");
}
else
{
@@ -876,7 +844,7 @@
=20=20=20=20=20
select(FD_SETSIZE, &rfd, NULL, NULL, NULL);
=20
- printf(__FUNCTION__", \n");
+ printf(__FUNCTION__ "\n");
=20=20=20=20=20
if (FD_ISSET(clnt_fd, &rfd))
{
@@ -906,7 +874,7 @@
int sdp_srv_sock;
int sdp_clnt_sock;
=20
- syslog(LOG_INFO, "Opening server socket %s\n", name);
+ syslog(LOG_INFO, "Opening server socket %s", name);
=20
/* remove any old socket */
unlink(name);
@@ -925,7 +893,7 @@
=20
while (1)
{
- syslog(LOG_INFO, "SDP Server listens...\n");
+ syslog(LOG_INFO, "SDP Server listens...");
listen(sdp_srv_sock, 5);
=20
client_len =3D sizeof(client_address);
--- sdp_server.c 2001/03/25 09:50:02 1.18
+++ sdp_server.c 2001/03/26 11:28:41 1.19
@@ -51,68 +51,68 @@
#include "sdp_parser.h"
=20
#ifdef BTD_USERSTACK
-#define syslog(x, fmt...) printf(fmt)
+#define syslog(x, fmt...) do { fprintf(stderr, __FILE__ "::"); fprintf(std=
err, fmt); fprintf(stderr, "\n"); } while (0)
#endif
=20
/* Does printouts in all functions called by expat */
-#define DBG_SUBFNC 0
+#define SDP_DEBUG_SUBFNC 0
=20
/* Does debug printouts in functions related to incomming data from the sdp
parts in the kernel */
-#define DBG_SDP_INCOMING 0
+#define SDP_DEBUG_INCOMING 0
=20
/* Other misc functions such as get_values, char2hex etc */
-#define DBG_MISC 0
+#define SDP_DEBUG_MISC 0
=20
/* Debug for the get attribute functions */
-#define DBG_GET_ATTRIBUTES 0
+#define SDP_DEBUG_GET_ATTRIBUTES 0
=20
/* Debug for the get record handle functions */
-#define DBG_GET_RECORD_HDL 0
+#define SDP_DEBUG_GET_RECORD_HDL 0
=20
/* Debug all malloc and free commands */
-#define DBG_MEM 0
+#define SDP_DEBUG_MEM 0
=20
/* Printouts data in hex format */
-#define DBG_PRINT_DATA 0
+#define SDP_DEBUG_PRINT_DATA 0
=20
-#if DBG_SUBFNC
-#define S_FNC(fmt...) syslog(LOG_DEBUG, fmt)
+#if SDP_DEBUG_SUBFNC
+#define S_FNC(fmt...) syslog(LOG_DEBUG, __FUNCTION__ ": " fmt)
#else
#define S_FNC(fmt...)
#endif
=20
-#if DBG_SDP_INCOMING
-#define D_REC(fmt...) syslog(LOG_DEBUG, fmt)
+#if SDP_DEBUG_INCOMING
+#define D_REC(fmt...) syslog(LOG_DEBUG, __FUNCTION__ ": " fmt)
#else
#define D_REC(fmt...)
#endif
=20
-#if DBG_MISC
-#define D_MISC(fmt...) syslog(LOG_DEBUG, fmt)
+#if SDP_DEBUG_MISC
+#define D_MISC(fmt...) syslog(LOG_DEBUG, __FUNCTION__ ": " fmt)
#else
#define D_MISC(fmt...)
#endif
=20
-#if DBG_GET_ATTRIBUTES
-#define D_ATTR(fmt...) syslog(LOG_DEBUG, fmt)
+#if SDP_DEBUG_GET_ATTRIBUTES
+#define D_ATTR(fmt...) syslog(LOG_DEBUG, __FUNCTION__ ": " fmt)
#else
#define D_ATTR(fmt...)
#endif
=20
-#if DBG_GET_RECORD_HDL
-#define D_RHDL(fmt...) syslog(LOG_DEBUG, fmt)
+#if SDP_DEBUG_GET_RECORD_HDL
+#define D_RHDL(fmt...) syslog(LOG_DEBUG, __FUNCTION__ ": " fmt)
#else
#define D_RHDL(fmt...)
#endif
=20
-#if DBG_MEM
-#define D_MEM(fmt...) syslog(LOG_DEBUG, fmt)
+#if SDP_DEBUG_MEM
+#define D_MEM(fmt...) syslog(LOG_DEBUG, __FUNCTION__ ": " fmt)
#else
#define D_MEM(fmt...)
#endif
=20
-#if DBG_PRINT_DATA
+#if SDP_DEBUG_PRINT_DATA
#define PRINT_DATA(str, data, len) print_data(str, data, len)
#else
#define PRINT_DATA(str, data, len)
@@ -160,36 +160,27 @@
extern cont_state_struct *cont_state_buf;
=20
void=20
-print_data(const char *message, char *buf, int len)
+print_data(const char *message, const unsigned char *buf, int len)
{=20
- int t, offs;
- char tmp[1024];
+ int t, offs =3D 0;
+ char tmp[100];
=20=20=20
- sprintf(tmp, "\n %s (%d)", message, len);
- offs =3D strlen(tmp);
+ syslog(LOG_DEBUG, "%s (%d):", message, len);
=20=20=20
for (t =3D 0; t < len; t++)=20
{
- if ((t % 16) =3D=3D 0)
+ offs +=3D sprintf(tmp + offs, " 0x%02x", (unsigned int)buf[t]);
+ if (!((t+1) % 8))
{
- if ((offs + 2) > (1024 - 3))
- break;
-
- sprintf(tmp + offs , "\n ");
- offs +=3D 2;
+ syslog(LOG_DEBUG, tmp);
+ offs =3D 0;
}
-=20=20=20=20
- if ((offs + 5) > (1024 - 3))
- break;
-=20=20=20
- sprintf(tmp + offs, "0x%02x ", (unsigned char) buf[t]);
- offs +=3D 5;
-=20=20=20
}
- sprintf(tmp + offs, "\n");
=20
- syslog(LOG_DEBUG, "%s", tmp);
-=20=20
+ if (offs)
+ {
+ syslog(LOG_DEBUG, tmp);
+ }
}
=20
void
@@ -227,7 +218,7 @@
buf =3D XML_GetBuffer(p, BUFFSIZE);
if (buf =3D=3D NULL)
{
- syslog(LOG_ERR, "start_xml_parser: couldn't get a free buffer\n");
+ syslog(LOG_ERR, "start_xml_parser: couldn't get a free buffer");
break;
}
=20
@@ -262,7 +253,7 @@
=20
m_size =3D strlen(char_data) / 2;=20
hex_data =3D (char*) malloc(m_size);
- D_MEM("---> malloc%d %d bytes at 0x%08x\n", malloc_dbg++, m_size, (int) =
hex_data);
+ D_MEM("---> malloc%d %ld bytes at 0x%8p", malloc_dbg++, m_size, hex_data=
);
=20
/* FIXME, How will this work when using big endian ? */
for (i =3D 0; i < strlen(char_data) / 2; i++)
@@ -277,7 +268,6 @@
char*
get_values(char *value_string, int value_string_len, int fd)
{
-#define FNC "get_values: "
int value_string_pos =3D 0;
char *tmp_list;
char tmp_len =3D 0;
@@ -289,7 +279,7 @@
i =3D 0;
while (i < value_string_len)
{
- D_MISC(FNC"%s \n",value_string + i);
+ D_MISC("%s", value_string + i);
i +=3D strlen(value_string + i) + 1;
}
=20=20=20
@@ -299,8 +289,7 @@
}
=20=20=20
tmp_list =3D (char*) malloc(256);
- D_MEM("---> malloc%d %d bytes at 0x%08x\n", malloc_dbg++, 256, (int) tmp=
_list);
-=20=20
+ D_MEM("---> malloc%d %d bytes at 0x%8p", malloc_dbg++, 256, tmp_list);
=20=20=20
/* While we have not reached the end of the string */
while (value_string_pos < value_string_len)
@@ -317,17 +306,17 @@
{
int j;
=20
- i =3D (int) strtol(value_string + value_string_pos +
- strlen(S_DES_HDR), NULL, 16);
+ i =3D (int) strtol(value_string + value_string_pos + strlen(S_DES_=
HDR),
+ NULL, 16);
=20
/* Now we found a data element sequens header inside another
data element sequense */
if (des_pos[i])
{
sprintf(c_des_len[i], "%02x", des_len[i]);
- D_MISC(FNC"c_des_len[%d]: %s\n", i, c_des_len[i]);
+ D_MISC("c_des_len[%d]: %s", i, c_des_len[i]);
strncpy(des_pos[i], c_des_len[i], 2);
- D_MISC(FNC"des_pos[%d]: %s\n", i, des_pos[i]);
+ D_MISC("des_pos[%d]: %s", i, des_pos[i]);
}
des_pos[i] =3D tmp_list + tmp_len - 2;
des_len[i] =3D 0;
@@ -353,8 +342,8 @@
=20=20=20=20=20=20=20
if (tmp_code =3D=3D NULL)
{
- D_MISC(FNC"Didn't find the hex code for: %s\n", value_string
- + value_string_pos);
+ D_MISC("Didn't find the hex code for: %s",
+ value_string + value_string_pos);
}
else
{
@@ -368,12 +357,12 @@
des_len[1] +=3D tmp / 2;
des_len[0] +=3D tmp / 2;
=20
- D_MISC(FNC"des_len[1]: %d\n", des_len[1]);
- D_MISC(FNC"Found %s\n", tmp_code);
+ D_MISC("des_len[1]: %d", des_len[1]);
+ D_MISC("Found %...
[truncated message content] |
|
From: Peter K. <pk...@us...> - 2001-03-26 12:25:26
|
The following files were modified in apps/bluetooth/sdp_server:
Name Old version New version Comment
---- ----------- ----------- -------
sdp_parser.c 1.15 1.16=20=20=20=20=20=20=20=20=20=20=20=20
sdp_server.c 1.19 1.20=20=20=20=20=20=20=20=20=20=20=20=20
sdp_server.h 1.8 1.9=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Use defines for the SDP header fields.
The diff of the modified file(s):
--- sdp_parser.c 2001/03/26 11:28:41 1.15
+++ sdp_parser.c 2001/03/26 12:25:24 1.16
@@ -172,9 +172,10 @@
sdp_con_id =3D db_hdl->sdp_con_id;
pkt_len =3D db_hdl->len;
=20
- id =3D data[0];
- trans_id =3D CHAR2INT16(data[1], data[2]);
- par_len =3D CHAR2INT16(data[3], data[4]);
+ id =3D data[SDP_HDR_TYPE];
+ trans_id =3D CHAR2INT16(data[SDP_HDR_TRANS_ID_MS], data[SDP_HDR_TRANS_ID=
_LS]);
+ par_len =3D CHAR2INT16(data[SDP_HDR_LENGTH_MS], data[SDP_HDR_LENGTH_LS]);
+ data +=3D SDP_HDR_SIZE;
=20
if (par_len > (len - SDP_HDR_SIZE))
{
@@ -189,7 +190,7 @@
switch (id)
{
case SDP_ERROR_RSP:
- switch (CHAR2INT16(data[5], data[6]))
+ switch (CHAR2INT16(data[0], data[1]))
{
case SDP_INVALID_SDP_VERSION:
D_ERR("Got Invalid/unsupported SDP version");
@@ -211,39 +212,39 @@
break;
default:
D_ERR("Error code 0x%04x is not specified",
- CHAR2INT16(data[5], data[6]));
+ CHAR2INT16(data[0], data[1]));
break;
}
break;
=20
case SDP_SERVICESEARCH_REQ:
D_REC("SDP_SERVICESEARCH_REQ %d bytes", par_len);
- process_service_search_req(sdp_con_id, data + 5, par_len, trans_id);
+ process_service_search_req(sdp_con_id, data, par_len, trans_id);
break;
=20=20=20=20=20
case SDP_SERVICESEARCH_RSP:
D_REC("SDP_SERVICESEARCH_RSP");
- process_service_search_rsp(sdp_con_id, data + 5);
+ process_service_search_rsp(sdp_con_id, data);
break;
=20=20=20=20=20
case SDP_SERVICEATTR_REQ:
D_REC("SDP_SERVICEATTR_REQ");
- process_service_attr_req(sdp_con_id, data + 5, par_len, trans_id);
+ process_service_attr_req(sdp_con_id, data, par_len, trans_id);
break;
=20=20=20=20=20
case SDP_SERVICEATTR_RSP:
D_REC("SDP_SERVICEATTR_RSP");
- process_service_attr_rsp(sdp_con_id, data + 5);
+ process_service_attr_rsp(sdp_con_id, data);
break;
=20=20=20=20=20
case SDP_SERVICESEARCHATTR_REQ:
D_REC("SDP_SERVICESEARCHATTR_REQ");
- process_service_search_attr_req(sdp_con_id, data + 5, par_len, trans_i=
d);
+ process_service_search_attr_req(sdp_con_id, data, par_len, trans_id);
break;
=20=20=20=20=20
case SDP_SERVICESEARCHATTR_RSP:
D_REC("SDP_SERVICESEARCHATTR_RSP");
- process_service_search_attr_rsp(sdp_con_id, data + 5);
+ process_service_search_attr_rsp(sdp_con_id, data);
break;
=20=20=20=20=20
default:
--- sdp_server.c 2001/03/26 11:28:41 1.19
+++ sdp_server.c 2001/03/26 12:25:24 1.20
@@ -390,11 +390,11 @@
void set_sdp_hdr(unsigned char *hdr, unsigned char pkt_type,
unsigned short trans_id, unsigned short len)
{
- hdr[0] =3D pkt_type;
- hdr[1] =3D SHORT2CHAR_MS(trans_id);
- hdr[2] =3D SHORT2CHAR_LS(trans_id);
- hdr[3] =3D SHORT2CHAR_MS(len);
- hdr[4] =3D SHORT2CHAR_LS(len);
+ hdr[SDP_HDR_TYPE] =3D pkt_type;
+ hdr[SDP_HDR_TRANS_ID_MS] =3D SHORT2CHAR_MS(trans_id);
+ hdr[SDP_HDR_TRANS_ID_LS] =3D SHORT2CHAR_LS(trans_id);
+ hdr[SDP_HDR_LENGTH_MS] =3D SHORT2CHAR_MS(len);
+ hdr[SDP_HDR_LENGTH_LS] =3D SHORT2CHAR_LS(len);
}
=20
unsigned int
@@ -1296,8 +1296,8 @@
=20
/* Set the attribute byte count to packet length minus sdp pdu header si=
ze
minus attribute byte count field length, minus continuation field len=
gth*/
- rsp_pkt[5] =3D SHORT2CHAR_MS(rsp_pkt_len - SDP_HDR_SIZE - 2);
- rsp_pkt[6] =3D SHORT2CHAR_LS(rsp_pkt_len - SDP_HDR_SIZE - 2);
+ rsp_pkt[SDP_HDR_SIZE] =3D SHORT2CHAR_MS(rsp_pkt_len - SDP_HDR_SIZE - 2=
);
+ rsp_pkt[SDP_HDR_SIZE+1] =3D SHORT2CHAR_LS(rsp_pkt_len - SDP_HDR_SIZE - 2=
);
=20
/* The length of the attribute list is the length of the attribute byte
count minus the size of the data element sequens header */
@@ -1397,8 +1397,8 @@
=20
/* Set the attribute byte count to packet length minus sdp pdu header si=
ze
minus attribute byte count field length */
- rsp_pkt[5] =3D SHORT2CHAR_MS(rsp_pkt_len - SDP_HDR_SIZE - 2);
- rsp_pkt[6] =3D SHORT2CHAR_LS(rsp_pkt_len - SDP_HDR_SIZE - 2);
+ rsp_pkt[SDP_HDR_SIZE] =3D SHORT2CHAR_MS(rsp_pkt_len - SDP_HDR_SIZE - 2=
);
+ rsp_pkt[SDP_HDR_SIZE+1] =3D SHORT2CHAR_LS(rsp_pkt_len - SDP_HDR_SIZE - 2=
);
=20
/* The length of the attribute list is the same as the packet length min=
us
the packet header length minus the attibute byte count filed minus the
@@ -1428,11 +1428,11 @@
S_FNC("Setting cont state, cur_rec_cnt:%d, max_rec_cnt:%d",
cur_rec_cnt, max_rec_cnt);
=20
- pkt[5] =3D SHORT2CHAR_MS(max_rec_cnt);
- pkt[6] =3D SHORT2CHAR_LS(max_rec_cnt);
+ pkt[SDP_HDR_SIZE] =3D SHORT2CHAR_MS(max_rec_cnt);
+ pkt[SDP_HDR_SIZE+1] =3D SHORT2CHAR_LS(max_rec_cnt);
=20=20=20=20=20
- pkt[7] =3D SHORT2CHAR_MS(max_rec_cnt);
- pkt[8] =3D SHORT2CHAR_LS(max_rec_cnt);
+ pkt[SDP_HDR_SIZE+2] =3D SHORT2CHAR_MS(max_rec_cnt);
+ pkt[SDP_HDR_SIZE+3] =3D SHORT2CHAR_LS(max_rec_cnt);
=20=20=20=20=20
/* There are cnt_len byte too much to fit the data in one packet */
cnt_len =3D (cur_rec_cnt - max_rec_cnt) * 4;
@@ -1464,8 +1464,8 @@
}
=20=20=20
/* Change the length field */
- pkt[3] =3D SHORT2CHAR_MS(len - SDP_HDR_SIZE);
- pkt[4] =3D SHORT2CHAR_LS(len - SDP_HDR_SIZE);
+ pkt[SDP_HDR_LENGTH_MS] =3D SHORT2CHAR_MS(len - SDP_HDR_SIZE);
+ pkt[SDP_HDR_LENGTH_LS] =3D SHORT2CHAR_LS(len - SDP_HDR_SIZE);
=20
return len;
}
@@ -1478,7 +1478,7 @@
int cur_attr_cnt;
int cont_len;
=20=20=20
- cur_attr_cnt =3D CHAR2INT16(pkt[5], pkt[6]);
+ cur_attr_cnt =3D CHAR2INT16(pkt[SDP_HDR_SIZE], pkt[SDP_HDR_SIZE+1]);
=20
S_FNC("len %d, max_attr_len %d, cur_attr_cnt %d", len, max_attr_len, cur=
_attr_cnt);
=20
@@ -1504,8 +1504,8 @@
cont_state_buf->len =3D cont_len;
memcpy(cont_state_buf->data, pkt + len, cont_len);
=20
- pkt[5] =3D SHORT2CHAR_MS(max_attr_len);
- pkt[6] =3D SHORT2CHAR_LS(max_attr_len);
+ pkt[SDP_HDR_SIZE] =3D SHORT2CHAR_MS(max_attr_len);
+ pkt[SDP_HDR_SIZE+1] =3D SHORT2CHAR_LS(max_attr_len);
=20=20=20=20=20
pkt[len] =3D 1;
len +=3D 1;
@@ -1522,8 +1522,8 @@
/* Change the length field */
=20
S_FNC("Changing length field");
- pkt[3] =3D SHORT2CHAR_MS(len- SDP_HDR_SIZE);
- pkt[4] =3D SHORT2CHAR_LS(len -SDP_HDR_SIZE);
+ pkt[SDP_HDR_LENGTH_MS] =3D SHORT2CHAR_MS(len - SDP_HDR_SIZE);
+ pkt[SDP_HDR_LENGTH_LS] =3D SHORT2CHAR_LS(len - SDP_HDR_SIZE);
=20
return len;
}
@@ -1552,12 +1552,12 @@
set_sdp_hdr(send_buf, cont_state_buf->pdu, trans_id, send_len - SDP_=
HDR_SIZE);
=20
/* Set the attribute byte count field */
- send_buf[5] =3D SHORT2CHAR_MS(cont_state_buf->len / 4);
- send_buf[6] =3D SHORT2CHAR_LS(cont_state_buf->len / 4);
+ send_buf[SDP_HDR_SIZE] =3D SHORT2CHAR_MS(cont_state_buf->len / 4);
+ send_buf[SDP_HDR_SIZE+1] =3D SHORT2CHAR_LS(cont_state_buf->len / 4);
=20
/* Set the attribute byte count field */
- send_buf[7] =3D SHORT2CHAR_MS(cont_state_buf->len / 4);
- send_buf[8] =3D SHORT2CHAR_LS(cont_state_buf->len / 4);
+ send_buf[SDP_HDR_SIZE+2] =3D SHORT2CHAR_MS(cont_state_buf->len / 4);
+ send_buf[SDP_HDR_SIZE+3] =3D SHORT2CHAR_LS(cont_state_buf->len / 4);
=20
memcpy(send_buf + SDP_HDR_SIZE + 2 + 2, cont_state_buf->data, cont_s=
tate_buf->len);
=20
@@ -1608,8 +1608,8 @@
set_sdp_hdr(send_buf, cont_state_buf->pdu, trans_id, send_len - SDP_=
HDR_SIZE);
=20
/* Set the attribute byte count field */
- send_buf[5] =3D SHORT2CHAR_MS(cont_state_buf->len);
- send_buf[6] =3D SHORT2CHAR_LS(cont_state_buf->len);
+ send_buf[SDP_HDR_SIZE] =3D SHORT2CHAR_MS(cont_state_buf->len);
+ send_buf[SDP_HDR_SIZE+1] =3D SHORT2CHAR_LS(cont_state_buf->len);
=20
memcpy(send_buf + SDP_HDR_SIZE + 2, cont_state_buf->data, cont_state=
_buf->len);
=20
--- sdp_server.h 2001/03/26 11:28:41 1.8
+++ sdp_server.h 2001/03/26 12:25:24 1.9
@@ -54,6 +54,11 @@
=20
#define BUFFSIZE 1024
=20
+#define SDP_HDR_TYPE 0
+#define SDP_HDR_TRANS_ID_MS 1
+#define SDP_HDR_TRANS_ID_LS 2
+#define SDP_HDR_LENGTH_MS 3
+#define SDP_HDR_LENGTH_LS 4
#define SDP_HDR_SIZE 5
=20
#define DES_HDR 0x35
|