sccp: u_int8_t -> uint8_t

This commit is contained in:
Holger Hans Peter Freyther 2010-07-23 18:39:17 +08:00
parent 040e10a547
commit 8deda23007
4 changed files with 91 additions and 91 deletions

View File

@ -47,12 +47,12 @@ enum {
struct sockaddr_sccp {
sa_family_t sccp_family; /* AF_SCCP in the future??? */
u_int8_t sccp_ssn; /* subssystem number for routing */
uint8_t sccp_ssn; /* subssystem number for routing */
/* TODO fill in address indicator... if that is ever needed */
/* not sure about these */
/* u_int8_t sccp_class; */
/* uint8_t sccp_class; */
};
/*
@ -60,13 +60,13 @@ struct sockaddr_sccp {
*/
struct sccp_address {
struct sccp_called_party_address address;
u_int8_t ssn;
u_int8_t poi[2];
uint8_t ssn;
uint8_t poi[2];
};
struct sccp_optional_data {
u_int8_t data_len;
u_int8_t data_start;
uint8_t data_len;
uint8_t data_start;
};
struct sccp_connection {

View File

@ -90,31 +90,31 @@ enum {
struct sccp_called_party_address {
#if __BYTE_ORDER == __LITTLE_ENDIAN
u_int8_t point_code_indicator : 1,
uint8_t point_code_indicator : 1,
ssn_indicator : 1,
global_title_indicator : 4,
routing_indicator : 1,
reserved : 1;
#elif __BYTE_ORDER == __BIG_ENDIAN
u_int8_t reserved : 1,
uint8_t reserved : 1,
routing_indicator : 1,
global_title_indicator : 4,
ssn_indicator : 1,
point_code_indicator : 1;
#endif
u_int8_t data[0];
uint8_t data[0];
} __attribute__((packed));
/* indicator indicates presence in the above order */
/* Figure 6/Q.713 */
struct sccp_signalling_point_code {
u_int8_t lsb;
uint8_t lsb;
#if __BYTE_ORDER == __LITTLE_ENDIAN
u_int8_t msb : 6,
uint8_t msb : 6,
reserved : 2;
#elif __BYTE_ORDER == __BIG_ENDIAN
u_int8_t reserved : 2,
uint8_t reserved : 2,
msb : 6;
#endif
} __attribute__((packed));
@ -153,20 +153,20 @@ enum {
struct sccp_global_title {
#if __BYTE_ORDER == __LITTLE_ENDIAN
u_int8_t nature_of_addr_ind : 7,
uint8_t nature_of_addr_ind : 7,
odd_even : 1;
#elif __BYTE_ORDER == __BIG_ENDIAN
u_int8_t odd_even : 1,
uint8_t odd_even : 1,
nature_of_addr_ind : 7;
#endif
u_int8_t data[0];
uint8_t data[0];
} __attribute__((packed));
/* Q.713, 3.3 */
struct sccp_source_reference {
u_int8_t octet1;
u_int8_t octet2;
u_int8_t octet3;
uint8_t octet1;
uint8_t octet2;
uint8_t octet3;
} __attribute__((packed));
/* Q.714, 3.6 */
@ -271,19 +271,19 @@ enum sccp_refusal_cause {
*/
struct sccp_connection_request {
/* mandantory */
u_int8_t type;
uint8_t type;
struct sccp_source_reference source_local_reference;
u_int8_t proto_class;
uint8_t proto_class;
/* variable */
u_int8_t variable_called;
uint8_t variable_called;
#if VARIABLE
called_party_address
#endif
/* optional */
u_int8_t optional_start;
uint8_t optional_start;
#if OPTIONAL
credit 3
@ -294,18 +294,18 @@ struct sccp_connection_request {
end_of_optional 1
#endif
u_int8_t data[0];
uint8_t data[0];
} __attribute__((packed));
struct sccp_connection_confirm {
/* mandantory */
u_int8_t type;
uint8_t type;
struct sccp_source_reference destination_local_reference;
struct sccp_source_reference source_local_reference;
u_int8_t proto_class;
uint8_t proto_class;
/* optional */
u_int8_t optional_start;
uint8_t optional_start;
/* optional */
#if OPTIONAL
@ -316,17 +316,17 @@ struct sccp_connection_confirm {
end_of_optional 1
#endif
u_int8_t data[0];
uint8_t data[0];
} __attribute__((packed));
struct sccp_connection_refused {
/* mandantory */
u_int8_t type;
uint8_t type;
struct sccp_source_reference destination_local_reference;
u_int8_t cause;
uint8_t cause;
/* optional */
u_int8_t optional_start;
uint8_t optional_start;
/* optional */
#if OPTIONAL
@ -336,85 +336,85 @@ struct sccp_connection_refused {
end_of_optional 1
#endif
u_int8_t data[0];
uint8_t data[0];
} __attribute__((packed));
struct sccp_connection_released {
/* mandantory */
u_int8_t type;
uint8_t type;
struct sccp_source_reference destination_local_reference;
struct sccp_source_reference source_local_reference;
u_int8_t release_cause;
uint8_t release_cause;
/* optional */
u_int8_t optional_start;
uint8_t optional_start;
#if OPTIONAL
data 3-130
importance 3
end_of_optional 1
#endif
u_int8_t data[0];
uint8_t data[0];
} __attribute__((packed));
struct sccp_connection_release_complete {
u_int8_t type;
uint8_t type;
struct sccp_source_reference destination_local_reference;
struct sccp_source_reference source_local_reference;
} __attribute__((packed));
struct sccp_data_form1 {
/* mandantory */
u_int8_t type;
uint8_t type;
struct sccp_source_reference destination_local_reference;
u_int8_t segmenting;
uint8_t segmenting;
/* variable */
u_int8_t variable_start;
uint8_t variable_start;
#if VARIABLE
data 2-256;
#endif
u_int8_t data[0];
uint8_t data[0];
} __attribute__((packed));
struct sccp_data_unitdata {
/* mandantory */
u_int8_t type;
u_int8_t proto_class;
uint8_t type;
uint8_t proto_class;
/* variable */
u_int8_t variable_called;
u_int8_t variable_calling;
u_int8_t variable_data;
uint8_t variable_called;
uint8_t variable_calling;
uint8_t variable_data;
#if VARIABLE
called party address
calling party address
#endif
u_int8_t data[0];
uint8_t data[0];
} __attribute__((packed));
struct sccp_data_it {
/* mandantory */
u_int8_t type;
uint8_t type;
struct sccp_source_reference destination_local_reference;
struct sccp_source_reference source_local_reference;
u_int8_t proto_class;
uint8_t proto_class;
u_int8_t sequencing[2];
u_int8_t credit;
uint8_t sequencing[2];
uint8_t credit;
} __attribute__((packed));
struct sccp_proto_err {
u_int8_t type;
uint8_t type;
struct sccp_source_reference destination_local_reference;
u_int8_t error_cause;
uint8_t error_cause;
};
#endif

View File

@ -63,13 +63,13 @@ struct sccp_data_callback {
int (*read_cb)(struct msgb *, unsigned int, void *);
void *read_context;
u_int8_t ssn;
uint8_t ssn;
struct llist_head callback;
};
static LLIST_HEAD(sccp_callbacks);
static struct sccp_data_callback *_find_ssn(u_int8_t ssn)
static struct sccp_data_callback *_find_ssn(uint8_t ssn)
{
struct sccp_data_callback *cb;
@ -99,13 +99,13 @@ static void _send_msg(struct msgb *msg)
/*
* parsing routines
*/
static int copy_address(struct sccp_address *addr, u_int8_t offset, struct msgb *msgb)
static int copy_address(struct sccp_address *addr, uint8_t offset, struct msgb *msgb)
{
struct sccp_called_party_address *party;
int room = msgb_l2len(msgb) - offset;
u_int8_t read = 0;
u_int8_t length;
uint8_t read = 0;
uint8_t length;
if (room <= 0) {
LOGP(DSCCP, LOGL_ERROR, "Not enough room for an address: %u\n", room);
@ -142,7 +142,7 @@ static int copy_address(struct sccp_address *addr, u_int8_t offset, struct msgb
}
if (party->global_title_indicator) {
LOGP(DSCCP, LOGL_ERROR, "GTI not supported %u\n", *(u_int8_t *)party);
LOGP(DSCCP, LOGL_ERROR, "GTI not supported %u\n", *(uint8_t *)party);
return -1;
}
@ -158,7 +158,7 @@ static int check_address(struct sccp_address *addr)
|| addr->address.routing_indicator != 1) {
LOGP(DSCCP, LOGL_ERROR,
"Invalid called address according to 08.06: 0x%x 0x%x\n",
*(u_int8_t *)&addr->address, addr->ssn);
*(uint8_t *)&addr->address, addr->ssn);
return -1;
}
@ -172,7 +172,7 @@ static int _sccp_parse_optional_data(const int offset,
u_int16_t read = 0;
while (room > read) {
u_int8_t type = msgb->l2h[offset + read];
uint8_t type = msgb->l2h[offset + read];
if (type == SCCP_PNC_END_OF_OPTIONAL)
return 0;
@ -181,7 +181,7 @@ static int _sccp_parse_optional_data(const int offset,
return 0;
}
u_int8_t length = msgb->l2h[offset + read + 1];
uint8_t length = msgb->l2h[offset + read + 1];
read += 2 + length;
@ -227,7 +227,7 @@ int _sccp_parse_connection_request(struct msgb *msgb, struct sccp_parse_result *
if (check_address(&result->called) != 0) {
LOGP(DSCCP, LOGL_ERROR, "Invalid called address according to 08.06: 0x%x 0x%x\n",
*(u_int8_t *)&result->called.address, result->called.ssn);
*(uint8_t *)&result->called.address, result->called.ssn);
return -1;
}
@ -441,7 +441,7 @@ int _sccp_parse_udt(struct msgb *msgb, struct sccp_parse_result *result)
if (check_address(&result->called) != 0) {
LOGP(DSCCP, LOGL_ERROR, "Invalid called address according to 08.06: 0x%x 0x%x\n",
*(u_int8_t *)&result->called.address, result->called.ssn);
*(uint8_t *)&result->called.address, result->called.ssn);
return -1;
}
@ -450,7 +450,7 @@ int _sccp_parse_udt(struct msgb *msgb, struct sccp_parse_result *result)
if (check_address(&result->calling) != 0) {
LOGP(DSCCP, LOGL_ERROR, "Invalid called address according to 08.06: 0x%x 0x%x\n",
*(u_int8_t *)&result->called.address, result->called.ssn);
*(uint8_t *)&result->called.address, result->called.ssn);
}
/* we don't have enough size for the data */
@ -517,7 +517,7 @@ static int _sccp_send_data(int class, const struct sockaddr_sccp *in,
const struct sockaddr_sccp *out, struct msgb *payload)
{
struct sccp_data_unitdata *udt;
u_int8_t *data;
uint8_t *data;
if (msgb_l3len(payload) > 256) {
LOGP(DSCCP, LOGL_ERROR, "The payload is too big for one udt\n");
@ -642,7 +642,7 @@ struct msgb *sccp_create_refuse(struct sccp_source_reference *src_ref, int cause
{
struct msgb *msgb;
struct sccp_connection_refused *ref;
u_int8_t *data;
uint8_t *data;
msgb = msgb_alloc_headroom(SCCP_MSG_SIZE,
SCCP_MSG_HEADROOM, "sccp ref");
@ -687,7 +687,7 @@ struct msgb *sccp_create_cc(struct sccp_source_reference *src_ref,
{
struct msgb *response;
struct sccp_connection_confirm *confirm;
u_int8_t *optional_data;
uint8_t *optional_data;
response = msgb_alloc_headroom(SCCP_MSG_SIZE,
SCCP_MSG_HEADROOM, "sccp confirm");
@ -708,7 +708,7 @@ struct msgb *sccp_create_cc(struct sccp_source_reference *src_ref,
confirm->proto_class = 2;
confirm->optional_start = 1;
optional_data = (u_int8_t *) msgb_put(response, 1);
optional_data = (uint8_t *) msgb_put(response, 1);
optional_data[0] = SCCP_PNC_END_OF_OPTIONAL;
return response;
}
@ -735,8 +735,8 @@ static int _sccp_send_connection_request(struct sccp_connection *connection,
{
struct msgb *request;
struct sccp_connection_request *req;
u_int8_t *data;
u_int8_t extra_size = 3 + 1;
uint8_t *data;
uint8_t extra_size = 3 + 1;
if (msg && (msgb_l3len(msg) < 3 || msgb_l3len(msg) > 130)) {
@ -794,7 +794,7 @@ struct msgb *sccp_create_dt1(struct sccp_source_reference *dst_ref, uint8_t *inp
{
struct msgb *msgb;
struct sccp_data_form1 *dt1;
u_int8_t *data;
uint8_t *data;
msgb = msgb_alloc_headroom(SCCP_MSG_SIZE,
SCCP_MSG_HEADROOM, "sccp dt1");
@ -866,7 +866,7 @@ struct msgb *sccp_create_rlsd(struct sccp_source_reference *src_ref,
{
struct msgb *msg;
struct sccp_connection_released *rel;
u_int8_t *data;
uint8_t *data;
msg = msgb_alloc_headroom(SCCP_MSG_SIZE, SCCP_MSG_HEADROOM,
"sccp: connection released");

View File

@ -35,21 +35,21 @@
#define MIN(x, y) ((x) < (y) ? (x) : (y))
/* BSC -> MSC */
static const u_int8_t bssmap_reset[] = {
static const uint8_t bssmap_reset[] = {
0x09, 0x00, 0x03, 0x05, 0x07, 0x02, 0x42, 0xfe,
0x02, 0x42, 0xfe, 0x06, 0x00, 0x04, 0x30, 0x04,
0x01, 0x20,
};
/* MSC -> BSC reset ack */
static const u_int8_t bssmap_reset_ack[] = {
static const uint8_t bssmap_reset_ack[] = {
0x09, 0x00, 0x03, 0x07, 0x0b, 0x04, 0x43, 0x01,
0x00, 0xfe, 0x04, 0x43, 0x5c, 0x00, 0xfe, 0x03,
0x00, 0x01, 0x31,
};
/* MSC -> BSC paging, connection less */
static const u_int8_t bssmap_paging[] = {
static const uint8_t bssmap_paging[] = {
0x09, 0x00, 0x03, 0x07, 0x0b, 0x04, 0x43, 0x01,
0x00, 0xfe, 0x04, 0x43, 0x5c, 0x00, 0xfe, 0x10,
0x00, 0x0e, 0x52, 0x08, 0x08, 0x29, 0x47, 0x10,
@ -57,7 +57,7 @@ static const u_int8_t bssmap_paging[] = {
};
/* MSC -> BSC paging, UDT without PC */
static const u_int8_t bssmap_udt[] = {
static const uint8_t bssmap_udt[] = {
0x09, 0x00, 0x03, 0x05, 0x07, 0x02, 0x42, 0xfe,
0x02, 0x42, 0xfe, 0x10, 0x00, 0x0e, 0x52, 0x08,
0x08, 0x29, 0x47, 0x10, 0x02, 0x01, 0x31, 0x97,
@ -65,7 +65,7 @@ static const u_int8_t bssmap_udt[] = {
};
/* BSC -> MSC connection open */
static const u_int8_t bssmap_cr[] = {
static const uint8_t bssmap_cr[] = {
0x01, 0x01, 0x02, 0x03, 0x02, 0x02, 0x04, 0x02,
0x42, 0xfe, 0x0f, 0x1f, 0x00, 0x1d, 0x57, 0x05,
0x08, 0x00, 0x72, 0xf4, 0x80, 0x20, 0x12, 0xc3,
@ -75,7 +75,7 @@ static const u_int8_t bssmap_cr[] = {
};
/* MSC -> BSC connection confirm */
static const u_int8_t bssmap_cc[] = {
static const uint8_t bssmap_cc[] = {
0x02, 0x01, 0x02, 0x03, 0x00, 0x00, 0x03, 0x02, 0x01, 0x00,
};
@ -84,39 +84,39 @@ static const u_int8_t bssmap_cc[] = {
* we fake a bit and make it BSC -> MSC... so the
* payload does not make any sense..
*/
static const u_int8_t bssmap_dtap[] = {
static const uint8_t bssmap_dtap[] = {
0x06, 0x00, 0x00, 0x03, 0x00, 0x01, 0x0f, 0x01, 0x00, 0x0c,
0x03, 0x05, 0x5c, 0x08, 0x11, 0x81, 0x33, 0x66, 0x02, 0x13,
0x45, 0xf4,
};
/* MSC -> BSC clear command */
static const u_int8_t bssmap_clear[] = {
static const uint8_t bssmap_clear[] = {
0x06, 0x00, 0x00, 0x03, 0x00, 0x01, 0x06, 0x00, 0x04, 0x20,
0x04, 0x01, 0x09,
};
/* MSC -> BSC released */
static const u_int8_t bssmap_released[] = {
static const uint8_t bssmap_released[] = {
0x04, 0x00, 0x00, 0x03, 0x01, 0x02, 0x03, 0x00, 0x01, 0x0f,
0x02, 0x23, 0x42, 0x00,
};
/* BSC -> MSC released */
static const u_int8_t bssmap_release_complete[] = {
static const uint8_t bssmap_release_complete[] = {
0x05, 0x01, 0x02, 0x03, 0x00, 0x00, 0x03
};
struct test_data {
int length;
const u_int8_t *data;
const uint8_t *data;
int payload_start;
int payload_length;
u_int8_t first_byte;
uint8_t first_byte;
/* in case it should trigger a sccp response */
int write;
const u_int8_t *response;
const uint8_t *response;
int response_length;
};
@ -256,15 +256,15 @@ struct sccp_parse_header_result {
struct sccp_source_reference dst_ref;
/* the input */
const u_int8_t *input;
const uint8_t *input;
int input_len;
};
static const u_int8_t it_test[] = {
static const uint8_t it_test[] = {
0x10, 0x01, 0x07,
0x94, 0x01, 0x04, 0x00, 0x02, 0x00, 0x00, 0x00 };
static const u_int8_t proto_err[] = {
static const uint8_t proto_err[] = {
0x0f, 0x0c, 0x04, 0x00, 0x00,
};
@ -336,7 +336,7 @@ static int write_called = 0;
int sccp_read_cb(struct msgb *data, unsigned len, void *context)
{
u_int16_t payload_length = test_data[current_test].payload_length;
const u_int8_t *got, *wanted;
const uint8_t *got, *wanted;
int i;
called = 1;
@ -376,7 +376,7 @@ int sccp_read_cb(struct msgb *data, unsigned len, void *context)
void sccp_write_cb(struct msgb *data, void *ctx)
{
int i = 0;
const u_int8_t *got, *wanted;
const uint8_t *got, *wanted;
if (test_data[current_test].response == NULL) {
FAIL("Didn't expect write callback\n");
@ -432,7 +432,7 @@ int sccp_accept_cb(struct sccp_connection *connection, void *user_data)
static void sccp_udt_write_cb(struct msgb *data, void *context)
{
const u_int8_t *got, *wanted;
const uint8_t *got, *wanted;
int i;
write_called = 1;