rpl: cleanup, changing structdefs into typedefs

dev/timer
Cenk Gündoğan 9 years ago
parent dc916ad458
commit aca1ade01c

@ -31,7 +31,7 @@ extern "C" {
/* Modes of Operation */
/* DIO Base Object (RFC 6550 Fig. 14) */
struct __attribute__((packed)) rpl_dio_t {
typedef struct __attribute__((packed)) {
uint8_t rpl_instanceid;
uint8_t version_number;
uint16_t rank;
@ -40,34 +40,34 @@ struct __attribute__((packed)) rpl_dio_t {
uint8_t flags;
uint8_t reserved;
ipv6_addr_t dodagid;
};
} rpl_dio_t;
struct __attribute__((packed)) rpl_dis_t {
typedef struct __attribute__((packed)) {
uint8_t flags;
uint8_t reserved;
};
} rpl_dis_t;
/* DAO Base Object (RFC 6550 Fig. 16) */
struct __attribute__((packed)) rpl_dao_t {
typedef struct __attribute__((packed)) {
uint8_t rpl_instanceid;
uint8_t k_d_flags;
uint8_t reserved;
uint8_t dao_sequence;
};
} rpl_dao_t;
/* DAO ACK Base Object (RFC 6550 Fig. 17.) */
struct __attribute__((packed)) rpl_dao_ack_t {
typedef struct __attribute__((packed)) {
uint8_t rpl_instanceid;
uint8_t d_reserved;
uint8_t dao_sequence;
uint8_t status;
};
} rpl_dao_ack_t;
/* DODAG ID Struct */
/* may be present in dao or dao_ack packets */
struct __attribute__((packed)) dodag_id_t {
typedef struct __attribute__((packed)) {
ipv6_addr_t dodagid;
};
} dodag_id_t;
/* RPL-Option Generic Format (RFC 6550 Fig. 19) */
typedef struct __attribute__((packed)) {

@ -41,23 +41,23 @@ static uint8_t rpl_send_buffer[BUFFER_SIZE];
/* SEND BUFFERS */
static icmpv6_hdr_t *icmp_send_buf;
static struct rpl_dis_t *rpl_send_dis_buf;
static rpl_dis_t *rpl_send_dis_buf;
static ipv6_hdr_t *ipv6_send_buf;
static struct rpl_dio_t *rpl_send_dio_buf;
static struct rpl_dao_t *rpl_send_dao_buf;
static rpl_dio_t *rpl_send_dio_buf;
static rpl_dao_t *rpl_send_dao_buf;
static rpl_opt_dodag_conf_t *rpl_send_opt_dodag_conf_buf;
static rpl_opt_target_t *rpl_send_opt_target_buf;
static rpl_opt_transit_t *rpl_send_opt_transit_buf;
/* RECEIVE BUFFERS */
static ipv6_hdr_t *ipv6_buf;
static struct rpl_dio_t *rpl_dio_buf;
static struct rpl_dao_t *rpl_dao_buf;
static struct rpl_dao_ack_t *rpl_dao_ack_buf;
static rpl_dio_t *rpl_dio_buf;
static rpl_dao_t *rpl_dao_buf;
static rpl_dao_ack_t *rpl_dao_ack_buf;
static rpl_opt_dodag_conf_t *rpl_opt_dodag_conf_buf;
static rpl_opt_target_t *rpl_opt_target_buf;
static rpl_opt_transit_t *rpl_opt_transit_buf;
static struct rpl_dis_t *rpl_dis_buf;
static rpl_dis_t *rpl_dis_buf;
static rpl_opt_t *rpl_opt_buf;
static rpl_opt_solicited_t *rpl_opt_solicited_buf;
@ -67,9 +67,9 @@ static icmpv6_hdr_t *get_rpl_send_icmpv6_buf(uint8_t ext_len)
return ((icmpv6_hdr_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ext_len]));
}
static struct rpl_dis_t *get_rpl_send_dis_buf(void)
static rpl_dis_t *get_rpl_send_dis_buf(void)
{
return ((struct rpl_dis_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN]));
return ((rpl_dis_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN]));
}
static ipv6_hdr_t *get_rpl_send_ipv6_buf(void)
@ -82,14 +82,14 @@ static uint8_t *get_rpl_send_payload_buf(uint8_t ext_len)
return &(rpl_send_buffer[IPV6_HDR_LEN + ext_len]);
}
static struct rpl_dio_t *get_rpl_send_dio_buf(void)
static rpl_dio_t *get_rpl_send_dio_buf(void)
{
return ((struct rpl_dio_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN]));
return ((rpl_dio_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN]));
}
static struct rpl_dao_t *get_rpl_send_dao_buf(void)
static rpl_dao_t *get_rpl_send_dao_buf(void)
{
return ((struct rpl_dao_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN]));
return ((rpl_dao_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN]));
}
static rpl_opt_dodag_conf_t *get_rpl_send_opt_dodag_conf_buf(uint8_t rpl_msg_len)
@ -129,24 +129,24 @@ static rpl_opt_dodag_conf_t *get_rpl_opt_dodag_conf_buf(uint8_t rpl_msg_len)
return ((rpl_opt_dodag_conf_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len]));
}
static struct rpl_dio_t *get_rpl_dio_buf(void)
static rpl_dio_t *get_rpl_dio_buf(void)
{
return ((struct rpl_dio_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN]));
return ((rpl_dio_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN]));
}
static struct rpl_dao_t *get_rpl_dao_buf(void)
static rpl_dao_t *get_rpl_dao_buf(void)
{
return ((struct rpl_dao_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN]));
return ((rpl_dao_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN]));
}
static struct rpl_dao_ack_t *get_rpl_dao_ack_buf(void)
static rpl_dao_ack_t *get_rpl_dao_ack_buf(void)
{
return ((struct rpl_dao_ack_t *) & (buffer[(LL_HDR_LEN + IPV6_HDR_LEN + ICMPV6_HDR_LEN)]));
return ((rpl_dao_ack_t *) & (buffer[(LL_HDR_LEN + IPV6_HDR_LEN + ICMPV6_HDR_LEN)]));
}
static struct rpl_dis_t *get_rpl_dis_buf(void)
static rpl_dis_t *get_rpl_dis_buf(void)
{
return ((struct rpl_dis_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN]));
return ((rpl_dis_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN]));
}
static rpl_opt_t *get_rpl_opt_buf(uint8_t rpl_msg_len)

@ -43,24 +43,24 @@ static uint8_t rpl_send_buffer[BUFFER_SIZE];
/* SEND BUFFERS */
static icmpv6_hdr_t *icmp_send_buf;
static struct rpl_dis_t *rpl_send_dis_buf;
static struct rpl_dao_ack_t *rpl_send_dao_ack_buf;
static rpl_dis_t *rpl_send_dis_buf;
static rpl_dao_ack_t *rpl_send_dao_ack_buf;
static ipv6_hdr_t *ipv6_send_buf;
static struct rpl_dio_t *rpl_send_dio_buf;
static struct rpl_dao_t *rpl_send_dao_buf;
static rpl_dio_t *rpl_send_dio_buf;
static rpl_dao_t *rpl_send_dao_buf;
static rpl_opt_dodag_conf_t *rpl_send_opt_dodag_conf_buf;
static rpl_opt_target_t *rpl_send_opt_target_buf;
static rpl_opt_transit_t *rpl_send_opt_transit_buf;
/* RECEIVE BUFFERS */
static ipv6_hdr_t *ipv6_buf;
static struct rpl_dio_t *rpl_dio_buf;
static struct rpl_dao_t *rpl_dao_buf;
static struct rpl_dao_ack_t *rpl_dao_ack_buf;
static rpl_dio_t *rpl_dio_buf;
static rpl_dao_t *rpl_dao_buf;
static rpl_dao_ack_t *rpl_dao_ack_buf;
static rpl_opt_dodag_conf_t *rpl_opt_dodag_conf_buf;
static rpl_opt_target_t *rpl_opt_target_buf;
static rpl_opt_transit_t *rpl_opt_transit_buf;
static struct rpl_dis_t *rpl_dis_buf;
static rpl_dis_t *rpl_dis_buf;
static rpl_opt_t *rpl_opt_buf;
static rpl_opt_solicited_t *rpl_opt_solicited_buf;
@ -70,14 +70,14 @@ static icmpv6_hdr_t *get_rpl_send_icmpv6_buf(uint8_t ext_len)
return ((icmpv6_hdr_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ext_len]));
}
static struct rpl_dao_ack_t *get_rpl_send_dao_ack_buf(void)
static rpl_dao_ack_t *get_rpl_send_dao_ack_buf(void)
{
return ((struct rpl_dao_ack_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN]));
return ((rpl_dao_ack_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN]));
}
static struct rpl_dis_t *get_rpl_send_dis_buf(void)
static rpl_dis_t *get_rpl_send_dis_buf(void)
{
return ((struct rpl_dis_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN]));
return ((rpl_dis_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN]));
}
static ipv6_hdr_t *get_rpl_send_ipv6_buf(void)
@ -90,14 +90,14 @@ static uint8_t *get_rpl_send_payload_buf(uint8_t ext_len)
return &(rpl_send_buffer[IPV6_HDR_LEN + ext_len]);
}
static struct rpl_dio_t *get_rpl_send_dio_buf(void)
static rpl_dio_t *get_rpl_send_dio_buf(void)
{
return ((struct rpl_dio_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN]));
return ((rpl_dio_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN]));
}
static struct rpl_dao_t *get_rpl_send_dao_buf(void)
static rpl_dao_t *get_rpl_send_dao_buf(void)
{
return ((struct rpl_dao_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN]));
return ((rpl_dao_t *) & (rpl_send_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN]));
}
static rpl_opt_dodag_conf_t *get_rpl_send_opt_dodag_conf_buf(uint8_t rpl_msg_len)
@ -137,24 +137,24 @@ static rpl_opt_dodag_conf_t *get_rpl_opt_dodag_conf_buf(uint8_t rpl_msg_len)
return ((rpl_opt_dodag_conf_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN + rpl_msg_len]));
}
static struct rpl_dio_t *get_rpl_dio_buf(void)
static rpl_dio_t *get_rpl_dio_buf(void)
{
return ((struct rpl_dio_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN]));
return ((rpl_dio_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN]));
}
static struct rpl_dao_t *get_rpl_dao_buf(void)
static rpl_dao_t *get_rpl_dao_buf(void)
{
return ((struct rpl_dao_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN]));
return ((rpl_dao_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN]));
}
static struct rpl_dao_ack_t *get_rpl_dao_ack_buf(void)
static rpl_dao_ack_t *get_rpl_dao_ack_buf(void)
{
return ((struct rpl_dao_ack_t *) & (buffer[(LL_HDR_LEN + IPV6_HDR_LEN + ICMPV6_HDR_LEN)]));
return ((rpl_dao_ack_t *) & (buffer[(LL_HDR_LEN + IPV6_HDR_LEN + ICMPV6_HDR_LEN)]));
}
static struct rpl_dis_t *get_rpl_dis_buf(void)
static rpl_dis_t *get_rpl_dis_buf(void)
{
return ((struct rpl_dis_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN]));
return ((rpl_dis_t *) & (rpl_buffer[IPV6_HDR_LEN + ICMPV6_HDR_LEN]));
}
static rpl_opt_t *get_rpl_opt_buf(uint8_t rpl_msg_len)

Loading…
Cancel
Save