Commit b8202b68 authored by Daniele Lacamera's avatar Daniele Lacamera

Changed gcc's attribute packet to enable compatibility with IAR

parent d8bf67ce
......@@ -65,5 +65,11 @@
#define PICO_FREE(x) pico_free(x)
#endif /* PICO_SUPPORT_MM */
#ifdef __IAR_SYSTEMS_ICC__
# define PACKED_STRUCT_DEF __packed struct
#else
# define PACKED_STRUCT_DEF struct __attribute__((packed))
#endif
#endif
......@@ -10,7 +10,7 @@
#include "pico_ipv6.h"
struct __attribute__((packed)) pico_eth_hdr {
PACKED_STRUCT_DEF pico_eth_hdr {
uint8_t daddr[6];
uint8_t saddr[6];
uint16_t proto;
......
......@@ -7,6 +7,7 @@
*********************************************************************/
#ifndef INCLUDE_PICO_DHCP_COMMON
#define INCLUDE_PICO_DHCP_COMMON
#include "pico_config.h"
#include "pico_addressing.h"
#define PICO_DHCPD_PORT (short_be(67))
......@@ -82,7 +83,7 @@
#define PICO_DHCP_EVENT_LEASE 11
#define PICO_DHCP_EVENT_RETRANSMIT 12
struct __attribute__((packed)) pico_dhcp_hdr
PACKED_STRUCT_DEF pico_dhcp_hdr
{
uint8_t op;
uint8_t htype;
......@@ -103,7 +104,7 @@ struct __attribute__((packed)) pico_dhcp_hdr
uint8_t options[0];
};
struct __attribute__((packed)) pico_dhcp_opt
PACKED_STRUCT_DEF pico_dhcp_opt
{
uint8_t code;
uint8_t len;
......
......@@ -79,14 +79,14 @@ static void pico_dns_client_callback(uint16_t ev, struct pico_socket *s);
static void pico_dns_client_retransmission(pico_time now, void *arg);
/* RFC 1035 section 4. MESSAGES */
struct __attribute__((packed)) pico_dns_name
PACKED_STRUCT_DEF pico_dns_name
{
char name[0];
};
/* prefix = header + name pointer
* flags splitted in 2x uint8 due to endianness */
struct __attribute__((packed)) pico_dns_prefix
PACKED_STRUCT_DEF pico_dns_prefix
{
uint16_t id;
uint8_t rd : 1; /* recursion desired */
......@@ -104,13 +104,13 @@ struct __attribute__((packed)) pico_dns_prefix
struct pico_dns_name domain;
};
struct __attribute__((packed)) pico_dns_query_suffix
PACKED_STRUCT_DEF pico_dns_query_suffix
{
uint16_t qtype;
uint16_t qclass;
};
struct __attribute__((packed)) pico_dns_answer_suffix
PACKED_STRUCT_DEF pico_dns_answer_suffix
{
uint16_t qtype;
uint16_t qclass;
......
......@@ -12,7 +12,7 @@
extern struct pico_protocol pico_proto_icmp4;
struct __attribute__((packed)) pico_icmp4_hdr {
PACKED_STRUCT_DEF pico_icmp4_hdr {
uint8_t type;
uint8_t code;
uint16_t crc;
......
......@@ -70,7 +70,7 @@
extern struct pico_protocol pico_proto_icmp6;
struct __attribute__((packed)) pico_icmp6_hdr {
PACKED_STRUCT_DEF pico_icmp6_hdr {
uint8_t type;
uint8_t code;
uint16_t crc;
......@@ -140,7 +140,7 @@ struct __attribute__((packed)) pico_icmp6_hdr {
} msg;
};
struct __attribute__((packed)) pico_icmp6_opt_lladdr
PACKED_STRUCT_DEF pico_icmp6_opt_lladdr
{
uint8_t type;
uint8_t len;
......@@ -149,7 +149,7 @@ struct __attribute__((packed)) pico_icmp6_opt_lladdr
} addr;
};
struct __attribute__((packed)) pico_icmp6_opt_prefix
PACKED_STRUCT_DEF pico_icmp6_opt_prefix
{
uint8_t type;
uint8_t len;
......@@ -163,7 +163,7 @@ struct __attribute__((packed)) pico_icmp6_opt_prefix
struct pico_ip6 prefix;
};
struct __attribute__((packed)) pico_icmp6_opt_mtu
PACKED_STRUCT_DEF pico_icmp6_opt_mtu
{
uint8_t type;
uint8_t len;
......@@ -171,7 +171,7 @@ struct __attribute__((packed)) pico_icmp6_opt_mtu
uint32_t mtu;
};
struct __attribute__((packed)) pico_icmp6_opt_redirect
PACKED_STRUCT_DEF pico_icmp6_opt_redirect
{
uint8_t type;
uint8_t len;
......@@ -180,7 +180,7 @@ struct __attribute__((packed)) pico_icmp6_opt_redirect
uint8_t data[0];
};
struct __attribute__((packed)) pico_icmp6_opt_na
PACKED_STRUCT_DEF pico_icmp6_opt_na
{
uint8_t type;
uint8_t len;
......
......@@ -79,14 +79,14 @@
#define IP_OPTION_ROUTER_ALERT_LEN (4u)
#define IGMP_MAX_GROUPS (32) /* max 255 */
struct __attribute__((packed)) igmp_message {
PACKED_STRUCT_DEF igmp_message {
uint8_t type;
uint8_t max_resp_time;
uint16_t crc;
uint32_t mcast_group;
};
struct __attribute__((packed)) igmpv3_query {
PACKED_STRUCT_DEF igmpv3_query {
uint8_t type;
uint8_t max_resp_time;
uint16_t crc;
......@@ -97,7 +97,7 @@ struct __attribute__((packed)) igmpv3_query {
uint32_t source_addr[];
};
struct __attribute__((packed)) igmpv3_group_record {
PACKED_STRUCT_DEF igmpv3_group_record {
uint8_t type;
uint8_t aux;
uint16_t sources;
......@@ -105,7 +105,7 @@ struct __attribute__((packed)) igmpv3_group_record {
uint32_t source_addr[];
};
struct __attribute__((packed)) igmpv3_report {
PACKED_STRUCT_DEF igmpv3_report {
uint8_t type;
uint8_t res0;
uint16_t crc;
......
......@@ -29,7 +29,7 @@
extern struct pico_protocol pico_proto_ipv4;
struct __attribute__((packed)) pico_ipv4_hdr {
PACKED_STRUCT_DEF pico_ipv4_hdr {
uint8_t vhl;
uint8_t tos;
uint16_t len;
......@@ -43,7 +43,7 @@ struct __attribute__((packed)) pico_ipv4_hdr {
uint8_t options[];
};
struct __attribute__((packed)) pico_ipv4_pseudo_hdr
PACKED_STRUCT_DEF pico_ipv4_pseudo_hdr
{
struct pico_ip4 src;
struct pico_ip4 dst;
......
......@@ -17,7 +17,7 @@
extern const uint8_t PICO_IP6_ANY[PICO_SIZE_IP6];
extern struct pico_protocol pico_proto_ipv6;
struct __attribute__((packed)) pico_ipv6_hdr {
PACKED_STRUCT_DEF pico_ipv6_hdr {
uint32_t vtf;
uint16_t len;
uint8_t nxthdr;
......@@ -27,7 +27,7 @@ struct __attribute__((packed)) pico_ipv6_hdr {
uint8_t extensions[0];
};
struct __attribute__((packed)) pico_ipv6_pseudo_hdr
PACKED_STRUCT_DEF pico_ipv6_pseudo_hdr
{
struct pico_ip6 src;
struct pico_ip6 dst;
......@@ -45,7 +45,7 @@ struct pico_ipv6_link
uint8_t isduplicate : 1;
};
struct __attribute__((packed)) pico_ipv6_exthdr {
PACKED_STRUCT_DEF pico_ipv6_exthdr {
uint8_t nxthdr;
union ipv6_ext_u {
......
......@@ -69,14 +69,14 @@ struct olsr_dev_entry
/* Headers */
struct __attribute__((packed)) olsr_link
PACKED_STRUCT_DEF olsr_link
{
uint8_t link_code;
uint8_t reserved;
uint16_t link_msg_size;
};
struct __attribute__((packed)) olsr_neighbor
PACKED_STRUCT_DEF olsr_neighbor
{
uint32_t addr;
uint8_t lq;
......@@ -84,21 +84,21 @@ struct __attribute__((packed)) olsr_neighbor
uint16_t reserved;
};
struct __attribute__((packed)) olsr_hmsg_hello
PACKED_STRUCT_DEF olsr_hmsg_hello
{
uint16_t reserved;
uint8_t htime;
uint8_t willingness;
};
struct __attribute__((packed)) olsr_hmsg_tc
PACKED_STRUCT_DEF olsr_hmsg_tc
{
uint16_t ansn;
uint16_t reserved;
};
struct __attribute__((packed)) olsrmsg
PACKED_STRUCT_DEF olsrmsg
{
uint8_t type;
uint8_t vtime;
......@@ -109,7 +109,7 @@ struct __attribute__((packed)) olsrmsg
uint16_t seq;
};
struct __attribute__((packed)) olsrhdr
PACKED_STRUCT_DEF olsrhdr
{
uint16_t len;
uint16_t seq;
......
......@@ -13,7 +13,7 @@
extern struct pico_protocol pico_proto_tcp;
struct __attribute__((packed)) pico_tcp_hdr {
PACKED_STRUCT_DEF pico_tcp_hdr {
struct pico_trans trans;
uint32_t seq;
uint32_t ack;
......@@ -24,7 +24,7 @@ struct __attribute__((packed)) pico_tcp_hdr {
uint16_t urgent;
};
struct __attribute__((packed)) tcp_pseudo_hdr_ipv4
PACKED_STRUCT_DEF tcp_pseudo_hdr_ipv4
{
struct pico_ip4 src;
struct pico_ip4 dst;
......@@ -74,7 +74,7 @@ struct __attribute__((packed)) tcp_pseudo_hdr_ipv4
#define PICO_TCP_RSTACK (PICO_TCP_RST | PICO_TCP_ACK)
struct __attribute__((packed)) pico_tcp_option
PACKED_STRUCT_DEF pico_tcp_option
{
uint8_t kind;
uint8_t len;
......
......@@ -24,7 +24,7 @@ struct pico_socket_udp
extern struct pico_protocol pico_proto_udp;
struct __attribute__((packed)) pico_udp_hdr {
PACKED_STRUCT_DEF pico_udp_hdr {
struct pico_trans trans;
uint16_t len;
uint16_t crc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment