Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9ace221ca0 | ||
|
|
a7a2245b12 |
6
Makefile
6
Makefile
@@ -27,6 +27,8 @@
|
||||
CC=gcc
|
||||
GREP=grep
|
||||
AWK=awk
|
||||
AR=ar
|
||||
RANLIB=ranlib
|
||||
|
||||
OSARCH=$(shell uname -s)
|
||||
PROC?=$(shell uname -m)
|
||||
@@ -193,8 +195,8 @@ MAKE_DEPS= -MD -MT $@ -MF .$(subst /,_,$@).d -MP
|
||||
$(CC) $(CFLAGS) $(MAKE_DEPS) -c -o $@ $<
|
||||
|
||||
$(STATIC_LIBRARY): $(STATIC_OBJS)
|
||||
ar rcs $(STATIC_LIBRARY) $(STATIC_OBJS)
|
||||
ranlib $(STATIC_LIBRARY)
|
||||
$(AR) rcs $(STATIC_LIBRARY) $(STATIC_OBJS)
|
||||
$(RANLIB) $(STATIC_LIBRARY)
|
||||
|
||||
$(DYNAMIC_LIBRARY): $(DYNAMIC_OBJS)
|
||||
$(CC) $(SOFLAGS) -o $@ $(DYNAMIC_OBJS)
|
||||
|
||||
39
q931.c
39
q931.c
@@ -2196,17 +2196,33 @@ static int transmit_subaddr_helper(int full_ie, struct pri *ctrl, struct q931_pa
|
||||
|
||||
static int receive_subaddr_helper(int full_ie, struct pri *ctrl, struct q931_party_subaddress *q931_subaddress, int msgtype, q931_ie *ie, int offset, int len)
|
||||
{
|
||||
int i = -1;
|
||||
|
||||
if (len <= 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* To follow Q.931 (4.5.1), we must search for start of octet 4 by
|
||||
* walking through all bytes until one with ext bit (8) set to 1
|
||||
*/
|
||||
do {
|
||||
++i;
|
||||
switch (i) {
|
||||
case 0: /* Octet 3 */
|
||||
/* type: 0 = NSAP, 2 = User Specified */
|
||||
q931_subaddress->type = ((ie->data[0] & 0x70) >> 4);
|
||||
q931_subaddress->odd_even_indicator = (ie->data[0] & 0x08) ? 1 : 0;
|
||||
break;
|
||||
default: /* Octet 3* extra */
|
||||
break;
|
||||
}
|
||||
} while (!(ie->data[i] & 0x80) && len - i);
|
||||
|
||||
q931_subaddress->valid = 1;
|
||||
q931_subaddress->length = len;
|
||||
/* type: 0 = NSAP, 2 = User Specified */
|
||||
q931_subaddress->type = ((ie->data[0] & 0x70) >> 4);
|
||||
q931_subaddress->odd_even_indicator = (ie->data[0] & 0x08) ? 1 : 0;
|
||||
q931_subaddress->length = len - i;
|
||||
q931_memget(q931_subaddress->data, sizeof(q931_subaddress->data),
|
||||
ie->data + offset, len);
|
||||
ie->data + offset + i, len - i);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -2214,13 +2230,22 @@ static int receive_subaddr_helper(int full_ie, struct pri *ctrl, struct q931_par
|
||||
static void dump_subaddr_helper(int full_ie, struct pri *ctrl, q931_ie *ie, int offset, int len, int datalen, char prefix)
|
||||
{
|
||||
unsigned char cnum[256];
|
||||
int i = -1;
|
||||
|
||||
/*
|
||||
* To follow Q.931 (4.5.1), we must search for start of octet 4 by
|
||||
* walking through all bytes until one with ext bit (8) set to 1
|
||||
*/
|
||||
do {
|
||||
++i;
|
||||
} while (!(ie->data[i] & 0x80) && datalen - i);
|
||||
|
||||
if (!(ie->data[0] & 0x70)) {
|
||||
/* NSAP Get it as a string for dump display purposes only. */
|
||||
q931_strget(cnum, sizeof(cnum), ie->data + offset, datalen);
|
||||
q931_strget(cnum, sizeof(cnum), ie->data + offset + i, datalen - i);
|
||||
} else {
|
||||
/* User Specified */
|
||||
q931_get_subaddr_specific(cnum, sizeof(cnum), ie->data + offset, datalen,
|
||||
q931_get_subaddr_specific(cnum, sizeof(cnum), ie->data + offset + i, datalen - i,
|
||||
ie->data[0] & 0x08);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user