net: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.
Jira: ZEP-2051
Change-Id: I4ec03eb2183d59ef86ea2c20d956e5d272656837
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
diff --git a/drivers/ethernet/eth_dw.c b/drivers/ethernet/eth_dw.c
index 5f0bf52..060e5df 100644
--- a/drivers/ethernet/eth_dw.c
+++ b/drivers/ethernet/eth_dw.c
@@ -23,13 +23,13 @@
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_ETHERNET_LEVEL
#include <logging/sys_log.h>
-static inline uint32_t eth_read(uint32_t base_addr, uint32_t offset)
+static inline u32_t eth_read(u32_t base_addr, u32_t offset)
{
return sys_read32(base_addr + offset);
}
-static inline void eth_write(uint32_t base_addr, uint32_t offset,
- uint32_t val)
+static inline void eth_write(u32_t base_addr, u32_t offset,
+ u32_t val)
{
sys_write32(val, base_addr + offset);
}
@@ -37,9 +37,9 @@
static void eth_rx(struct device *port)
{
struct eth_runtime *context = port->driver_data;
- uint32_t base_addr = context->base_addr;
+ u32_t base_addr = context->base_addr;
struct net_buf *buf;
- uint32_t frm_len = 0;
+ u32_t frm_len = 0;
/* Check whether the RX descriptor is still owned by the device. If not,
* process the received frame or an error that may have occurred.
@@ -97,7 +97,7 @@
static int eth_tx(struct device *port, struct net_buf *buf)
{
struct eth_runtime *context = port->driver_data;
- uint32_t base_addr = context->base_addr;
+ u32_t base_addr = context->base_addr;
/* Wait until the TX descriptor is no longer owned by the device. */
while (context->tx_desc.own == 1) {
@@ -135,8 +135,8 @@
static void eth_dw_isr(struct device *port)
{
struct eth_runtime *context = port->driver_data;
- uint32_t base_addr = context->base_addr;
- uint32_t int_status;
+ u32_t base_addr = context->base_addr;
+ u32_t int_status;
int_status = eth_read(base_addr, REG_ADDR_STATUS);
@@ -186,14 +186,14 @@
{
struct eth_runtime *context = port->driver_data;
const struct eth_config *config = port->config->config_info;
- uint32_t base_addr;
+ u32_t base_addr;
union {
struct {
- uint8_t bytes[6];
- uint8_t pad[2];
+ u8_t bytes[6];
+ u8_t pad[2];
} __attribute__((packed));
- uint32_t words[2];
+ u32_t words[2];
} mac_addr;
if (!eth_setup(port))
@@ -214,7 +214,7 @@
context->tx_desc.tdes0 = 0;
context->tx_desc.tdes1 = 0;
- context->tx_desc.buf1_ptr = (uint8_t *)context->tx_buf;
+ context->tx_desc.buf1_ptr = (u8_t *)context->tx_buf;
context->tx_desc.tx_end_of_ring = 1;
context->tx_desc.first_seg_in_frm = 1;
context->tx_desc.last_seg_in_frm = 1;
@@ -224,7 +224,7 @@
context->rx_desc.rdes0 = 0;
context->rx_desc.rdes1 = 0;
- context->rx_desc.buf1_ptr = (uint8_t *)context->rx_buf;
+ context->rx_desc.buf1_ptr = (u8_t *)context->rx_buf;
context->rx_desc.own = 1;
context->rx_desc.first_desc = 1;
context->rx_desc.last_desc = 1;
@@ -232,8 +232,8 @@
context->rx_desc.rx_end_of_ring = 1;
/* Install transmit and receive descriptors. */
- eth_write(base_addr, REG_ADDR_RX_DESC_LIST, (uint32_t)&context->rx_desc);
- eth_write(base_addr, REG_ADDR_TX_DESC_LIST, (uint32_t)&context->tx_desc);
+ eth_write(base_addr, REG_ADDR_RX_DESC_LIST, (u32_t)&context->rx_desc);
+ eth_write(base_addr, REG_ADDR_TX_DESC_LIST, (u32_t)&context->tx_desc);
eth_write(base_addr, REG_ADDR_MAC_CONF,
/* Set the RMII speed to 100Mbps */
diff --git a/drivers/ethernet/eth_dw_priv.h b/drivers/ethernet/eth_dw_priv.h
index 7e23242..bab7d26 100644
--- a/drivers/ethernet/eth_dw_priv.h
+++ b/drivers/ethernet/eth_dw_priv.h
@@ -23,7 +23,7 @@
typedef void (*eth_config_irq_t)(struct device *port);
struct eth_config {
- uint32_t irq_num;
+ u32_t irq_num;
eth_config_irq_t config_func;
#ifdef CONFIG_ETH_DW_SHARED_IRQ
@@ -46,54 +46,54 @@
union {
struct {
/* Only valid in half-duplex mode. */
- uint32_t deferred_bit : 1;
- uint32_t err_underflow : 1;
- uint32_t err_excess_defer : 1;
- uint32_t coll_cnt_slot_num : 4;
- uint32_t vlan_frm : 1;
- uint32_t err_excess_coll : 1;
- uint32_t err_late_coll : 1;
- uint32_t err_no_carrier : 1;
- uint32_t err_carrier_loss : 1;
- uint32_t err_ip_payload : 1;
- uint32_t err_frm_flushed : 1;
- uint32_t err_jabber_tout : 1;
+ u32_t deferred_bit : 1;
+ u32_t err_underflow : 1;
+ u32_t err_excess_defer : 1;
+ u32_t coll_cnt_slot_num : 4;
+ u32_t vlan_frm : 1;
+ u32_t err_excess_coll : 1;
+ u32_t err_late_coll : 1;
+ u32_t err_no_carrier : 1;
+ u32_t err_carrier_loss : 1;
+ u32_t err_ip_payload : 1;
+ u32_t err_frm_flushed : 1;
+ u32_t err_jabber_tout : 1;
/* OR of all other error bits. */
- uint32_t err_summary : 1;
- uint32_t err_ip_hdr : 1;
- uint32_t tx_timestamp_stat : 1;
- uint32_t vlan_ins_ctrl : 2;
- uint32_t addr2_chained : 1;
- uint32_t tx_end_of_ring : 1;
- uint32_t chksum_ins_ctrl : 2;
- uint32_t replace_crc : 1;
- uint32_t tx_timestamp_en : 1;
- uint32_t dis_pad : 1;
- uint32_t dis_crc : 1;
- uint32_t first_seg_in_frm : 1;
- uint32_t last_seg_in_frm : 1;
- uint32_t intr_on_complete : 1;
+ u32_t err_summary : 1;
+ u32_t err_ip_hdr : 1;
+ u32_t tx_timestamp_stat : 1;
+ u32_t vlan_ins_ctrl : 2;
+ u32_t addr2_chained : 1;
+ u32_t tx_end_of_ring : 1;
+ u32_t chksum_ins_ctrl : 2;
+ u32_t replace_crc : 1;
+ u32_t tx_timestamp_en : 1;
+ u32_t dis_pad : 1;
+ u32_t dis_crc : 1;
+ u32_t first_seg_in_frm : 1;
+ u32_t last_seg_in_frm : 1;
+ u32_t intr_on_complete : 1;
/* When set, descriptor is owned by DMA. */
- uint32_t own : 1;
+ u32_t own : 1;
};
- uint32_t tdes0;
+ u32_t tdes0;
};
/* Second word of transmit descriptor */
union {
struct {
- uint32_t tx_buf1_sz : 13;
- uint32_t : 3;
- uint32_t tx_buf2_sz : 13;
- uint32_t src_addr_ins_ctrl : 3;
+ u32_t tx_buf1_sz : 13;
+ u32_t : 3;
+ u32_t tx_buf2_sz : 13;
+ u32_t src_addr_ins_ctrl : 3;
};
- uint32_t tdes1;
+ u32_t tdes1;
};
/* Pointer to frame data buffer */
- uint8_t *buf1_ptr;
+ u8_t *buf1_ptr;
/* Unused, since this driver initializes only a single descriptor for each
* direction.
*/
- uint8_t *buf2_ptr;
+ u8_t *buf2_ptr;
};
/* Transmit descriptor */
@@ -101,63 +101,63 @@
/* First word of receive descriptor */
union {
struct {
- uint32_t ext_stat : 1;
- uint32_t err_crc : 1;
- uint32_t err_dribble_bit : 1;
- uint32_t err_rx_mii : 1;
- uint32_t err_rx_wdt : 1;
- uint32_t frm_type : 1;
- uint32_t err_late_coll : 1;
- uint32_t giant_frm : 1;
- uint32_t last_desc : 1;
- uint32_t first_desc : 1;
- uint32_t vlan_tag : 1;
- uint32_t err_overflow : 1;
- uint32_t length_err : 1;
- uint32_t s_addr_filt_fail : 1;
- uint32_t err_desc : 1;
- uint32_t err_summary : 1;
- uint32_t frm_len : 14;
- uint32_t d_addr_filt_fail : 1;
- uint32_t own : 1;
+ u32_t ext_stat : 1;
+ u32_t err_crc : 1;
+ u32_t err_dribble_bit : 1;
+ u32_t err_rx_mii : 1;
+ u32_t err_rx_wdt : 1;
+ u32_t frm_type : 1;
+ u32_t err_late_coll : 1;
+ u32_t giant_frm : 1;
+ u32_t last_desc : 1;
+ u32_t first_desc : 1;
+ u32_t vlan_tag : 1;
+ u32_t err_overflow : 1;
+ u32_t length_err : 1;
+ u32_t s_addr_filt_fail : 1;
+ u32_t err_desc : 1;
+ u32_t err_summary : 1;
+ u32_t frm_len : 14;
+ u32_t d_addr_filt_fail : 1;
+ u32_t own : 1;
};
- uint32_t rdes0;
+ u32_t rdes0;
};
/* Second word of receive descriptor */
union {
struct {
- uint32_t rx_buf1_sz : 13;
- uint32_t : 1;
- uint32_t addr2_chained : 1;
- uint32_t rx_end_of_ring : 1;
- uint32_t rx_buf2_sz : 13;
- uint32_t : 2;
- uint32_t dis_int_compl : 1;
+ u32_t rx_buf1_sz : 13;
+ u32_t : 1;
+ u32_t addr2_chained : 1;
+ u32_t rx_end_of_ring : 1;
+ u32_t rx_buf2_sz : 13;
+ u32_t : 2;
+ u32_t dis_int_compl : 1;
};
- uint32_t rdes1;
+ u32_t rdes1;
};
/* Pointer to frame data buffer */
- uint8_t *buf1_ptr;
+ u8_t *buf1_ptr;
/* Unused, since this driver initializes only a single descriptor for each
* direction.
*/
- uint8_t *buf2_ptr;
+ u8_t *buf2_ptr;
};
/* Driver metadata associated with each Ethernet device */
struct eth_runtime {
- uint32_t base_addr;
+ u32_t base_addr;
#ifdef CONFIG_PCI
struct pci_dev_info pci_dev;
#endif /* CONFIG_PCI */
/* Transmit descriptor */
volatile struct eth_tx_desc tx_desc;
/* Transmit DMA packet buffer */
- volatile uint8_t tx_buf[UIP_BUFSIZE];
+ volatile u8_t tx_buf[UIP_BUFSIZE];
/* Receive descriptor */
volatile struct eth_rx_desc rx_desc;
/* Receive DMA packet buffer */
- volatile uint8_t rx_buf[UIP_BUFSIZE];
+ volatile u8_t rx_buf[UIP_BUFSIZE];
};
#define MMC_DEFAULT_MASK 0xffffffff
diff --git a/drivers/ethernet/eth_enc28j60.c b/drivers/ethernet/eth_enc28j60.c
index c0321c8..8a02546 100644
--- a/drivers/ethernet/eth_enc28j60.c
+++ b/drivers/ethernet/eth_enc28j60.c
@@ -28,15 +28,15 @@
static int eth_enc28j60_soft_reset(struct device *dev)
{
struct eth_enc28j60_runtime *context = dev->driver_data;
- uint8_t tx_buf[2] = {ENC28J60_SPI_SC, 0xFF};
+ u8_t tx_buf[2] = {ENC28J60_SPI_SC, 0xFF};
return spi_write(context->spi, tx_buf, 2);
}
-static void eth_enc28j60_set_bank(struct device *dev, uint16_t reg_addr)
+static void eth_enc28j60_set_bank(struct device *dev, u16_t reg_addr)
{
struct eth_enc28j60_runtime *context = dev->driver_data;
- uint8_t tx_buf[2];
+ u8_t tx_buf[2];
k_sem_take(&context->spi_sem, K_FOREVER);
@@ -53,11 +53,11 @@
k_sem_give(&context->spi_sem);
}
-static void eth_enc28j60_write_reg(struct device *dev, uint16_t reg_addr,
- uint8_t value)
+static void eth_enc28j60_write_reg(struct device *dev, u16_t reg_addr,
+ u8_t value)
{
struct eth_enc28j60_runtime *context = dev->driver_data;
- uint8_t tx_buf[2];
+ u8_t tx_buf[2];
k_sem_take(&context->spi_sem, K_FOREVER);
@@ -69,12 +69,12 @@
k_sem_give(&context->spi_sem);
}
-static void eth_enc28j60_read_reg(struct device *dev, uint16_t reg_addr,
- uint8_t *value)
+static void eth_enc28j60_read_reg(struct device *dev, u16_t reg_addr,
+ u8_t *value)
{
struct eth_enc28j60_runtime *context = dev->driver_data;
- uint8_t tx_size = 2;
- uint8_t tx_buf[3];
+ u8_t tx_size = 2;
+ u8_t tx_buf[3];
k_sem_take(&context->spi_sem, K_FOREVER);
@@ -92,11 +92,11 @@
k_sem_give(&context->spi_sem);
}
-static void eth_enc28j60_set_eth_reg(struct device *dev, uint16_t reg_addr,
- uint8_t value)
+static void eth_enc28j60_set_eth_reg(struct device *dev, u16_t reg_addr,
+ u8_t value)
{
struct eth_enc28j60_runtime *context = dev->driver_data;
- uint8_t tx_buf[2];
+ u8_t tx_buf[2];
k_sem_take(&context->spi_sem, K_FOREVER);
@@ -109,11 +109,11 @@
}
-static void eth_enc28j60_clear_eth_reg(struct device *dev, uint16_t reg_addr,
- uint8_t value)
+static void eth_enc28j60_clear_eth_reg(struct device *dev, u16_t reg_addr,
+ u8_t value)
{
struct eth_enc28j60_runtime *context = dev->driver_data;
- uint8_t tx_buf[2];
+ u8_t tx_buf[2];
k_sem_take(&context->spi_sem, K_FOREVER);
@@ -125,13 +125,13 @@
k_sem_give(&context->spi_sem);
}
-static void eth_enc28j60_write_mem(struct device *dev, uint8_t *data_buffer,
- uint16_t buf_len)
+static void eth_enc28j60_write_mem(struct device *dev, u8_t *data_buffer,
+ u16_t buf_len)
{
struct eth_enc28j60_runtime *context = dev->driver_data;
- uint8_t *index_buf;
- uint16_t num_segments;
- uint16_t num_remaining;
+ u8_t *index_buf;
+ u16_t num_segments;
+ u16_t num_remaining;
index_buf = data_buffer;
num_segments = buf_len / MAX_BUFFER_LENGTH;
@@ -156,12 +156,12 @@
k_sem_give(&context->spi_sem);
}
-static void eth_enc28j60_read_mem(struct device *dev, uint8_t *data_buffer,
- uint16_t buf_len)
+static void eth_enc28j60_read_mem(struct device *dev, u8_t *data_buffer,
+ u16_t buf_len)
{
struct eth_enc28j60_runtime *context = dev->driver_data;
- uint16_t num_segments;
- uint16_t num_remaining;
+ u16_t num_segments;
+ u16_t num_remaining;
num_segments = buf_len / MAX_BUFFER_LENGTH;
num_remaining = buf_len - MAX_BUFFER_LENGTH * num_segments;
@@ -194,10 +194,10 @@
k_sem_give(&context->spi_sem);
}
-static void eth_enc28j60_write_phy(struct device *dev, uint16_t reg_addr,
- int16_t data)
+static void eth_enc28j60_write_phy(struct device *dev, u16_t reg_addr,
+ s16_t data)
{
- uint8_t data_mistat;
+ u8_t data_mistat;
eth_enc28j60_set_bank(dev, ENC28J60_REG_MIREGADR);
eth_enc28j60_write_reg(dev, ENC28J60_REG_MIREGADR, reg_addr);
@@ -215,7 +215,7 @@
static void eth_enc28j60_gpio_callback(struct device *dev,
struct gpio_callback *cb,
- uint32_t pins)
+ u32_t pins)
{
struct eth_enc28j60_runtime *context =
CONTAINER_OF(cb, struct eth_enc28j60_runtime, gpio_cb);
@@ -225,7 +225,7 @@
static void eth_enc28j60_init_buffers(struct device *dev)
{
- uint8_t data_estat;
+ u8_t data_estat;
/* Reception buffers initialization */
eth_enc28j60_set_bank(dev, ENC28J60_REG_ERXSTL);
@@ -273,7 +273,7 @@
static void eth_enc28j60_init_mac(struct device *dev)
{
const struct eth_enc28j60_config *config = dev->config->config_info;
- uint8_t data_macon;
+ u8_t data_macon;
eth_enc28j60_set_bank(dev, ENC28J60_REG_MACON1);
@@ -425,15 +425,15 @@
}
static int eth_enc28j60_tx(struct device *dev, struct net_pkt *pkt,
- uint16_t len)
+ u16_t len)
{
struct eth_enc28j60_runtime *context = dev->driver_data;
- uint16_t tx_bufaddr = ENC28J60_TXSTART;
+ u16_t tx_bufaddr = ENC28J60_TXSTART;
bool first_frag = true;
- uint8_t per_packet_control;
- uint16_t tx_bufaddr_end;
+ u8_t per_packet_control;
+ u16_t tx_bufaddr_end;
struct net_buf *frag;
- uint8_t tx_end;
+ u8_t tx_end;
k_sem_take(&context->tx_rx_sem, K_FOREVER);
@@ -462,8 +462,8 @@
eth_enc28j60_write_mem(dev, &per_packet_control, 1);
for (frag = pkt->frags; frag; frag = frag->frags) {
- uint8_t *data_ptr;
- uint16_t data_len;
+ u8_t *data_ptr;
+ u16_t data_len;
if (first_frag) {
data_ptr = net_pkt_ll(pkt);
@@ -509,8 +509,8 @@
{
const struct eth_enc28j60_config *config = dev->config->config_info;
struct eth_enc28j60_runtime *context = dev->driver_data;
- uint16_t lengthfr;
- uint8_t counter;
+ u16_t lengthfr;
+ u8_t counter;
/* Errata 6. The Receive Packet Pending Interrupt Flag (EIR.PKTIF)
* does not reliably/accurately report the status of pending packet.
@@ -523,14 +523,14 @@
do {
struct net_buf *pkt_buf = NULL;
- uint16_t frm_len = 0;
+ u16_t frm_len = 0;
struct net_pkt *pkt;
- uint16_t next_packet;
- uint8_t np[2];
+ u16_t next_packet;
+ u8_t np[2];
/* Read address for next packet */
eth_enc28j60_read_mem(dev, np, 2);
- next_packet = np[0] | (uint16_t)np[1] << 8;
+ next_packet = np[0] | (u16_t)np[1] << 8;
/* Errata 14. Even values in ERXRDPT
* may corrupt receive buffer.
@@ -559,7 +559,7 @@
do {
size_t frag_len;
- uint8_t *data_ptr;
+ u8_t *data_ptr;
size_t spi_frame_len;
/* Reserve a data frag to receive the frame */
@@ -629,7 +629,7 @@
{
struct device *dev = (struct device *) arg1;
struct eth_enc28j60_runtime *context;
- uint8_t int_stat;
+ u8_t int_stat;
ARG_UNUSED(unused1);
ARG_UNUSED(unused2);
@@ -652,7 +652,7 @@
static int eth_net_tx(struct net_if *iface, struct net_pkt *pkt)
{
- uint16_t len = net_pkt_ll_reserve(pkt) + net_pkt_get_len(pkt);
+ u16_t len = net_pkt_ll_reserve(pkt) + net_pkt_get_len(pkt);
int ret;
SYS_LOG_DBG("pkt %p (len %u)", pkt, len);
@@ -667,7 +667,7 @@
#ifdef CONFIG_ETH_ENC28J60_0
-static uint8_t mac_address_0[6] = { MICROCHIP_OUI_B0,
+static u8_t mac_address_0[6] = { MICROCHIP_OUI_B0,
MICROCHIP_OUI_B1,
MICROCHIP_OUI_B2,
CONFIG_ETH_ENC28J60_0_MAC3,
diff --git a/drivers/ethernet/eth_enc28j60_priv.h b/drivers/ethernet/eth_enc28j60_priv.h
index 3ba9b2e..3163c6d 100644
--- a/drivers/ethernet/eth_enc28j60_priv.h
+++ b/drivers/ethernet/eth_enc28j60_priv.h
@@ -215,12 +215,12 @@
struct eth_enc28j60_config {
const char *gpio_port;
- uint8_t gpio_pin;
+ u8_t gpio_pin;
const char *spi_port;
- uint32_t spi_freq;
- uint8_t spi_slave;
- uint8_t full_duplex;
- int32_t timeout;
+ u32_t spi_freq;
+ u8_t spi_slave;
+ u8_t full_duplex;
+ s32_t timeout;
};
struct eth_enc28j60_runtime {
@@ -229,9 +229,9 @@
struct device *gpio;
struct device *spi;
struct gpio_callback gpio_cb;
- uint8_t mem_buf[MAX_BUFFER_LENGTH + 1];
- uint8_t tx_tsv[TSV_SIZE];
- uint8_t rx_rsv[RSV_SIZE];
+ u8_t mem_buf[MAX_BUFFER_LENGTH + 1];
+ u8_t tx_tsv[TSV_SIZE];
+ u8_t rx_rsv[RSV_SIZE];
struct k_sem tx_rx_sem;
struct k_sem int_sem;
struct k_sem spi_sem;
diff --git a/drivers/ethernet/eth_mcux.c b/drivers/ethernet/eth_mcux.c
index 428219f..27b1b8f 100644
--- a/drivers/ethernet/eth_mcux.c
+++ b/drivers/ethernet/eth_mcux.c
@@ -67,7 +67,7 @@
bool link_up;
phy_duplex_t phy_duplex;
phy_speed_t phy_speed;
- uint8_t mac_addr[6];
+ u8_t mac_addr[6];
struct k_work phy_work;
struct k_delayed_work delayed_phy_work;
/* TODO: FIXME. This Ethernet frame sized buffer is used for
@@ -82,7 +82,7 @@
* bypassing it and writing a more complex driver working
* directly with hardware).
*/
- uint8_t frame_buf[1500];
+ u8_t frame_buf[1500];
};
static void eth_0_config_func(void);
@@ -99,13 +99,13 @@
#define ETH_MCUX_BUFFER_SIZE \
ROUND_UP(ENET_FRAME_MAX_FRAMELEN, ENET_BUFF_ALIGNMENT)
-static uint8_t __aligned(ENET_BUFF_ALIGNMENT)
+static u8_t __aligned(ENET_BUFF_ALIGNMENT)
rx_buffer[CONFIG_ETH_MCUX_RX_BUFFERS][ETH_MCUX_BUFFER_SIZE];
-static uint8_t __aligned(ENET_BUFF_ALIGNMENT)
+static u8_t __aligned(ENET_BUFF_ALIGNMENT)
tx_buffer[CONFIG_ETH_MCUX_TX_BUFFERS][ETH_MCUX_BUFFER_SIZE];
-static void eth_mcux_decode_duplex_and_speed(uint32_t status,
+static void eth_mcux_decode_duplex_and_speed(u32_t status,
phy_duplex_t *p_phy_duplex,
phy_speed_t *p_phy_speed)
{
@@ -131,7 +131,7 @@
static void eth_mcux_phy_enter_reset(struct eth_context *context)
{
- const uint32_t phy_addr = 0;
+ const u32_t phy_addr = 0;
/* Reset the PHY. */
ENET_StartSMIWrite(ENET, phy_addr, PHY_BASICCONTROL_REG,
@@ -197,11 +197,11 @@
static void eth_mcux_phy_event(struct eth_context *context)
{
- uint32_t status;
+ u32_t status;
bool link_up;
phy_duplex_t phy_duplex = kPHY_FullDuplex;
phy_speed_t phy_speed = kPHY_Speed100M;
- const uint32_t phy_addr = 0;
+ const u32_t phy_addr = 0;
#ifdef CONFIG_ETH_MCUX_PHY_DETAILED_DEBUG
SYS_LOG_DBG("phy_state=%s", phy_state_name(context->phy_state));
@@ -310,11 +310,11 @@
{
struct eth_context *context = iface->dev->driver_data;
const struct net_buf *frag;
- uint8_t *dst;
+ u8_t *dst;
status_t status;
unsigned int imask;
- uint16_t total_len = net_pkt_ll_reserve(pkt) + net_pkt_get_len(pkt);
+ u16_t total_len = net_pkt_ll_reserve(pkt) + net_pkt_get_len(pkt);
k_sem_take(&context->tx_buf_sem, K_FOREVER);
@@ -359,8 +359,8 @@
{
struct eth_context *context = iface->driver_data;
struct net_pkt *pkt;
- const uint8_t *src;
- uint32_t frame_length = 0;
+ const u8_t *src;
+ u32_t frame_length = 0;
status_t status;
unsigned int imask;
@@ -481,9 +481,9 @@
}
#if defined(CONFIG_ETH_MCUX_0_RANDOM_MAC)
-static void generate_mac(uint8_t *mac_addr)
+static void generate_mac(u8_t *mac_addr)
{
- uint32_t entropy;
+ u32_t entropy;
entropy = sys_rand32_get();
@@ -498,7 +498,7 @@
{
struct eth_context *context = dev->driver_data;
enet_config_t enet_config;
- uint32_t sys_clock;
+ u32_t sys_clock;
enet_buffer_config_t buffer_config = {
.rxBdNumber = CONFIG_ETH_MCUX_RX_BUFFERS,
.txBdNumber = CONFIG_ETH_MCUX_TX_BUFFERS,
@@ -596,7 +596,7 @@
{
struct device *dev = p;
struct eth_context *context = dev->driver_data;
- uint32_t pending = ENET_GetInterruptStatus(ENET);
+ u32_t pending = ENET_GetInterruptStatus(ENET);
if (pending & ENET_EIR_MII_MASK) {
k_work_submit(&context->phy_work);
diff --git a/drivers/ethernet/eth_sam_gmac.c b/drivers/ethernet/eth_sam_gmac.c
index 7df7993..9f7c513 100644
--- a/drivers/ethernet/eth_sam_gmac.c
+++ b/drivers/ethernet/eth_sam_gmac.c
@@ -93,9 +93,9 @@
/*
* Get one 32 bit item from the ring buffer
*/
-static uint32_t ring_buf_get(struct ring_buf *rb)
+static u32_t ring_buf_get(struct ring_buf *rb)
{
- uint32_t val;
+ u32_t val;
__ASSERT(rb->tail != rb->head,
"retrieving data from empty ring buffer");
@@ -109,7 +109,7 @@
/*
* Put one 32 bit item into the ring buffer
*/
-static void ring_buf_put(struct ring_buf *rb, uint32_t val)
+static void ring_buf_put(struct ring_buf *rb, u32_t val)
{
rb->buf[rb->head] = val;
MODULO_INC(rb->head, rb->len);
@@ -136,8 +136,8 @@
/*
* Set MAC Address for frame filtering logic
*/
-static void mac_addr_set(Gmac *gmac, uint8_t index,
- uint8_t mac_addr[6])
+static void mac_addr_set(Gmac *gmac, u8_t index,
+ u8_t mac_addr[6])
{
__ASSERT(index < 4, "index has to be in the range 0..3");
@@ -157,7 +157,7 @@
struct gmac_desc_list *rx_desc_list = &queue->rx_desc_list;
struct ring_buf *rx_pkt_list = &queue->rx_pkt_list;
struct net_buf *rx_buf;
- uint8_t *rx_buf_addr;
+ u8_t *rx_buf_addr;
__ASSERT_NO_MSG(rx_pkt_list->buf);
@@ -172,15 +172,15 @@
return -ENOBUFS;
}
- rx_pkt_list->buf[i] = (uint32_t)rx_buf;
+ rx_pkt_list->buf[i] = (u32_t)rx_buf;
rx_buf_addr = rx_buf->data;
- __ASSERT(!((uint32_t)rx_buf_addr & ~GMAC_RXW0_ADDR),
+ __ASSERT(!((u32_t)rx_buf_addr & ~GMAC_RXW0_ADDR),
"Misaligned RX buffer address");
__ASSERT(rx_buf->size == CONFIG_NET_BUF_DATA_SIZE,
"Incorrect length of RX data buffer");
/* Give ownership to GMAC and remove the wrap bit */
- rx_desc_list->buf[i].w0 = (uint32_t)rx_buf_addr & GMAC_RXW0_ADDR;
+ rx_desc_list->buf[i].w0 = (u32_t)rx_buf_addr & GMAC_RXW0_ADDR;
rx_desc_list->buf[i].w1 = 0;
}
@@ -293,7 +293,7 @@
}
/* Set Receive Buffer Queue Pointer Register */
- gmac->GMAC_RBQB = (uint32_t)queue->rx_desc_list.buf;
+ gmac->GMAC_RBQB = (u32_t)queue->rx_desc_list.buf;
/* Restart reception */
gmac->GMAC_NCR |= GMAC_NCR_RXEN;
@@ -304,9 +304,9 @@
*
* According to 802.3 MDC should be less then 2.5 MHz.
*/
-static int get_mck_clock_divisor(uint32_t mck)
+static int get_mck_clock_divisor(u32_t mck)
{
- uint32_t mck_divisor;
+ u32_t mck_divisor;
if (mck <= 20000000) {
mck_divisor = GMAC_NCFGR_CLK_MCK_8;
@@ -328,7 +328,7 @@
return mck_divisor;
}
-static int gmac_init(Gmac *gmac, uint32_t gmac_ncfgr_val)
+static int gmac_init(Gmac *gmac, u32_t gmac_ncfgr_val)
{
int mck_divisor;
@@ -364,9 +364,9 @@
return 0;
}
-static void link_configure(Gmac *gmac, uint32_t flags)
+static void link_configure(Gmac *gmac, u32_t flags)
{
- uint32_t val;
+ u32_t val;
gmac->GMAC_NCR &= ~(GMAC_NCR_RXEN | GMAC_NCR_TXEN);
@@ -387,9 +387,9 @@
__ASSERT_NO_MSG(queue->rx_desc_list.len > 0);
__ASSERT_NO_MSG(queue->tx_desc_list.len > 0);
- __ASSERT(!((uint32_t)queue->rx_desc_list.buf & ~GMAC_RBQB_ADDR_Msk),
+ __ASSERT(!((u32_t)queue->rx_desc_list.buf & ~GMAC_RBQB_ADDR_Msk),
"RX descriptors have to be word aligned");
- __ASSERT(!((uint32_t)queue->tx_desc_list.buf & ~GMAC_TBQB_ADDR_Msk),
+ __ASSERT(!((u32_t)queue->tx_desc_list.buf & ~GMAC_TBQB_ADDR_Msk),
"TX descriptors have to be word aligned");
/* Setup descriptor lists */
@@ -408,9 +408,9 @@
queue->tx_desc_list.len - 1);
/* Set Receive Buffer Queue Pointer Register */
- gmac->GMAC_RBQB = (uint32_t)queue->rx_desc_list.buf;
+ gmac->GMAC_RBQB = (u32_t)queue->rx_desc_list.buf;
/* Set Transmit Buffer Queue Pointer Register */
- gmac->GMAC_TBQB = (uint32_t)queue->tx_desc_list.buf;
+ gmac->GMAC_TBQB = (u32_t)queue->tx_desc_list.buf;
/* Configure GMAC DMA transfer */
gmac->GMAC_DCFGR =
@@ -442,9 +442,9 @@
struct gmac_desc_list *rx_desc_list = &queue->rx_desc_list;
struct gmac_desc_list *tx_desc_list = &queue->tx_desc_list;
- __ASSERT(!((uint32_t)rx_desc_list->buf & ~GMAC_RBQB_ADDR_Msk),
+ __ASSERT(!((u32_t)rx_desc_list->buf & ~GMAC_RBQB_ADDR_Msk),
"RX descriptors have to be word aligned");
- __ASSERT(!((uint32_t)tx_desc_list->buf & ~GMAC_TBQB_ADDR_Msk),
+ __ASSERT(!((u32_t)tx_desc_list->buf & ~GMAC_TBQB_ADDR_Msk),
"TX descriptors have to be word aligned");
__ASSERT((rx_desc_list->len == 1) && (tx_desc_list->len == 1),
"Priority queues are currently not supported, descriptor "
@@ -460,9 +460,9 @@
tx_desc_list->buf[0].w1 = GMAC_TXW1_USED | GMAC_TXW1_WRAP;
/* Set Receive Buffer Queue Pointer Register */
- gmac->GMAC_RBQBAPQ[queue->que_idx - 1] = (uint32_t)rx_desc_list->buf;
+ gmac->GMAC_RBQBAPQ[queue->que_idx - 1] = (u32_t)rx_desc_list->buf;
/* Set Transmit Buffer Queue Pointer Register */
- gmac->GMAC_TBQBAPQ[queue->que_idx - 1] = (uint32_t)tx_desc_list->buf;
+ gmac->GMAC_TBQBAPQ[queue->que_idx - 1] = (u32_t)tx_desc_list->buf;
return 0;
}
@@ -476,10 +476,10 @@
bool frame_is_complete;
struct net_buf *frag;
struct net_buf *new_frag;
- uint8_t *frag_data;
- uint32_t frag_len;
- uint32_t frame_len = 0;
- uint16_t tail;
+ u8_t *frag_data;
+ u32_t frag_len;
+ u32_t frame_len = 0;
+ u16_t tail;
/* Check if there exists a complete frame in RX descriptor list */
tail = rx_desc_list->tail;
@@ -517,7 +517,7 @@
*/
while ((rx_desc->w0 & GMAC_RXW0_OWNERSHIP) && !frame_is_complete) {
frag = (struct net_buf *)rx_pkt_list->buf[tail];
- frag_data = (uint8_t *)(rx_desc->w0 & GMAC_RXW0_ADDR);
+ frag_data = (u8_t *)(rx_desc->w0 & GMAC_RXW0_ADDR);
__ASSERT(frag->data == frag_data,
"RX descriptor and buffer list desynchronized");
frame_is_complete = (bool)(rx_desc->w1 & GMAC_RXW1_EOF);
@@ -544,7 +544,7 @@
net_buf_add(frag, frag_len);
net_pkt_frag_insert(rx_frame, frag);
frag = new_frag;
- rx_pkt_list->buf[tail] = (uint32_t)frag;
+ rx_pkt_list->buf[tail] = (u32_t)frag;
}
}
@@ -556,7 +556,7 @@
__DMB(); /* data memory barrier */
/* Update buffer descriptor address word */
rx_desc->w0 =
- ((uint32_t)frag->data & GMAC_RXW0_ADDR)
+ ((u32_t)frag->data & GMAC_RXW0_ADDR)
| (tail == rx_desc_list->len-1 ? GMAC_RXW0_WRAP : 0);
MODULO_INC(tail, rx_desc_list->len);
@@ -601,9 +601,9 @@
struct gmac_desc_list *tx_desc_list = &queue->tx_desc_list;
struct gmac_desc *tx_desc;
struct net_buf *frag;
- uint8_t *frag_data;
- uint16_t frag_len;
- uint32_t err_tx_flushed_count_at_entry = queue->err_tx_flushed_count;
+ u8_t *frag_data;
+ u16_t frag_len;
+ u32_t err_tx_flushed_count_at_entry = queue->err_tx_flushed_count;
unsigned int key;
__ASSERT(pkt, "buf pointer is NULL");
@@ -642,7 +642,7 @@
tx_desc = &tx_desc_list->buf[tx_desc_list->head];
/* Update buffer descriptor address word */
- tx_desc->w0 = (uint32_t)frag_data;
+ tx_desc->w0 = (u32_t)frag_data;
/* Guarantee that address word is written before the status
* word to avoid race condition.
*/
@@ -696,7 +696,7 @@
struct eth_sam_dev_data *const dev_data = DEV_DATA(dev);
Gmac *gmac = cfg->regs;
struct gmac_queue *queue = &dev_data->queue_list[0];
- uint32_t isr;
+ u32_t isr;
/* Interrupt Status Register is cleared on read */
isr = gmac->GMAC_ISR;
@@ -747,8 +747,8 @@
struct device *const dev = net_if_get_device(iface);
struct eth_sam_dev_data *const dev_data = DEV_DATA(dev);
const struct eth_sam_dev_cfg *const cfg = DEV_CFG(dev);
- uint32_t gmac_ncfgr_val;
- uint32_t link_status;
+ u32_t gmac_ncfgr_val;
+ u32_t link_status;
int result;
dev_data->iface = iface;
@@ -845,11 +845,11 @@
.len = ARRAY_SIZE(tx_desc_que0),
},
.rx_pkt_list = {
- .buf = (uint32_t *)rx_buf_list_que0,
+ .buf = (u32_t *)rx_buf_list_que0,
.len = ARRAY_SIZE(rx_buf_list_que0),
},
.tx_frames = {
- .buf = (uint32_t *)tx_frame_list_que0,
+ .buf = (u32_t *)tx_frame_list_que0,
.len = ARRAY_SIZE(tx_frame_list_que0),
},
}, {
diff --git a/drivers/ethernet/eth_sam_gmac_priv.h b/drivers/ethernet/eth_sam_gmac_priv.h
index 95d6102..fadec94 100644
--- a/drivers/ethernet/eth_sam_gmac_priv.h
+++ b/drivers/ethernet/eth_sam_gmac_priv.h
@@ -32,9 +32,9 @@
*/
#if 0
#define DCACHE_INVALIDATE(addr, size) \
- SCB_InvalidateDCache_by_Addr((uint32_t *)addr, size)
+ SCB_InvalidateDCache_by_Addr((u32_t *)addr, size)
#define DCACHE_CLEAN(addr, size) \
- SCB_CleanDCache_by_Addr((uint32_t *)addr, size)
+ SCB_CleanDCache_by_Addr((u32_t *)addr, size)
#else
#define DCACHE_INVALIDATE(addr, size) { ; }
#define DCACHE_CLEAN(addr, size) { ; }
@@ -126,24 +126,24 @@
/** Minimal ring buffer implementation */
struct ring_buf {
- uint32_t *buf;
- uint16_t len;
- uint16_t head;
- uint16_t tail;
+ u32_t *buf;
+ u16_t len;
+ u16_t head;
+ u16_t tail;
};
/** Receive/transmit buffer descriptor */
struct gmac_desc {
- uint32_t w0;
- uint32_t w1;
+ u32_t w0;
+ u32_t w1;
};
/** Ring list of receive/transmit buffer descriptors */
struct gmac_desc_list {
struct gmac_desc *buf;
- uint16_t len;
- uint16_t head;
- uint16_t tail;
+ u16_t len;
+ u16_t head;
+ u16_t tail;
};
/** GMAC Queue data */
@@ -156,11 +156,11 @@
struct ring_buf tx_frames;
/** Number of RX frames dropped by the driver */
- volatile uint32_t err_rx_frames_dropped;
+ volatile u32_t err_rx_frames_dropped;
/** Number of times receive queue was flushed */
- volatile uint32_t err_rx_flushed_count;
+ volatile u32_t err_rx_flushed_count;
/** Number of times transmit queue was flushed */
- volatile uint32_t err_tx_flushed_count;
+ volatile u32_t err_tx_flushed_count;
enum queue_idx que_idx;
};
@@ -168,9 +168,9 @@
/* Device constant configuration parameters */
struct eth_sam_dev_cfg {
Gmac *regs;
- uint32_t periph_id;
+ u32_t periph_id;
const struct soc_gpio_pin *pin_list;
- uint32_t pin_list_size;
+ u32_t pin_list_size;
void (*config_func)(void);
struct phy_sam_gmac_dev phy;
};
@@ -178,7 +178,7 @@
/* Device run time data */
struct eth_sam_dev_data {
struct net_if *iface;
- uint8_t mac_addr[6];
+ u8_t mac_addr[6];
struct gmac_queue queue_list[GMAC_QUEUE_NO];
};
diff --git a/drivers/ethernet/phy_sam_gmac.c b/drivers/ethernet/phy_sam_gmac.c
index d2467e4..ebccde1 100644
--- a/drivers/ethernet/phy_sam_gmac.c
+++ b/drivers/ethernet/phy_sam_gmac.c
@@ -37,7 +37,7 @@
/* Wait PHY operation complete. */
static int mdio_bus_wait(Gmac *gmac)
{
- uint32_t retries = 100; /* will wait up to 1 s */
+ u32_t retries = 100; /* will wait up to 1 s */
while (!(gmac->GMAC_NSR & GMAC_NSR_IDLE)) {
if (retries-- == 0) {
@@ -52,8 +52,8 @@
}
/* Send command to PHY over MDIO serial bus */
-static int mdio_bus_send(Gmac *gmac, uint8_t phy_addr, uint8_t reg_addr,
- uint8_t rw, uint16_t data)
+static int mdio_bus_send(Gmac *gmac, u8_t phy_addr, u8_t reg_addr,
+ u8_t rw, u16_t data)
{
int retval;
@@ -75,11 +75,11 @@
}
/* Read PHY register. */
-static int phy_read(const struct phy_sam_gmac_dev *phy, uint8_t reg_addr,
- uint32_t *value)
+static int phy_read(const struct phy_sam_gmac_dev *phy, u8_t reg_addr,
+ u32_t *value)
{
Gmac *const gmac = phy->regs;
- uint8_t phy_addr = phy->address;
+ u8_t phy_addr = phy->address;
int retval;
retval = mdio_bus_send(gmac, phy_addr, reg_addr, 1, 0);
@@ -94,11 +94,11 @@
}
/* Write PHY register. */
-static int phy_write(const struct phy_sam_gmac_dev *phy, uint8_t reg_addr,
- uint32_t value)
+static int phy_write(const struct phy_sam_gmac_dev *phy, u8_t reg_addr,
+ u32_t value)
{
Gmac *const gmac = phy->regs;
- uint8_t phy_addr = phy->address;
+ u8_t phy_addr = phy->address;
return mdio_bus_send(gmac, phy_addr, reg_addr, 0, value);
}
@@ -106,8 +106,8 @@
/* Issue a PHY soft reset. */
static int phy_soft_reset(const struct phy_sam_gmac_dev *phy)
{
- uint32_t phy_reg;
- uint32_t retries = 12;
+ u32_t phy_reg;
+ u32_t retries = 12;
int retval;
/* Issue a soft reset */
@@ -160,11 +160,11 @@
return 0;
}
-uint32_t phy_sam_gmac_id_get(const struct phy_sam_gmac_dev *phy)
+u32_t phy_sam_gmac_id_get(const struct phy_sam_gmac_dev *phy)
{
Gmac *const gmac = phy->regs;
- uint32_t phy_reg;
- uint32_t phy_id;
+ u32_t phy_reg;
+ u32_t phy_id;
mdio_bus_enable(gmac);
@@ -186,13 +186,13 @@
}
int phy_sam_gmac_auto_negotiate(const struct phy_sam_gmac_dev *phy,
- uint32_t *status)
+ u32_t *status)
{
Gmac *const gmac = phy->regs;
- uint32_t val;
- uint32_t ability_adv;
- uint32_t ability_rcvd;
- uint32_t retries = PHY_AUTONEG_TIMEOUT_MS / 100;
+ u32_t val;
+ u32_t ability_adv;
+ u32_t ability_rcvd;
+ u32_t retries = PHY_AUTONEG_TIMEOUT_MS / 100;
int retval;
mdio_bus_enable(gmac);
diff --git a/drivers/ethernet/phy_sam_gmac.h b/drivers/ethernet/phy_sam_gmac.h
index 5c2178e..640edb5 100644
--- a/drivers/ethernet/phy_sam_gmac.h
+++ b/drivers/ethernet/phy_sam_gmac.h
@@ -24,7 +24,7 @@
struct phy_sam_gmac_dev {
Gmac *regs;
- uint8_t address;
+ u8_t address;
};
/**
@@ -43,7 +43,7 @@
* @return 0 on success or a negative error value on failure
*/
int phy_sam_gmac_auto_negotiate(const struct phy_sam_gmac_dev *phy,
- uint32_t *status);
+ u32_t *status);
/**
* @brief Get PHY ID value.
@@ -51,7 +51,7 @@
* @param phy PHY instance
* @return PHY ID value or 0xFFFFFFFF on failure
*/
-uint32_t phy_sam_gmac_id_get(const struct phy_sam_gmac_dev *phy);
+u32_t phy_sam_gmac_id_get(const struct phy_sam_gmac_dev *phy);
#ifdef __cplusplus
}
diff --git a/drivers/ieee802154/ieee802154_cc2520.c b/drivers/ieee802154/ieee802154_cc2520.c
index a6eef8c..1696c60 100644
--- a/drivers/ieee802154/ieee802154_cc2520.c
+++ b/drivers/ieee802154/ieee802154_cc2520.c
@@ -78,7 +78,7 @@
static inline void _cc2520_print_exceptions(struct cc2520_context *cc2520)
{
- uint8_t flag = read_reg_excflag0(&cc2520->spi);
+ u8_t flag = read_reg_excflag0(&cc2520->spi);
SYS_LOG_DBG("EXCFLAG0:");
@@ -157,7 +157,7 @@
static inline void _cc2520_print_errors(struct cc2520_context *cc2520)
{
- uint8_t flag = read_reg_excflag2(&cc2520->spi);
+ u8_t flag = read_reg_excflag2(&cc2520->spi);
SYS_LOG_DBG("EXCFLAG2:");
@@ -203,10 +203,10 @@
********************/
#define _usleep(usec) k_busy_wait(usec)
-uint8_t _cc2520_read_reg(struct cc2520_spi *spi,
- bool freg, uint8_t addr)
+u8_t _cc2520_read_reg(struct cc2520_spi *spi,
+ bool freg, u8_t addr)
{
- uint8_t len = freg ? 2 : 3;
+ u8_t len = freg ? 2 : 3;
spi->cmd_buf[0] = freg ? CC2520_INS_REGRD | addr : CC2520_INS_MEMRD;
spi->cmd_buf[1] = freg ? 0 : addr;
@@ -223,9 +223,9 @@
}
bool _cc2520_write_reg(struct cc2520_spi *spi, bool freg,
- uint8_t addr, uint8_t value)
+ u8_t addr, u8_t value)
{
- uint8_t len = freg ? 2 : 3;
+ u8_t len = freg ? 2 : 3;
spi->cmd_buf[0] = freg ? CC2520_INS_REGWR | addr : CC2520_INS_MEMWR;
spi->cmd_buf[1] = freg ? value : addr;
@@ -236,13 +236,13 @@
return (spi_write(spi->dev, spi->cmd_buf, len) == 0);
}
-bool _cc2520_write_ram(struct cc2520_spi *spi, uint16_t addr,
- uint8_t *data_buf, uint8_t len)
+bool _cc2520_write_ram(struct cc2520_spi *spi, u16_t addr,
+ u8_t *data_buf, u8_t len)
{
#ifndef CONFIG_IEEE802154_CC2520_CRYPTO
- uint8_t *cmd_data = spi->cmd_buf;
+ u8_t *cmd_data = spi->cmd_buf;
#else
- uint8_t cmd_data[128];
+ u8_t cmd_data[128];
#endif
cmd_data[0] = CC2520_INS_MEMWR | (addr >> 8);
@@ -255,7 +255,7 @@
return (spi_write(spi->dev, cmd_data, len + 2) == 0);
}
-static uint8_t _cc2520_status(struct cc2520_spi *spi)
+static u8_t _cc2520_status(struct cc2520_spi *spi)
{
spi->cmd_buf[0] = CC2520_INS_SNOP;
@@ -271,8 +271,8 @@
static bool verify_osc_stabilization(struct cc2520_context *cc2520)
{
- uint8_t timeout = 100;
- uint8_t status;
+ u8_t timeout = 100;
+ u8_t status;
do {
status = _cc2520_status(&cc2520->spi);
@@ -284,12 +284,12 @@
}
-static inline uint8_t *get_mac(struct device *dev)
+static inline u8_t *get_mac(struct device *dev)
{
struct cc2520_context *cc2520 = dev->driver_data;
#if defined(CONFIG_IEEE802154_CC2520_RANDOM_MAC)
- uint32_t *ptr = (uint32_t *)(cc2520->mac_addr + 4);
+ u32_t *ptr = (u32_t *)(cc2520->mac_addr + 4);
UNALIGNED_PUT(sys_rand32_get(), ptr);
@@ -312,7 +312,7 @@
/******************
* GPIO functions *
*****************/
-static inline void set_reset(struct device *dev, uint32_t value)
+static inline void set_reset(struct device *dev, u32_t value)
{
struct cc2520_context *cc2520 = dev->driver_data;
@@ -320,7 +320,7 @@
cc2520->gpios[CC2520_GPIO_IDX_RESET].pin, value);
}
-static inline void set_vreg_en(struct device *dev, uint32_t value)
+static inline void set_vreg_en(struct device *dev, u32_t value)
{
struct cc2520_context *cc2520 = dev->driver_data;
@@ -328,9 +328,9 @@
cc2520->gpios[CC2520_GPIO_IDX_VREG_EN].pin, value);
}
-static inline uint32_t get_fifo(struct cc2520_context *cc2520)
+static inline u32_t get_fifo(struct cc2520_context *cc2520)
{
- uint32_t pin_value;
+ u32_t pin_value;
gpio_pin_read(cc2520->gpios[CC2520_GPIO_IDX_FIFO].dev,
cc2520->gpios[CC2520_GPIO_IDX_FIFO].pin, &pin_value);
@@ -338,9 +338,9 @@
return pin_value;
}
-static inline uint32_t get_fifop(struct cc2520_context *cc2520)
+static inline u32_t get_fifop(struct cc2520_context *cc2520)
{
- uint32_t pin_value;
+ u32_t pin_value;
gpio_pin_read(cc2520->gpios[CC2520_GPIO_IDX_FIFOP].dev,
cc2520->gpios[CC2520_GPIO_IDX_FIFOP].pin, &pin_value);
@@ -348,9 +348,9 @@
return pin_value;
}
-static inline uint32_t get_cca(struct cc2520_context *cc2520)
+static inline u32_t get_cca(struct cc2520_context *cc2520)
{
- uint32_t pin_value;
+ u32_t pin_value;
gpio_pin_read(cc2520->gpios[CC2520_GPIO_IDX_CCA].dev,
cc2520->gpios[CC2520_GPIO_IDX_CCA].pin, &pin_value);
@@ -359,7 +359,7 @@
}
static inline void sfd_int_handler(struct device *port,
- struct gpio_callback *cb, uint32_t pins)
+ struct gpio_callback *cb, u32_t pins)
{
struct cc2520_context *cc2520 =
CONTAINER_OF(cb, struct cc2520_context, sfd_cb);
@@ -371,7 +371,7 @@
}
static inline void fifop_int_handler(struct device *port,
- struct gpio_callback *cb, uint32_t pins)
+ struct gpio_callback *cb, u32_t pins)
{
struct cc2520_context *cc2520 =
CONTAINER_OF(cb, struct cc2520_context, fifop_cb);
@@ -436,7 +436,7 @@
* TX functions *
***************/
static inline bool write_txfifo_length(struct cc2520_spi *spi,
- uint8_t len)
+ u8_t len)
{
spi->cmd_buf[0] = CC2520_INS_TXBUF;
spi->cmd_buf[1] = len + CC2520_FCS_LENGTH;
@@ -447,9 +447,9 @@
}
static inline bool write_txfifo_content(struct cc2520_spi *spi,
- uint8_t *frame, uint8_t len)
+ u8_t *frame, u8_t len)
{
- uint8_t cmd[128];
+ u8_t cmd[128];
cmd[0] = CC2520_INS_TXBUF;
memcpy(&cmd[1], frame, len);
@@ -460,7 +460,7 @@
}
static inline bool verify_txfifo_status(struct cc2520_context *cc2520,
- uint8_t len)
+ u8_t len)
{
if (read_reg_txfifocnt(&cc2520->spi) < len ||
(read_reg_excflag0(&cc2520->spi) & EXCFLAG0_TX_UNDERFLOW)) {
@@ -472,8 +472,8 @@
static inline bool verify_tx_done(struct cc2520_context *cc2520)
{
- uint8_t timeout = 10;
- uint8_t status;
+ u8_t timeout = 10;
+ u8_t status;
do {
_usleep(1);
@@ -501,7 +501,7 @@
write_reg_excflag0(&cc2520->spi, EXCFLAG0_RESET_RX_FLAGS);
}
-static inline uint8_t read_rxfifo_length(struct cc2520_spi *spi)
+static inline u8_t read_rxfifo_length(struct cc2520_spi *spi)
{
spi->cmd_buf[0] = CC2520_INS_RXBUF;
spi->cmd_buf[1] = 0;
@@ -517,9 +517,9 @@
}
static inline bool read_rxfifo_content(struct cc2520_spi *spi,
- struct net_buf *frag, uint8_t len)
+ struct net_buf *frag, u8_t len)
{
- uint8_t data[128+1];
+ u8_t data[128+1];
data[0] = CC2520_INS_RXBUF;
memset(&data[1], 0, len);
@@ -584,7 +584,7 @@
}
static inline bool verify_rxfifo_validity(struct cc2520_spi *spi,
- uint8_t pkt_len)
+ u8_t pkt_len)
{
if (pkt_len < 2 || read_reg_rxfifocnt(spi) != pkt_len) {
return false;
@@ -599,7 +599,7 @@
struct cc2520_context *cc2520 = dev->driver_data;
struct net_buf *pkt_frag = NULL;
struct net_pkt *pkt;
- uint8_t pkt_len;
+ u8_t pkt_len;
while (1) {
pkt = NULL;
@@ -717,7 +717,7 @@
return 0;
}
-static int cc2520_set_channel(struct device *dev, uint16_t channel)
+static int cc2520_set_channel(struct device *dev, u16_t channel)
{
struct cc2520_context *cc2520 = dev->driver_data;
@@ -738,7 +738,7 @@
return 0;
}
-static int cc2520_set_pan_id(struct device *dev, uint16_t pan_id)
+static int cc2520_set_pan_id(struct device *dev, u16_t pan_id)
{
struct cc2520_context *cc2520 = dev->driver_data;
@@ -746,7 +746,7 @@
pan_id = sys_le16_to_cpu(pan_id);
- if (!write_mem_pan_id(&cc2520->spi, (uint8_t *) &pan_id)) {
+ if (!write_mem_pan_id(&cc2520->spi, (u8_t *) &pan_id)) {
SYS_LOG_ERR("Failed");
return -EIO;
}
@@ -754,7 +754,7 @@
return 0;
}
-static int cc2520_set_short_addr(struct device *dev, uint16_t short_addr)
+static int cc2520_set_short_addr(struct device *dev, u16_t short_addr)
{
struct cc2520_context *cc2520 = dev->driver_data;
@@ -762,7 +762,7 @@
short_addr = sys_le16_to_cpu(short_addr);
- if (!write_mem_short_addr(&cc2520->spi, (uint8_t *) &short_addr)) {
+ if (!write_mem_short_addr(&cc2520->spi, (u8_t *) &short_addr)) {
SYS_LOG_ERR("Failed");
return -EIO;
}
@@ -770,7 +770,7 @@
return 0;
}
-static int cc2520_set_ieee_addr(struct device *dev, const uint8_t *ieee_addr)
+static int cc2520_set_ieee_addr(struct device *dev, const u8_t *ieee_addr)
{
struct cc2520_context *cc2520 = dev->driver_data;
@@ -786,10 +786,10 @@
return 0;
}
-static int cc2520_set_txpower(struct device *dev, int16_t dbm)
+static int cc2520_set_txpower(struct device *dev, s16_t dbm)
{
struct cc2520_context *cc2520 = dev->driver_data;
- uint8_t pwr;
+ u8_t pwr;
SYS_LOG_DBG("%d", dbm);
@@ -840,10 +840,10 @@
struct net_pkt *pkt,
struct net_buf *frag)
{
- uint8_t *frame = frag->data - net_pkt_ll_reserve(pkt);
- uint8_t len = net_pkt_ll_reserve(pkt) + frag->len;
+ u8_t *frame = frag->data - net_pkt_ll_reserve(pkt);
+ u8_t len = net_pkt_ll_reserve(pkt) + frag->len;
struct cc2520_context *cc2520 = dev->driver_data;
- uint8_t retry = 2;
+ u8_t retry = 2;
bool status;
SYS_LOG_DBG("%p (%u)", frag, len);
@@ -943,7 +943,7 @@
return 0;
}
-static uint8_t cc2520_get_lqi(struct device *dev)
+static u8_t cc2520_get_lqi(struct device *dev)
{
struct cc2520_context *cc2520 = dev->driver_data;
@@ -1090,7 +1090,7 @@
{
struct device *dev = net_if_get_device(iface);
struct cc2520_context *cc2520 = dev->driver_data;
- uint8_t *mac = get_mac(dev);
+ u8_t *mac = get_mac(dev);
SYS_LOG_DBG("");
@@ -1142,10 +1142,10 @@
#ifdef CONFIG_IEEE802154_CC2520_CRYPTO
-static bool _cc2520_read_ram(struct cc2520_spi *spi, uint16_t addr,
- uint8_t *data_buf, uint8_t len)
+static bool _cc2520_read_ram(struct cc2520_spi *spi, u16_t addr,
+ u8_t *data_buf, u8_t len)
{
- uint8_t cmd_buf[128];
+ u8_t cmd_buf[128];
cmd_buf[0] = CC2520_INS_MEMRD | (addr >> 8);
cmd_buf[1] = addr;
@@ -1163,15 +1163,15 @@
}
static inline bool instruct_ccm(struct cc2520_context *cc2520,
- uint8_t key_addr,
- uint8_t auth_crypt,
- uint8_t nonce_addr,
- uint16_t input_addr,
- uint16_t output_addr,
- uint8_t in_len,
- uint8_t m)
+ u8_t key_addr,
+ u8_t auth_crypt,
+ u8_t nonce_addr,
+ u16_t input_addr,
+ u16_t output_addr,
+ u8_t in_len,
+ u8_t m)
{
- uint8_t cmd[9];
+ u8_t cmd[9];
int ret;
SYS_LOG_DBG("CCM(P={01} K={%02x} C={%02x} N={%02x}"
@@ -1183,10 +1183,10 @@
cmd[1] = key_addr;
cmd[2] = (auth_crypt & 0x7f);
cmd[3] = nonce_addr;
- cmd[4] = (uint8_t)(((input_addr & 0x0f00) >> 4) |
+ cmd[4] = (u8_t)(((input_addr & 0x0f00) >> 4) |
((output_addr & 0x0f00) >> 8));
- cmd[5] = (uint8_t)(input_addr & 0x00ff);
- cmd[6] = (uint8_t)(output_addr & 0x00ff);
+ cmd[5] = (u8_t)(input_addr & 0x00ff);
+ cmd[6] = (u8_t)(output_addr & 0x00ff);
cmd[7] = (in_len & 0x7f);
cmd[8] = (m & 0x03);
@@ -1205,15 +1205,15 @@
}
static inline bool instruct_uccm(struct cc2520_context *cc2520,
- uint8_t key_addr,
- uint8_t auth_crypt,
- uint8_t nonce_addr,
- uint16_t input_addr,
- uint16_t output_addr,
- uint8_t in_len,
- uint8_t m)
+ u8_t key_addr,
+ u8_t auth_crypt,
+ u8_t nonce_addr,
+ u16_t input_addr,
+ u16_t output_addr,
+ u8_t in_len,
+ u8_t m)
{
- uint8_t cmd[9];
+ u8_t cmd[9];
int ret;
SYS_LOG_DBG("UCCM(P={01} K={%02x} C={%02x} N={%02x}"
@@ -1225,10 +1225,10 @@
cmd[1] = key_addr;
cmd[2] = (auth_crypt & 0x7f);
cmd[3] = nonce_addr;
- cmd[4] = (uint8_t)(((input_addr & 0x0f00) >> 4) |
+ cmd[4] = (u8_t)(((input_addr & 0x0f00) >> 4) |
((output_addr & 0x0f00) >> 8));
- cmd[5] = (uint8_t)(input_addr & 0x00ff);
- cmd[6] = (uint8_t)(output_addr & 0x00ff);
+ cmd[5] = (u8_t)(input_addr & 0x00ff);
+ cmd[6] = (u8_t)(output_addr & 0x00ff);
cmd[7] = (in_len & 0x7f);
cmd[8] = (m & 0x03);
@@ -1246,15 +1246,15 @@
return true;
}
-static inline void generate_nonce(uint8_t *ccm_nonce, uint8_t *nonce,
- struct cipher_aead_pkt *apkt, uint8_t m)
+static inline void generate_nonce(u8_t *ccm_nonce, u8_t *nonce,
+ struct cipher_aead_pkt *apkt, u8_t m)
{
nonce[0] = 0 | (apkt->ad_len ? 0x40 : 0) | (m << 3) | 1;
memcpy(&nonce[1], ccm_nonce, 13);
- nonce[14] = (uint8_t)(apkt->pkt->in_len >> 8);
- nonce[15] = (uint8_t)(apkt->pkt->in_len);
+ nonce[14] = (u8_t)(apkt->pkt->in_len >> 8);
+ nonce[15] = (u8_t)(apkt->pkt->in_len);
/* See section 26.8.1 */
sys_mem_swap(nonce, 16);
@@ -1262,13 +1262,13 @@
static int insert_crypto_parameters(struct cipher_ctx *ctx,
struct cipher_aead_pkt *apkt,
- uint8_t *ccm_nonce, uint8_t *auth_crypt)
+ u8_t *ccm_nonce, u8_t *auth_crypt)
{
struct cc2520_context *cc2520 = ctx->device->driver_data;
- uint8_t data[128];
- uint8_t *in_buf;
- uint8_t in_len;
- uint8_t m = 0;
+ u8_t data[128];
+ u8_t *in_buf;
+ u8_t in_len;
+ u8_t m = 0;
if (!apkt->pkt->out_buf || !apkt->pkt->out_buf_max) {
SYS_LOG_ERR("Out buffer needs to be set");
@@ -1353,10 +1353,10 @@
static int _cc2520_crypto_ccm(struct cipher_ctx *ctx,
struct cipher_aead_pkt *apkt,
- uint8_t *ccm_nonce)
+ u8_t *ccm_nonce)
{
struct cc2520_context *cc2520 = ctx->device->driver_data;
- uint8_t auth_crypt;
+ u8_t auth_crypt;
int m;
if (!apkt || !apkt->pkt) {
@@ -1400,10 +1400,10 @@
static int _cc2520_crypto_uccm(struct cipher_ctx *ctx,
struct cipher_aead_pkt *apkt,
- uint8_t *ccm_nonce)
+ u8_t *ccm_nonce)
{
struct cc2520_context *cc2520 = ctx->device->driver_data;
- uint8_t auth_crypt;
+ u8_t auth_crypt;
int m;
if (!apkt || !apkt->pkt) {
diff --git a/drivers/ieee802154/ieee802154_cc2520.h b/drivers/ieee802154/ieee802154_cc2520.h
index 8311cbe..755f9dc 100644
--- a/drivers/ieee802154/ieee802154_cc2520.h
+++ b/drivers/ieee802154/ieee802154_cc2520.h
@@ -20,12 +20,12 @@
*/
struct cc2520_spi {
struct device *dev;
- uint32_t slave;
+ u32_t slave;
/**
* cmd_buf will use at most 9 bytes:
* dummy bytes + 8 ieee address bytes
*/
- uint8_t cmd_buf[12];
+ u8_t cmd_buf[12];
};
struct cc2520_context {
@@ -35,7 +35,7 @@
struct gpio_callback sfd_cb;
struct gpio_callback fifop_cb;
struct cc2520_spi spi;
- uint8_t mac_addr[8];
+ u8_t mac_addr[8];
/************TX************/
struct k_sem tx_sync;
atomic_t tx;
@@ -46,7 +46,7 @@
struct k_sem access_lock;
#endif
bool overflow;
- uint8_t lqi;
+ u8_t lqi;
};
#include "ieee802154_cc2520_regs.h"
@@ -56,20 +56,20 @@
***************************
*/
-uint8_t _cc2520_read_reg(struct cc2520_spi *spi,
- bool freg, uint8_t addr);
+u8_t _cc2520_read_reg(struct cc2520_spi *spi,
+ bool freg, u8_t addr);
bool _cc2520_write_reg(struct cc2520_spi *spi, bool freg,
- uint8_t addr, uint8_t value);
+ u8_t addr, u8_t value);
#define DEFINE_REG_READ(__reg_name, __reg_addr, __freg) \
- static inline uint8_t read_reg_##__reg_name(struct cc2520_spi *spi) \
+ static inline u8_t read_reg_##__reg_name(struct cc2520_spi *spi) \
{ \
return _cc2520_read_reg(spi, __freg, __reg_addr); \
}
#define DEFINE_REG_WRITE(__reg_name, __reg_addr, __freg) \
static inline bool write_reg_##__reg_name(struct cc2520_spi *spi, \
- uint8_t val) \
+ u8_t val) \
{ \
return _cc2520_write_reg(spi, __freg, __reg_addr, val); \
}
@@ -128,12 +128,12 @@
************************
*/
-bool _cc2520_write_ram(struct cc2520_spi *spi, uint16_t addr,
- uint8_t *data_buf, uint8_t len);
+bool _cc2520_write_ram(struct cc2520_spi *spi, u16_t addr,
+ u8_t *data_buf, u8_t len);
#define DEFINE_MEM_WRITE(__mem_name, __addr, __sz) \
static inline bool write_mem_##__mem_name(struct cc2520_spi *spi, \
- uint8_t *buf) \
+ u8_t *buf) \
{ \
return _cc2520_write_ram(spi, __addr, buf, __sz); \
}
@@ -148,7 +148,7 @@
*/
static inline bool _cc2520_command_strobe(struct cc2520_spi *spi,
- uint8_t instruction)
+ u8_t instruction)
{
spi_slave_select(spi->dev, spi->slave);
@@ -156,9 +156,9 @@
}
static inline bool _cc2520_command_strobe_snop(struct cc2520_spi *spi,
- uint8_t instruction)
+ u8_t instruction)
{
- uint8_t ins[2] = {
+ u8_t ins[2] = {
instruction,
CC2520_INS_SNOP
};
diff --git a/drivers/ieee802154/ieee802154_cc2520_regs.h b/drivers/ieee802154/ieee802154_cc2520_regs.h
index f312e08..6a67bde 100644
--- a/drivers/ieee802154/ieee802154_cc2520_regs.h
+++ b/drivers/ieee802154/ieee802154_cc2520_regs.h
@@ -111,12 +111,12 @@
#define EXCFLAG0_RX_UNDERFLOW BIT(5)
#define EXCFLAG0_RX_OVERFLOW BIT(6)
#define EXCFLAG0_RXENABLE_ZERO BIT(7)
-#define EXCFLAG0_RESET_TX_FLAGS ((uint8_t) \
+#define EXCFLAG0_RESET_TX_FLAGS ((u8_t) \
~(EXCFLAG0_TX_FRM_DONE | \
EXCFLAG0_TX_ACK_DONE | \
EXCFLAG0_TX_UNDERFLOW | \
EXCFLAG0_TX_OVERFLOW))
-#define EXCFLAG0_RESET_RX_FLAGS ((uint8_t) \
+#define EXCFLAG0_RESET_RX_FLAGS ((u8_t) \
~(EXCFLAG0_RX_UNDERFLOW | \
EXCFLAG0_RX_OVERFLOW | \
EXCFLAG0_RXENABLE_ZERO))
@@ -130,7 +130,7 @@
#define EXCFLAG1_SFD BIT(5)
#define EXCFLAG1_DPU_DONE_L BIT(6)
#define EXCFLAG1_DPU_DONE_H BIT(7)
-#define EXCFLAG1_RESET_RX_FLAGS ((uint8_t) \
+#define EXCFLAG1_RESET_RX_FLAGS ((u8_t) \
~(EXCFLAG1_RX_FRM_DONE | \
EXCFLAG1_RX_FRM_ACCEPTED | \
EXCFLAG1_FIFOP))
diff --git a/drivers/ieee802154/ieee802154_mcr20a.c b/drivers/ieee802154/ieee802154_mcr20a.c
index fbac7b8..7ab2eca 100644
--- a/drivers/ieee802154/ieee802154_mcr20a.c
+++ b/drivers/ieee802154/ieee802154_mcr20a.c
@@ -105,7 +105,7 @@
#define MCR20A_OUTPUT_POWER_MIN (-35)
/* Lookup table for the Power Control register */
-static const uint8_t pow_lt[44] = {
+static const u8_t pow_lt[44] = {
3, 4, 5, 6,
6, 7, 7, 8,
8, 9, 9, 10,
@@ -127,14 +127,14 @@
* F = ((PLL_INT0 + 64) + (PLL_FRAC0/65536))32MHz
*
*/
-static const uint8_t pll_int_lt[16] = {
+static const u8_t pll_int_lt[16] = {
11, 11, 11, 11,
11, 11, 12, 12,
12, 12, 12, 12,
13, 13, 13, 13
};
-static const uint16_t pll_frac_lt[16] = {
+static const u16_t pll_frac_lt[16] = {
10240, 20480, 30720, 40960,
51200, 61440, 6144, 16384,
26624, 36864, 47104, 57344,
@@ -144,9 +144,9 @@
#define _usleep(usec) k_busy_wait(usec)
/* Read direct (dreg is true) or indirect register (dreg is false) */
-uint8_t _mcr20a_read_reg(struct mcr20a_spi *spi, bool dreg, uint8_t addr)
+u8_t _mcr20a_read_reg(struct mcr20a_spi *spi, bool dreg, u8_t addr)
{
- uint8_t len = dreg ? 2 : 3;
+ u8_t len = dreg ? 2 : 3;
k_sem_take(&spi->spi_sem, K_FOREVER);
@@ -169,10 +169,10 @@
}
/* Write direct (dreg is true) or indirect register (dreg is false) */
-bool _mcr20a_write_reg(struct mcr20a_spi *spi, bool dreg, uint8_t addr,
- uint8_t value)
+bool _mcr20a_write_reg(struct mcr20a_spi *spi, bool dreg, u8_t addr,
+ u8_t value)
{
- uint8_t len = dreg ? 2 : 3;
+ u8_t len = dreg ? 2 : 3;
bool retval;
k_sem_take(&spi->spi_sem, K_FOREVER);
@@ -191,8 +191,8 @@
}
/* Write multiple bytes to direct or indirect register */
-bool _mcr20a_write_burst(struct mcr20a_spi *spi, bool dreg, uint16_t addr,
- uint8_t *data_buf, uint8_t len)
+bool _mcr20a_write_burst(struct mcr20a_spi *spi, bool dreg, u16_t addr,
+ u8_t *data_buf, u8_t len)
{
bool retval;
@@ -222,8 +222,8 @@
}
/* Read multiple bytes from direct or indirect register */
-bool _mcr20a_read_burst(struct mcr20a_spi *spi, bool dreg, uint16_t addr,
- uint8_t *data_buf, uint8_t len)
+bool _mcr20a_read_burst(struct mcr20a_spi *spi, bool dreg, u16_t addr,
+ u8_t *data_buf, u8_t len)
{
k_sem_take(&spi->spi_sem, K_FOREVER);
@@ -262,7 +262,7 @@
/* Mask (msk is true) or unmask all interrupts from asserting IRQ_B */
static bool mcr20a_mask_irqb(struct mcr20a_context *dev, bool msk)
{
- uint8_t ctrl4 = read_reg_phy_ctrl4(&dev->spi);
+ u8_t ctrl4 = read_reg_phy_ctrl4(&dev->spi);
if (msk) {
ctrl4 |= MCR20A_PHY_CTRL4_TRCV_MSK;
@@ -275,14 +275,14 @@
/** Set an timeout value for the given compare register */
static int mcr20a_timer_set(struct mcr20a_context *mcr20a,
- uint8_t cmp_reg,
- uint32_t timeout)
+ u8_t cmp_reg,
+ u32_t timeout)
{
- uint32_t now = 0;
- uint32_t next;
+ u32_t now = 0;
+ u32_t next;
bool retval;
- if (!read_burst_event_timer(&mcr20a->spi, (uint8_t *)&now)) {
+ if (!read_burst_event_timer(&mcr20a->spi, (u8_t *)&now)) {
goto error;
}
@@ -293,16 +293,16 @@
switch (cmp_reg) {
case 1:
- retval = write_burst_t1cmp(&mcr20a->spi, (uint8_t *)&next);
+ retval = write_burst_t1cmp(&mcr20a->spi, (u8_t *)&next);
break;
case 2:
- retval = write_burst_t2cmp(&mcr20a->spi, (uint8_t *)&next);
+ retval = write_burst_t2cmp(&mcr20a->spi, (u8_t *)&next);
break;
case 3:
- retval = write_burst_t3cmp(&mcr20a->spi, (uint8_t *)&next);
+ retval = write_burst_t3cmp(&mcr20a->spi, (u8_t *)&next);
break;
case 4:
- retval = write_burst_t4cmp(&mcr20a->spi, (uint8_t *)&next);
+ retval = write_burst_t4cmp(&mcr20a->spi, (u8_t *)&next);
break;
default:
goto error;
@@ -319,11 +319,11 @@
return -EIO;
}
-static int mcr20a_timer_init(struct device *dev, uint8_t tb)
+static int mcr20a_timer_init(struct device *dev, u8_t tb)
{
struct mcr20a_context *mcr20a = dev->driver_data;
- uint8_t buf[3] = {0, 0, 0};
- uint8_t ctrl4;
+ u8_t buf[3] = {0, 0, 0};
+ u8_t ctrl4;
if (!write_reg_tmr_prescale(&mcr20a->spi,
set_bits_tmr_prescale(tb))) {
@@ -350,10 +350,10 @@
/* Set Timer Comparator 4 */
static int mcr20a_t4cmp_set(struct mcr20a_context *mcr20a,
- uint32_t timeout)
+ u32_t timeout)
{
- uint8_t irqsts3;
- uint8_t ctrl3;
+ u8_t irqsts3;
+ u8_t ctrl3;
if (mcr20a_timer_set(mcr20a, 4, timeout)) {
goto error;
@@ -383,8 +383,8 @@
/* Clear Timer Comparator 4 */
static int mcr20a_t4cmp_clear(struct mcr20a_context *mcr20a)
{
- uint8_t irqsts3;
- uint8_t ctrl3;
+ u8_t irqsts3;
+ u8_t ctrl3;
ctrl3 = read_reg_phy_ctrl3(&mcr20a->spi);
ctrl3 &= ~MCR20A_PHY_CTRL3_TMR4CMP_EN;
@@ -407,8 +407,8 @@
static inline void _xcvseq_wait_until_idle(struct mcr20a_context *mcr20a)
{
- uint8_t state;
- uint8_t retries = MCR20A_GET_SEQ_STATE_RETRIES;
+ u8_t state;
+ u8_t retries = MCR20A_GET_SEQ_STATE_RETRIES;
do {
state = read_reg_seq_state(&mcr20a->spi);
@@ -423,7 +423,7 @@
static inline int mcr20a_abort_sequence(struct mcr20a_context *mcr20a,
bool force)
{
- uint8_t ctrl1;
+ u8_t ctrl1;
ctrl1 = read_reg_phy_ctrl1(&mcr20a->spi);
SYS_LOG_DBG("CTRL1 0x%02x", ctrl1);
@@ -453,9 +453,9 @@
/* Initiate a (new) Transceiver Sequence */
static inline int mcr20a_set_sequence(struct mcr20a_context *mcr20a,
- uint8_t seq)
+ u8_t seq)
{
- uint8_t ctrl1 = 0;
+ u8_t ctrl1 = 0;
seq = set_bits_phy_ctrl1_xcvseq(seq);
ctrl1 = read_reg_phy_ctrl1(&mcr20a->spi);
@@ -476,7 +476,7 @@
return 0;
}
-static inline uint32_t mcr20a_get_rssi(uint32_t lqi)
+static inline u32_t mcr20a_get_rssi(u32_t lqi)
{
/* Get rssi (Received Signal Strength Indicator, unit is dBm)
* from lqi (Link Quality Indicator) value.
@@ -489,19 +489,19 @@
* -RF * 65536 = (LQI / 2.84 - 295.4 / 2.84) * 65536
* RF * 65536 = (295.4 * 65536 / 2.84) - (LQI * 65536 / 2.84)
*/
- uint32_t a = (uint32_t)(295.4 * 65536 / 2.84);
- uint32_t b = (uint32_t)(65536 / 2.84);
+ u32_t a = (u32_t)(295.4 * 65536 / 2.84);
+ u32_t b = (u32_t)(65536 / 2.84);
return (a - (b * lqi)) >> 16;
}
-static inline uint8_t *get_mac(struct device *dev)
+static inline u8_t *get_mac(struct device *dev)
{
struct mcr20a_context *mcr20a = dev->driver_data;
- uint32_t *ptr = (uint32_t *)(mcr20a->mac_addr);
+ u32_t *ptr = (u32_t *)(mcr20a->mac_addr);
UNALIGNED_PUT(sys_rand32_get(), ptr);
- ptr = (uint32_t *)(mcr20a->mac_addr + 4);
+ ptr = (u32_t *)(mcr20a->mac_addr + 4);
UNALIGNED_PUT(sys_rand32_get(), ptr);
mcr20a->mac_addr[0] = (mcr20a->mac_addr[0] & ~0x01) | 0x02;
@@ -510,9 +510,9 @@
}
static inline bool read_rxfifo_content(struct mcr20a_spi *spi,
- struct net_buf *buf, uint8_t len)
+ struct net_buf *buf, u8_t len)
{
- uint8_t data[1 + MCR20A_PSDU_LENGTH];
+ u8_t data[1 + MCR20A_PSDU_LENGTH];
if (len > MCR20A_PSDU_LENGTH) {
SYS_LOG_ERR("Packet length too large");
@@ -537,11 +537,11 @@
return true;
}
-static inline void mcr20a_rx(struct mcr20a_context *mcr20a, uint8_t len)
+static inline void mcr20a_rx(struct mcr20a_context *mcr20a, u8_t len)
{
struct net_pkt *pkt = NULL;
struct net_buf *frag;
- uint8_t pkt_len;
+ u8_t pkt_len;
pkt_len = len - MCR20A_FCS_LENGTH;
@@ -607,10 +607,10 @@
* when a sequence has been completed.
*/
static inline bool _irqsts1_event(struct mcr20a_context *mcr20a,
- uint8_t *dregs)
+ u8_t *dregs)
{
- uint8_t seq = dregs[MCR20A_PHY_CTRL1] & MCR20A_PHY_CTRL1_XCVSEQ_MASK;
- uint8_t new_seq = MCR20A_XCVSEQ_RECEIVE;
+ u8_t seq = dregs[MCR20A_PHY_CTRL1] & MCR20A_PHY_CTRL1_XCVSEQ_MASK;
+ u8_t new_seq = MCR20A_XCVSEQ_RECEIVE;
bool retval = false;
switch (seq) {
@@ -694,7 +694,7 @@
* usually the TR.
*/
static inline bool _irqsts3_event(struct mcr20a_context *mcr20a,
- uint8_t *dregs)
+ u8_t *dregs)
{
bool retval = false;
@@ -724,9 +724,9 @@
{
struct device *dev = (struct device *)arg;
struct mcr20a_context *mcr20a = dev->driver_data;
- uint8_t dregs[MCR20A_PHY_CTRL4 + 1];
+ u8_t dregs[MCR20A_PHY_CTRL4 + 1];
bool set_new_seq;
- uint8_t ctrl1 = 0;
+ u8_t ctrl1 = 0;
while (true) {
k_sem_take(&mcr20a->isr_sem, K_FOREVER);
@@ -796,7 +796,7 @@
}
static inline void irqb_int_handler(struct device *port,
- struct gpio_callback *cb, uint32_t pins)
+ struct gpio_callback *cb, u32_t pins)
{
struct mcr20a_context *mcr20a = CONTAINER_OF(cb,
struct mcr20a_context,
@@ -804,7 +804,7 @@
k_sem_give(&mcr20a->isr_sem);
}
-static inline void set_reset(struct device *dev, uint32_t value)
+static inline void set_reset(struct device *dev, u32_t value)
{
struct mcr20a_context *mcr20a = dev->driver_data;
@@ -832,10 +832,10 @@
gpio_add_callback(mcr20a->irq_gpio, &mcr20a->irqb_cb);
}
-static int mcr20a_set_cca_mode(struct device *dev, uint8_t mode)
+static int mcr20a_set_cca_mode(struct device *dev, u8_t mode)
{
struct mcr20a_context *mcr20a = dev->driver_data;
- uint8_t ctrl4;
+ u8_t ctrl4;
ctrl4 = read_reg_phy_ctrl4(&mcr20a->spi);
ctrl4 &= ~MCR20A_PHY_CTRL4_CCATYPE_MASK;
@@ -891,11 +891,11 @@
return -EIO;
}
-static int mcr20a_set_channel(struct device *dev, uint16_t channel)
+static int mcr20a_set_channel(struct device *dev, u16_t channel)
{
struct mcr20a_context *mcr20a = dev->driver_data;
- uint8_t buf[3];
- uint8_t ctrl1;
+ u8_t buf[3];
+ u8_t ctrl1;
int retval = -EIO;
if (channel < 11 || channel > 26) {
@@ -920,8 +920,8 @@
SYS_LOG_DBG("%u", channel);
channel -= 11;
buf[0] = set_bits_pll_int0_val(pll_int_lt[channel]);
- buf[1] = (uint8_t)pll_frac_lt[channel];
- buf[2] = (uint8_t)(pll_frac_lt[channel] >> 8);
+ buf[1] = (u8_t)pll_frac_lt[channel];
+ buf[2] = (u8_t)(pll_frac_lt[channel] >> 8);
if (!write_burst_pll_int0(&mcr20a->spi, buf)) {
SYS_LOG_ERR("Failed to set PLL");
@@ -946,14 +946,14 @@
return retval;
}
-static int mcr20a_set_pan_id(struct device *dev, uint16_t pan_id)
+static int mcr20a_set_pan_id(struct device *dev, u16_t pan_id)
{
struct mcr20a_context *mcr20a = dev->driver_data;
pan_id = sys_le16_to_cpu(pan_id);
k_mutex_lock(&mcr20a->phy_mutex, K_FOREVER);
- if (!write_burst_pan_id(&mcr20a->spi, (uint8_t *) &pan_id)) {
+ if (!write_burst_pan_id(&mcr20a->spi, (u8_t *) &pan_id)) {
SYS_LOG_ERR("FAILED");
return -EIO;
}
@@ -964,14 +964,14 @@
return 0;
}
-static int mcr20a_set_short_addr(struct device *dev, uint16_t short_addr)
+static int mcr20a_set_short_addr(struct device *dev, u16_t short_addr)
{
struct mcr20a_context *mcr20a = dev->driver_data;
short_addr = sys_le16_to_cpu(short_addr);
k_mutex_lock(&mcr20a->phy_mutex, K_FOREVER);
- if (!write_burst_short_addr(&mcr20a->spi, (uint8_t *) &short_addr)) {
+ if (!write_burst_short_addr(&mcr20a->spi, (u8_t *) &short_addr)) {
SYS_LOG_ERR("FAILED");
return -EIO;
}
@@ -982,7 +982,7 @@
return 0;
}
-static int mcr20a_set_ieee_addr(struct device *dev, const uint8_t *ieee_addr)
+static int mcr20a_set_ieee_addr(struct device *dev, const u8_t *ieee_addr)
{
struct mcr20a_context *mcr20a = dev->driver_data;
@@ -1001,10 +1001,10 @@
return 0;
}
-static int mcr20a_set_txpower(struct device *dev, int16_t dbm)
+static int mcr20a_set_txpower(struct device *dev, s16_t dbm)
{
struct mcr20a_context *mcr20a = dev->driver_data;
- uint8_t pwr;
+ u8_t pwr;
k_mutex_lock(&mcr20a->phy_mutex, K_FOREVER);
SYS_LOG_DBG("%d", dbm);
@@ -1032,9 +1032,9 @@
struct net_pkt *pkt,
struct net_buf *frag)
{
- uint8_t cmd[2 + MCR20A_PSDU_LENGTH];
- uint8_t payload_len = net_pkt_ll_reserve(pkt) + frag->len;
- uint8_t *payload = frag->data - net_pkt_ll_reserve(pkt);
+ u8_t cmd[2 + MCR20A_PSDU_LENGTH];
+ u8_t payload_len = net_pkt_ll_reserve(pkt) + frag->len;
+ u8_t *payload = frag->data - net_pkt_ll_reserve(pkt);
bool retval;
k_sem_take(&spi->spi_sem, K_FOREVER);
@@ -1069,7 +1069,7 @@
struct net_buf *frag)
{
struct mcr20a_context *mcr20a = dev->driver_data;
- uint8_t seq = MCR20A_AUTOACK_ENABLED ? MCR20A_XCVSEQ_TX_RX :
+ u8_t seq = MCR20A_AUTOACK_ENABLED ? MCR20A_XCVSEQ_TX_RX :
MCR20A_XCVSEQ_TX;
k_mutex_lock(&mcr20a->phy_mutex, K_FOREVER);
@@ -1118,8 +1118,8 @@
static int mcr20a_start(struct device *dev)
{
struct mcr20a_context *mcr20a = dev->driver_data;
- uint8_t timeout = 6;
- uint8_t status;
+ u8_t timeout = 6;
+ u8_t status;
k_mutex_lock(&mcr20a->phy_mutex, K_FOREVER);
enable_irqb_interrupt(mcr20a, false);
@@ -1206,7 +1206,7 @@
return -EIO;
}
-static uint8_t mcr20a_get_lqi(struct device *dev)
+static u8_t mcr20a_get_lqi(struct device *dev)
{
struct mcr20a_context *mcr20a = dev->driver_data;
@@ -1224,7 +1224,7 @@
k_sem_take(&spi->spi_sem, K_FOREVER);
- for (uint8_t i = 0;
+ for (u8_t i = 0;
i < sizeof(overwrites_indirect) / sizeof(overwrites_t);
i++) {
@@ -1252,9 +1252,9 @@
static int power_on_and_setup(struct device *dev)
{
struct mcr20a_context *mcr20a = dev->driver_data;
- uint8_t timeout = 6;
- uint32_t status;
- uint8_t tmp = 0;
+ u8_t timeout = 6;
+ u32_t status;
+ u8_t tmp = 0;
set_reset(dev, 0);
_usleep(150);
@@ -1418,7 +1418,7 @@
{
struct device *dev = net_if_get_device(iface);
struct mcr20a_context *mcr20a = dev->driver_data;
- uint8_t *mac = get_mac(dev);
+ u8_t *mac = get_mac(dev);
net_if_set_link_addr(iface, mac, 8, NET_LINK_IEEE802154);
diff --git a/drivers/ieee802154/ieee802154_mcr20a.h b/drivers/ieee802154/ieee802154_mcr20a.h
index 52c7180..2fd96b8 100644
--- a/drivers/ieee802154/ieee802154_mcr20a.h
+++ b/drivers/ieee802154/ieee802154_mcr20a.h
@@ -19,13 +19,13 @@
*/
struct mcr20a_spi {
struct device *dev;
- uint32_t slave;
+ u32_t slave;
struct k_sem spi_sem;
/**
* cmd_buf will use at most 9 bytes:
* dummy bytes + 8 ieee address bytes
*/
- uint8_t cmd_buf[12];
+ u8_t cmd_buf[12];
};
struct mcr20a_context {
@@ -35,7 +35,7 @@
struct device *reset_gpio;
struct gpio_callback irqb_cb;
struct mcr20a_spi spi;
- uint8_t mac_addr[8];
+ u8_t mac_addr[8];
struct k_mutex phy_mutex;
struct k_sem isr_sem;
/*********TX + CCA*********/
@@ -43,28 +43,28 @@
atomic_t seq_retval;
/************RX************/
char __stack mcr20a_rx_stack[CONFIG_IEEE802154_MCR20A_RX_STACK_SIZE];
- uint8_t lqi;
+ u8_t lqi;
};
#include "ieee802154_mcr20a_regs.h"
-uint8_t _mcr20a_read_reg(struct mcr20a_spi *spi, bool dreg, uint8_t addr);
-bool _mcr20a_write_reg(struct mcr20a_spi *spi, bool dreg, uint8_t addr,
- uint8_t value);
-bool _mcr20a_write_burst(struct mcr20a_spi *spi, bool dreg, uint16_t addr,
- uint8_t *data_buf, uint8_t len);
-bool _mcr20a_read_burst(struct mcr20a_spi *spi, bool dreg, uint16_t addr,
- uint8_t *data_buf, uint8_t len);
+u8_t _mcr20a_read_reg(struct mcr20a_spi *spi, bool dreg, u8_t addr);
+bool _mcr20a_write_reg(struct mcr20a_spi *spi, bool dreg, u8_t addr,
+ u8_t value);
+bool _mcr20a_write_burst(struct mcr20a_spi *spi, bool dreg, u16_t addr,
+ u8_t *data_buf, u8_t len);
+bool _mcr20a_read_burst(struct mcr20a_spi *spi, bool dreg, u16_t addr,
+ u8_t *data_buf, u8_t len);
#define DEFINE_REG_READ(__reg_name, __reg_addr, __dreg) \
- static inline uint8_t read_reg_##__reg_name(struct mcr20a_spi *spi) \
+ static inline u8_t read_reg_##__reg_name(struct mcr20a_spi *spi) \
{ \
return _mcr20a_read_reg(spi, __dreg, __reg_addr); \
}
#define DEFINE_REG_WRITE(__reg_name, __reg_addr, __dreg) \
static inline bool write_reg_##__reg_name(struct mcr20a_spi *spi, \
- uint8_t value) \
+ u8_t value) \
{ \
return _mcr20a_write_reg(spi, __dreg, __reg_addr, value); \
}
@@ -141,7 +141,7 @@
DEFINE_IREG_WRITE(rx_wtr_mark, MCR20A_RX_WTR_MARK)
#define DEFINE_BITS_SET(__reg_name, __reg_addr, __nibble) \
- static inline uint8_t set_bits_##__reg_name(uint8_t value) \
+ static inline u8_t set_bits_##__reg_name(u8_t value) \
{ \
value = (value << __reg_addr##__nibble##_SHIFT) & \
__reg_addr##__nibble##_MASK; \
@@ -156,14 +156,14 @@
#define DEFINE_BURST_WRITE(__reg_addr, __addr, __sz, __dreg) \
static inline bool write_burst_##__reg_addr(struct mcr20a_spi *spi, \
- uint8_t *buf) \
+ u8_t *buf) \
{ \
return _mcr20a_write_burst(spi, __dreg, __addr, buf, __sz); \
}
#define DEFINE_BURST_READ(__reg_addr, __addr, __sz, __dreg) \
static inline bool read_burst_##__reg_addr(struct mcr20a_spi *spi, \
- uint8_t *buf) \
+ u8_t *buf) \
{ \
return _mcr20a_read_burst(spi, __dreg, __addr, buf, __sz); \
}
diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c
index 28cf151..993b9b8 100644
--- a/drivers/ieee802154/ieee802154_nrf5.c
+++ b/drivers/ieee802154/ieee802154_nrf5.c
@@ -46,9 +46,9 @@
#define NRF5_802154_CFG(dev) \
((struct nrf5_802154_config * const)(dev)->config->config_info)
-static void nrf5_get_eui64(uint8_t *mac)
+static void nrf5_get_eui64(u8_t *mac)
{
- memcpy(mac, (const uint32_t *)&NRF_FICR->DEVICEID, 8);
+ memcpy(mac, (const u32_t *)&NRF_FICR->DEVICEID, 8);
}
static void nrf5_rx_thread(void *arg1, void *arg2, void *arg3)
@@ -58,7 +58,7 @@
struct net_buf *frag = NULL;
enum net_verdict ack_result;
struct net_pkt *pkt;
- uint8_t pkt_len;
+ u8_t pkt_len;
ARG_UNUSED(arg2);
ARG_UNUSED(arg3);
@@ -162,7 +162,7 @@
return 0;
}
-static int nrf5_set_channel(struct device *dev, uint16_t channel)
+static int nrf5_set_channel(struct device *dev, u16_t channel)
{
struct nrf5_802154_data *nrf5_radio = NRF5_802154_DATA(dev);
@@ -180,9 +180,9 @@
return 0;
}
-static int nrf5_set_pan_id(struct device *dev, uint16_t pan_id)
+static int nrf5_set_pan_id(struct device *dev, u16_t pan_id)
{
- uint8_t pan_id_le[2];
+ u8_t pan_id_le[2];
ARG_UNUSED(dev);
@@ -193,9 +193,9 @@
return 0;
}
-static int nrf5_set_short_addr(struct device *dev, uint16_t short_addr)
+static int nrf5_set_short_addr(struct device *dev, u16_t short_addr)
{
- uint8_t short_addr_le[2];
+ u8_t short_addr_le[2];
ARG_UNUSED(dev);
@@ -206,7 +206,7 @@
return 0;
}
-static int nrf5_set_ieee_addr(struct device *dev, const uint8_t *ieee_addr)
+static int nrf5_set_ieee_addr(struct device *dev, const u8_t *ieee_addr)
{
ARG_UNUSED(dev);
@@ -219,7 +219,7 @@
return 0;
}
-static int nrf5_set_txpower(struct device *dev, int16_t dbm)
+static int nrf5_set_txpower(struct device *dev, s16_t dbm)
{
struct nrf5_802154_data *nrf5_radio = NRF5_802154_DATA(dev);
@@ -234,8 +234,8 @@
struct net_buf *frag)
{
struct nrf5_802154_data *nrf5_radio = NRF5_802154_DATA(dev);
- uint8_t payload_len = net_pkt_ll_reserve(pkt) + frag->len;
- uint8_t *payload = frag->data - net_pkt_ll_reserve(pkt);
+ u8_t payload_len = net_pkt_ll_reserve(pkt) + frag->len;
+ u8_t *payload = frag->data - net_pkt_ll_reserve(pkt);
SYS_LOG_DBG("%p (%u)", payload, payload_len);
@@ -292,7 +292,7 @@
return 0;
}
-static uint8_t nrf5_get_lqi(struct device *dev)
+static u8_t nrf5_get_lqi(struct device *dev)
{
struct nrf5_802154_data *nrf5_radio = NRF5_802154_DATA(dev);
@@ -365,7 +365,7 @@
/* nRF5 radio driver callbacks */
-void nrf_drv_radio802154_received(uint8_t *p_data, int8_t power, int8_t lqi)
+void nrf_drv_radio802154_received(u8_t *p_data, s8_t power, s8_t lqi)
{
nrf5_data.rx_psdu = p_data;
nrf5_data.rssi = power;
@@ -387,7 +387,7 @@
k_sem_give(&nrf5_data.tx_wait);
}
-void nrf_drv_radio802154_energy_detected(int8_t result)
+void nrf_drv_radio802154_energy_detected(s8_t result)
{
nrf5_data.channel_ed = result;
k_sem_give(&nrf5_data.cca_wait);
diff --git a/drivers/ieee802154/ieee802154_nrf5.h b/drivers/ieee802154/ieee802154_nrf5.h
index 2601faf..8a0a17a 100644
--- a/drivers/ieee802154/ieee802154_nrf5.h
+++ b/drivers/ieee802154/ieee802154_nrf5.h
@@ -19,13 +19,13 @@
/* Pointer to the network interface. */
struct net_if *iface;
/* Pointer to a received frame. */
- uint8_t *rx_psdu;
+ u8_t *rx_psdu;
/* TX buffer. First byte is PHR (length), remaining bytes are
* MPDU data.
*/
- uint8_t tx_psdu[NRF5_PHR_LENGTH + NRF5_PSDU_LENGTH];
+ u8_t tx_psdu[NRF5_PHR_LENGTH + NRF5_PSDU_LENGTH];
/* 802.15.4 HW address. */
- uint8_t mac[8];
+ u8_t mac[8];
/* RX thread stack. */
char __stack rx_stack[CONFIG_IEEE802154_NRF5_RX_STACK_SIZE];
@@ -43,17 +43,17 @@
bool tx_success;
/* CCA channel energy. Unit as per 802.15.4-2006 specification. */
- int8_t channel_ed;
+ s8_t channel_ed;
/* TX power, in dBm, to be used when sending a frame. */
- int8_t txpower;
+ s8_t txpower;
/* 802.15.4 channel to be used when sending a frame. */
- uint8_t channel;
+ u8_t channel;
/* Last received frame LQI value. */
- uint8_t lqi;
+ u8_t lqi;
/* Last received frame RSSI value. */
- int8_t rssi;
+ s8_t rssi;
};
#endif /* __IEEE802154_NRF5_H__ */
diff --git a/drivers/ieee802154/ieee802154_uart_pipe.c b/drivers/ieee802154/ieee802154_uart_pipe.c
index 31f50f9..b5fbeae 100644
--- a/drivers/ieee802154/ieee802154_uart_pipe.c
+++ b/drivers/ieee802154/ieee802154_uart_pipe.c
@@ -27,7 +27,7 @@
/** Singleton device used in uart pipe callback */
static struct device *upipe_dev;
-static uint8_t *upipe_rx(uint8_t *buf, size_t *off)
+static u8_t *upipe_rx(u8_t *buf, size_t *off)
{
struct upipe_context *upipe = upipe_dev->driver_data;
struct net_pkt *pkt = NULL;
@@ -107,7 +107,7 @@
return 0;
}
-static int upipe_set_channel(struct device *dev, uint16_t channel)
+static int upipe_set_channel(struct device *dev, u16_t channel)
{
struct upipe_context *upipe = dev->driver_data;
@@ -118,7 +118,7 @@
return 0;
}
-static int upipe_set_pan_id(struct device *dev, uint16_t pan_id)
+static int upipe_set_pan_id(struct device *dev, u16_t pan_id)
{
struct upipe_context *upipe = dev->driver_data;
@@ -129,7 +129,7 @@
return 0;
}
-static int upipe_set_short_addr(struct device *dev, uint16_t short_addr)
+static int upipe_set_short_addr(struct device *dev, u16_t short_addr)
{
struct upipe_context *upipe = dev->driver_data;
@@ -140,7 +140,7 @@
return 0;
}
-static int upipe_set_ieee_addr(struct device *dev, const uint8_t *ieee_addr)
+static int upipe_set_ieee_addr(struct device *dev, const u8_t *ieee_addr)
{
struct upipe_context *upipe = dev->driver_data;
@@ -151,7 +151,7 @@
return 0;
}
-static int upipe_set_txpower(struct device *dev, int16_t dbm)
+static int upipe_set_txpower(struct device *dev, s16_t dbm)
{
struct upipe_context *upipe = dev->driver_data;
@@ -166,10 +166,10 @@
struct net_pkt *pkt,
struct net_buf *frag)
{
- uint8_t *pkt_buf = frag->data - net_pkt_ll_reserve(pkt);
- uint8_t len = net_pkt_ll_reserve(pkt) + frag->len;
+ u8_t *pkt_buf = frag->data - net_pkt_ll_reserve(pkt);
+ u8_t len = net_pkt_ll_reserve(pkt) + frag->len;
struct upipe_context *upipe = dev->driver_data;
- uint8_t i, data;
+ u8_t i, data;
SYS_LOG_DBG("%p (%u)", frag, len);
@@ -234,7 +234,7 @@
return 0;
}
-static inline uint8_t *get_mac(struct device *dev)
+static inline u8_t *get_mac(struct device *dev)
{
struct upipe_context *upipe = dev->driver_data;
@@ -244,7 +244,7 @@
upipe->mac_addr[3] = 0x30;
UNALIGNED_PUT(sys_cpu_to_be32(sys_rand32_get()),
- (uint32_t *) ((void *)upipe->mac_addr+4));
+ (u32_t *) ((void *)upipe->mac_addr+4));
return upipe->mac_addr;
}
@@ -253,7 +253,7 @@
{
struct device *dev = net_if_get_device(iface);
struct upipe_context *upipe = dev->driver_data;
- uint8_t *mac = get_mac(dev);
+ u8_t *mac = get_mac(dev);
SYS_LOG_DBG("");
diff --git a/drivers/ieee802154/ieee802154_uart_pipe.h b/drivers/ieee802154/ieee802154_uart_pipe.h
index 8b78d8e..f1eaa17 100644
--- a/drivers/ieee802154/ieee802154_uart_pipe.h
+++ b/drivers/ieee802154/ieee802154_uart_pipe.h
@@ -13,14 +13,14 @@
struct upipe_context {
struct net_if *iface;
- uint8_t mac_addr[8];
+ u8_t mac_addr[8];
bool stopped;
/** RX specific attributes */
- uint8_t uart_pipe_buf[1];
+ u8_t uart_pipe_buf[1];
bool rx;
- uint8_t rx_len;
- uint8_t rx_off;
- uint8_t rx_buf[127];
+ u8_t rx_len;
+ u8_t rx_off;
+ u8_t rx_buf[127];
};
#endif /* __IEEE802154_UART_PIPE_H__ */
diff --git a/include/drivers/ieee802154/cc2520.h b/include/drivers/ieee802154/cc2520.h
index 14199f0..1312db2 100644
--- a/include/drivers/ieee802154/cc2520.h
+++ b/include/drivers/ieee802154/cc2520.h
@@ -19,7 +19,7 @@
struct cc2520_gpio_configuration {
struct device *dev;
- uint32_t pin;
+ u32_t pin;
};
struct cc2520_gpio_configuration *cc2520_configure_gpios(void);
diff --git a/include/net/arp.h b/include/net/arp.h
index e451fb8..4e8ebad 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -20,11 +20,11 @@
#define NET_ARP_HDR(pkt) ((struct net_arp_hdr *)net_pkt_ip_data(pkt))
struct net_arp_hdr {
- uint16_t hwtype; /* HTYPE */
- uint16_t protocol; /* PTYPE */
- uint8_t hwlen; /* HLEN */
- uint8_t protolen; /* PLEN */
- uint16_t opcode;
+ u16_t hwtype; /* HTYPE */
+ u16_t protocol; /* PTYPE */
+ u8_t hwlen; /* HLEN */
+ u8_t protolen; /* PLEN */
+ u16_t opcode;
struct net_eth_addr src_hwaddr; /* SHA */
struct in_addr src_ipaddr; /* SPA */
struct net_eth_addr dst_hwaddr; /* THA */
diff --git a/include/net/buf.h b/include/net/buf.h
index 7a65e97..e09f296 100644
--- a/include/net/buf.h
+++ b/include/net/buf.h
@@ -40,7 +40,7 @@
#define NET_BUF_SIMPLE(_size) \
((struct net_buf_simple *)(&(struct { \
struct net_buf_simple buf; \
- uint8_t data[_size] __net_buf_align; \
+ u8_t data[_size] __net_buf_align; \
}) { \
.buf.size = _size, \
}))
@@ -60,18 +60,18 @@
*/
struct net_buf_simple {
/** Pointer to the start of data in the buffer. */
- uint8_t *data;
+ u8_t *data;
/** Length of the data behind the data pointer. */
- uint16_t len;
+ u16_t len;
/** Amount of data that this buffer can store. */
- uint16_t size;
+ u16_t size;
/** Start of the data storage. Not to be accessed directly
* (the data pointer should be used instead).
*/
- uint8_t __buf[0] __net_buf_align;
+ u8_t __buf[0] __net_buf_align;
};
/** @brief Initialize a net_buf_simple object.
@@ -128,7 +128,7 @@
*
* @return Pointer to the value added
*/
-uint8_t *net_buf_simple_add_u8(struct net_buf_simple *buf, uint8_t val);
+u8_t *net_buf_simple_add_u8(struct net_buf_simple *buf, u8_t val);
/**
* @brief Add 16-bit value at the end of the buffer
@@ -140,7 +140,7 @@
* @param buf Buffer to update.
* @param val 16-bit value to be added.
*/
-void net_buf_simple_add_le16(struct net_buf_simple *buf, uint16_t val);
+void net_buf_simple_add_le16(struct net_buf_simple *buf, u16_t val);
/**
* @brief Add 16-bit value at the end of the buffer
@@ -152,7 +152,7 @@
* @param buf Buffer to update.
* @param val 16-bit value to be added.
*/
-void net_buf_simple_add_be16(struct net_buf_simple *buf, uint16_t val);
+void net_buf_simple_add_be16(struct net_buf_simple *buf, u16_t val);
/**
* @brief Add 32-bit value at the end of the buffer
@@ -164,7 +164,7 @@
* @param buf Buffer to update.
* @param val 32-bit value to be added.
*/
-void net_buf_simple_add_le32(struct net_buf_simple *buf, uint32_t val);
+void net_buf_simple_add_le32(struct net_buf_simple *buf, u32_t val);
/**
* @brief Add 32-bit value at the end of the buffer
@@ -176,7 +176,7 @@
* @param buf Buffer to update.
* @param val 32-bit value to be added.
*/
-void net_buf_simple_add_be32(struct net_buf_simple *buf, uint32_t val);
+void net_buf_simple_add_be32(struct net_buf_simple *buf, u32_t val);
/**
* @brief Push data to the beginning of the buffer.
@@ -200,7 +200,7 @@
* @param buf Buffer to update.
* @param val 16-bit value to be pushed to the buffer.
*/
-void net_buf_simple_push_le16(struct net_buf_simple *buf, uint16_t val);
+void net_buf_simple_push_le16(struct net_buf_simple *buf, u16_t val);
/**
* @brief Push 16-bit value to the beginning of the buffer
@@ -211,7 +211,7 @@
* @param buf Buffer to update.
* @param val 16-bit value to be pushed to the buffer.
*/
-void net_buf_simple_push_be16(struct net_buf_simple *buf, uint16_t val);
+void net_buf_simple_push_be16(struct net_buf_simple *buf, u16_t val);
/**
* @brief Push 8-bit value to the beginning of the buffer
@@ -221,7 +221,7 @@
* @param buf Buffer to update.
* @param val 8-bit value to be pushed to the buffer.
*/
-void net_buf_simple_push_u8(struct net_buf_simple *buf, uint8_t val);
+void net_buf_simple_push_u8(struct net_buf_simple *buf, u8_t val);
/**
* @brief Remove data from the beginning of the buffer.
@@ -246,7 +246,7 @@
*
* @return The 8-bit removed value
*/
-uint8_t net_buf_simple_pull_u8(struct net_buf_simple *buf);
+u8_t net_buf_simple_pull_u8(struct net_buf_simple *buf);
/**
* @brief Remove and convert 16 bits from the beginning of the buffer.
@@ -258,7 +258,7 @@
*
* @return 16-bit value converted from little endian to host endian.
*/
-uint16_t net_buf_simple_pull_le16(struct net_buf_simple *buf);
+u16_t net_buf_simple_pull_le16(struct net_buf_simple *buf);
/**
* @brief Remove and convert 16 bits from the beginning of the buffer.
@@ -270,7 +270,7 @@
*
* @return 16-bit value converted from big endian to host endian.
*/
-uint16_t net_buf_simple_pull_be16(struct net_buf_simple *buf);
+u16_t net_buf_simple_pull_be16(struct net_buf_simple *buf);
/**
* @brief Remove and convert 32 bits from the beginning of the buffer.
@@ -282,7 +282,7 @@
*
* @return 32-bit value converted from little endian to host endian.
*/
-uint32_t net_buf_simple_pull_le32(struct net_buf_simple *buf);
+u32_t net_buf_simple_pull_le32(struct net_buf_simple *buf);
/**
* @brief Remove and convert 32 bits from the beginning of the buffer.
@@ -294,7 +294,7 @@
*
* @return 32-bit value converted from big endian to host endian.
*/
-uint32_t net_buf_simple_pull_be32(struct net_buf_simple *buf);
+u32_t net_buf_simple_pull_be32(struct net_buf_simple *buf);
/**
* @brief Get the tail pointer for a buffer.
@@ -305,7 +305,7 @@
*
* @return Tail pointer for the buffer.
*/
-static inline uint8_t *net_buf_simple_tail(struct net_buf_simple *buf)
+static inline u8_t *net_buf_simple_tail(struct net_buf_simple *buf)
{
return buf->data + buf->len;
}
@@ -341,9 +341,9 @@
*/
struct net_buf_simple_state {
/** Offset of the data pointer from the beginning of the storage */
- uint16_t offset;
+ u16_t offset;
/** Length of data */
- uint16_t len;
+ u16_t len;
};
/**
@@ -402,10 +402,10 @@
};
/** Reference count. */
- uint8_t ref;
+ u8_t ref;
/** Bit-field of buffer flags. */
- uint8_t flags;
+ u8_t flags;
/** Where the buffer should go when freed up. */
struct net_buf_pool *pool;
@@ -417,13 +417,13 @@
/* The ABI of this struct must match net_buf_simple */
struct {
/** Pointer to the start of data in the buffer. */
- uint8_t *data;
+ u8_t *data;
/** Length of the data behind the data pointer. */
- uint16_t len;
+ u16_t len;
/** Amount of data that this buffer can store. */
- uint16_t size;
+ u16_t size;
};
struct net_buf_simple b;
@@ -432,7 +432,7 @@
/** Start of the data storage. Not to be accessed directly
* (the data pointer should be used instead).
*/
- uint8_t __buf[0] __net_buf_align;
+ u8_t __buf[0] __net_buf_align;
/** After __buf (as given by the "size" field, which can be 0),
* there may be so-called "user data", which is actually a system
@@ -447,23 +447,23 @@
struct k_lifo free;
/** Number of buffers in pool */
- const uint16_t buf_count;
+ const u16_t buf_count;
/** Number of uninitialized buffers */
- uint16_t uninit_count;
+ u16_t uninit_count;
/** Data size of each buffer in the pool */
- const uint16_t buf_size;
+ const u16_t buf_size;
/** Size of the user data associated with each buffer. */
- const uint16_t user_data_size;
+ const u16_t user_data_size;
#if defined(CONFIG_NET_BUF_POOL_USAGE)
/** Amount of available buffers in the pool. */
- int16_t avail_count;
+ s16_t avail_count;
/** Total size of the pool. */
- const uint16_t pool_size;
+ const u16_t pool_size;
/** Name of the pool. Used when printing pool information. */
const char *name;
@@ -528,8 +528,8 @@
#define NET_BUF_POOL_DEFINE(_name, _count, _size, _ud_size, _destroy) \
static struct { \
struct net_buf buf; \
- uint8_t data[_size] __net_buf_align; \
- uint8_t ud[ROUND_UP(_ud_size, 4)] __net_buf_align; \
+ u8_t data[_size] __net_buf_align; \
+ u8_t ud[ROUND_UP(_ud_size, 4)] __net_buf_align; \
} _net_buf_pool_##_name[_count] __noinit; \
static struct net_buf_pool _name = \
NET_BUF_POOL_INITIALIZER(_name, _net_buf_pool_##_name, \
@@ -549,12 +549,12 @@
* @return New buffer or NULL if out of buffers.
*/
#if defined(CONFIG_NET_BUF_LOG)
-struct net_buf *net_buf_alloc_debug(struct net_buf_pool *pool, int32_t timeout,
+struct net_buf *net_buf_alloc_debug(struct net_buf_pool *pool, s32_t timeout,
const char *func, int line);
#define net_buf_alloc(_pool, _timeout) \
net_buf_alloc_debug(_pool, _timeout, __func__, __LINE__)
#else
-struct net_buf *net_buf_alloc(struct net_buf_pool *pool, int32_t timeout);
+struct net_buf *net_buf_alloc(struct net_buf_pool *pool, s32_t timeout);
#endif
/**
@@ -571,12 +571,12 @@
* @return New buffer or NULL if the FIFO is empty.
*/
#if defined(CONFIG_NET_BUF_LOG)
-struct net_buf *net_buf_get_debug(struct k_fifo *fifo, int32_t timeout,
+struct net_buf *net_buf_get_debug(struct k_fifo *fifo, s32_t timeout,
const char *func, int line);
#define net_buf_get(_fifo, _timeout) \
net_buf_get_debug(_fifo, _timeout, __func__, __LINE__)
#else
-struct net_buf *net_buf_get(struct k_fifo *fifo, int32_t timeout);
+struct net_buf *net_buf_get(struct k_fifo *fifo, s32_t timeout);
#endif
/**
@@ -663,7 +663,7 @@
*
* @return Duplicated buffer or NULL if out of buffers.
*/
-struct net_buf *net_buf_clone(struct net_buf *buf, int32_t timeout);
+struct net_buf *net_buf_clone(struct net_buf *buf, s32_t timeout);
/**
* @brief Get a pointer to the user data of a buffer.
diff --git a/include/net/dns_resolve.h b/include/net/dns_resolve.h
index f39e289..2fa63c1 100644
--- a/include/net/dns_resolve.h
+++ b/include/net/dns_resolve.h
@@ -51,10 +51,10 @@
struct sockaddr ai_addr;
char ai_canonname[DNS_MAX_NAME_SIZE + 1];
socklen_t ai_addrlen;
- uint16_t ai_flags;
- uint8_t ai_family;
- uint8_t ai_socktype;
- uint8_t ai_protocol;
+ u16_t ai_flags;
+ u8_t ai_family;
+ u8_t ai_socktype;
+ u8_t ai_protocol;
};
/**
@@ -118,7 +118,7 @@
/** This timeout is also used when a buffer is required from the
* buffer pools.
*/
- int32_t buf_timeout;
+ s32_t buf_timeout;
/** Result callbacks. We have multiple callbacks here so that it is
* possible to do multiple queries at the same time.
@@ -137,7 +137,7 @@
void *user_data;
/** TX timeout */
- int32_t timeout;
+ s32_t timeout;
/** String containing the thing to resolve like www.example.com
*/
@@ -147,7 +147,7 @@
enum dns_query_type query_type;
/** DNS id of this query */
- uint16_t id;
+ u16_t id;
} queries[CONFIG_DNS_NUM_CONCUR_QUERIES];
/** Is this context in use */
@@ -203,7 +203,7 @@
* @return 0 if ok, <0 if error.
*/
int dns_resolve_cancel(struct dns_resolve_context *ctx,
- uint16_t dns_id);
+ u16_t dns_id);
/**
* @brief Resolve DNS name.
@@ -235,10 +235,10 @@
int dns_resolve_name(struct dns_resolve_context *ctx,
const char *query,
enum dns_query_type type,
- uint16_t *dns_id,
+ u16_t *dns_id,
dns_resolve_cb_t cb,
void *user_data,
- int32_t timeout);
+ s32_t timeout);
/**
* @brief Get default DNS context.
@@ -281,10 +281,10 @@
*/
static inline int dns_get_addr_info(const char *query,
enum dns_query_type type,
- uint16_t *dns_id,
+ u16_t *dns_id,
dns_resolve_cb_t cb,
void *user_data,
- int32_t timeout)
+ s32_t timeout)
{
return dns_resolve_name(dns_resolve_get_default(),
query,
@@ -304,7 +304,7 @@
*
* @return 0 if ok, <0 if error.
*/
-static inline int dns_cancel_addr_info(uint16_t dns_id)
+static inline int dns_cancel_addr_info(u16_t dns_id)
{
return dns_resolve_cancel(dns_resolve_get_default(), dns_id);
}
diff --git a/include/net/ethernet.h b/include/net/ethernet.h
index 66362a9..3bb90ae 100644
--- a/include/net/ethernet.h
+++ b/include/net/ethernet.h
@@ -29,13 +29,13 @@
#define NET_ETH_MINIMAL_FRAME_SIZE 60
struct net_eth_addr {
- uint8_t addr[6];
+ u8_t addr[6];
};
struct net_eth_hdr {
struct net_eth_addr dst;
struct net_eth_addr src;
- uint16_t type;
+ u16_t type;
} __packed;
static inline bool net_eth_is_addr_broadcast(struct net_eth_addr *addr)
diff --git a/include/net/http.h b/include/net/http.h
index 18764bb..9e3c38f 100644
--- a/include/net/http.h
+++ b/include/net/http.h
@@ -30,22 +30,22 @@
/** Payload, may be NULL */
char *payload;
/** Payload size, may be 0 */
- uint16_t payload_size;
+ u16_t payload_size;
};
-int http_request(struct net_context *net_ctx, int32_t timeout,
+int http_request(struct net_context *net_ctx, s32_t timeout,
struct http_client_request *req);
-int http_request_get(struct net_context *net_ctx, int32_t timeout, char *url,
+int http_request_get(struct net_context *net_ctx, s32_t timeout, char *url,
char *header_fields);
-int http_request_head(struct net_context *net_ctx, int32_t timeout, char *url,
+int http_request_head(struct net_context *net_ctx, s32_t timeout, char *url,
char *header_fields);
-int http_request_options(struct net_context *net_ctx, int32_t timeout,
+int http_request_options(struct net_context *net_ctx, s32_t timeout,
char *url, char *header_fields);
-int http_request_post(struct net_context *net_ctx, int32_t timeout, char *url,
+int http_request_post(struct net_context *net_ctx, s32_t timeout, char *url,
char *header_fields, char *content_type_value,
char *payload);
#endif
@@ -71,35 +71,35 @@
*/
const char *key;
/** Length of the field name */
- uint16_t key_len;
+ u16_t key_len;
/** Value, this variable will point to the beginning of the string
* containing the field value
*/
const char *value;
/** Length of the field value */
- uint16_t value_len;
+ u16_t value_len;
};
/* The HTTP server context struct */
struct http_server_ctx {
- uint8_t state;
+ u8_t state;
/** Collection of header fields */
struct http_field_value field_values[CONFIG_HTTP_HEADER_FIELD_ITEMS];
/** Number of header field elements */
- uint16_t field_values_ctr;
+ u16_t field_values_ctr;
/** HTTP Request URL */
const char *url;
/** URL's length */
- uint16_t url_len;
+ u16_t url_len;
/**IP stack network context */
struct net_context *net_ctx;
/** Network timeout */
- int32_t timeout;
+ s32_t timeout;
#if defined(CONFIG_HTTP_PARSER)
/** HTTP parser */
diff --git a/include/net/http_parser.h b/include/net/http_parser.h
index b53c241..28e0fa5 100644
--- a/include/net/http_parser.h
+++ b/include/net/http_parser.h
@@ -34,14 +34,14 @@
(!defined(_MSC_VER) || _MSC_VER < 1600) && !defined(__WINE__)
#include <BaseTsd.h>
#include <stddef.h>
-typedef __int8 int8_t;
-typedef unsigned __int8 uint8_t;
-typedef __int16 int16_t;
-typedef unsigned __int16 uint16_t;
-typedef __int32 int32_t;
-typedef unsigned __int32 uint32_t;
-typedef __int64 int64_t;
-typedef unsigned __int64 uint64_t;
+typedef __int8 s8_t;
+typedef unsigned __int8 u8_t;
+typedef __int16 s16_t;
+typedef unsigned __int16 u16_t;
+typedef __int32 s32_t;
+typedef unsigned __int32 u32_t;
+typedef __int64 s64_t;
+typedef unsigned __int64 u64_t;
#else
#include <zephyr/types.h>
#include <stddef.h>
@@ -186,8 +186,8 @@
unsigned int index : 7; /* index into current matcher */
unsigned int lenient_http_headers : 1;
- uint32_t nread; /* # bytes read in various scenarios */
- uint64_t content_length; /* # bytes in body (0 if no Content-Length
+ u32_t nread; /* # bytes read in various scenarios */
+ u64_t content_length; /* # bytes in body (0 if no Content-Length
* header)
*/
/** READ-ONLY **/
@@ -246,17 +246,17 @@
* Callers should index into field_data[] with UF_* values iff field_set
* has the relevant (1 << UF_*) bit set. As a courtesy to clients (and
* because we probably have padding left over), we convert any port to
- * a uint16_t.
+ * a u16_t.
*/
struct http_parser_url {
- uint16_t field_set; /* Bitmask of (1 << UF_*) values */
- uint16_t port; /* Converted UF_PORT string */
+ u16_t field_set; /* Bitmask of (1 << UF_*) values */
+ u16_t port; /* Converted UF_PORT string */
struct {
- uint16_t off; /* Offset into buffer in which field
+ u16_t off; /* Offset into buffer in which field
* starts
*/
- uint16_t len; /* Length of run in buffer */
+ u16_t len; /* Length of run in buffer */
} field_data[UF_MAX];
};
diff --git a/include/net/ieee802154.h b/include/net/ieee802154.h
index f86a83b..bd23be6 100644
--- a/include/net/ieee802154.h
+++ b/include/net/ieee802154.h
@@ -18,23 +18,23 @@
#define IEEE802154_MAX_ADDR_LENGTH 8
struct ieee802154_security_ctx {
- uint32_t frame_counter;
+ u32_t frame_counter;
struct cipher_ctx enc;
struct cipher_ctx dec;
- uint8_t key[16];
- uint8_t key_len;
- uint8_t level : 3;
- uint8_t key_mode : 2;
- uint8_t _unused : 3;
+ u8_t key[16];
+ u8_t key_len;
+ u8_t level : 3;
+ u8_t key_mode : 2;
+ u8_t _unused : 3;
};
/* This not meant to be used by any code but 802.15.4 L2 stack */
struct ieee802154_context {
- uint16_t pan_id;
- uint16_t channel;
+ u16_t pan_id;
+ u16_t channel;
struct k_sem ack_lock;
- uint16_t short_addr;
- uint8_t ext_addr[IEEE802154_MAX_ADDR_LENGTH];
+ u16_t short_addr;
+ u8_t ext_addr[IEEE802154_MAX_ADDR_LENGTH];
#ifdef CONFIG_NET_L2_IEEE802154_MGMT
struct ieee802154_req_params *scan_ctx;
union {
@@ -42,20 +42,20 @@
struct k_sem req_lock;
};
union {
- uint8_t ext_addr[IEEE802154_MAX_ADDR_LENGTH];
- uint16_t short_addr;
+ u8_t ext_addr[IEEE802154_MAX_ADDR_LENGTH];
+ u16_t short_addr;
} coord;
- uint8_t coord_addr_len;
+ u8_t coord_addr_len;
#endif
#ifdef CONFIG_NET_L2_IEEE802154_SECURITY
struct ieee802154_security_ctx sec_ctx;
#endif
- int16_t tx_power;
- uint8_t sequence;
- uint8_t ack_received : 1;
- uint8_t ack_requested : 1;
- uint8_t associated : 1;
- uint8_t _unused : 5;
+ s16_t tx_power;
+ u8_t sequence;
+ u8_t ack_received : 1;
+ u8_t ack_requested : 1;
+ u8_t associated : 1;
+ u8_t _unused : 5;
};
@@ -219,26 +219,26 @@
*/
struct ieee802154_req_params {
/** The set of channels to scan, use above macros to manage it */
- uint32_t channel_set;
+ u32_t channel_set;
/** Duration of scan, per-channel, in milliseconds */
- uint32_t duration;
+ u32_t duration;
/** Current channel in use as a result */
- uint16_t channel;
+ u16_t channel;
/** Current pan_id in use as a result */
- uint16_t pan_id;
+ u16_t pan_id;
/** Result address */
union {
- uint8_t addr[IEEE802154_MAX_ADDR_LENGTH];
- uint16_t short_addr;
+ u8_t addr[IEEE802154_MAX_ADDR_LENGTH];
+ u16_t short_addr;
};
/** length of address */
- uint8_t len;
+ u8_t len;
/** Link quality information, between 0 and 255 */
- uint8_t lqi;
+ u8_t lqi;
};
/**
@@ -247,11 +247,11 @@
* Used to setup the link-layer security settings
*/
struct ieee802154_security_params {
- uint8_t key[16];
- uint8_t key_len;
- uint8_t key_mode : 2;
- uint8_t level : 3;
- uint8_t _unused : 3;
+ u8_t key[16];
+ u8_t key_len;
+ u8_t key_mode : 2;
+ u8_t level : 3;
+ u8_t _unused : 3;
};
#endif /* __IEEE802154_H__ */
diff --git a/include/net/ieee802154_radio.h b/include/net/ieee802154_radio.h
index 6d29ccd..c2344da 100644
--- a/include/net/ieee802154_radio.h
+++ b/include/net/ieee802154_radio.h
@@ -28,19 +28,19 @@
int (*cca)(struct device *dev);
/** Set current channel */
- int (*set_channel)(struct device *dev, uint16_t channel);
+ int (*set_channel)(struct device *dev, u16_t channel);
/** Set current PAN id */
- int (*set_pan_id)(struct device *dev, uint16_t pan_id);
+ int (*set_pan_id)(struct device *dev, u16_t pan_id);
/** Set current device's short address */
- int (*set_short_addr)(struct device *dev, uint16_t short_addr);
+ int (*set_short_addr)(struct device *dev, u16_t short_addr);
/** Set current devices's full length address */
- int (*set_ieee_addr)(struct device *dev, const uint8_t *ieee_addr);
+ int (*set_ieee_addr)(struct device *dev, const u8_t *ieee_addr);
/** Set TX power level in dbm */
- int (*set_txpower)(struct device *dev, int16_t dbm);
+ int (*set_txpower)(struct device *dev, s16_t dbm);
/** Transmit a packet fragment */
int (*tx)(struct device *dev,
@@ -54,7 +54,7 @@
int (*stop)(struct device *dev);
/** Get latest Link Quality Information */
- uint8_t (*get_lqi)(struct device *dev);
+ u8_t (*get_lqi)(struct device *dev);
} __packed;
/**
diff --git a/include/net/mqtt.h b/include/net/mqtt.h
index 4dd1cd6..a462b77 100644
--- a/include/net/mqtt.h
+++ b/include/net/mqtt.h
@@ -60,7 +60,7 @@
/** IP stack context structure */
struct net_context *net_ctx;
/** Network timeout for tx and rx routines */
- int32_t net_timeout;
+ s32_t net_timeout;
/** Callback executed when a MQTT CONNACK msg is received and validated.
* If this function pointer is not used, must be set to NULL.
@@ -88,7 +88,7 @@
* @param [in] pkt_id Packet Identifier for the input MQTT msg
* @param [in] type Packet type
*/
- int (*publish_tx)(struct mqtt_ctx *ctx, uint16_t pkt_id,
+ int (*publish_tx)(struct mqtt_ctx *ctx, u16_t pkt_id,
enum mqtt_packet type);
/** Callback executed when a MQTT_APP_SUBSCRIBER,
@@ -108,7 +108,7 @@
* @param [in] type Packet type
*/
int (*publish_rx)(struct mqtt_ctx *ctx, struct mqtt_publish_msg *msg,
- uint16_t pkt_id, enum mqtt_packet type);
+ u16_t pkt_id, enum mqtt_packet type);
/** Callback executed when a MQTT_APP_SUBSCRIBER or
* MQTT_APP_PUBLISHER_SUBSCRIBER receives the MQTT SUBACK message
@@ -122,8 +122,8 @@
* @param [in] items Number of elements in the qos array
* @param [in] qos Array of QoS values
*/
- int (*subscribe)(struct mqtt_ctx *ctx, uint16_t pkt_id,
- uint8_t items, enum mqtt_qos qos[]);
+ int (*subscribe)(struct mqtt_ctx *ctx, u16_t pkt_id,
+ u8_t items, enum mqtt_qos qos[]);
/** Callback executed when a MQTT_APP_SUBSCRIBER or
* MQTT_APP_PUBLISHER_SUBSCRIBER receives the MQTT UNSUBACK message
@@ -135,7 +135,7 @@
* @param [in] ctx MQTT context
* @param [in] pkt_id Packet Identifier for the MQTT SUBACK msg
*/
- int (*unsubscribe)(struct mqtt_ctx *ctx, uint16_t pkt_id);
+ int (*unsubscribe)(struct mqtt_ctx *ctx, u16_t pkt_id);
/** Callback executed when an incoming message doesn't pass the
* validation stage. This callback may be NULL.
@@ -145,22 +145,22 @@
* @param [in] ctx MQTT context
* @param [in] pkt_type MQTT Packet type
*/
- void (*malformed)(struct mqtt_ctx *ctx, uint16_t pkt_type);
+ void (*malformed)(struct mqtt_ctx *ctx, u16_t pkt_type);
/* Internal use only */
int (*rcv)(struct mqtt_ctx *ctx, struct net_pkt *);
/** Application type, see: enum mqtt_app */
- uint8_t app_type;
+ u8_t app_type;
/* Clean session is also part of the MQTT CONNECT msg, however app
* behavior is influenced by this parameter, so we keep a copy here
*/
/** MQTT Clean Session parameter */
- uint8_t clean_session:1;
+ u8_t clean_session:1;
/** 1 if the MQTT application is connected and 0 otherwise */
- uint8_t connected:1;
+ u8_t connected:1;
};
/**
@@ -208,7 +208,7 @@
* @retval -ENOMEM
* @retval -EIO
*/
-int mqtt_tx_puback(struct mqtt_ctx *ctx, uint16_t id);
+int mqtt_tx_puback(struct mqtt_ctx *ctx, u16_t id);
/**
* Sends the MQTT PUBCOMP message with the given packet id
@@ -221,7 +221,7 @@
* @retval -ENOMEM
* @retval -EIO
*/
-int mqtt_tx_pubcomp(struct mqtt_ctx *ctx, uint16_t id);
+int mqtt_tx_pubcomp(struct mqtt_ctx *ctx, u16_t id);
/**
* Sends the MQTT PUBREC message with the given packet id
@@ -233,7 +233,7 @@
* @retval -ENOMEM
* @retval -EIO
*/
-int mqtt_tx_pubrec(struct mqtt_ctx *ctx, uint16_t id);
+int mqtt_tx_pubrec(struct mqtt_ctx *ctx, u16_t id);
/**
* Sends the MQTT PUBREL message with the given packet id
@@ -246,7 +246,7 @@
* @retval -ENOMEM
* @retval -EIO
*/
-int mqtt_tx_pubrel(struct mqtt_ctx *ctx, uint16_t id);
+int mqtt_tx_pubrel(struct mqtt_ctx *ctx, u16_t id);
/**
* Sends the MQTT PUBLISH message
@@ -292,7 +292,7 @@
* @retval -ENOMEM
* @retval -EIO
*/
-int mqtt_tx_subscribe(struct mqtt_ctx *ctx, uint16_t pkt_id, uint8_t items,
+int mqtt_tx_subscribe(struct mqtt_ctx *ctx, u16_t pkt_id, u8_t items,
const char *topics[], const enum mqtt_qos qos[]);
/**
@@ -308,7 +308,7 @@
* @retval -ENOMEM
* @retval -EIO
*/
-int mqtt_tx_unsubscribe(struct mqtt_ctx *ctx, uint16_t pkt_id, uint8_t items,
+int mqtt_tx_unsubscribe(struct mqtt_ctx *ctx, u16_t pkt_id, u8_t items,
const char *topics[]);
diff --git a/include/net/mqtt_types.h b/include/net/mqtt_types.h
index 0de0300..cdc6fae 100644
--- a/include/net/mqtt_types.h
+++ b/include/net/mqtt_types.h
@@ -54,32 +54,32 @@
};
struct mqtt_connect_msg {
- uint8_t clean_session:1;
+ u8_t clean_session:1;
char *client_id;
- uint16_t client_id_len;
- uint8_t will_flag:1;
+ u16_t client_id_len;
+ u8_t will_flag:1;
enum mqtt_qos will_qos;
- uint8_t will_retain:1;
+ u8_t will_retain:1;
char *will_topic;
- uint16_t will_topic_len;
- uint8_t *will_msg;
- uint16_t will_msg_len;
- uint16_t keep_alive;
+ u16_t will_topic_len;
+ u8_t *will_msg;
+ u16_t will_msg_len;
+ u16_t keep_alive;
const char *user_name;
- uint16_t user_name_len;
- uint8_t *password;
- uint16_t password_len;
+ u16_t user_name_len;
+ u8_t *password;
+ u16_t password_len;
};
struct mqtt_publish_msg {
- uint8_t dup;
+ u8_t dup;
enum mqtt_qos qos;
- uint8_t retain;
- uint16_t pkt_id;
+ u8_t retain;
+ u16_t pkt_id;
char *topic;
- uint16_t topic_len;
- uint8_t *msg;
- uint16_t msg_len;
+ u16_t topic_len;
+ u8_t *msg;
+ u16_t msg_len;
};
/**
diff --git a/include/net/net_context.h b/include/net/net_context.h
index 927a12a..326cc76 100644
--- a/include/net/net_context.h
+++ b/include/net/net_context.h
@@ -228,10 +228,10 @@
#endif /* CONFIG_NET_CONTEXT_SYNC_RECV */
/** Network interface assigned to this context */
- uint8_t iface;
+ u8_t iface;
/** Flags for the context */
- uint8_t flags;
+ u8_t flags;
#if defined(CONFIG_NET_TCP)
/** TCP connection information */
@@ -575,7 +575,7 @@
const struct sockaddr *addr,
socklen_t addrlen,
net_context_connect_cb_t cb,
- int32_t timeout,
+ s32_t timeout,
void *user_data);
/**
@@ -605,7 +605,7 @@
*/
int net_context_accept(struct net_context *context,
net_tcp_accept_cb_t cb,
- int32_t timeout,
+ s32_t timeout,
void *user_data);
/**
@@ -635,7 +635,7 @@
*/
int net_context_send(struct net_pkt *pkt,
net_context_send_cb_t cb,
- int32_t timeout,
+ s32_t timeout,
void *token,
void *user_data);
@@ -670,7 +670,7 @@
const struct sockaddr *dst_addr,
socklen_t addrlen,
net_context_send_cb_t cb,
- int32_t timeout,
+ s32_t timeout,
void *token,
void *user_data);
@@ -712,7 +712,7 @@
*/
int net_context_recv(struct net_context *context,
net_context_recv_cb_t cb,
- int32_t timeout,
+ s32_t timeout,
void *user_data);
/**
diff --git a/include/net/net_if.h b/include/net/net_if.h
index eddffa8..ece74a0 100644
--- a/include/net/net_if.h
+++ b/include/net/net_if.h
@@ -58,7 +58,7 @@
#if defined(CONFIG_NET_IPV6_DAD)
/** How many times we have done DAD */
- uint8_t dad_count;
+ u8_t dad_count;
#endif
/** Is the IP address valid forever */
@@ -75,12 +75,12 @@
*/
struct net_if_mcast_addr {
/** Is this multicast IP address used or not */
- uint8_t is_used : 1;
+ u8_t is_used : 1;
/** Did we join to this group */
- uint8_t is_joined : 1;
+ u8_t is_joined : 1;
- uint8_t _unused : 6;
+ u8_t _unused : 6;
/** IP address */
struct net_addr address;
@@ -100,7 +100,7 @@
struct in6_addr prefix;
/** Prefix length */
- uint8_t len;
+ u8_t len;
/** Is the IP prefix valid forever */
bool is_infinite;
@@ -200,7 +200,7 @@
struct k_fifo tx_queue;
/** The hardware MTU */
- uint16_t mtu;
+ u16_t mtu;
#if defined(CONFIG_NET_OFFLOAD)
/** TCP/IP Offload functions.
@@ -229,24 +229,24 @@
struct k_delayed_work rs_timer;
/** Default reachable time (RFC 4861, page 52) */
- uint32_t base_reachable_time;
+ u32_t base_reachable_time;
/** Reachable time (RFC 4861, page 20) */
- uint32_t reachable_time;
+ u32_t reachable_time;
/** Retransmit timer (RFC 4861, page 52) */
- uint32_t retrans_timer;
+ u32_t retrans_timer;
/** IPv6 hop limit */
- uint8_t hop_limit;
+ u8_t hop_limit;
#if defined(CONFIG_NET_IPV6_DAD)
/** IPv6 current duplicate address detection count */
- uint8_t dad_count;
+ u8_t dad_count;
#endif /* CONFIG_NET_IPV6_DAD */
/** RS count */
- uint8_t rs_count;
+ u8_t rs_count;
} ipv6;
#endif /* CONFIG_NET_IPV6 */
@@ -267,22 +267,22 @@
struct in_addr netmask;
/** IPv4 time-to-live */
- uint8_t ttl;
+ u8_t ttl;
} ipv4;
#endif /* CONFIG_NET_IPV4 */
#if defined(CONFIG_NET_DHCPV4)
struct {
- uint32_t xid;
+ u32_t xid;
/** IP address Lease time */
- uint32_t lease_time;
+ u32_t lease_time;
/** IP address Renewal time */
- uint32_t renewal_time;
+ u32_t renewal_time;
/** IP address Rebinding time */
- uint32_t rebinding_time;
+ u32_t rebinding_time;
/** Server ID */
struct in_addr server_id;
@@ -308,7 +308,7 @@
enum net_dhcpv4_state state;
/** Number of attempts made for REQUEST and RENEWAL messages */
- uint8_t attempts;
+ u8_t attempts;
} dhcpv4;
#endif
} __net_if_align;
@@ -345,7 +345,7 @@
*
* @return Return the link layer header size
*/
-static inline uint16_t net_if_get_ll_reserve(struct net_if *iface,
+static inline u16_t net_if_get_ll_reserve(struct net_if *iface,
const struct in6_addr *dst_ip6)
{
return iface->l2->reserve(iface, (void *)dst_ip6);
@@ -434,14 +434,14 @@
* @brief Set a network interface's link address
*
* @param iface Pointer to a network interface structure
- * @param addr a pointer on a uint8_t buffer representing the address
+ * @param addr a pointer on a u8_t buffer representing the address
* @param len length of the address buffer
* @param type network bearer type of this link address
*
* @return 0 on success
*/
static inline int net_if_set_link_addr(struct net_if *iface,
- uint8_t *addr, uint8_t len,
+ u8_t *addr, u8_t len,
enum net_link_type type)
{
if (atomic_test_bit(iface->flags, NET_IF_UP)) {
@@ -462,7 +462,7 @@
*
* @return the MTU
*/
-static inline uint16_t net_if_get_mtu(struct net_if *iface)
+static inline u16_t net_if_get_mtu(struct net_if *iface)
{
return iface->mtu;
}
@@ -474,7 +474,7 @@
* @param mtu New MTU, note that we store only 16 bit mtu value.
*/
static inline void net_if_set_mtu(struct net_if *iface,
- uint16_t mtu)
+ u16_t mtu)
{
iface->mtu = mtu;
}
@@ -583,7 +583,7 @@
struct net_if_addr *net_if_ipv6_addr_add(struct net_if *iface,
struct in6_addr *addr,
enum net_addr_type addr_type,
- uint32_t vlifetime);
+ u32_t vlifetime);
/**
* @brief Update validity lifetime time of an IPv6 address.
@@ -592,7 +592,7 @@
* @param vlifetime Validity time for this address
*/
void net_if_ipv6_addr_update_lifetime(struct net_if_addr *ifaddr,
- uint32_t vlifetime);
+ u32_t vlifetime);
/**
* @brief Remove an IPv6 address from an interface
@@ -688,7 +688,7 @@
*/
struct net_if_ipv6_prefix *net_if_ipv6_prefix_lookup(struct net_if *iface,
struct in6_addr *addr,
- uint8_t len);
+ u8_t len);
/**
* @brief Add a IPv6 prefix to an network interface.
@@ -702,8 +702,8 @@
*/
struct net_if_ipv6_prefix *net_if_ipv6_prefix_add(struct net_if *iface,
struct in6_addr *prefix,
- uint8_t len,
- uint32_t lifetime);
+ u8_t len,
+ u32_t lifetime);
/**
* @brief Remove an IPv6 prefix from an interface
@@ -715,7 +715,7 @@
* @return True if successfully removed, false otherwise
*/
bool net_if_ipv6_prefix_rm(struct net_if *iface, struct in6_addr *addr,
- uint8_t len);
+ u8_t len);
/**
* @brief Set the infinite status of the prefix
@@ -736,7 +736,7 @@
* @param lifetime Prefix lifetime in seconds
*/
void net_if_ipv6_prefix_set_timer(struct net_if_ipv6_prefix *prefix,
- uint32_t lifetime);
+ u32_t lifetime);
/**
* @brief Unset the prefix lifetime timer.
@@ -788,7 +788,7 @@
* @param lifetime Lifetime of this router.
*/
void net_if_ipv6_router_update_lifetime(struct net_if_router *router,
- uint32_t lifetime);
+ u32_t lifetime);
/**
* @brief Add IPv6 router to the system.
@@ -801,7 +801,7 @@
*/
struct net_if_router *net_if_ipv6_router_add(struct net_if *iface,
struct in6_addr *addr,
- uint16_t router_lifetime);
+ u16_t router_lifetime);
/**
* @brief Remove IPv6 router from the system.
@@ -820,7 +820,7 @@
*
* @return Hop limit
*/
-static inline uint8_t net_if_ipv6_get_hop_limit(struct net_if *iface)
+static inline u8_t net_if_ipv6_get_hop_limit(struct net_if *iface)
{
return iface->ipv6.hop_limit;
}
@@ -832,7 +832,7 @@
* @param hop_limit New hop limit
*/
static inline void net_ipv6_set_hop_limit(struct net_if *iface,
- uint8_t hop_limit)
+ u8_t hop_limit)
{
iface->ipv6.hop_limit = hop_limit;
}
@@ -844,7 +844,7 @@
* @param reachable_time New reachable time
*/
static inline void net_if_ipv6_set_base_reachable_time(struct net_if *iface,
- uint32_t reachable_time)
+ u32_t reachable_time)
{
iface->ipv6.base_reachable_time = reachable_time;
}
@@ -856,7 +856,7 @@
*
* @return Reachable timeout
*/
-static inline uint32_t net_if_ipv6_get_reachable_time(struct net_if *iface)
+static inline u32_t net_if_ipv6_get_reachable_time(struct net_if *iface)
{
return iface->ipv6.reachable_time;
}
@@ -868,7 +868,7 @@
*
* @return Reachable time
*/
-uint32_t net_if_ipv6_calc_reachable_time(struct net_if *iface);
+u32_t net_if_ipv6_calc_reachable_time(struct net_if *iface);
/**
* @brief Set IPv6 reachable time for a given interface. This requires
@@ -888,7 +888,7 @@
* @param retrans_timer New retransmit timer
*/
static inline void net_if_ipv6_set_retrans_timer(struct net_if *iface,
- uint32_t retrans_timer)
+ u32_t retrans_timer)
{
iface->ipv6.retrans_timer = retrans_timer;
}
@@ -900,7 +900,7 @@
*
* @return Retransmit timer
*/
-static inline uint32_t net_if_ipv6_get_retrans_timer(struct net_if *iface)
+static inline u32_t net_if_ipv6_get_retrans_timer(struct net_if *iface)
{
return iface->ipv6.retrans_timer;
}
@@ -975,7 +975,7 @@
*
* @return Time-to-live
*/
-static inline uint8_t net_if_ipv4_get_ttl(struct net_if *iface)
+static inline u8_t net_if_ipv4_get_ttl(struct net_if *iface)
{
return iface->ipv4.ttl;
}
@@ -1004,7 +1004,7 @@
struct net_if_addr *net_if_ipv4_addr_add(struct net_if *iface,
struct in_addr *addr,
enum net_addr_type addr_type,
- uint32_t vlifetime);
+ u32_t vlifetime);
/**
* @brief Remove a IPv4 address from an interface
@@ -1042,7 +1042,7 @@
struct net_if_router *net_if_ipv4_router_add(struct net_if *iface,
struct in_addr *addr,
bool is_default,
- uint16_t router_lifetime);
+ u16_t router_lifetime);
/**
* @brief Check if the given IPv4 address belongs to local subnet.
@@ -1144,7 +1144,7 @@
*
* @return Pointer to interface or NULL if not found.
*/
-struct net_if *net_if_get_by_index(uint8_t index);
+struct net_if *net_if_get_by_index(u8_t index);
/**
* @brief Get interface index according to pointer
@@ -1153,7 +1153,7 @@
*
* @return Interface index
*/
-uint8_t net_if_get_by_iface(struct net_if *iface);
+u8_t net_if_get_by_iface(struct net_if *iface);
/**
* @typedef net_if_cb_t
diff --git a/include/net/net_ip.h b/include/net/net_ip.h
index e78e12f..0681e39 100644
--- a/include/net/net_ip.h
+++ b/include/net/net_ip.h
@@ -63,9 +63,9 @@
/** IPv6 address structure */
struct in6_addr {
union {
- uint8_t u6_addr8[16];
- uint16_t u6_addr16[8]; /* In big endian */
- uint32_t u6_addr32[4]; /* In big endian */
+ u8_t u6_addr8[16];
+ u16_t u6_addr16[8]; /* In big endian */
+ u32_t u6_addr32[4]; /* In big endian */
} in6_u;
#define s6_addr in6_u.u6_addr8
#define s6_addr16 in6_u.u6_addr16
@@ -75,9 +75,9 @@
/** IPv4 address */
struct in_addr {
union {
- uint8_t u4_addr8[4];
- uint16_t u4_addr16[2]; /* In big endian */
- uint32_t u4_addr32[1]; /* In big endian */
+ u8_t u4_addr8[4];
+ u16_t u4_addr16[2]; /* In big endian */
+ u32_t u4_addr32[1]; /* In big endian */
} in4_u;
#define s4_addr in4_u.u4_addr8
#define s4_addr16 in4_u.u4_addr16
@@ -95,27 +95,27 @@
*/
struct sockaddr_in6 {
sa_family_t sin6_family; /* AF_INET6 */
- uint16_t sin6_port; /* Port number */
+ u16_t sin6_port; /* Port number */
struct in6_addr sin6_addr; /* IPv6 address */
- uint8_t sin6_scope_id; /* interfaces for a scope */
+ u8_t sin6_scope_id; /* interfaces for a scope */
};
struct sockaddr_in6_ptr {
sa_family_t sin6_family; /* AF_INET6 */
- uint16_t sin6_port; /* Port number */
+ u16_t sin6_port; /* Port number */
struct in6_addr *sin6_addr; /* IPv6 address */
- uint8_t sin6_scope_id; /* interfaces for a scope */
+ u8_t sin6_scope_id; /* interfaces for a scope */
};
struct sockaddr_in {
sa_family_t sin_family; /* AF_INET */
- uint16_t sin_port; /* Port number */
+ u16_t sin_port; /* Port number */
struct in_addr sin_addr; /* IPv4 address */
};
struct sockaddr_in_ptr {
sa_family_t sin_family; /* AF_INET */
- uint16_t sin_port; /* Port number */
+ u16_t sin_port; /* Port number */
struct in_addr *sin_addr; /* IPv4 address */
};
@@ -184,9 +184,9 @@
/** IPv6/IPv4 local address */
struct net_addr *local_addr;
/** UDP/TCP remote port */
- uint16_t remote_port;
+ u16_t remote_port;
/** UDP/TCP local port */
- uint16_t local_port;
+ u16_t local_port;
/** IP protocol */
enum net_ip_protocol ip_proto;
};
@@ -234,60 +234,60 @@
};
struct net_ipv6_hdr {
- uint8_t vtc;
- uint8_t tcflow;
- uint16_t flow;
- uint8_t len[2];
- uint8_t nexthdr;
- uint8_t hop_limit;
+ u8_t vtc;
+ u8_t tcflow;
+ u16_t flow;
+ u8_t len[2];
+ u8_t nexthdr;
+ u8_t hop_limit;
struct in6_addr src;
struct in6_addr dst;
} __packed;
struct net_ipv6_frag_hdr {
- uint8_t nexthdr;
- uint8_t reserved;
- uint16_t offset;
- uint32_t id;
+ u8_t nexthdr;
+ u8_t reserved;
+ u16_t offset;
+ u32_t id;
} __packed;
struct net_ipv4_hdr {
- uint8_t vhl;
- uint8_t tos;
- uint8_t len[2];
- uint8_t id[2];
- uint8_t offset[2];
- uint8_t ttl;
- uint8_t proto;
- uint16_t chksum;
+ u8_t vhl;
+ u8_t tos;
+ u8_t len[2];
+ u8_t id[2];
+ u8_t offset[2];
+ u8_t ttl;
+ u8_t proto;
+ u16_t chksum;
struct in_addr src;
struct in_addr dst;
} __packed;
struct net_icmp_hdr {
- uint8_t type;
- uint8_t code;
- uint16_t chksum;
+ u8_t type;
+ u8_t code;
+ u16_t chksum;
} __packed;
struct net_udp_hdr {
- uint16_t src_port;
- uint16_t dst_port;
- uint16_t len;
- uint16_t chksum;
+ u16_t src_port;
+ u16_t dst_port;
+ u16_t len;
+ u16_t chksum;
} __packed;
struct net_tcp_hdr {
- uint16_t src_port;
- uint16_t dst_port;
- uint8_t seq[4];
- uint8_t ack[4];
- uint8_t offset;
- uint8_t flags;
- uint8_t wnd[2];
- uint16_t chksum;
- uint8_t urg[2];
- uint8_t optdata[0];
+ u16_t src_port;
+ u16_t dst_port;
+ u8_t seq[4];
+ u8_t ack[4];
+ u8_t offset;
+ u8_t flags;
+ u8_t wnd[2];
+ u16_t chksum;
+ u8_t urg[2];
+ u8_t optdata[0];
} __packed;
#define NET_UDPH_LEN 8 /* Size of UDP header */
@@ -376,14 +376,14 @@
*
* @return True if IPv6 prefixes are the same, False otherwise.
*/
-static inline bool net_is_ipv6_prefix(const uint8_t *addr1,
- const uint8_t *addr2,
- uint8_t length)
+static inline bool net_is_ipv6_prefix(const u8_t *addr1,
+ const u8_t *addr2,
+ u8_t length)
{
- uint8_t bits = 128 - length;
- uint8_t bytes = length / 8;
- uint8_t remain = bits % 8;
- uint8_t mask;
+ u8_t bits = 128 - length;
+ u8_t bytes = length / 8;
+ u8_t remain = bits % 8;
+ u8_t mask;
if (length > 128) {
return false;
@@ -633,10 +633,10 @@
* @param addr7 16-bit word which is part of the address
*/
static inline void net_ipv6_addr_create(struct in6_addr *addr,
- uint16_t addr0, uint16_t addr1,
- uint16_t addr2, uint16_t addr3,
- uint16_t addr4, uint16_t addr5,
- uint16_t addr6, uint16_t addr7)
+ u16_t addr0, u16_t addr1,
+ u16_t addr2, u16_t addr3,
+ u16_t addr4, u16_t addr5,
+ u16_t addr6, u16_t addr7)
{
UNALIGNED_PUT(htons(addr0), &addr->s6_addr16[0]);
UNALIGNED_PUT(htons(addr1), &addr->s6_addr16[1]);
diff --git a/include/net/net_l2.h b/include/net/net_l2.h
index 7a73422..253cf89 100644
--- a/include/net/net_l2.h
+++ b/include/net/net_l2.h
@@ -39,7 +39,7 @@
* reserve as headroom in a net packet. Such space is relevant to L2
* layer only.
*/
- uint16_t (*reserve)(struct net_if *iface, void *data);
+ u16_t (*reserve)(struct net_if *iface, void *data);
/**
* This function is used to enable/disable traffic over a network
diff --git a/include/net/net_linkaddr.h b/include/net/net_linkaddr.h
index 9ea76aa..336d306 100644
--- a/include/net/net_linkaddr.h
+++ b/include/net/net_linkaddr.h
@@ -29,7 +29,7 @@
/**
* Type of the link address. This indicates the network technology that this
* address is used in. Note that in order to save space we store the value
- * into a uint8_t variable, so please do not introduce any values > 255 in
+ * into a u8_t variable, so please do not introduce any values > 255 in
* this enum.
*/
enum net_link_type {
@@ -47,13 +47,13 @@
*/
struct net_linkaddr {
/** The array of byte representing the address */
- uint8_t *addr;
+ u8_t *addr;
/** Length of that address array */
- uint8_t len;
+ u8_t len;
/** What kind of address is this for */
- uint8_t type;
+ u8_t type;
};
/**
@@ -62,19 +62,19 @@
* Used to hold the link address information. This variant is needed
* when we have to store the link layer address.
*
- * Note that you cannot cast this to net_linkaddr as uint8_t * is
- * handled differently than uint8_t addr[] and the fields are purposely
+ * Note that you cannot cast this to net_linkaddr as u8_t * is
+ * handled differently than u8_t addr[] and the fields are purposely
* in a different order.
*/
struct net_linkaddr_storage {
/** What kind of address is this for */
- uint8_t type;
+ u8_t type;
/** The real length of the ll address. */
- uint8_t len;
+ u8_t len;
/** The array of bytes representing the address */
- uint8_t addr[NET_LINK_ADDR_MAX_LENGTH];
+ u8_t addr[NET_LINK_ADDR_MAX_LENGTH];
};
/**
@@ -109,7 +109,7 @@
* This value should always be <= NET_LINK_ADDR_MAX_LENGTH.
*/
static inline int net_linkaddr_set(struct net_linkaddr_storage *lladdr_store,
- uint8_t *new_addr, uint8_t new_len)
+ u8_t *new_addr, u8_t new_len)
{
if (!lladdr_store || !new_addr) {
return -EINVAL;
diff --git a/include/net/net_mgmt.h b/include/net/net_mgmt.h
index ebfbed7..6fefabe 100644
--- a/include/net/net_mgmt.h
+++ b/include/net/net_mgmt.h
@@ -78,7 +78,7 @@
* NULL otherwise.
* @param len Length in byte of the memory pointed by data.
*/
-typedef int (*net_mgmt_request_handler_t)(uint32_t mgmt_request,
+typedef int (*net_mgmt_request_handler_t)(u32_t mgmt_request,
struct net_if *iface,
void *data, size_t len);
@@ -86,7 +86,7 @@
net_mgmt_##_mgmt_request(_mgmt_request, _iface, _data, _len)
#define NET_MGMT_DEFINE_REQUEST_HANDLER(_mgmt_request) \
- extern int net_mgmt_##_mgmt_request(uint32_t mgmt_request, \
+ extern int net_mgmt_##_mgmt_request(u32_t mgmt_request, \
struct net_if *iface, \
void *data, size_t len)
@@ -100,12 +100,12 @@
* @brief Define the user's callback handler function signature
* @param "struct net_mgmt_event_callback *cb"
* Original struct net_mgmt_event_callback owning this handler.
- * @param "uint32_t mgmt_event" The network event being notified.
+ * @param "u32_t mgmt_event" The network event being notified.
* @param "struct net_if *iface" A pointer on a struct net_if to which the
* the event belongs to, if it's an event on an iface. NULL otherwise.
*/
typedef void (*net_mgmt_event_handler_t)(struct net_mgmt_event_callback *cb,
- uint32_t mgmt_event,
+ u32_t mgmt_event,
struct net_if *iface);
/**
@@ -141,11 +141,11 @@
* modified whenever necessary by the owner, and thus will
* affect the handler being called or not.
*/
- uint32_t event_mask;
+ u32_t event_mask;
/** Internal place holder when a synchronous event wait is
* successfully unlocked on a event.
*/
- uint32_t raised_event;
+ u32_t raised_event;
};
};
@@ -159,7 +159,7 @@
static inline
void net_mgmt_init_event_callback(struct net_mgmt_event_callback *cb,
net_mgmt_event_handler_t handler,
- uint32_t mgmt_event_mask)
+ u32_t mgmt_event_mask)
{
__ASSERT(cb, "Callback pointer should not be NULL");
__ASSERT(handler, "Handler pointer should not be NULL");
@@ -186,12 +186,12 @@
* @param iface a valid pointer on a struct net_if if only the event is
* based on an iface. NULL otherwise.
*/
-void net_mgmt_event_notify(uint32_t mgmt_event, struct net_if *iface);
+void net_mgmt_event_notify(u32_t mgmt_event, struct net_if *iface);
/**
* @brief Used to wait synchronously on an event mask
* @param mgmt_event_mask A mask of relevant events to wait on.
- * @param raised_event a pointer on a uint32_t to get which event from
+ * @param raised_event a pointer on a u32_t to get which event from
* the mask generated the event. Can be NULL if the caller is not
* interested in that information.
* @param iface a pointer on a place holder for the iface on which the
@@ -205,8 +205,8 @@
* be specifically returned if the timeout kick-in instead of an
* actual event.
*/
-int net_mgmt_event_wait(uint32_t mgmt_event_mask,
- uint32_t *raised_event,
+int net_mgmt_event_wait(u32_t mgmt_event_mask,
+ u32_t *raised_event,
struct net_if **iface,
int timeout);
@@ -216,7 +216,7 @@
* @param mgmt_event_mask A mask of relevant events to wait on. Listened
* to events should be relevant to iface events and thus have the bit
* NET_MGMT_IFACE_BIT set.
- * @param raised_event a pointer on a uint32_t to get which event from
+ * @param raised_event a pointer on a u32_t to get which event from
* the mask generated the event. Can be NULL if the caller is not
* interested in that information.
* @param timeout a delay in milliseconds. K_FOREVER can be used to wait
@@ -227,8 +227,8 @@
* actual event.
*/
int net_mgmt_event_wait_on_iface(struct net_if *iface,
- uint32_t mgmt_event_mask,
- uint32_t *raised_event,
+ u32_t mgmt_event_mask,
+ u32_t *raised_event,
int timeout);
/**
@@ -242,8 +242,8 @@
#define net_mgmt_event_notify(...)
#define net_mgmt_event_init(...)
-static inline int net_mgmt_event_wait(uint32_t mgmt_event_mask,
- uint32_t *raised_event,
+static inline int net_mgmt_event_wait(u32_t mgmt_event_mask,
+ u32_t *raised_event,
struct net_if **iface,
int timeout)
{
@@ -251,8 +251,8 @@
}
static inline int net_mgmt_event_wait_on_iface(struct net_if *iface,
- uint32_t mgmt_event_mask,
- uint32_t *raised_event,
+ u32_t mgmt_event_mask,
+ u32_t *raised_event,
int timeout)
{
return 0;
diff --git a/include/net/net_offload.h b/include/net/net_offload.h
index c957f29..6e7e11b 100644
--- a/include/net/net_offload.h
+++ b/include/net/net_offload.h
@@ -55,7 +55,7 @@
const struct sockaddr *addr,
socklen_t addrlen,
net_context_connect_cb_t cb,
- int32_t timeout,
+ s32_t timeout,
void *user_data);
/**
@@ -64,7 +64,7 @@
*/
int (*accept)(struct net_context *context,
net_tcp_accept_cb_t cb,
- int32_t timeout,
+ s32_t timeout,
void *user_data);
/**
@@ -72,7 +72,7 @@
*/
int (*send)(struct net_pkt *pkt,
net_context_send_cb_t cb,
- int32_t timeout,
+ s32_t timeout,
void *token,
void *user_data);
@@ -83,7 +83,7 @@
const struct sockaddr *dst_addr,
socklen_t addrlen,
net_context_send_cb_t cb,
- int32_t timeout,
+ s32_t timeout,
void *token,
void *user_data);
@@ -93,7 +93,7 @@
*/
int (*recv)(struct net_context *context,
net_context_recv_cb_t cb,
- int32_t timeout,
+ s32_t timeout,
void *user_data);
/**
@@ -214,7 +214,7 @@
const struct sockaddr *addr,
socklen_t addrlen,
net_context_connect_cb_t cb,
- int32_t timeout,
+ s32_t timeout,
void *user_data)
{
NET_ASSERT(iface);
@@ -255,7 +255,7 @@
static inline int net_offload_accept(struct net_if *iface,
struct net_context *context,
net_tcp_accept_cb_t cb,
- int32_t timeout,
+ s32_t timeout,
void *user_data)
{
NET_ASSERT(iface);
@@ -295,7 +295,7 @@
static inline int net_offload_send(struct net_if *iface,
struct net_pkt *pkt,
net_context_send_cb_t cb,
- int32_t timeout,
+ s32_t timeout,
void *token,
void *user_data)
{
@@ -340,7 +340,7 @@
const struct sockaddr *dst_addr,
socklen_t addrlen,
net_context_send_cb_t cb,
- int32_t timeout,
+ s32_t timeout,
void *token,
void *user_data)
{
@@ -388,7 +388,7 @@
static inline int net_offload_recv(struct net_if *iface,
struct net_context *context,
net_context_recv_cb_t cb,
- int32_t timeout,
+ s32_t timeout,
void *user_data)
{
NET_ASSERT(iface);
diff --git a/include/net/net_pkt.h b/include/net/net_pkt.h
index 3d28540..53339f7 100644
--- a/include/net/net_pkt.h
+++ b/include/net/net_pkt.h
@@ -56,56 +56,56 @@
/** @cond ignore */
- uint8_t *appdata; /* application data starts here */
- uint8_t *next_hdr; /* where is the next header */
+ u8_t *appdata; /* application data starts here */
+ u8_t *next_hdr; /* where is the next header */
/* Filled by layer 2 when network packet is received. */
struct net_linkaddr lladdr_src;
struct net_linkaddr lladdr_dst;
- uint16_t appdatalen;
- uint8_t ll_reserve; /* link layer header length */
- uint8_t ip_hdr_len; /* pre-filled in order to avoid func call */
+ u16_t appdatalen;
+ u8_t ll_reserve; /* link layer header length */
+ u8_t ip_hdr_len; /* pre-filled in order to avoid func call */
#if defined(CONFIG_NET_TCP)
sys_snode_t sent_list;
#endif
- uint8_t sent : 1; /* Is this sent or not
+ u8_t sent : 1; /* Is this sent or not
* Used only if defined(CONFIG_NET_TCP)
*/
- uint8_t forwarding : 1; /* Are we forwarding this pkt
+ u8_t forwarding : 1; /* Are we forwarding this pkt
* Used only if defined(CONFIG_NET_ROUTE)
*/
- uint8_t family : 4; /* IPv4 vs IPv6 */
- uint8_t _unused : 4;
+ u8_t family : 4; /* IPv4 vs IPv6 */
+ u8_t _unused : 4;
#if defined(CONFIG_NET_IPV6)
- uint8_t ipv6_hop_limit; /* IPv6 hop limit for this network packet. */
- uint8_t ipv6_ext_len; /* length of extension headers */
- uint8_t ipv6_ext_opt_len; /* IPv6 ND option length */
+ u8_t ipv6_hop_limit; /* IPv6 hop limit for this network packet. */
+ u8_t ipv6_ext_len; /* length of extension headers */
+ u8_t ipv6_ext_opt_len; /* IPv6 ND option length */
/* Where is the start of the last header before payload data
* in IPv6 packet. This is offset value from start of the IPv6
* packet. Note that this value should be updated by who ever
* adds IPv6 extension headers to the network packet.
*/
- uint16_t ipv6_prev_hdr_start;
+ u16_t ipv6_prev_hdr_start;
#if defined(CONFIG_NET_IPV6_FRAGMENT)
- uint16_t ipv6_fragment_offset; /* Fragment offset of this packet */
- uint32_t ipv6_fragment_id; /* Fragment id */
- uint8_t *ipv6_frag_hdr_start; /* Where starts the fragment header */
+ u16_t ipv6_fragment_offset; /* Fragment offset of this packet */
+ u32_t ipv6_fragment_id; /* Fragment id */
+ u8_t *ipv6_frag_hdr_start; /* Where starts the fragment header */
#endif /* CONFIG_NET_IPV6_FRAGMENT */
#endif /* CONFIG_NET_IPV6 */
#if defined(CONFIG_NET_L2_IEEE802154)
- uint8_t ieee802154_rssi;
+ u8_t ieee802154_rssi;
#endif
/* @endcond */
/** Reference counter */
- uint8_t ref;
+ u8_t ref;
};
/** @cond ignore */
@@ -155,38 +155,38 @@
pkt->lladdr_dst.type = iface->link_addr.type;
}
-static inline uint8_t net_pkt_family(struct net_pkt *pkt)
+static inline u8_t net_pkt_family(struct net_pkt *pkt)
{
return pkt->family;
}
-static inline void net_pkt_set_family(struct net_pkt *pkt, uint8_t family)
+static inline void net_pkt_set_family(struct net_pkt *pkt, u8_t family)
{
pkt->family = family;
}
-static inline uint8_t net_pkt_ip_hdr_len(struct net_pkt *pkt)
+static inline u8_t net_pkt_ip_hdr_len(struct net_pkt *pkt)
{
return pkt->ip_hdr_len;
}
-static inline void net_pkt_set_ip_hdr_len(struct net_pkt *pkt, uint8_t len)
+static inline void net_pkt_set_ip_hdr_len(struct net_pkt *pkt, u8_t len)
{
pkt->ip_hdr_len = len;
}
-static inline uint8_t *net_pkt_next_hdr(struct net_pkt *pkt)
+static inline u8_t *net_pkt_next_hdr(struct net_pkt *pkt)
{
return pkt->next_hdr;
}
-static inline void net_pkt_set_next_hdr(struct net_pkt *pkt, uint8_t *hdr)
+static inline void net_pkt_set_next_hdr(struct net_pkt *pkt, u8_t *hdr)
{
pkt->next_hdr = hdr;
}
#if defined(CONFIG_NET_TCP)
-static inline uint8_t net_pkt_sent(struct net_pkt *pkt)
+static inline u8_t net_pkt_sent(struct net_pkt *pkt)
{
return pkt->sent;
}
@@ -215,79 +215,79 @@
#endif
#if defined(CONFIG_NET_IPV6)
-static inline uint8_t net_pkt_ipv6_ext_opt_len(struct net_pkt *pkt)
+static inline u8_t net_pkt_ipv6_ext_opt_len(struct net_pkt *pkt)
{
return pkt->ipv6_ext_opt_len;
}
static inline void net_pkt_set_ipv6_ext_opt_len(struct net_pkt *pkt,
- uint8_t len)
+ u8_t len)
{
pkt->ipv6_ext_opt_len = len;
}
-static inline uint8_t net_pkt_ipv6_ext_len(struct net_pkt *pkt)
+static inline u8_t net_pkt_ipv6_ext_len(struct net_pkt *pkt)
{
return pkt->ipv6_ext_len;
}
-static inline void net_pkt_set_ipv6_ext_len(struct net_pkt *pkt, uint8_t len)
+static inline void net_pkt_set_ipv6_ext_len(struct net_pkt *pkt, u8_t len)
{
pkt->ipv6_ext_len = len;
}
-static inline uint16_t net_pkt_ipv6_hdr_prev(struct net_pkt *pkt)
+static inline u16_t net_pkt_ipv6_hdr_prev(struct net_pkt *pkt)
{
return pkt->ipv6_prev_hdr_start;
}
static inline void net_pkt_set_ipv6_hdr_prev(struct net_pkt *pkt,
- uint16_t offset)
+ u16_t offset)
{
pkt->ipv6_prev_hdr_start = offset;
}
-static inline uint8_t net_pkt_ipv6_hop_limit(struct net_pkt *pkt)
+static inline u8_t net_pkt_ipv6_hop_limit(struct net_pkt *pkt)
{
return pkt->ipv6_hop_limit;
}
static inline void net_pkt_set_ipv6_hop_limit(struct net_pkt *pkt,
- uint8_t hop_limit)
+ u8_t hop_limit)
{
pkt->ipv6_hop_limit = hop_limit;
}
#if defined(CONFIG_NET_IPV6_FRAGMENT)
-static inline uint8_t *net_pkt_ipv6_fragment_start(struct net_pkt *pkt)
+static inline u8_t *net_pkt_ipv6_fragment_start(struct net_pkt *pkt)
{
return pkt->ipv6_frag_hdr_start;
}
static inline void net_pkt_set_ipv6_fragment_start(struct net_pkt *pkt,
- uint8_t *start)
+ u8_t *start)
{
pkt->ipv6_frag_hdr_start = start;
}
-static inline uint16_t net_pkt_ipv6_fragment_offset(struct net_pkt *pkt)
+static inline u16_t net_pkt_ipv6_fragment_offset(struct net_pkt *pkt)
{
return pkt->ipv6_fragment_offset;
}
static inline void net_pkt_set_ipv6_fragment_offset(struct net_pkt *pkt,
- uint16_t offset)
+ u16_t offset)
{
pkt->ipv6_fragment_offset = offset;
}
-static inline uint32_t net_pkt_ipv6_fragment_id(struct net_pkt *pkt)
+static inline u32_t net_pkt_ipv6_fragment_id(struct net_pkt *pkt)
{
return pkt->ipv6_fragment_id;
}
static inline void net_pkt_set_ipv6_fragment_id(struct net_pkt *pkt,
- uint32_t id)
+ u32_t id)
{
pkt->ipv6_fragment_id = id;
}
@@ -302,60 +302,60 @@
return net_buf_frags_len(pkt->frags);
}
-static inline uint8_t *net_pkt_ip_data(struct net_pkt *pkt)
+static inline u8_t *net_pkt_ip_data(struct net_pkt *pkt)
{
return pkt->frags->data;
}
-static inline uint8_t *net_pkt_udp_data(struct net_pkt *pkt)
+static inline u8_t *net_pkt_udp_data(struct net_pkt *pkt)
{
return &pkt->frags->data[net_pkt_ip_hdr_len(pkt) +
net_pkt_ipv6_ext_len(pkt)];
}
-static inline uint8_t *net_pkt_tcp_data(struct net_pkt *pkt)
+static inline u8_t *net_pkt_tcp_data(struct net_pkt *pkt)
{
return &pkt->frags->data[net_pkt_ip_hdr_len(pkt) +
net_pkt_ipv6_ext_len(pkt)];
}
-static inline uint8_t *net_pkt_icmp_data(struct net_pkt *pkt)
+static inline u8_t *net_pkt_icmp_data(struct net_pkt *pkt)
{
return &pkt->frags->data[net_pkt_ip_hdr_len(pkt) +
net_pkt_ipv6_ext_len(pkt)];
}
-static inline uint8_t *net_pkt_appdata(struct net_pkt *pkt)
+static inline u8_t *net_pkt_appdata(struct net_pkt *pkt)
{
return pkt->appdata;
}
-static inline void net_pkt_set_appdata(struct net_pkt *pkt, uint8_t *data)
+static inline void net_pkt_set_appdata(struct net_pkt *pkt, u8_t *data)
{
pkt->appdata = data;
}
-static inline uint16_t net_pkt_appdatalen(struct net_pkt *pkt)
+static inline u16_t net_pkt_appdatalen(struct net_pkt *pkt)
{
return pkt->appdatalen;
}
-static inline void net_pkt_set_appdatalen(struct net_pkt *pkt, uint16_t len)
+static inline void net_pkt_set_appdatalen(struct net_pkt *pkt, u16_t len)
{
pkt->appdatalen = len;
}
-static inline uint8_t net_pkt_ll_reserve(struct net_pkt *pkt)
+static inline u8_t net_pkt_ll_reserve(struct net_pkt *pkt)
{
return pkt->ll_reserve;
}
-static inline void net_pkt_set_ll_reserve(struct net_pkt *pkt, uint8_t len)
+static inline void net_pkt_set_ll_reserve(struct net_pkt *pkt, u8_t len)
{
pkt->ll_reserve = len;
}
-static inline uint8_t *net_pkt_ll(struct net_pkt *pkt)
+static inline u8_t *net_pkt_ll(struct net_pkt *pkt)
{
return net_pkt_ip_data(pkt) - net_pkt_ll_reserve(pkt);
}
@@ -379,20 +379,20 @@
static inline void net_pkt_ll_swap(struct net_pkt *pkt)
{
- uint8_t *addr = net_pkt_ll_src(pkt)->addr;
+ u8_t *addr = net_pkt_ll_src(pkt)->addr;
net_pkt_ll_src(pkt)->addr = net_pkt_ll_dst(pkt)->addr;
net_pkt_ll_dst(pkt)->addr = addr;
}
#if defined(CONFIG_NET_L2_IEEE802154)
-static inline uint8_t net_pkt_ieee802154_rssi(struct net_pkt *pkt)
+static inline u8_t net_pkt_ieee802154_rssi(struct net_pkt *pkt)
{
return pkt->ieee802154_rssi;
}
static inline void net_pkt_set_ieee802154_rssi(struct net_pkt *pkt,
- uint8_t rssi)
+ u8_t rssi)
{
pkt->ieee802154_rssi = rssi;
}
@@ -441,8 +441,8 @@
*/
struct net_pkt *net_pkt_get_reserve_debug(struct k_mem_slab *slab,
- uint16_t reserve_head,
- int32_t timeout,
+ u16_t reserve_head,
+ s32_t timeout,
const char *caller,
int line);
#define net_pkt_get_reserve(slab, reserve_head, timeout) \
@@ -450,8 +450,8 @@
__func__, __LINE__)
struct net_buf *net_pkt_get_reserve_data_debug(struct net_buf_pool *pool,
- uint16_t reserve_head,
- int32_t timeout,
+ u16_t reserve_head,
+ s32_t timeout,
const char *caller,
int line);
@@ -460,51 +460,51 @@
__func__, __LINE__)
struct net_pkt *net_pkt_get_rx_debug(struct net_context *context,
- int32_t timeout,
+ s32_t timeout,
const char *caller, int line);
#define net_pkt_get_rx(context, timeout) \
net_pkt_get_rx_debug(context, timeout, __func__, __LINE__)
struct net_pkt *net_pkt_get_tx_debug(struct net_context *context,
- int32_t timeout,
+ s32_t timeout,
const char *caller, int line);
#define net_pkt_get_tx(context, timeout) \
net_pkt_get_tx_debug(context, timeout, __func__, __LINE__)
struct net_buf *net_pkt_get_data_debug(struct net_context *context,
- int32_t timeout,
+ s32_t timeout,
const char *caller, int line);
#define net_pkt_get_data(context, timeout) \
net_pkt_get_data_debug(context, timeout, __func__, __LINE__)
-struct net_pkt *net_pkt_get_reserve_rx_debug(uint16_t reserve_head,
- int32_t timeout,
+struct net_pkt *net_pkt_get_reserve_rx_debug(u16_t reserve_head,
+ s32_t timeout,
const char *caller, int line);
#define net_pkt_get_reserve_rx(res, timeout) \
net_pkt_get_reserve_rx_debug(res, timeout, __func__, __LINE__)
-struct net_pkt *net_pkt_get_reserve_tx_debug(uint16_t reserve_head,
- int32_t timeout,
+struct net_pkt *net_pkt_get_reserve_tx_debug(u16_t reserve_head,
+ s32_t timeout,
const char *caller, int line);
#define net_pkt_get_reserve_tx(res, timeout) \
net_pkt_get_reserve_tx_debug(res, timeout, __func__, __LINE__)
-struct net_buf *net_pkt_get_reserve_rx_data_debug(uint16_t reserve_head,
- int32_t timeout,
+struct net_buf *net_pkt_get_reserve_rx_data_debug(u16_t reserve_head,
+ s32_t timeout,
const char *caller,
int line);
#define net_pkt_get_reserve_rx_data(res, timeout) \
net_pkt_get_reserve_rx_data_debug(res, timeout, __func__, __LINE__)
-struct net_buf *net_pkt_get_reserve_tx_data_debug(uint16_t reserve_head,
- int32_t timeout,
+struct net_buf *net_pkt_get_reserve_tx_data_debug(u16_t reserve_head,
+ s32_t timeout,
const char *caller,
int line);
#define net_pkt_get_reserve_tx_data(res, timeout) \
net_pkt_get_reserve_tx_data_debug(res, timeout, __func__, __LINE__)
struct net_buf *net_pkt_get_frag_debug(struct net_pkt *pkt,
- int32_t timeout,
+ s32_t timeout,
const char *caller, int line);
#define net_pkt_get_frag(pkt, timeout) \
net_pkt_get_frag_debug(pkt, timeout, __func__, __LINE__)
@@ -570,8 +570,8 @@
* @return Network packet if successful, NULL otherwise.
*/
struct net_pkt *net_pkt_get_reserve(struct k_mem_slab *slab,
- uint16_t reserve_head,
- int32_t timeout);
+ u16_t reserve_head,
+ s32_t timeout);
/**
* @brief Get packet from the RX packet slab.
@@ -588,7 +588,7 @@
* @return Network packet if successful, NULL otherwise.
*/
struct net_pkt *net_pkt_get_rx(struct net_context *context,
- int32_t timeout);
+ s32_t timeout);
/**
* @brief Get packet from the TX packets slab.
@@ -606,7 +606,7 @@
* @return Network packet if successful, NULL otherwise.
*/
struct net_pkt *net_pkt_get_tx(struct net_context *context,
- int32_t timeout);
+ s32_t timeout);
/**
* @brief Get buffer from the DATA buffers pool.
@@ -624,7 +624,7 @@
* @return Network buffer if successful, NULL otherwise.
*/
struct net_buf *net_pkt_get_data(struct net_context *context,
- int32_t timeout);
+ s32_t timeout);
/**
* @brief Get RX packet from slab but also reserve headroom for
@@ -641,8 +641,8 @@
*
* @return Network packet if successful, NULL otherwise.
*/
-struct net_pkt *net_pkt_get_reserve_rx(uint16_t reserve_head,
- int32_t timeout);
+struct net_pkt *net_pkt_get_reserve_rx(u16_t reserve_head,
+ s32_t timeout);
/**
* @brief Get TX packet from slab but also reserve headroom for
@@ -659,8 +659,8 @@
*
* @return Network packet if successful, NULL otherwise.
*/
-struct net_pkt *net_pkt_get_reserve_tx(uint16_t reserve_head,
- int32_t timeout);
+struct net_pkt *net_pkt_get_reserve_tx(u16_t reserve_head,
+ s32_t timeout);
/**
* @brief Get RX DATA buffer from pool but also reserve headroom for
@@ -677,8 +677,8 @@
*
* @return Network buffer if successful, NULL otherwise.
*/
-struct net_buf *net_pkt_get_reserve_rx_data(uint16_t reserve_head,
- int32_t timeout);
+struct net_buf *net_pkt_get_reserve_rx_data(u16_t reserve_head,
+ s32_t timeout);
/**
* @brief Get TX DATA buffer from pool but also reserve headroom for
@@ -695,8 +695,8 @@
*
* @return Network buffer if successful, NULL otherwise.
*/
-struct net_buf *net_pkt_get_reserve_tx_data(uint16_t reserve_head,
- int32_t timeout);
+struct net_buf *net_pkt_get_reserve_tx_data(u16_t reserve_head,
+ s32_t timeout);
/**
* @brief Get a data fragment that might be from user specific
@@ -710,7 +710,7 @@
*
* @return Network buffer if successful, NULL otherwise.
*/
-struct net_buf *net_pkt_get_frag(struct net_pkt *pkt, int32_t timeout);
+struct net_buf *net_pkt_get_frag(struct net_pkt *pkt, s32_t timeout);
/**
* @brief Place packet back into the available packets slab
@@ -801,7 +801,7 @@
* @return New fragment list if successful, NULL otherwise.
*/
struct net_buf *net_pkt_copy(struct net_pkt *pkt, size_t amount,
- size_t reserve, int32_t timeout);
+ size_t reserve, s32_t timeout);
/**
* @brief Copy a packet fragment list while reserving some extra space
@@ -820,7 +820,7 @@
*/
static inline struct net_buf *net_pkt_copy_all(struct net_pkt *pkt,
size_t reserve,
- int32_t timeout)
+ s32_t timeout)
{
return net_pkt_copy(pkt, net_buf_frags_len(pkt->frags),
reserve, timeout);
@@ -840,7 +840,7 @@
* @return -ENOMEM on error
*/
int net_frag_linear_copy(struct net_buf *dst, struct net_buf *src,
- uint16_t offset, uint16_t len);
+ u16_t offset, u16_t len);
/**
* @brief Compact the fragment list of a packet.
@@ -871,11 +871,11 @@
* False otherwise (In-case of false pkt might contain input
* data in the process of placing into fragments).
*/
-bool net_pkt_append(struct net_pkt *pkt, uint16_t len, const uint8_t *data,
- int32_t timeout);
+bool net_pkt_append(struct net_pkt *pkt, u16_t len, const u8_t *data,
+ s32_t timeout);
/**
- * @brief Append uint8_t data to last fragment in fragment list of a packet
+ * @brief Append u8_t data to last fragment in fragment list of a packet
*
* @details Append data to last fragment. If there is not enough space in last
* fragment then new data fragment will be created and will be added to
@@ -888,13 +888,13 @@
* False otherwise (In-case of false pkt might contain input
* data in the process of placing into fragments).
*/
-static inline bool net_pkt_append_u8(struct net_pkt *pkt, uint8_t data)
+static inline bool net_pkt_append_u8(struct net_pkt *pkt, u8_t data)
{
return net_pkt_append(pkt, 1, &data, K_FOREVER);
}
/**
- * @brief Append uint16_t data to last fragment in fragment list of a packet
+ * @brief Append u16_t data to last fragment in fragment list of a packet
*
* @details Append data to last fragment. If there is not enough space in last
* fragment then new data fragment will be created and will be added to
@@ -907,16 +907,16 @@
* False otherwise (In-case of false pkt might contain input data
* in the process of placing into fragments).
*/
-static inline bool net_pkt_append_be16(struct net_pkt *pkt, uint16_t data)
+static inline bool net_pkt_append_be16(struct net_pkt *pkt, u16_t data)
{
- uint16_t value = sys_cpu_to_be16(data);
+ u16_t value = sys_cpu_to_be16(data);
- return net_pkt_append(pkt, sizeof(uint16_t), (uint8_t *)&value,
+ return net_pkt_append(pkt, sizeof(u16_t), (u8_t *)&value,
K_FOREVER);
}
/**
- * @brief Append uint32_t data to last fragment in fragment list of a packet
+ * @brief Append u32_t data to last fragment in fragment list of a packet
*
* @details Append data to last fragment. If there is not enough space in last
* fragment then new data fragment will be created and will be added to
@@ -929,16 +929,16 @@
* False otherwise (In-case of false pkt might contain input data
* in the process of placing into fragments).
*/
-static inline bool net_pkt_append_be32(struct net_pkt *pkt, uint32_t data)
+static inline bool net_pkt_append_be32(struct net_pkt *pkt, u32_t data)
{
- uint32_t value = sys_cpu_to_be32(data);
+ u32_t value = sys_cpu_to_be32(data);
- return net_pkt_append(pkt, sizeof(uint32_t), (uint8_t *)&value,
+ return net_pkt_append(pkt, sizeof(u32_t), (u8_t *)&value,
K_FOREVER);
}
/**
- * @brief Append uint32_t data to last fragment in fragment list
+ * @brief Append u32_t data to last fragment in fragment list
*
* @details Append data to last fragment. If there is not enough space in last
* fragment then new data fragment will be created and will be added to
@@ -951,11 +951,11 @@
* False otherwise (In-case of false pkt might contain input data
* in the process of placing into fragments).
*/
-static inline bool net_pkt_append_le32(struct net_pkt *pkt, uint32_t data)
+static inline bool net_pkt_append_le32(struct net_pkt *pkt, u32_t data)
{
- uint32_t value = sys_cpu_to_le32(data);
+ u32_t value = sys_cpu_to_le32(data);
- return net_pkt_append(pkt, sizeof(uint32_t), (uint8_t *)&value,
+ return net_pkt_append(pkt, sizeof(u32_t), (u8_t *)&value,
K_FOREVER);
}
@@ -978,8 +978,8 @@
* NULL and pos is 0 after successful read,
* NULL and pos is 0xffff otherwise.
*/
-struct net_buf *net_frag_read(struct net_buf *frag, uint16_t offset,
- uint16_t *pos, uint16_t len, uint8_t *data);
+struct net_buf *net_frag_read(struct net_buf *frag, u16_t offset,
+ u16_t *pos, u16_t len, u8_t *data);
/**
* @brief Skip N number of bytes while reading buffer
@@ -1001,8 +1001,8 @@
* NULL and pos is 0xffff otherwise.
*/
static inline struct net_buf *net_frag_skip(struct net_buf *frag,
- uint16_t offset,
- uint16_t *pos, uint16_t len)
+ u16_t offset,
+ u16_t *pos, u16_t len)
{
return net_frag_read(frag, offset, pos, len, NULL);
}
@@ -1020,9 +1020,9 @@
* NULL otherwise (if pos is 0, NULL is not a failure case).
*/
static inline struct net_buf *net_frag_read_u8(struct net_buf *frag,
- uint16_t offset,
- uint16_t *pos,
- uint8_t *value)
+ u16_t offset,
+ u16_t *pos,
+ u8_t *value)
{
return net_frag_read(frag, offset, pos, 1, value);
}
@@ -1039,8 +1039,8 @@
* @return Pointer to fragment after successful read,
* NULL otherwise (if pos is 0, NULL is not a failure case).
*/
-struct net_buf *net_frag_read_be16(struct net_buf *frag, uint16_t offset,
- uint16_t *pos, uint16_t *value);
+struct net_buf *net_frag_read_be16(struct net_buf *frag, u16_t offset,
+ u16_t *pos, u16_t *value);
/**
* @brief Get 32 bit big endian value from fragmented buffer
@@ -1054,8 +1054,8 @@
* @return Pointer to fragment after successful read,
* NULL otherwise (if pos is 0, NULL is not a failure case).
*/
-struct net_buf *net_frag_read_be32(struct net_buf *frag, uint16_t offset,
- uint16_t *pos, uint32_t *value);
+struct net_buf *net_frag_read_be32(struct net_buf *frag, u16_t offset,
+ u16_t *pos, u32_t *value);
/**
* @brief Write data to an arbitrary offset in fragments list of a packet.
@@ -1118,44 +1118,44 @@
* NULL and pos is 0xffff otherwise.
*/
struct net_buf *net_pkt_write(struct net_pkt *pkt, struct net_buf *frag,
- uint16_t offset, uint16_t *pos, uint16_t len,
- uint8_t *data, int32_t timeout);
+ u16_t offset, u16_t *pos, u16_t len,
+ u8_t *data, s32_t timeout);
-/* Write uint8_t data to an arbitrary offset in fragment. */
+/* Write u8_t data to an arbitrary offset in fragment. */
static inline struct net_buf *net_pkt_write_u8(struct net_pkt *pkt,
struct net_buf *frag,
- uint16_t offset,
- uint16_t *pos,
- uint8_t data)
+ u16_t offset,
+ u16_t *pos,
+ u8_t data)
{
- return net_pkt_write(pkt, frag, offset, pos, sizeof(uint8_t),
+ return net_pkt_write(pkt, frag, offset, pos, sizeof(u8_t),
&data, K_FOREVER);
}
-/* Write uint16_t big endian value to an arbitrary offset in fragment. */
+/* Write u16_t big endian value to an arbitrary offset in fragment. */
static inline struct net_buf *net_pkt_write_be16(struct net_pkt *pkt,
struct net_buf *frag,
- uint16_t offset,
- uint16_t *pos,
- uint16_t data)
+ u16_t offset,
+ u16_t *pos,
+ u16_t data)
{
- uint16_t value = htons(data);
+ u16_t value = htons(data);
- return net_pkt_write(pkt, frag, offset, pos, sizeof(uint16_t),
- (uint8_t *)&value, K_FOREVER);
+ return net_pkt_write(pkt, frag, offset, pos, sizeof(u16_t),
+ (u8_t *)&value, K_FOREVER);
}
-/* Write uint32_t big endian value to an arbitrary offset in fragment. */
+/* Write u32_t big endian value to an arbitrary offset in fragment. */
static inline struct net_buf *net_pkt_write_be32(struct net_pkt *pkt,
struct net_buf *frag,
- uint16_t offset,
- uint16_t *pos,
- uint32_t data)
+ u16_t offset,
+ u16_t *pos,
+ u32_t data)
{
- uint32_t value = htonl(data);
+ u32_t value = htonl(data);
- return net_pkt_write(pkt, frag, offset, pos, sizeof(uint32_t),
- (uint8_t *)&value, K_FOREVER);
+ return net_pkt_write(pkt, frag, offset, pos, sizeof(u32_t),
+ (u8_t *)&value, K_FOREVER);
}
/**
@@ -1183,45 +1183,45 @@
* @return True on success, False otherwise.
*/
bool net_pkt_insert(struct net_pkt *pkt, struct net_buf *frag,
- uint16_t offset, uint16_t len, uint8_t *data,
- int32_t timeout);
+ u16_t offset, u16_t len, u8_t *data,
+ s32_t timeout);
-/* Insert uint8_t data at an arbitrary offset in a series of fragments. */
+/* Insert u8_t data at an arbitrary offset in a series of fragments. */
static inline bool net_pkt_insert_u8(struct net_pkt *pkt,
struct net_buf *frag,
- uint16_t offset,
- uint8_t data)
+ u16_t offset,
+ u8_t data)
{
- return net_pkt_insert(pkt, frag, offset, sizeof(uint8_t), &data,
+ return net_pkt_insert(pkt, frag, offset, sizeof(u8_t), &data,
K_FOREVER);
}
-/* Insert uint16_t big endian value at an arbitrary offset in a series of
+/* Insert u16_t big endian value at an arbitrary offset in a series of
* fragments.
*/
static inline bool net_pkt_insert_be16(struct net_pkt *pkt,
struct net_buf *frag,
- uint16_t offset,
- uint16_t data)
+ u16_t offset,
+ u16_t data)
{
- uint16_t value = htons(data);
+ u16_t value = htons(data);
- return net_pkt_insert(pkt, frag, offset, sizeof(uint16_t),
- (uint8_t *)&value, K_FOREVER);
+ return net_pkt_insert(pkt, frag, offset, sizeof(u16_t),
+ (u8_t *)&value, K_FOREVER);
}
-/* Insert uint32_t big endian value at an arbitrary offset in a series of
+/* Insert u32_t big endian value at an arbitrary offset in a series of
* fragments.
*/
static inline bool net_pkt_insert_be32(struct net_pkt *pkt,
struct net_buf *frag,
- uint16_t offset,
- uint32_t data)
+ u16_t offset,
+ u32_t data)
{
- uint32_t value = htonl(data);
+ u32_t value = htonl(data);
- return net_pkt_insert(pkt, frag, offset, sizeof(uint32_t),
- (uint8_t *)&value, K_FOREVER);
+ return net_pkt_insert(pkt, frag, offset, sizeof(u32_t),
+ (u8_t *)&value, K_FOREVER);
}
/**
@@ -1250,8 +1250,8 @@
* @return 0 on success, <0 otherwise.
*/
int net_pkt_split(struct net_pkt *pkt, struct net_buf *orig_frag,
- uint16_t len, struct net_buf **fragA,
- struct net_buf **fragB, int32_t timeout);
+ u16_t len, struct net_buf **fragA,
+ struct net_buf **fragB, s32_t timeout);
/**
* @brief Get information about pre-defined RX, TX and DATA pools.
diff --git a/include/net/net_stats.h b/include/net/net_stats.h
index ca26a91..89b0d05 100644
--- a/include/net/net_stats.h
+++ b/include/net/net_stats.h
@@ -20,7 +20,7 @@
extern "C" {
#endif
-typedef uint32_t net_stats_t;
+typedef u32_t net_stats_t;
struct net_stats_ip {
/** Number of received packets at the IP layer. */
@@ -179,16 +179,16 @@
};
struct net_stats_rpl {
- uint16_t mem_overflows;
- uint16_t local_repairs;
- uint16_t global_repairs;
- uint16_t malformed_msgs;
- uint16_t resets;
- uint16_t parent_switch;
- uint16_t forward_errors;
- uint16_t loop_errors;
- uint16_t loop_warnings;
- uint16_t root_repairs;
+ u16_t mem_overflows;
+ u16_t local_repairs;
+ u16_t global_repairs;
+ u16_t malformed_msgs;
+ u16_t resets;
+ u16_t parent_switch;
+ u16_t forward_errors;
+ u16_t loop_errors;
+ u16_t loop_warnings;
+ u16_t root_repairs;
struct net_stats_rpl_dis dis;
struct net_stats_rpl_dio dio;
@@ -208,8 +208,8 @@
};
struct net_stats_bytes {
- uint32_t sent;
- uint32_t received;
+ u32_t sent;
+ u32_t received;
};
struct net_stats {
diff --git a/include/net/trickle.h b/include/net/trickle.h
index d72bf5c..5a318f5 100644
--- a/include/net/trickle.h
+++ b/include/net/trickle.h
@@ -34,15 +34,15 @@
* only via the Trickle API.
*/
struct net_trickle {
- uint32_t Imin; /* Min interval size in ms */
- uint8_t Imax; /* Max number of doublings */
- uint8_t k; /* Redundancy constant */
+ u32_t Imin; /* Min interval size in ms */
+ u8_t Imax; /* Max number of doublings */
+ u8_t k; /* Redundancy constant */
- uint32_t I; /* Current interval size */
- uint32_t Istart; /* Start of the interval in ms */
- uint8_t c; /* Consistency counter */
+ u32_t I; /* Current interval size */
+ u32_t Istart; /* Start of the interval in ms */
+ u8_t c; /* Consistency counter */
- uint32_t Imax_abs; /* Max interval size in ms (not doublings)
+ u32_t Imax_abs; /* Max interval size in ms (not doublings)
*/
struct k_delayed_work timer;
@@ -63,9 +63,9 @@
* @return Return 0 if ok and <0 if error.
*/
int net_trickle_create(struct net_trickle *trickle,
- uint32_t Imin,
- uint8_t Imax,
- uint8_t k);
+ u32_t Imin,
+ u8_t Imax,
+ u8_t k);
/**
* @brief Start a Trickle timer.
diff --git a/include/net/zoap.h b/include/net/zoap.h
index 9cc0953..ca75f45 100644
--- a/include/net/zoap.h
+++ b/include/net/zoap.h
@@ -185,8 +185,8 @@
struct zoap_observer {
sys_snode_t list;
struct sockaddr addr;
- uint8_t token[8];
- uint8_t tkl;
+ u8_t token[8];
+ u8_t tkl;
};
/**
@@ -194,8 +194,8 @@
*/
struct zoap_packet {
struct net_pkt *pkt;
- uint8_t *start; /* Start of the payload */
- uint16_t total_size;
+ u8_t *start; /* Start of the payload */
+ u16_t total_size;
};
/**
@@ -213,8 +213,8 @@
struct zoap_pending {
struct net_pkt *pkt;
struct sockaddr addr;
- int32_t timeout;
- uint16_t id;
+ s32_t timeout;
+ u16_t id;
};
/**
@@ -225,8 +225,8 @@
zoap_reply_t reply;
void *user_data;
int age;
- uint8_t token[8];
- uint8_t tkl;
+ u8_t token[8];
+ u8_t tkl;
};
/**
@@ -304,8 +304,8 @@
* To be used with zoap_find_options().
*/
struct zoap_option {
- uint8_t *value;
- uint16_t len;
+ u8_t *value;
+ u16_t len;
};
/**
@@ -492,7 +492,7 @@
*
* @return pointer to the start of the payload, NULL in case of error.
*/
-uint8_t *zoap_packet_get_payload(struct zoap_packet *zpkt, uint16_t *len);
+u8_t *zoap_packet_get_payload(struct zoap_packet *zpkt, u16_t *len);
/**
* @brief Sets how much space was used by the payload.
@@ -506,7 +506,7 @@
*
* @return 0 in case of success or negative in case of error.
*/
-int zoap_packet_set_used(struct zoap_packet *zpkt, uint16_t len);
+int zoap_packet_set_used(struct zoap_packet *zpkt, u16_t len);
/**
* @brief Adds an option to the packet.
@@ -520,8 +520,8 @@
*
* @return 0 in case of success or negative in case of error.
*/
-int zoap_add_option(struct zoap_packet *zpkt, uint16_t code,
- const void *value, uint16_t len);
+int zoap_add_option(struct zoap_packet *zpkt, u16_t code,
+ const void *value, u16_t len);
/**
* @brief Converts an option to its integer representation.
@@ -548,7 +548,7 @@
*
* @return 0 in case of success or negative in case of error.
*/
-int zoap_add_option_int(struct zoap_packet *zpkt, uint16_t code,
+int zoap_add_option_int(struct zoap_packet *zpkt, u16_t code,
unsigned int val);
/**
@@ -564,8 +564,8 @@
* @return The number of options found in packet matching code,
* negative on error.
*/
-int zoap_find_options(const struct zoap_packet *zpkt, uint16_t code,
- struct zoap_option *options, uint16_t veclen);
+int zoap_find_options(const struct zoap_packet *zpkt, u16_t code,
+ struct zoap_option *options, u16_t veclen);
/**
* Represents the size of each block that will be transferred using
@@ -593,7 +593,7 @@
*
* @return The size in bytes that the block_size represents
*/
-static inline uint16_t zoap_block_size_to_bytes(
+static inline u16_t zoap_block_size_to_bytes(
enum zoap_block_size block_size)
{
return (1 << (block_size + 4));
@@ -700,7 +700,7 @@
*
* @return the CoAP version in packet
*/
-uint8_t zoap_header_get_version(const struct zoap_packet *zpkt);
+u8_t zoap_header_get_version(const struct zoap_packet *zpkt);
/**
* @brief Returns the type of the CoAP packet.
@@ -709,7 +709,7 @@
*
* @return the type of the packet
*/
-uint8_t zoap_header_get_type(const struct zoap_packet *zpkt);
+u8_t zoap_header_get_type(const struct zoap_packet *zpkt);
/**
* @brief Returns the token (if any) in the CoAP packet.
@@ -719,8 +719,8 @@
*
* @return pointer to the start of the token in the CoAP packet.
*/
-const uint8_t *zoap_header_get_token(const struct zoap_packet *zpkt,
- uint8_t *len);
+const u8_t *zoap_header_get_token(const struct zoap_packet *zpkt,
+ u8_t *len);
/**
* @brief Returns the code of the CoAP packet.
@@ -729,7 +729,7 @@
*
* @return the code present in the packet
*/
-uint8_t zoap_header_get_code(const struct zoap_packet *zpkt);
+u8_t zoap_header_get_code(const struct zoap_packet *zpkt);
/**
* @brief Returns the message id associated with the CoAP packet.
@@ -738,7 +738,7 @@
*
* @return the message id present in the packet
*/
-uint16_t zoap_header_get_id(const struct zoap_packet *zpkt);
+u16_t zoap_header_get_id(const struct zoap_packet *zpkt);
/**
* @brief Sets the version of the CoAP packet.
@@ -746,7 +746,7 @@
* @param zpkt CoAP packet representation
* @param ver The CoAP version to set in the packet
*/
-void zoap_header_set_version(struct zoap_packet *zpkt, uint8_t ver);
+void zoap_header_set_version(struct zoap_packet *zpkt, u8_t ver);
/**
* @brief Sets the type of the CoAP packet.
@@ -754,7 +754,7 @@
* @param zpkt CoAP packet representation
* @param type The packet type to set
*/
-void zoap_header_set_type(struct zoap_packet *zpkt, uint8_t type);
+void zoap_header_set_type(struct zoap_packet *zpkt, u8_t type);
/**
* @brief Sets the token in the CoAP packet.
@@ -765,8 +765,8 @@
*
* @return 0 in case of success or negative in case of error.
*/
-int zoap_header_set_token(struct zoap_packet *zpkt, const uint8_t *token,
- uint8_t tokenlen);
+int zoap_header_set_token(struct zoap_packet *zpkt, const u8_t *token,
+ u8_t tokenlen);
/**
* @brief Sets the code present in the CoAP packet.
@@ -774,7 +774,7 @@
* @param zpkt CoAP packet representation
* @param code The code set in the packet
*/
-void zoap_header_set_code(struct zoap_packet *zpkt, uint8_t code);
+void zoap_header_set_code(struct zoap_packet *zpkt, u8_t code);
/**
* @brief Sets the message id present in the CoAP packet.
@@ -782,16 +782,16 @@
* @param zpkt CoAP packet representation
* @param id The message id to set in the packet
*/
-void zoap_header_set_id(struct zoap_packet *zpkt, uint16_t id);
+void zoap_header_set_id(struct zoap_packet *zpkt, u16_t id);
/**
* @brief Helper to generate message ids
*
* @return a new message id
*/
-static inline uint16_t zoap_next_id(void)
+static inline u16_t zoap_next_id(void)
{
- static uint16_t message_id;
+ static u16_t message_id;
return ++message_id;
}
@@ -802,7 +802,7 @@
*
* @return a 8-byte pseudo-random token.
*/
-uint8_t *zoap_next_token(void);
+u8_t *zoap_next_token(void);
/**
* @}
diff --git a/samples/net/coaps_client/src/coaps_client.c b/samples/net/coaps_client/src/coaps_client.c
index 49119cf..bd1c06c 100644
--- a/samples/net/coaps_client/src/coaps_client.c
+++ b/samples/net/coaps_client/src/coaps_client.c
@@ -78,12 +78,12 @@
static struct in6_addr mcast_addr = MCAST_IP_ADDR;
struct dtls_timing_context {
- uint32_t snapshot;
- uint32_t int_ms;
- uint32_t fin_ms;
+ u32_t snapshot;
+ u32_t int_ms;
+ u32_t fin_ms;
};
-static void msg_dump(const char *s, uint8_t *data, unsigned int len)
+static void msg_dump(const char *s, u8_t *data, unsigned int len)
{
unsigned int i;
@@ -125,7 +125,7 @@
mbedtls_printf("%s:%04d: |%d| %s", basename, line, level, str);
}
-void dtls_timing_set_delay(void *data, uint32_t int_ms, uint32_t fin_ms)
+void dtls_timing_set_delay(void *data, u32_t int_ms, u32_t fin_ms)
{
struct dtls_timing_context *ctx = (struct dtls_timing_context *)data;
@@ -162,7 +162,7 @@
static int entropy_source(void *data, unsigned char *output, size_t len,
size_t *olen)
{
- uint32_t seed;
+ u32_t seed;
ARG_UNUSED(data);
@@ -188,9 +188,9 @@
struct zoap_reply *reply;
struct net_pkt *pkt;
struct net_buf *frag;
- uint8_t observe = 0;
+ u8_t observe = 0;
const char *const *p;
- uint16_t len;
+ u16_t len;
mbedtls_entropy_context entropy;
mbedtls_ctr_drbg_context ctr_drbg;
@@ -411,7 +411,7 @@
}
#define STACK_SIZE 4096
-uint8_t stack[STACK_SIZE];
+u8_t stack[STACK_SIZE];
static inline int init_app(void)
{
diff --git a/samples/net/coaps_client/src/udp.c b/samples/net/coaps_client/src/udp.c
index ce53deb..20da925 100644
--- a/samples/net/coaps_client/src/udp.c
+++ b/samples/net/coaps_client/src/udp.c
@@ -63,7 +63,7 @@
return MBEDTLS_ERR_SSL_ALLOC_FAILED;
}
- rc = net_pkt_append(send_pkt, size, (uint8_t *) buf, K_FOREVER);
+ rc = net_pkt_append(send_pkt, size, (u8_t *) buf, K_FOREVER);
if (!rc) {
return MBEDTLS_ERR_SSL_INTERNAL_ERROR;
}
@@ -82,12 +82,12 @@
}
}
-int udp_rx(void *context, unsigned char *buf, size_t size, uint32_t timeout)
+int udp_rx(void *context, unsigned char *buf, size_t size, u32_t timeout)
{
struct udp_context *ctx = context;
struct net_buf *rx_buf = NULL;
- uint16_t read_bytes;
- uint8_t *ptr;
+ u16_t read_bytes;
+ u8_t *ptr;
int pos;
int len;
int rc;
diff --git a/samples/net/coaps_client/src/udp.h b/samples/net/coaps_client/src/udp.h
index bd3b66a..f8c68cd 100644
--- a/samples/net/coaps_client/src/udp.h
+++ b/samples/net/coaps_client/src/udp.h
@@ -18,6 +18,6 @@
int udp_init(struct udp_context *ctx);
int udp_tx(void *ctx, const unsigned char *buf, size_t size);
-int udp_rx(void *ctx, unsigned char *buf, size_t size, uint32_t timeout);
+int udp_rx(void *ctx, unsigned char *buf, size_t size, u32_t timeout);
#endif
diff --git a/samples/net/coaps_server/src/coaps_server.c b/samples/net/coaps_server/src/coaps_server.c
index 1bd1155..69044e0 100644
--- a/samples/net/coaps_server/src/coaps_server.c
+++ b/samples/net/coaps_server/src/coaps_server.c
@@ -76,13 +76,13 @@
static mbedtls_ssl_context *curr_ctx;
-static int send_response(struct zoap_packet *request, uint8_t response_code)
+static int send_response(struct zoap_packet *request, u8_t response_code)
{
struct net_pkt *pkt;
struct net_buf *frag;
struct zoap_packet response;
- uint8_t code, type;
- uint16_t id;
+ u8_t code, type;
+ u16_t id;
int r;
code = zoap_header_get_code(request);
@@ -154,8 +154,8 @@
struct net_pkt *pkt;
struct net_buf *frag;
struct zoap_packet response;
- uint8_t *payload, code, type;
- uint16_t len, id;
+ u8_t *payload, code, type;
+ u16_t len, id;
int r;
code = zoap_header_get_code(request);
@@ -226,8 +226,8 @@
struct net_pkt *pkt;
struct net_buf *frag;
struct zoap_packet response;
- uint8_t *payload, code, type;
- uint16_t len, id;
+ u8_t *payload, code, type;
+ u16_t len, id;
int i, r;
code = zoap_header_get_code(request);
@@ -337,9 +337,9 @@
};
struct dtls_timing_context {
- uint32_t snapshot;
- uint32_t int_ms;
- uint32_t fin_ms;
+ u32_t snapshot;
+ u32_t int_ms;
+ u32_t fin_ms;
};
static void my_debug(void *ctx, int level,
@@ -360,7 +360,7 @@
mbedtls_printf("%s:%04d: |%d| %s", basename, line, level, str);
}
-void dtls_timing_set_delay(void *data, uint32_t int_ms, uint32_t fin_ms)
+void dtls_timing_set_delay(void *data, u32_t int_ms, u32_t fin_ms)
{
struct dtls_timing_context *ctx = (struct dtls_timing_context *)data;
@@ -397,7 +397,7 @@
static int entropy_source(void *data, unsigned char *output, size_t len,
size_t *olen)
{
- uint32_t seed;
+ u32_t seed;
ARG_UNUSED(data);
@@ -632,7 +632,7 @@
}
#define STACK_SIZE 4096
-uint8_t stack[STACK_SIZE];
+u8_t stack[STACK_SIZE];
static inline int init_app(void)
{
diff --git a/samples/net/coaps_server/src/udp.c b/samples/net/coaps_server/src/udp.c
index ac9905f0b..745b598 100644
--- a/samples/net/coaps_server/src/udp.c
+++ b/samples/net/coaps_server/src/udp.c
@@ -53,7 +53,7 @@
return -EIO;
}
- rc = net_pkt_append(send_pkt, size, (uint8_t *) buf, K_FOREVER);
+ rc = net_pkt_append(send_pkt, size, (u8_t *) buf, K_FOREVER);
if (!rc) {
printk("cannot write buf\n");
return -EIO;
@@ -79,8 +79,8 @@
struct net_context *net_ctx = ctx->net_ctx;
struct net_pkt *rx_pkt = NULL;
struct net_buf *rx_buf;
- uint16_t read_bytes;
- uint8_t *ptr;
+ u16_t read_bytes;
+ u8_t *ptr;
int pos;
int len;
int rc;
diff --git a/samples/net/common/ieee802154_settings.c b/samples/net/common/ieee802154_settings.c
index 2451587..478c1f8 100644
--- a/samples/net/common/ieee802154_settings.c
+++ b/samples/net/common/ieee802154_settings.c
@@ -16,9 +16,9 @@
int ieee802154_sample_setup(void)
{
- uint16_t channel = CONFIG_NET_APP_IEEE802154_CHANNEL;
- uint16_t pan_id = CONFIG_NET_APP_IEEE802154_PAN_ID;
- int16_t tx_power = CONFIG_NET_APP_IEEE802154_RADIO_TX_POWER;
+ u16_t channel = CONFIG_NET_APP_IEEE802154_CHANNEL;
+ u16_t pan_id = CONFIG_NET_APP_IEEE802154_PAN_ID;
+ s16_t tx_power = CONFIG_NET_APP_IEEE802154_RADIO_TX_POWER;
#ifdef CONFIG_NET_L2_IEEE802154_SECURITY
struct ieee802154_security_params sec_params = {
@@ -43,11 +43,11 @@
}
if (net_mgmt(NET_REQUEST_IEEE802154_SET_PAN_ID,
- iface, &pan_id, sizeof(uint16_t)) ||
+ iface, &pan_id, sizeof(u16_t)) ||
net_mgmt(NET_REQUEST_IEEE802154_SET_CHANNEL,
- iface, &channel, sizeof(uint16_t)) ||
+ iface, &channel, sizeof(u16_t)) ||
net_mgmt(NET_REQUEST_IEEE802154_SET_TX_POWER,
- iface, &tx_power, sizeof(int16_t))) {
+ iface, &tx_power, sizeof(s16_t))) {
return -EINVAL;
}
diff --git a/samples/net/dhcpv4_client/src/main.c b/samples/net/dhcpv4_client/src/main.c
index e48c147..3eacf28 100644
--- a/samples/net/dhcpv4_client/src/main.c
+++ b/samples/net/dhcpv4_client/src/main.c
@@ -29,7 +29,7 @@
static struct net_mgmt_event_callback mgmt_cb;
static void handler(struct net_mgmt_event_callback *cb,
- uint32_t mgmt_event,
+ u32_t mgmt_event,
struct net_if *iface)
{
int i = 0;
diff --git a/samples/net/dns_resolve/src/main.c b/samples/net/dns_resolve/src/main.c
index 1fa93d1..04bab39 100644
--- a/samples/net/dns_resolve/src/main.c
+++ b/samples/net/dns_resolve/src/main.c
@@ -79,7 +79,7 @@
static void do_ipv4_lookup(struct k_work *work)
{
- uint16_t dns_id;
+ u16_t dns_id;
int ret;
ret = dns_get_addr_info("www.zephyrproject.org",
@@ -97,7 +97,7 @@
}
static void ipv4_addr_add_handler(struct net_mgmt_event_callback *cb,
- uint32_t mgmt_event,
+ u32_t mgmt_event,
struct net_if *iface)
{
char hr_addr[NET_IPV4_ADDR_LEN];
@@ -160,7 +160,7 @@
{
char hr_addr[NET_IPV4_ADDR_LEN];
struct in_addr addr;
- uint16_t dns_id;
+ u16_t dns_id;
int ret;
if (net_addr_pton(AF_INET, CONFIG_NET_APP_MY_IPV4_ADDR, &addr)) {
@@ -202,7 +202,7 @@
static void do_ipv6_lookup(struct k_work *work)
{
- uint16_t dns_id;
+ u16_t dns_id;
int ret;
ret = dns_get_addr_info("www.zephyrproject.org",
@@ -224,7 +224,7 @@
* network. So wait for that before continuing.
*/
static void ipv6_router_add_handler(struct net_mgmt_event_callback *cb,
- uint32_t mgmt_event,
+ u32_t mgmt_event,
struct net_if *iface)
{
if (mgmt_event != NET_EVENT_IPV6_ROUTER_ADD) {
diff --git a/samples/net/echo_client/src/echo-client.c b/samples/net/echo_client/src/echo-client.c
index e72fd0c..0ba5676 100644
--- a/samples/net/echo_client/src/echo-client.c
+++ b/samples/net/echo_client/src/echo-client.c
@@ -111,9 +111,9 @@
#define PEER_PORT 4242
struct data {
- uint32_t expecting_udp;
- uint32_t expecting_tcp;
- uint32_t received_tcp;
+ u32_t expecting_udp;
+ u32_t expecting_tcp;
+ u32_t received_tcp;
};
static struct {
@@ -455,7 +455,7 @@
#if defined(CONFIG_NET_UDP)
static bool compare_udp_data(struct net_pkt *pkt, int expecting_len)
{
- uint8_t *ptr = net_pkt_appdata(pkt);
+ u8_t *ptr = net_pkt_appdata(pkt);
struct net_buf *frag;
int pos = 0;
int len;
@@ -617,7 +617,7 @@
static bool compare_tcp_data(struct net_pkt *pkt, int expecting_len,
int received_len)
{
- uint8_t *ptr = net_pkt_appdata(pkt), *start;
+ u8_t *ptr = net_pkt_appdata(pkt), *start;
int pos = 0;
struct net_buf *frag;
int len;
@@ -714,7 +714,7 @@
void *token,
void *user_data)
{
- uint32_t len = POINTER_TO_UINT(token);
+ u32_t len = POINTER_TO_UINT(token);
if (len) {
if (status) {
@@ -854,7 +854,7 @@
#endif
static void event_iface_up(struct net_mgmt_event_callback *cb,
- uint32_t mgmt_event, struct net_if *iface)
+ u32_t mgmt_event, struct net_if *iface)
{
struct net_context *udp_send4 = { 0 };
struct net_context *udp_send6 = { 0 };
diff --git a/samples/net/http_client/src/http_client_cb.c b/samples/net/http_client/src/http_client_cb.c
index 7cbc8e1..767512c 100644
--- a/samples/net/http_client/src/http_client_cb.c
+++ b/samples/net/http_client/src/http_client_cb.c
@@ -24,7 +24,7 @@
int on_status(struct http_parser *parser, const char *at, size_t length)
{
struct http_client_ctx *ctx;
- uint16_t len;
+ u16_t len;
ARG_UNUSED(parser);
@@ -40,7 +40,7 @@
{
char *content_len = "Content-Length";
struct http_client_ctx *ctx;
- uint16_t len;
+ u16_t len;
ctx = CONTAINER_OF(parser, struct http_client_ctx, parser);
diff --git a/samples/net/http_client/src/http_client_rcv.c b/samples/net/http_client/src/http_client_rcv.c
index c9bd031..7eacfeb 100644
--- a/samples/net/http_client/src/http_client_rcv.c
+++ b/samples/net/http_client/src/http_client_rcv.c
@@ -18,8 +18,8 @@
{
struct http_client_ctx *http_ctx;
struct net_buf *data_buf = NULL;
- uint16_t data_len;
- uint16_t offset;
+ u16_t data_len;
+ u16_t offset;
int rc;
if (!rx) {
@@ -59,7 +59,7 @@
{
struct http_client_ctx *http_ctx;
struct net_buf *frag = rx->frags;
- uint16_t offset;
+ u16_t offset;
if (!rx) {
return;
diff --git a/samples/net/http_client/src/http_client_types.h b/samples/net/http_client/src/http_client_types.h
index e916fe0..fe3915c 100644
--- a/samples/net/http_client/src/http_client_types.h
+++ b/samples/net/http_client/src/http_client_types.h
@@ -17,8 +17,8 @@
struct tcp_client_ctx tcp_ctx;
- uint32_t content_length;
- uint32_t processed;
+ u32_t content_length;
+ u32_t processed;
/* https://tools.ietf.org/html/rfc7230#section-3.1.2
* The status-code element is a 3-digit integer code
@@ -30,8 +30,8 @@
*/
char http_status[HTTP_STATUS_STR_SIZE];
- uint8_t cl_present:1;
- uint8_t body_found:1;
+ u8_t cl_present:1;
+ u8_t body_found:1;
};
#endif
diff --git a/samples/net/http_client/src/main.c b/samples/net/http_client/src/main.c
index 7477e03..3cda741 100644
--- a/samples/net/http_client/src/main.c
+++ b/samples/net/http_client/src/main.c
@@ -70,7 +70,7 @@
char *content_type, char *payload)
{
struct net_context *net_ctx;
- int32_t timeout;
+ s32_t timeout;
int rc;
print_banner(method);
diff --git a/samples/net/http_client/src/tcp_client.c b/samples/net/http_client/src/tcp_client.c
index 1550620..850c9e5 100644
--- a/samples/net/http_client/src/tcp_client.c
+++ b/samples/net/http_client/src/tcp_client.c
@@ -14,7 +14,7 @@
#include <misc/printk.h>
static
-int set_addr(struct sockaddr *sock_addr, const char *addr, uint16_t server_port)
+int set_addr(struct sockaddr *sock_addr, const char *addr, u16_t server_port)
{
void *ptr = NULL;
int rc;
@@ -104,7 +104,7 @@
}
int tcp_connect(struct tcp_client_ctx *ctx, const char *server_addr,
- uint16_t server_port)
+ u16_t server_port)
{
#if CONFIG_NET_IPV6
socklen_t addr_len = sizeof(struct sockaddr_in6);
diff --git a/samples/net/http_client/src/tcp_client.h b/samples/net/http_client/src/tcp_client.h
index 011a09f..f974d03 100644
--- a/samples/net/http_client/src/tcp_client.h
+++ b/samples/net/http_client/src/tcp_client.h
@@ -16,7 +16,7 @@
/* Local sock address */
struct sockaddr local_sock;
/* Network timeout */
- int32_t timeout;
+ s32_t timeout;
/* User defined call back*/
void (*receive_cb)(struct tcp_client_ctx *ctx, struct net_pkt *rx);
};
@@ -24,7 +24,7 @@
int tcp_set_local_addr(struct tcp_client_ctx *ctx, const char *local_addr);
int tcp_connect(struct tcp_client_ctx *ctx, const char *server_addr,
- uint16_t server_port);
+ u16_t server_port);
int tcp_disconnect(struct tcp_client_ctx *ctx);
diff --git a/samples/net/http_server/src/http_server.c b/samples/net/http_server/src/http_server.c
index 2908c44..77f8467 100644
--- a/samples/net/http_server/src/http_server.c
+++ b/samples/net/http_server/src/http_server.c
@@ -77,8 +77,8 @@
static struct http_root_url *http_url_find(struct http_server_ctx *http_ctx);
-static int http_url_cmp(const char *url, uint16_t url_len,
- const char *root_url, uint16_t root_url_len);
+static int http_url_cmp(const char *url, u16_t url_len,
+ const char *root_url, u16_t root_url_len);
static void http_tx(struct http_server_ctx *http_ctx);
@@ -87,8 +87,8 @@
{
struct http_server_ctx *http_ctx = NULL;
struct net_buf *data = NULL;
- uint16_t rcv_len;
- uint16_t offset;
+ u16_t rcv_len;
+ u16_t offset;
int parsed_len;
int rc;
@@ -342,7 +342,7 @@
return 0;
}
-int http_url_add(const char *url, uint8_t flags,
+int http_url_add(const char *url, u8_t flags,
int (*write_cb)(struct http_server_ctx *http_ctx))
{
struct http_root_url *root = NULL;
@@ -364,8 +364,8 @@
return 0;
}
-static int http_url_cmp(const char *url, uint16_t url_len,
- const char *root_url, uint16_t root_url_len)
+static int http_url_cmp(const char *url, u16_t url_len,
+ const char *root_url, u16_t root_url_len)
{
if (url_len < root_url_len) {
return -EINVAL;
@@ -397,10 +397,10 @@
static struct http_root_url *http_url_find(struct http_server_ctx *http_ctx)
{
- uint16_t url_len = http_ctx->url_len;
+ u16_t url_len = http_ctx->url_len;
const char *url = http_ctx->url;
struct http_root_url *root_url;
- uint8_t i;
+ u8_t i;
int rc;
/* at some point we must come up with something better */
diff --git a/samples/net/http_server/src/http_server.h b/samples/net/http_server/src/http_server.h
index 3169fff..0a3711f 100644
--- a/samples/net/http_server/src/http_server.h
+++ b/samples/net/http_server/src/http_server.h
@@ -49,7 +49,7 @@
int http_url_default_handler(int (*write_cb)(struct http_server_ctx *));
-int http_url_add(const char *url, uint8_t flags,
+int http_url_add(const char *url, u8_t flags,
int (*write_cb)(struct http_server_ctx *http_ctx));
int http_auth(struct http_server_ctx *ctx);
diff --git a/samples/net/http_server/src/http_types.h b/samples/net/http_server/src/http_types.h
index 2bcc81a..86dc345 100644
--- a/samples/net/http_server/src/http_types.h
+++ b/samples/net/http_server/src/http_types.h
@@ -28,9 +28,9 @@
*/
struct http_root_url {
const char *root;
- uint16_t root_len;
+ u16_t root_len;
- uint8_t flags;
+ u8_t flags;
int (*write_cb)(struct http_server_ctx *http_ctx);
};
@@ -39,7 +39,7 @@
*/
struct http_url_ctx {
struct http_root_url urls[HTTP_MAX_NUMBER_URL];
- uint8_t urls_ctr;
+ u8_t urls_ctr;
};
#endif
diff --git a/samples/net/http_server/src/http_utils.c b/samples/net/http_server/src/http_utils.c
index 6db5b5f..6669f51 100644
--- a/samples/net/http_server/src/http_utils.c
+++ b/samples/net/http_server/src/http_utils.c
@@ -21,13 +21,13 @@
#ifdef CONFIG_NET_IPV6
struct sockaddr_in6 *addr = (struct sockaddr_in6 *)ip_addr;
void *raw = (void *)&addr->sin6_addr;
- uint16_t port = addr->sin6_port;
+ u16_t port = addr->sin6_port;
sa_family_t family = AF_INET6;
char str[STR_IP6_ADDR];
#else
struct sockaddr_in *addr = (struct sockaddr_in *)ip_addr;
void *raw = (void *)&addr->sin_addr;
- uint16_t port = addr->sin_port;
+ u16_t port = addr->sin_port;
sa_family_t family = AF_INET;
char str[STR_IP4_ADDR];
#endif
diff --git a/samples/net/http_server/src/http_write_utils.c b/samples/net/http_server/src/http_write_utils.c
index c94be49..a4e5ce6 100644
--- a/samples/net/http_server/src/http_write_utils.c
+++ b/samples/net/http_server/src/http_write_utils.c
@@ -29,10 +29,10 @@
/* Prints the received HTTP header fields as an HTML list */
static void print_http_headers(struct http_server_ctx *ctx,
- char *str, uint16_t size)
+ char *str, u16_t size)
{
struct http_parser *parser = &ctx->parser;
- uint16_t offset = 0;
+ u16_t offset = 0;
offset = snprintf(str, size,
HTML_HEADER
@@ -41,7 +41,7 @@
return;
}
- for (uint8_t i = 0; i < ctx->field_values_ctr; i++) {
+ for (u8_t i = 0; i < ctx->field_values_ctr; i++) {
struct http_field_value *kv = &ctx->field_values[i];
offset += snprintf(str + offset, size - offset,
diff --git a/samples/net/http_server/src/https_server.c b/samples/net/http_server/src/https_server.c
index 6173c7e..d2834db 100644
--- a/samples/net/http_server/src/https_server.c
+++ b/samples/net/http_server/src/https_server.c
@@ -68,7 +68,7 @@
struct parsed_url {
const char *url;
- uint16_t url_len;
+ u16_t url_len;
};
#define HTTP_RESPONSE \
@@ -102,7 +102,7 @@
static int entropy_source(void *data, unsigned char *output, size_t len,
size_t *olen)
{
- uint32_t seed;
+ u32_t seed;
ARG_UNUSED(data);
@@ -366,7 +366,7 @@
}
#define STACK_SIZE 8192
-uint8_t stack[STACK_SIZE];
+u8_t stack[STACK_SIZE];
static inline int init_app(void)
{
diff --git a/samples/net/http_server/src/main.c b/samples/net/http_server/src/main.c
index ec24e51..29f7433 100644
--- a/samples/net/http_server/src/main.c
+++ b/samples/net/http_server/src/main.c
@@ -23,7 +23,7 @@
/* Sets the network parameters */
static
int network_setup(struct net_context **net_ctx, net_tcp_accept_cb_t accept_cb,
- const char *addr, uint16_t port);
+ const char *addr, u16_t port);
#if defined(CONFIG_MBEDTLS)
#include "ssl_utils.h"
@@ -68,7 +68,7 @@
static
int network_setup(struct net_context **net_ctx, net_tcp_accept_cb_t accept_cb,
- const char *addr, uint16_t port)
+ const char *addr, u16_t port)
{
struct sockaddr local_sock;
void *ptr;
diff --git a/samples/net/http_server/src/ssl_utils.c b/samples/net/http_server/src/ssl_utils.c
index 73ac7fa..8dd1786 100644
--- a/samples/net/http_server/src/ssl_utils.c
+++ b/samples/net/http_server/src/ssl_utils.c
@@ -76,7 +76,7 @@
return MBEDTLS_ERR_SSL_ALLOC_FAILED;
}
- rc = net_pkt_append(send_buf, size, (uint8_t *) buf, K_FOREVER);
+ rc = net_pkt_append(send_buf, size, (u8_t *) buf, K_FOREVER);
if (!rc) {
net_pkt_unref(send_buf);
return MBEDTLS_ERR_SSL_INTERNAL_ERROR;
@@ -98,9 +98,9 @@
int ssl_rx(void *context, unsigned char *buf, size_t size)
{
struct ssl_context *ctx = context;
- uint16_t read_bytes;
+ u16_t read_bytes;
struct rx_fifo_block *rx_data;
- uint8_t *ptr;
+ u8_t *ptr;
int pos;
int len;
int rc = 0;
diff --git a/samples/net/irc_bot/src/irc-bot.c b/samples/net/irc_bot/src/irc-bot.c
index d8d75e8..b38920a 100644
--- a/samples/net/irc_bot/src/irc-bot.c
+++ b/samples/net/irc_bot/src/irc-bot.c
@@ -29,10 +29,10 @@
#endif
#define STACK_SIZE 2048
-uint8_t stack[STACK_SIZE];
+u8_t stack[STACK_SIZE];
#define CMD_BUFFER_SIZE 256
-static uint8_t cmd_buf[CMD_BUFFER_SIZE];
+static u8_t cmd_buf[CMD_BUFFER_SIZE];
/* LED */
#if defined(LED0_GPIO_PORT)
@@ -276,9 +276,9 @@
{
struct zirc *irc = data;
struct net_buf *tmp;
- uint8_t *end_of_line;
+ u8_t *end_of_line;
size_t len;
- uint16_t pos = 0, cmd_len = 0;
+ u16_t pos = 0, cmd_len = 0;
if (!pkt) {
/* TODO: notify of disconnection, maybe reconnect? */
@@ -678,7 +678,7 @@
on_cmd_random(struct zirc_chan *chan, const char *nick, const char *msg)
{
char buf[128];
- int32_t num = sys_rand32_get();
+ s32_t num = sys_rand32_get();
int ret;
switch (num & 3) {
@@ -714,7 +714,7 @@
static bool
read_led(void)
{
- uint32_t led = 0;
+ u32_t led = 0;
int r;
if (!led0) {
@@ -851,7 +851,7 @@
static struct k_sem dhcpv4_ok = K_SEM_INITIALIZER(dhcpv4_ok, 0, UINT_MAX);
static void ipv4_addr_add_handler(struct net_mgmt_event_callback *cb,
- uint32_t mgmt_event,
+ u32_t mgmt_event,
struct net_if *iface)
{
char hr_addr[NET_IPV4_ADDR_LEN];
@@ -948,7 +948,7 @@
static struct in6_addr laddr;
static void ipv6_dad_ok_handler(struct net_mgmt_event_callback *cb,
- uint32_t mgmt_event,
+ u32_t mgmt_event,
struct net_if *iface)
{
struct net_if_addr *ifaddr;
diff --git a/samples/net/leds_demo/src/leds-demo.c b/samples/net/leds_demo/src/leds-demo.c
index 60cb8d7..44251ac 100644
--- a/samples/net/leds_demo/src/leds-demo.c
+++ b/samples/net/leds_demo/src/leds-demo.c
@@ -66,7 +66,7 @@
static bool read_led(void)
{
- uint32_t led = 0;
+ u32_t led = 0;
int r;
if (!led0) {
@@ -99,8 +99,8 @@
struct net_buf *frag;
struct zoap_packet response;
const char *str;
- uint8_t *payload;
- uint16_t len, id;
+ u8_t *payload;
+ u16_t len, id;
int r;
id = zoap_header_get_id(request);
@@ -165,9 +165,9 @@
struct net_buf *frag;
struct zoap_packet response;
const char *str;
- uint8_t *payload;
- uint16_t len, id;
- uint32_t led;
+ u8_t *payload;
+ u16_t len, id;
+ u32_t led;
int r;
payload = zoap_packet_get_payload(request, &len);
@@ -244,9 +244,9 @@
struct net_buf *frag;
struct zoap_packet response;
const char *str;
- uint8_t *payload;
- uint16_t len, id;
- uint32_t led;
+ u8_t *payload;
+ u16_t len, id;
+ u32_t led;
int r;
payload = zoap_packet_get_payload(request, &len);
@@ -324,8 +324,8 @@
struct net_pkt *pkt;
struct net_buf *frag;
struct zoap_packet response;
- uint8_t *payload;
- uint16_t len, id;
+ u8_t *payload;
+ u16_t len, id;
int r;
id = zoap_header_get_id(request);
diff --git a/samples/net/mbedtls_dtlsclient/src/dtls_client.c b/samples/net/mbedtls_dtlsclient/src/dtls_client.c
index 5a7d2fd..60175e2 100644
--- a/samples/net/mbedtls_dtlsclient/src/dtls_client.c
+++ b/samples/net/mbedtls_dtlsclient/src/dtls_client.c
@@ -77,9 +77,9 @@
};
struct dtls_timing_context {
- uint32_t snapshot;
- uint32_t int_ms;
- uint32_t fin_ms;
+ u32_t snapshot;
+ u32_t int_ms;
+ u32_t fin_ms;
};
static void my_debug(void *ctx, int level,
@@ -97,7 +97,7 @@
mbedtls_printf("%s:%04d: |%d| %s", basename, line, level, str);
}
-void dtls_timing_set_delay(void *data, uint32_t int_ms, uint32_t fin_ms)
+void dtls_timing_set_delay(void *data, u32_t int_ms, u32_t fin_ms)
{
struct dtls_timing_context *ctx = (struct dtls_timing_context *)data;
@@ -131,7 +131,7 @@
static int entropy_source(void *data, unsigned char *output, size_t len,
size_t *olen)
{
- uint32_t seed;
+ u32_t seed;
seed = sys_rand32_get();
if (len > sizeof(seed)) {
@@ -284,7 +284,7 @@
}
#define STACK_SIZE 8192
-uint8_t stack[STACK_SIZE];
+u8_t stack[STACK_SIZE];
static inline int init_app(void)
{
diff --git a/samples/net/mbedtls_dtlsclient/src/udp.c b/samples/net/mbedtls_dtlsclient/src/udp.c
index f2ea5b4..f2b082a 100644
--- a/samples/net/mbedtls_dtlsclient/src/udp.c
+++ b/samples/net/mbedtls_dtlsclient/src/udp.c
@@ -86,7 +86,7 @@
return -EIO;
}
- rc = net_pkt_append(send_buf, size, (uint8_t *) buf, K_FOREVER);
+ rc = net_pkt_append(send_buf, size, (u8_t *) buf, K_FOREVER);
if (!rc) {
printk("cannot write buf\n");
net_pkt_unref(send_buf);
@@ -112,8 +112,8 @@
{
struct udp_context *ctx = context;
struct net_buf *rx_buf = NULL;
- uint16_t read_bytes;
- uint8_t *ptr;
+ u16_t read_bytes;
+ u8_t *ptr;
int pos;
int len;
int rc;
diff --git a/samples/net/mbedtls_dtlsserver/src/dtls_server.c b/samples/net/mbedtls_dtlsserver/src/dtls_server.c
index 0db4e57..97822a8 100644
--- a/samples/net/mbedtls_dtlsserver/src/dtls_server.c
+++ b/samples/net/mbedtls_dtlsserver/src/dtls_server.c
@@ -63,9 +63,9 @@
#endif
struct dtls_timing_context {
- uint32_t snapshot;
- uint32_t int_ms;
- uint32_t fin_ms;
+ u32_t snapshot;
+ u32_t int_ms;
+ u32_t fin_ms;
};
static void my_debug(void *ctx, int level,
@@ -86,7 +86,7 @@
mbedtls_printf("%s:%04d: |%d| %s", basename, line, level, str);
}
-void dtls_timing_set_delay(void *data, uint32_t int_ms, uint32_t fin_ms)
+void dtls_timing_set_delay(void *data, u32_t int_ms, u32_t fin_ms)
{
struct dtls_timing_context *ctx = (struct dtls_timing_context *)data;
@@ -123,7 +123,7 @@
static int entropy_source(void *data, unsigned char *output, size_t len,
size_t *olen)
{
- uint32_t seed;
+ u32_t seed;
ARG_UNUSED(data);
@@ -362,7 +362,7 @@
}
#define STACK_SIZE 8192
-uint8_t stack[STACK_SIZE];
+u8_t stack[STACK_SIZE];
static inline int init_app(void)
{
diff --git a/samples/net/mbedtls_dtlsserver/src/udp.c b/samples/net/mbedtls_dtlsserver/src/udp.c
index c3b755c..d8e1c0f 100644
--- a/samples/net/mbedtls_dtlsserver/src/udp.c
+++ b/samples/net/mbedtls_dtlsserver/src/udp.c
@@ -66,7 +66,7 @@
return -EIO;
}
- rc = net_pkt_append(send_buf, size, (uint8_t *) buf, K_FOREVER);
+ rc = net_pkt_append(send_buf, size, (u8_t *) buf, K_FOREVER);
if (!rc) {
printk("cannot write buf\n");
return -EIO;
@@ -91,8 +91,8 @@
struct udp_context *ctx = context;
struct net_context *net_ctx = ctx->net_ctx;
struct net_buf *rx_buf = NULL;
- uint16_t read_bytes;
- uint8_t *ptr;
+ u16_t read_bytes;
+ u8_t *ptr;
int pos;
int len;
int rc;
diff --git a/samples/net/mbedtls_sslclient/src/mini_client.c b/samples/net/mbedtls_sslclient/src/mini_client.c
index c1e8f99..806694d 100644
--- a/samples/net/mbedtls_sslclient/src/mini_client.c
+++ b/samples/net/mbedtls_sslclient/src/mini_client.c
@@ -139,7 +139,7 @@
static int entropy_source(void *data, unsigned char *output, size_t len,
size_t *olen)
{
- uint32_t seed;
+ u32_t seed;
ARG_UNUSED(data);
@@ -315,7 +315,7 @@
}
#define STACK_SIZE 8192
-uint8_t stack[STACK_SIZE];
+u8_t stack[STACK_SIZE];
void main(void)
{
diff --git a/samples/net/mbedtls_sslclient/src/tcp.c b/samples/net/mbedtls_sslclient/src/tcp.c
index e24acf5..e845b62 100644
--- a/samples/net/mbedtls_sslclient/src/tcp.c
+++ b/samples/net/mbedtls_sslclient/src/tcp.c
@@ -55,7 +55,7 @@
return -EIO;
}
- rc = net_pkt_append(send_pkt, size, (uint8_t *) buf, K_FOREVER);
+ rc = net_pkt_append(send_pkt, size, (u8_t *) buf, K_FOREVER);
if (!rc) {
printk("cannot write buf\n");
return -EIO;
@@ -79,9 +79,9 @@
struct net_buf *data = NULL;
struct tcp_context *ctx = context;
int rc;
- uint8_t *ptr;
+ u8_t *ptr;
int read_bytes;
- uint16_t offset;
+ u16_t offset;
rc = net_context_recv(ctx->net_ctx, tcp_received, K_FOREVER, ctx);
if (rc != 0) {
@@ -109,7 +109,7 @@
}
static int set_addr(struct sockaddr *sock_addr, const char *addr,
- uint16_t server_port)
+ u16_t server_port)
{
void *ptr = NULL;
int rc;
@@ -174,7 +174,7 @@
}
int tcp_init(struct tcp_context *ctx, const char *server_addr,
- uint16_t server_port)
+ u16_t server_port)
{
struct sockaddr server_sock;
int rc;
diff --git a/samples/net/mbedtls_sslclient/src/tcp.h b/samples/net/mbedtls_sslclient/src/tcp.h
index 0ff77e1..15996a6 100644
--- a/samples/net/mbedtls_sslclient/src/tcp.h
+++ b/samples/net/mbedtls_sslclient/src/tcp.h
@@ -15,11 +15,11 @@
struct net_context *net_ctx;
struct sockaddr local_sock;
struct net_pkt *rx_pkt;
- int32_t timeout;
+ s32_t timeout;
};
int tcp_init(struct tcp_context *ctx, const char *server_addr,
- uint16_t server_port);
+ u16_t server_port);
int tcp_tx(void *ctx, const unsigned char *buf, size_t size);
int tcp_rx(void *ctx, unsigned char *buf, size_t size);
diff --git a/samples/net/mqtt_publisher/src/main.c b/samples/net/mqtt_publisher/src/main.c
index f9f4876..f6c4274 100644
--- a/samples/net/mqtt_publisher/src/main.c
+++ b/samples/net/mqtt_publisher/src/main.c
@@ -67,7 +67,7 @@
/* This routine sets some basic properties for the network context variable */
static int network_setup(struct net_context **net_ctx, const char *local_addr,
- const char *server_addr, uint16_t server_port);
+ const char *server_addr, u16_t server_port);
/* The signature of this routine must match the connect callback declared at
* the mqtt.h header.
@@ -120,7 +120,7 @@
* unknown pkt_id, this routine must return an error, for example -EINVAL or
* any negative value.
*/
-static int publish_cb(struct mqtt_ctx *mqtt_ctx, uint16_t pkt_id,
+static int publish_cb(struct mqtt_ctx *mqtt_ctx, u16_t pkt_id,
enum mqtt_packet type)
{
struct mqtt_client_ctx *client_ctx;
@@ -160,7 +160,7 @@
* The signature of this routine must match the malformed callback declared at
* the mqtt.h header.
*/
-static void malformed_cb(struct mqtt_ctx *mqtt_ctx, uint16_t pkt_type)
+static void malformed_cb(struct mqtt_ctx *mqtt_ctx, u16_t pkt_type)
{
printk("[%s:%d] pkt_type: %u\n", __func__, __LINE__, pkt_type);
}
@@ -171,7 +171,7 @@
static char payload[30];
snprintk(payload, sizeof(payload), "{d:{temperature:%d}}",
- (uint8_t)sys_rand32_get());
+ (u8_t)sys_rand32_get());
#else
static char payload[] = "DOORS:OPEN_QoSx";
@@ -323,7 +323,7 @@
printk("\nBye!\n");
}
-static int set_addr(struct sockaddr *sock_addr, const char *addr, uint16_t port)
+static int set_addr(struct sockaddr *sock_addr, const char *addr, u16_t port)
{
void *ptr;
int rc;
@@ -351,13 +351,13 @@
static bool bt_connected;
static
-void bt_connect_cb(struct bt_conn *conn, uint8_t err)
+void bt_connect_cb(struct bt_conn *conn, u8_t err)
{
bt_connected = true;
}
static
-void bt_disconnect_cb(struct bt_conn *conn, uint8_t reason)
+void bt_disconnect_cb(struct bt_conn *conn, u8_t reason)
{
bt_connected = false;
printk("bt disconnected (reason %u)\n", reason);
@@ -371,7 +371,7 @@
#endif
static int network_setup(struct net_context **net_ctx, const char *local_addr,
- const char *server_addr, uint16_t server_port)
+ const char *server_addr, u16_t server_port)
{
#ifdef CONFIG_NET_IPV6
socklen_t addr_len = sizeof(struct sockaddr_in6);
diff --git a/samples/net/nats/src/main.c b/samples/net/nats/src/main.c
index 31f93ed..f917b61 100644
--- a/samples/net/nats/src/main.c
+++ b/samples/net/nats/src/main.c
@@ -70,7 +70,7 @@
/* Default server */
#define DEFAULT_PORT 4222
-static uint8_t stack[2048];
+static u8_t stack[2048];
static void panic(const char *msg)
{
@@ -172,7 +172,7 @@
static bool read_led(void)
{
- uint32_t led = 0;
+ u32_t led = 0;
int r;
if (!led0) {
@@ -241,7 +241,7 @@
}
}
-static int connect(struct nats *nats, uint16_t port)
+static int connect(struct nats *nats, u16_t port)
{
#if defined(CONFIG_NET_IPV4) && defined(CONFIG_NET_DHCPV4)
struct net_if *iface;
diff --git a/samples/net/nats/src/nats.c b/samples/net/nats/src/nats.c
index dbff8f2..720c467 100644
--- a/samples/net/nats/src/nats.c
+++ b/samples/net/nats/src/nats.c
@@ -30,7 +30,7 @@
const char *go;
const char *host;
size_t max_payload;
- uint16_t port;
+ u16_t port;
bool ssl_required;
bool auth_required;
};
@@ -132,7 +132,7 @@
.type = type_ \
}
static int handle_server_info(struct nats *nats, char *payload, size_t len,
- struct net_buf *buf, uint16_t offset)
+ struct net_buf *buf, u16_t offset)
{
static const struct json_obj_descr descr[] = {
FIELD(struct nats_info, server_id, JSON_TOK_STRING),
@@ -231,11 +231,11 @@
return NULL;
}
-static int copy_pkt_to_buf(struct net_buf *src, uint16_t offset,
+static int copy_pkt_to_buf(struct net_buf *src, u16_t offset,
char *dst, size_t dst_size, size_t n_bytes)
{
- uint16_t to_copy;
- uint16_t copied;
+ u16_t to_copy;
+ u16_t copied;
if (dst_size < n_bytes) {
return -ENOMEM;
@@ -264,7 +264,7 @@
}
static int handle_server_msg(struct nats *nats, char *payload, size_t len,
- struct net_buf *buf, uint16_t offset)
+ struct net_buf *buf, u16_t offset)
{
char *subject, *sid, *reply_to, *bytes, *end_ptr;
char prev_end = payload[len];
@@ -320,7 +320,7 @@
}
static int handle_server_ping(struct nats *nats, char *payload, size_t len,
- struct net_buf *buf, uint16_t offset)
+ struct net_buf *buf, u16_t offset)
{
static const char pong[] = "PONG\r\n";
@@ -328,7 +328,7 @@
}
static int ignore(struct nats *nats, char *payload, size_t len,
- struct net_buf *buf, uint16_t offset)
+ struct net_buf *buf, u16_t offset)
{
/* FIXME: Notify user of success/errors. This would require
* maintaining information of what was the last sent command in
@@ -345,13 +345,13 @@
.handle = handler_ \
}
static int handle_server_cmd(struct nats *nats, char *cmd, size_t len,
- struct net_buf *buf, uint16_t offset)
+ struct net_buf *buf, u16_t offset)
{
static const struct {
const char *op;
size_t len;
int (*handle)(struct nats *nats, char *payload, size_t len,
- struct net_buf *buf, uint16_t offset);
+ struct net_buf *buf, u16_t offset);
} cmds[] = {
CMD("INFO", handle_server_info),
CMD("MSG", handle_server_msg),
@@ -537,9 +537,9 @@
struct nats *nats = user_data;
char cmd_buf[CMD_BUF_LEN];
struct net_buf *tmp;
- uint16_t pos = 0, cmd_len = 0;
+ u16_t pos = 0, cmd_len = 0;
size_t len;
- uint8_t *end_of_line;
+ u8_t *end_of_line;
if (!pkt) {
/* FIXME: How to handle disconnection? */
@@ -558,9 +558,9 @@
while (tmp) {
len = tmp->len - pos;
- end_of_line = memchr((uint8_t *)tmp->data + pos, '\n', len);
+ end_of_line = memchr((u8_t *)tmp->data + pos, '\n', len);
if (end_of_line) {
- len = end_of_line - ((uint8_t *)tmp->data + pos);
+ len = end_of_line - ((u8_t *)tmp->data + pos);
}
if (cmd_len + len > sizeof(cmd_buf)) {
diff --git a/samples/net/telnet/src/telnet.c b/samples/net/telnet/src/telnet.c
index 31c1ca7..4a0b45e 100644
--- a/samples/net/telnet/src/telnet.c
+++ b/samples/net/telnet/src/telnet.c
@@ -26,7 +26,7 @@
static struct net_mgmt_event_callback mgmt_cb;
static void ipv4_addr_add_handler(struct net_mgmt_event_callback *cb,
- uint32_t mgmt_event,
+ u32_t mgmt_event,
struct net_if *iface)
{
char hr_addr[NET_IPV4_ADDR_LEN];
diff --git a/samples/net/wpan_serial/src/main.c b/samples/net/wpan_serial/src/main.c
index fdfab17..fff2172 100644
--- a/samples/net/wpan_serial/src/main.c
+++ b/samples/net/wpan_serial/src/main.c
@@ -50,25 +50,25 @@
static char __noinit __stack tx_stack[1024];
/* Buffer for SLIP encoded data for the worst case */
-static uint8_t slip_buf[1 + 2 * CONFIG_NET_BUF_DATA_SIZE];
+static u8_t slip_buf[1 + 2 * CONFIG_NET_BUF_DATA_SIZE];
/* ieee802.15.4 device */
static struct ieee802154_radio_api *radio_api;
static struct device *ieee802154_dev;
-uint8_t mac_addr[8];
+u8_t mac_addr[8];
/* UART device */
static struct device *uart_dev;
/* SLIP state machine */
-static uint8_t slip_state = STATE_OK;
+static u8_t slip_state = STATE_OK;
static struct net_pkt *pkt_curr;
/* General helpers */
#ifdef VERBOSE_DEBUG
-static void hexdump(const char *str, const uint8_t *packet, size_t length)
+static void hexdump(const char *str, const u8_t *packet, size_t length)
{
int n = 0;
@@ -216,7 +216,7 @@
}
/* Allocate and send data to USB Host */
-static void send_data(uint8_t *cfg, uint8_t *data, size_t len)
+static void send_data(u8_t *cfg, u8_t *data, size_t len)
{
struct net_pkt *pkt;
struct net_buf *buf;
@@ -253,8 +253,8 @@
static void get_ieee_addr(void)
{
- uint8_t cfg[2] = { '!', 'M' };
- uint8_t mac[8];
+ u8_t cfg[2] = { '!', 'M' };
+ u8_t mac[8];
SYS_LOG_DBG("");
@@ -266,7 +266,7 @@
static void process_request(struct net_buf *buf)
{
- uint8_t cmd = net_buf_pull_u8(buf);
+ u8_t cmd = net_buf_pull_u8(buf);
switch (cmd) {
@@ -279,10 +279,10 @@
}
}
-static void send_pkt_report(uint8_t seq, uint8_t status, uint8_t num_tx)
+static void send_pkt_report(u8_t seq, u8_t status, u8_t num_tx)
{
- uint8_t cfg[2] = { '!', 'R' };
- uint8_t report[3];
+ u8_t cfg[2] = { '!', 'R' };
+ u8_t report[3];
report[0] = seq;
report[1] = status;
@@ -294,7 +294,7 @@
static void process_data(struct net_pkt *pkt)
{
struct net_buf *buf = net_buf_frag_last(pkt->frags);
- uint8_t seq, num_attr;
+ u8_t seq, num_attr;
int ret, i;
seq = net_buf_pull_u8(buf);
@@ -327,7 +327,7 @@
send_pkt_report(seq, ret, 1);
}
-static void set_channel(uint8_t chan)
+static void set_channel(u8_t chan)
{
SYS_LOG_DBG("Set channel %c", chan);
@@ -337,7 +337,7 @@
static void process_config(struct net_pkt *pkt)
{
struct net_buf *buf = net_buf_frag_last(pkt->frags);
- uint8_t cmd = net_buf_pull_u8(buf);
+ u8_t cmd = net_buf_pull_u8(buf);
SYS_LOG_DBG("Process config %c", cmd);
@@ -360,7 +360,7 @@
while (1) {
struct net_pkt *pkt;
struct net_buf *buf;
- uint8_t specifier;
+ u8_t specifier;
pkt = k_fifo_get(&rx_queue, K_FOREVER);
buf = net_buf_frag_last(pkt->frags);
@@ -389,10 +389,10 @@
}
}
-static size_t slip_buffer(uint8_t *sbuf, struct net_buf *buf)
+static size_t slip_buffer(u8_t *sbuf, struct net_buf *buf)
{
size_t len = buf->len;
- uint8_t *sbuf_orig = sbuf;
+ u8_t *sbuf_orig = sbuf;
int i;
/**
@@ -401,7 +401,7 @@
*/
for (i = 0; i < len; i++) {
- uint8_t byte = net_buf_pull_u8(buf);
+ u8_t byte = net_buf_pull_u8(buf);
switch (byte) {
case SLIP_END:
@@ -486,9 +486,9 @@
/**
* FIXME choose correct OUI, or add support in L2
*/
-static uint8_t *get_mac(struct device *dev)
+static u8_t *get_mac(struct device *dev)
{
- uint32_t *ptr = (uint32_t *)mac_addr;
+ u32_t *ptr = (u32_t *)mac_addr;
mac_addr[7] = 0x00;
mac_addr[6] = 0x12;
@@ -504,7 +504,7 @@
static bool init_ieee802154(void)
{
- uint16_t short_addr;
+ u16_t short_addr;
SYS_LOG_INF("Initialize ieee802.15.4");
@@ -548,7 +548,7 @@
void main(void)
{
struct device *dev;
- uint32_t baudrate, dtr = 0;
+ u32_t baudrate, dtr = 0;
int ret;
dev = device_get_binding(CONFIG_CDC_ACM_PORT_NAME);
diff --git a/samples/net/wpanusb/src/wpanusb.c b/samples/net/wpanusb/src/wpanusb.c
index d258a1b..9ee8c50 100644
--- a/samples/net/wpanusb/src/wpanusb.c
+++ b/samples/net/wpanusb/src/wpanusb.c
@@ -84,14 +84,14 @@
struct wpanusb_dev_data_t {
/* USB device status code */
enum usb_dc_status_code usb_status;
- uint8_t interface_data[WPANUSB_CLASS_MAX_DATA_SIZE];
- uint8_t notification_sent;
+ u8_t interface_data[WPANUSB_CLASS_MAX_DATA_SIZE];
+ u8_t notification_sent;
};
/**
* ieee802.15.4 USB descriptors configuration
*/
-static const uint8_t wpanusb_desc[] = {
+static const u8_t wpanusb_desc[] = {
/* Device descriptor */
USB_DEVICE_DESC_SIZE, /* Descriptor size */
USB_DEVICE_DESC, /* Descriptor type */
@@ -176,7 +176,7 @@
#ifdef VERBOSE_DEBUG
/* TODO: move to standard utils */
-static void hexdump(const char *str, const uint8_t *packet, size_t length)
+static void hexdump(const char *str, const u8_t *packet, size_t length)
{
int n = 0;
@@ -211,7 +211,7 @@
#endif
/* EP Bulk IN handler, used to send data to the Host */
-static void wpanusb_bulk_in(uint8_t ep, enum usb_dc_ep_cb_status_code ep_status)
+static void wpanusb_bulk_in(u8_t ep, enum usb_dc_ep_cb_status_code ep_status)
{
}
@@ -261,7 +261,7 @@
}
static int wpanusb_class_handler(struct usb_setup_packet *setup,
- int32_t *len, uint8_t **data)
+ s32_t *len, u8_t **data)
{
SYS_LOG_DBG("len %d", *len);
@@ -271,7 +271,7 @@
}
static int wpanusb_custom_handler(struct usb_setup_packet *setup,
- int32_t *len, uint8_t **data)
+ s32_t *len, u8_t **data)
{
/**
* FIXME:
@@ -281,7 +281,7 @@
return -ENOTSUP;
}
-static int try_write(uint8_t ep, uint8_t *data, uint16_t len)
+static int try_write(u8_t ep, u8_t *data, u16_t len)
{
while (1) {
int ret = usb_write(ep, data, len, NULL);
@@ -314,7 +314,7 @@
SYS_LOG_DBG("len %u", len);
return radio_api->set_ieee_addr(ieee802154_dev,
- (uint8_t *)&req->ieee_addr);
+ (u8_t *)&req->ieee_addr);
}
static int set_short_addr(void *data, int len)
@@ -352,7 +352,7 @@
static int tx(struct net_pkt *pkt)
{
struct net_buf *buf = net_buf_frag_last(pkt->frags);
- uint8_t seq = net_buf_pull_u8(buf);
+ u8_t seq = net_buf_pull_u8(buf);
int retries = 3;
int ret;
@@ -378,7 +378,7 @@
* later processing
*/
static int wpanusb_vendor_handler(struct usb_setup_packet *setup,
- int32_t *len, uint8_t **data)
+ s32_t *len, u8_t **data)
{
struct net_pkt *pkt;
struct net_buf *buf;
@@ -417,7 +417,7 @@
SYS_LOG_DBG("Tx thread started");
while (1) {
- uint8_t cmd;
+ u8_t cmd;
struct net_pkt *pkt;
struct net_buf *buf;
@@ -464,7 +464,7 @@
}
/* TODO: FIXME: correct buffer size */
-static uint8_t buffer[300];
+static u8_t buffer[300];
static struct usb_cfg_data wpanusb_config = {
.usb_device_description = wpanusb_desc,
diff --git a/samples/net/wpanusb/src/wpanusb.h b/samples/net/wpanusb/src/wpanusb.h
index a0cd115..7eeeadc 100644
--- a/samples/net/wpanusb/src/wpanusb.h
+++ b/samples/net/wpanusb/src/wpanusb.h
@@ -23,18 +23,18 @@
};
struct set_channel {
- uint8_t page;
- uint8_t channel;
+ u8_t page;
+ u8_t channel;
} __packed;
struct set_short_addr {
- uint16_t short_addr;
+ u16_t short_addr;
} __packed;
struct set_pan_id {
- uint16_t pan_id;
+ u16_t pan_id;
} __packed;
struct set_ieee_addr {
- uint64_t ieee_addr;
+ u64_t ieee_addr;
} __packed;
diff --git a/samples/net/zoap_client/src/zoap-client.c b/samples/net/zoap_client/src/zoap-client.c
index b8d76a8..41adf31 100644
--- a/samples/net/zoap_client/src/zoap-client.c
+++ b/samples/net/zoap_client/src/zoap-client.c
@@ -46,7 +46,7 @@
static const char * const test_path[] = { "test", NULL };
-static void msg_dump(const char *s, uint8_t *data, unsigned len)
+static void msg_dump(const char *s, u8_t *data, unsigned len)
{
unsigned i;
@@ -134,7 +134,7 @@
}
static void event_iface_up(struct net_mgmt_event_callback *cb,
- uint32_t mgmt_event, struct net_if *iface)
+ u32_t mgmt_event, struct net_if *iface)
{
static struct sockaddr_in6 any_addr = { .sin6_addr = IN6ADDR_ANY_INIT,
.sin6_family = AF_INET6 };
@@ -145,7 +145,7 @@
struct net_pkt *pkt;
struct net_buf *frag;
int r;
- uint8_t observe = 0;
+ u8_t observe = 0;
r = net_context_get(PF_INET6, SOCK_DGRAM, IPPROTO_UDP, &context);
if (r) {
diff --git a/samples/net/zoap_server/src/zoap-server.c b/samples/net/zoap_server/src/zoap-server.c
index ce745df..c50b14b 100644
--- a/samples/net/zoap_server/src/zoap-server.c
+++ b/samples/net/zoap_server/src/zoap-server.c
@@ -52,7 +52,7 @@
static struct net_context *context;
-static const uint8_t plain_text_format;
+static const u8_t plain_text_format;
static struct zoap_observer observers[NUM_OBSERVERS];
@@ -75,9 +75,9 @@
struct net_pkt *pkt;
struct net_buf *frag;
struct zoap_packet response;
- uint8_t tkl, code, type;
- const uint8_t *token;
- uint16_t id;
+ u8_t tkl, code, type;
+ const u8_t *token;
+ u16_t id;
int r;
code = zoap_header_get_code(request);
@@ -123,9 +123,9 @@
struct net_pkt *pkt;
struct net_buf *frag;
struct zoap_packet response;
- uint8_t *payload, code, type, tkl;
- const uint8_t *token;
- uint16_t len, id;
+ u8_t *payload, code, type, tkl;
+ const u8_t *token;
+ u16_t len, id;
int r;
payload = zoap_packet_get_payload(request, &len);
@@ -181,9 +181,9 @@
struct net_pkt *pkt;
struct net_buf *frag;
struct zoap_packet response;
- uint8_t *payload, code, type, tkl;
- const uint8_t *token;
- uint16_t len, id;
+ u8_t *payload, code, type, tkl;
+ const u8_t *token;
+ u16_t len, id;
int r;
payload = zoap_packet_get_payload(request, &len);
@@ -244,9 +244,9 @@
struct net_pkt *pkt;
struct net_buf *frag;
struct zoap_packet response;
- uint8_t *payload, code, type, tkl;
- const uint8_t *token;
- uint16_t len, id;
+ u8_t *payload, code, type, tkl;
+ const u8_t *token;
+ u16_t len, id;
int r;
payload = zoap_packet_get_payload(request, &len);
@@ -303,10 +303,10 @@
struct net_pkt *pkt;
struct net_buf *frag;
struct zoap_packet response;
- const uint8_t *token;
- uint8_t *payload, code, type;
- uint16_t len, id;
- uint8_t tkl;
+ const u8_t *token;
+ u8_t *payload, code, type;
+ u16_t len, id;
+ u8_t tkl;
int r;
code = zoap_header_get_code(request);
@@ -377,9 +377,9 @@
struct net_pkt *pkt;
struct net_buf *frag;
struct zoap_packet response;
- uint8_t *payload, code, type, tkl;
- const uint8_t *token;
- uint16_t len, id;
+ u8_t *payload, code, type, tkl;
+ const u8_t *token;
+ u16_t len, id;
int i, r;
code = zoap_header_get_code(request);
@@ -466,9 +466,9 @@
struct net_buf *frag;
struct zoap_packet response;
struct zoap_pending *pending;
- uint8_t *payload, code, type, tkl;
- const uint8_t *token;
- uint16_t len, id;
+ u8_t *payload, code, type, tkl;
+ const u8_t *token;
+ u16_t len, id;
int r;
code = zoap_header_get_code(request);
@@ -583,10 +583,10 @@
struct net_pkt *pkt;
struct net_buf *frag;
struct zoap_packet response;
- const uint8_t *token;
- uint8_t *payload, code, type;
- uint16_t len, id, size;
- uint8_t tkl;
+ const u8_t *token;
+ u8_t *payload, code, type;
+ u16_t len, id, size;
+ u8_t tkl;
int r;
if (ctx.total_size == 0) {
@@ -673,10 +673,10 @@
struct net_pkt *pkt;
struct net_buf *frag;
struct zoap_packet response;
- const uint8_t *token;
- uint8_t *payload, code, type;
- uint16_t len, id;
- uint8_t tkl;
+ const u8_t *token;
+ u8_t *payload, code, type;
+ u16_t len, id;
+ u8_t tkl;
int r;
if (ctx.total_size == 0) {
@@ -753,10 +753,10 @@
struct net_pkt *pkt;
struct net_buf *frag;
struct zoap_packet response;
- const uint8_t *token;
- uint8_t *payload, code, type;
- uint16_t len, id;
- uint8_t tkl;
+ const u8_t *token;
+ u8_t *payload, code, type;
+ u16_t len, id;
+ u8_t tkl;
int r;
if (ctx.total_size == 0) {
@@ -827,17 +827,17 @@
k_delayed_work_submit(&observer_work, 5 * MSEC_PER_SEC);
}
-static int send_notification_packet(const struct sockaddr *addr, uint16_t age,
- socklen_t addrlen, uint16_t id,
- const uint8_t *token, uint8_t tkl,
+static int send_notification_packet(const struct sockaddr *addr, u16_t age,
+ socklen_t addrlen, u16_t id,
+ const u8_t *token, u8_t tkl,
bool is_response)
{
struct zoap_packet response;
struct zoap_pending *pending;
struct net_pkt *pkt;
struct net_buf *frag;
- uint8_t *payload, type = ZOAP_TYPE_CON;
- uint16_t len;
+ u8_t *payload, type = ZOAP_TYPE_CON;
+ u16_t len;
int r;
pkt = net_pkt_get_tx(context, K_FOREVER);
@@ -918,10 +918,10 @@
const struct sockaddr *from)
{
struct zoap_observer *observer;
- const uint8_t *token;
- uint8_t code, type;
- uint16_t id;
- uint8_t tkl;
+ const u8_t *token;
+ u8_t code, type;
+ u16_t id;
+ u8_t tkl;
bool observe = true;
if (!zoap_request_is_observe(request)) {
@@ -971,9 +971,9 @@
struct net_pkt *pkt;
struct net_buf *frag;
struct zoap_packet response;
- uint8_t *payload, tkl;
- const uint8_t *token;
- uint16_t len, id;
+ u8_t *payload, tkl;
+ const u8_t *token;
+ u16_t len, id;
int r;
id = zoap_header_get_id(request);
diff --git a/samples/net/zperf/src/shell_utils.c b/samples/net/zperf/src/shell_utils.c
index 12740c4..e46ab58 100644
--- a/samples/net/zperf/src/shell_utils.c
+++ b/samples/net/zperf/src/shell_utils.c
@@ -14,19 +14,19 @@
#include "shell_utils.h"
-const uint32_t TIME_US[] = { 60 * 1000 * 1000, 1000 * 1000, 1000, 0 };
+const u32_t TIME_US[] = { 60 * 1000 * 1000, 1000 * 1000, 1000, 0 };
const char *TIME_US_UNIT[] = { "m", "s", "ms", "us" };
-const uint32_t KBPS[] = { 1024, 0 };
+const u32_t KBPS[] = { 1024, 0 };
const char *KBPS_UNIT[] = { "Mbps", "Kbps" };
-const uint32_t K[] = { 1024 * 1024, 1024, 0 };
+const u32_t K[] = { 1024 * 1024, 1024, 0 };
const char *K_UNIT[] = { "M", "K", "" };
-void print_number(uint32_t value, const uint32_t *divisor,
+void print_number(u32_t value, const u32_t *divisor,
const char **units)
{
const char **unit;
- const uint32_t *div;
- uint32_t dec, radix;
+ const u32_t *div;
+ u32_t dec, radix;
unit = units;
div = divisor;
@@ -45,11 +45,11 @@
}
}
-long parse_number(const char *string, const uint32_t *divisor,
+long parse_number(const char *string, const u32_t *divisor,
const char **units)
{
const char **unit;
- const uint32_t *div;
+ const u32_t *div;
char *suffix;
long dec;
int cmp;
diff --git a/samples/net/zperf/src/shell_utils.h b/samples/net/zperf/src/shell_utils.h
index 6116c2b..ae283fd 100644
--- a/samples/net/zperf/src/shell_utils.h
+++ b/samples/net/zperf/src/shell_utils.h
@@ -9,15 +9,15 @@
#define IPV4_STR_LEN_MAX 15
#define IPV4_STR_LEN_MIN 7
-extern const uint32_t TIME_US[];
+extern const u32_t TIME_US[];
extern const char *TIME_US_UNIT[];
-extern const uint32_t KBPS[];
+extern const u32_t KBPS[];
extern const char *KBPS_UNIT[];
-extern const uint32_t K[];
+extern const u32_t K[];
extern const char *K_UNIT[];
-extern void print_number(uint32_t value, const uint32_t *divisor,
+extern void print_number(u32_t value, const u32_t *divisor,
const char **units);
-extern long parse_number(const char *string, const uint32_t *divisor,
+extern long parse_number(const char *string, const u32_t *divisor,
const char **units);
#endif /* __SHELL_UTILS_H */
diff --git a/samples/net/zperf/src/zperf.h b/samples/net/zperf/src/zperf.h
index 5630d92..dc7e203 100644
--- a/samples/net/zperf/src/zperf.h
+++ b/samples/net/zperf/src/zperf.h
@@ -20,16 +20,16 @@
#define CMD_STR_TCP_DOWNLOAD "tcp.download"
struct zperf_results {
- uint32_t nb_packets_sent;
- uint32_t nb_packets_rcvd;
- uint32_t nb_packets_lost;
- uint32_t nb_packets_outorder;
- uint32_t nb_bytes_sent;
- uint32_t time_in_us;
- uint32_t jitter_in_us;
- uint32_t client_time_in_us;
- uint32_t packet_size;
- uint32_t nb_packets_errors;
+ u32_t nb_packets_sent;
+ u32_t nb_packets_rcvd;
+ u32_t nb_packets_lost;
+ u32_t nb_packets_outorder;
+ u32_t nb_bytes_sent;
+ u32_t time_in_us;
+ u32_t jitter_in_us;
+ u32_t client_time_in_us;
+ u32_t packet_size;
+ u32_t nb_packets_errors;
};
typedef void (*zperf_callback)(int status, struct zperf_results *);
diff --git a/samples/net/zperf/src/zperf_internal.h b/samples/net/zperf/src/zperf_internal.h
index 136cce6..5e63af8 100644
--- a/samples/net/zperf/src/zperf_internal.h
+++ b/samples/net/zperf/src/zperf_internal.h
@@ -30,50 +30,50 @@
#define HW_CYCLES_TO_USEC(__hw_cycle__) \
( \
- ((uint64_t)(__hw_cycle__) * (uint64_t)sys_clock_us_per_tick) / \
- ((uint64_t)sys_clock_hw_cycles_per_tick) \
+ ((u64_t)(__hw_cycle__) * (u64_t)sys_clock_us_per_tick) / \
+ ((u64_t)sys_clock_hw_cycles_per_tick) \
)
#define HW_CYCLES_TO_SEC(__hw_cycle__) \
( \
- ((uint64_t)(HW_CYCLES_TO_USEC(__hw_cycle__))) / \
- ((uint64_t)USEC_PER_SEC) \
+ ((u64_t)(HW_CYCLES_TO_USEC(__hw_cycle__))) / \
+ ((u64_t)USEC_PER_SEC) \
)
#define USEC_TO_HW_CYCLES(__usec__) \
( \
- ((uint64_t)(__usec__) * (uint64_t)sys_clock_hw_cycles_per_tick) / \
- ((uint64_t)sys_clock_us_per_tick) \
+ ((u64_t)(__usec__) * (u64_t)sys_clock_hw_cycles_per_tick) / \
+ ((u64_t)sys_clock_us_per_tick) \
)
#define SEC_TO_HW_CYCLES(__sec__) \
- USEC_TO_HW_CYCLES((uint64_t)(__sec__) * \
- (uint64_t)USEC_PER_SEC)
+ USEC_TO_HW_CYCLES((u64_t)(__sec__) * \
+ (u64_t)USEC_PER_SEC)
#define MSEC_TO_HW_CYCLES(__msec__) \
- USEC_TO_HW_CYCLES((uint64_t)(__msec__) * \
- (uint64_t)MSEC_PER_SEC)
+ USEC_TO_HW_CYCLES((u64_t)(__msec__) * \
+ (u64_t)MSEC_PER_SEC)
struct zperf_udp_datagram {
- int32_t id;
- uint32_t tv_sec;
- uint32_t tv_usec;
+ s32_t id;
+ u32_t tv_sec;
+ u32_t tv_usec;
};
struct zperf_server_hdr {
- int32_t flags;
- int32_t total_len1;
- int32_t total_len2;
- int32_t stop_sec;
- int32_t stop_usec;
- int32_t error_cnt;
- int32_t outorder_cnt;
- int32_t datagrams;
- int32_t jitter1;
- int32_t jitter2;
+ s32_t flags;
+ s32_t total_len1;
+ s32_t total_len2;
+ s32_t stop_sec;
+ s32_t stop_usec;
+ s32_t error_cnt;
+ s32_t outorder_cnt;
+ s32_t datagrams;
+ s32_t jitter1;
+ s32_t jitter2;
};
-static inline uint32_t time_delta(uint32_t ts, uint32_t t)
+static inline u32_t time_delta(u32_t ts, u32_t t)
{
return (t >= ts) ? (t - ts) : (ULONG_MAX - ts + t);
}
diff --git a/samples/net/zperf/src/zperf_session.c b/samples/net/zperf/src/zperf_session.c
index 2d04b7f..a0a3715 100644
--- a/samples/net/zperf/src/zperf_session.c
+++ b/samples/net/zperf/src/zperf_session.c
@@ -22,7 +22,7 @@
struct in6_addr ipv6 = { };
struct in_addr ipv4 = { };
int i = 0;
- uint16_t port;
+ u16_t port;
if (!pkt) {
printk("Error! null pkt detected.\n");
diff --git a/samples/net/zperf/src/zperf_session.h b/samples/net/zperf/src/zperf_session.h
index c1a0f6f..26c81b7 100644
--- a/samples/net/zperf/src/zperf_session.h
+++ b/samples/net/zperf/src/zperf_session.h
@@ -35,22 +35,22 @@
struct session {
/* Tuple */
- uint16_t port;
+ u16_t port;
struct net_addr ip;
enum state state;
/* Stat data */
- uint32_t counter;
- uint32_t next_id;
- uint32_t outorder;
- uint32_t error;
- uint64_t length;
- uint32_t start_time;
- uint32_t last_time;
- int32_t jitter;
- int32_t last_transit_time;
+ u32_t counter;
+ u32_t next_id;
+ u32_t outorder;
+ u32_t error;
+ u64_t length;
+ u32_t start_time;
+ u32_t last_time;
+ s32_t jitter;
+ s32_t last_transit_time;
/* Stats packet*/
struct zperf_server_hdr stat;
diff --git a/samples/net/zperf/src/zperf_shell.c b/samples/net/zperf/src/zperf_shell.c
index 7d7d564..6c22f16 100644
--- a/samples/net/zperf/src/zperf_shell.c
+++ b/samples/net/zperf/src/zperf_shell.c
@@ -442,20 +442,20 @@
printk("[%s] Upload completed!\n", CMD_STR_UDP_UPLOAD);
if (results->time_in_us != 0) {
- rate_in_kbps = (uint32_t)
- (((uint64_t)results->nb_bytes_sent *
- (uint64_t)8 * (uint64_t)USEC_PER_SEC) /
- ((uint64_t)results->time_in_us * 1024));
+ rate_in_kbps = (u32_t)
+ (((u64_t)results->nb_bytes_sent *
+ (u64_t)8 * (u64_t)USEC_PER_SEC) /
+ ((u64_t)results->time_in_us * 1024));
} else {
rate_in_kbps = 0;
}
if (results->client_time_in_us != 0) {
- client_rate_in_kbps = (uint32_t)
- (((uint64_t)results->nb_packets_sent *
- (uint64_t)results->packet_size * (uint64_t)8 *
- (uint64_t)USEC_PER_SEC) /
- ((uint64_t)results->client_time_in_us * 1024));
+ client_rate_in_kbps = (u32_t)
+ (((u64_t)results->nb_packets_sent *
+ (u64_t)results->packet_size * (u64_t)8 *
+ (u64_t)USEC_PER_SEC) /
+ ((u64_t)results->client_time_in_us * 1024));
} else {
client_rate_in_kbps = 0;
}
@@ -501,11 +501,11 @@
printk("[%s] Upload completed!\n", CMD_STR_TCP_UPLOAD);
if (results->client_time_in_us != 0) {
- client_rate_in_kbps = (uint32_t)
- (((uint64_t)results->nb_packets_sent *
- (uint64_t)results->packet_size * (uint64_t)8 *
- (uint64_t)USEC_PER_SEC) /
- ((uint64_t)results->client_time_in_us * 1024));
+ client_rate_in_kbps = (u32_t)
+ (((u64_t)results->nb_packets_sent *
+ (u64_t)results->packet_size * (u64_t)8 *
+ (u64_t)USEC_PER_SEC) /
+ ((u64_t)results->client_time_in_us * 1024));
} else {
client_rate_in_kbps = 0;
}
@@ -741,7 +741,7 @@
struct net_context *context6 = NULL, *context4 = NULL;
sa_family_t family = AF_UNSPEC;
unsigned int duration_in_ms, packet_size, rate_in_kbps;
- uint16_t port;
+ u16_t port;
bool is_udp;
int start = 0;
@@ -857,10 +857,10 @@
static int shell_cmd_upload2(int argc, char *argv[])
{
struct net_context *context6 = NULL, *context4 = NULL;
- uint16_t port = DEF_PORT;
+ u16_t port = DEF_PORT;
unsigned int duration_in_ms, packet_size, rate_in_kbps;
sa_family_t family;
- uint8_t is_udp;
+ u8_t is_udp;
int start = 0;
if (!strcmp(argv[0], "zperf")) {
diff --git a/samples/net/zperf/src/zperf_tcp_receiver.c b/samples/net/zperf/src/zperf_tcp_receiver.c
index d22c6bc..0efca5d 100644
--- a/samples/net/zperf/src/zperf_tcp_receiver.c
+++ b/samples/net/zperf/src/zperf_tcp_receiver.c
@@ -43,7 +43,7 @@
void *user_data)
{
struct session *session;
- uint32_t time;
+ u32_t time;
if (!pkt) {
return;
@@ -73,19 +73,19 @@
}
if (!pkt && status == 0) { /* EOF */
- uint32_t rate_in_kbps;
- uint32_t duration = HW_CYCLES_TO_USEC(
+ u32_t rate_in_kbps;
+ u32_t duration = HW_CYCLES_TO_USEC(
time_delta(session->start_time, time));
session->state = STATE_COMPLETED;
/* Compute baud rate */
if (duration != 0) {
- rate_in_kbps = (uint32_t)
- (((uint64_t)session->length *
- (uint64_t)8 *
- (uint64_t)USEC_PER_SEC) /
- ((uint64_t)duration * 1024));
+ rate_in_kbps = (u32_t)
+ (((u64_t)session->length *
+ (u64_t)8 *
+ (u64_t)USEC_PER_SEC) /
+ ((u64_t)duration * 1024));
} else {
rate_in_kbps = 0;
}
diff --git a/samples/net/zperf/src/zperf_tcp_uploader.c b/samples/net/zperf/src/zperf_tcp_uploader.c
index 56d544e..c47a49f 100644
--- a/samples/net/zperf/src/zperf_tcp_uploader.c
+++ b/samples/net/zperf/src/zperf_tcp_uploader.c
@@ -25,10 +25,10 @@
unsigned int packet_size,
struct zperf_results *results)
{
- uint32_t duration = MSEC_TO_HW_CYCLES(duration_in_ms);
- uint32_t nb_packets = 0, nb_errors = 0;
- uint32_t start_time, last_print_time, last_loop_time, end_time;
- uint8_t time_elapsed = 0, finished = 0;
+ u32_t duration = MSEC_TO_HW_CYCLES(duration_in_ms);
+ u32_t nb_packets = 0, nb_errors = 0;
+ u32_t start_time, last_print_time, last_loop_time, end_time;
+ u8_t time_elapsed = 0, finished = 0;
if (packet_size > PACKET_SIZE_MAX) {
printk(TAG "WARNING! packet size too large! max size: %u\n",
@@ -48,7 +48,7 @@
int ret = 0;
struct net_pkt *pkt;
struct net_buf *frag;
- uint32_t loop_time;
+ u32_t loop_time;
bool st;
/* Timestamps */
diff --git a/samples/net/zperf/src/zperf_udp_receiver.c b/samples/net/zperf/src/zperf_udp_receiver.c
index 9da45a8..c470634 100644
--- a/samples/net/zperf/src/zperf_udp_receiver.c
+++ b/samples/net/zperf/src/zperf_udp_receiver.c
@@ -128,10 +128,10 @@
struct net_buf *frag = pkt->frags;
struct zperf_udp_datagram hdr;
struct session *session;
- uint16_t offset, pos;
- int32_t transit_time;
- uint32_t time;
- int32_t id;
+ u16_t offset, pos;
+ s32_t transit_time;
+ u32_t time;
+ s32_t id;
if (!pkt) {
return;
@@ -152,7 +152,7 @@
offset = net_pkt_appdata(pkt) - net_pkt_ip_data(pkt);
- frag = net_frag_read_be32(frag, offset, &pos, (uint32_t *)&hdr.id);
+ frag = net_frag_read_be32(frag, offset, &pos, (u32_t *)&hdr.id);
frag = net_frag_read_be32(frag, pos, &pos, &hdr.tv_sec);
frag = net_frag_read_be32(frag, pos, &pos, &hdr.tv_usec);
@@ -208,7 +208,7 @@
hdr.tv_sec * USEC_PER_SEC +
hdr.tv_usec);
if (session->last_transit_time != 0) {
- int32_t delta_transit = transit_time -
+ s32_t delta_transit = transit_time -
session->last_transit_time;
delta_transit =
@@ -221,8 +221,8 @@
/* If necessary send statistics */
if (session->state == STATE_LAST_PACKET_RECEIVED) {
- uint32_t rate_in_kbps;
- uint32_t duration = HW_CYCLES_TO_USEC(
+ u32_t rate_in_kbps;
+ u32_t duration = HW_CYCLES_TO_USEC(
time_delta(session->start_time, time));
/* Update state machine */
@@ -230,10 +230,10 @@
/* Compute baud rate */
if (duration != 0) {
- rate_in_kbps = (uint32_t)
- (((uint64_t)session->length * (uint64_t)8 *
- (uint64_t)USEC_PER_SEC) /
- ((uint64_t)duration * 1024));
+ rate_in_kbps = (u32_t)
+ (((u64_t)session->length * (u64_t)8 *
+ (u64_t)USEC_PER_SEC) /
+ ((u64_t)duration * 1024));
} else {
rate_in_kbps = 0;
diff --git a/samples/net/zperf/src/zperf_udp_uploader.c b/samples/net/zperf/src/zperf_udp_uploader.c
index 336a816..8740452 100644
--- a/samples/net/zperf/src/zperf_udp_uploader.c
+++ b/samples/net/zperf/src/zperf_udp_uploader.c
@@ -24,8 +24,8 @@
{
struct net_buf *frag = pkt->frags;
struct zperf_server_hdr hdr;
- uint16_t offset;
- uint16_t pos;
+ u16_t offset;
+ u16_t pos;
offset = net_pkt_udp_data(pkt) - net_pkt_ip_data(pkt);
offset += sizeof(struct net_udp_hdr) +
@@ -42,17 +42,17 @@
return;
}
- frag = net_frag_read_be32(frag, offset, &pos, (uint32_t *)&hdr.flags);
- frag = net_frag_read_be32(frag, pos, &pos, (uint32_t *)&hdr.total_len1);
- frag = net_frag_read_be32(frag, pos, &pos, (uint32_t *)&hdr.total_len2);
- frag = net_frag_read_be32(frag, pos, &pos, (uint32_t *)&hdr.stop_sec);
- frag = net_frag_read_be32(frag, pos, &pos, (uint32_t *)&hdr.stop_usec);
- frag = net_frag_read_be32(frag, pos, &pos, (uint32_t *)&hdr.error_cnt);
+ frag = net_frag_read_be32(frag, offset, &pos, (u32_t *)&hdr.flags);
+ frag = net_frag_read_be32(frag, pos, &pos, (u32_t *)&hdr.total_len1);
+ frag = net_frag_read_be32(frag, pos, &pos, (u32_t *)&hdr.total_len2);
+ frag = net_frag_read_be32(frag, pos, &pos, (u32_t *)&hdr.stop_sec);
+ frag = net_frag_read_be32(frag, pos, &pos, (u32_t *)&hdr.stop_usec);
+ frag = net_frag_read_be32(frag, pos, &pos, (u32_t *)&hdr.error_cnt);
frag = net_frag_read_be32(frag, pos, &pos,
- (uint32_t *)&hdr.outorder_cnt);
- frag = net_frag_read_be32(frag, pos, &pos, (uint32_t *)&hdr.datagrams);
- frag = net_frag_read_be32(frag, pos, &pos, (uint32_t *)&hdr.jitter1);
- frag = net_frag_read_be32(frag, pos, &pos, (uint32_t *)&hdr.jitter2);
+ (u32_t *)&hdr.outorder_cnt);
+ frag = net_frag_read_be32(frag, pos, &pos, (u32_t *)&hdr.datagrams);
+ frag = net_frag_read_be32(frag, pos, &pos, (u32_t *)&hdr.jitter1);
+ frag = net_frag_read_be32(frag, pos, &pos, (u32_t *)&hdr.jitter2);
results->nb_packets_rcvd = hdr.datagrams;
results->nb_packets_lost = hdr.error_cnt;
@@ -73,9 +73,9 @@
}
static inline void zperf_upload_fin(struct net_context *context,
- uint32_t nb_packets,
- uint32_t end_time,
- uint32_t packet_size,
+ u32_t nb_packets,
+ u32_t end_time,
+ u32_t packet_size,
struct zperf_results *results)
{
struct net_pkt *stat = NULL;
@@ -109,7 +109,7 @@
USEC_PER_SEC);
status = net_pkt_append(pkt, sizeof(datagram),
- (uint8_t *)&datagram, K_FOREVER);
+ (u8_t *)&datagram, K_FOREVER);
if (!status) {
printk(TAG "ERROR! Cannot append datagram data\n");
break;
@@ -119,12 +119,12 @@
if (packet_size > sizeof(struct zperf_udp_datagram)) {
int size = packet_size -
sizeof(struct zperf_udp_datagram);
- uint16_t pos;
+ u16_t pos;
frag = net_pkt_write(pkt, net_buf_frag_last(pkt->frags),
sizeof(struct zperf_udp_datagram),
&pos, size,
- (uint8_t *)sample_packet,
+ (u8_t *)sample_packet,
K_FOREVER);
}
@@ -178,14 +178,14 @@
unsigned int rate_in_kbps,
struct zperf_results *results)
{
- uint32_t packet_duration = (uint32_t)(((uint64_t) packet_size *
+ u32_t packet_duration = (u32_t)(((u64_t) packet_size *
SEC_TO_HW_CYCLES(1) * 8) /
- (uint64_t)(rate_in_kbps * 1024));
- uint32_t duration = MSEC_TO_HW_CYCLES(duration_in_ms);
- uint32_t print_interval = SEC_TO_HW_CYCLES(1);
- uint32_t delay = packet_duration;
- uint32_t nb_packets = 0;
- uint32_t start_time, last_print_time, last_loop_time, end_time;
+ (u64_t)(rate_in_kbps * 1024));
+ u32_t duration = MSEC_TO_HW_CYCLES(duration_in_ms);
+ u32_t print_interval = SEC_TO_HW_CYCLES(1);
+ u32_t delay = packet_duration;
+ u32_t nb_packets = 0;
+ u32_t start_time, last_print_time, last_loop_time, end_time;
if (packet_size > PACKET_SIZE_MAX) {
printk(TAG "WARNING! packet size too large! max size: %u\n",
@@ -208,8 +208,8 @@
struct zperf_udp_datagram datagram;
struct net_pkt *pkt;
struct net_buf *frag;
- uint32_t loop_time;
- int32_t adjust;
+ u32_t loop_time;
+ s32_t adjust;
bool status;
int ret;
@@ -255,7 +255,7 @@
htonl(HW_CYCLES_TO_USEC(loop_time) % USEC_PER_SEC);
status = net_pkt_append(pkt, sizeof(datagram),
- (uint8_t *)&datagram, K_FOREVER);
+ (u8_t *)&datagram, K_FOREVER);
if (!status) {
printk(TAG "ERROR! Cannot append datagram data\n");
break;
@@ -265,7 +265,7 @@
if (packet_size > sizeof(struct zperf_udp_datagram)) {
int size = packet_size -
sizeof(struct zperf_udp_datagram);
- uint16_t pos;
+ u16_t pos;
frag = net_pkt_write(pkt, net_buf_frag_last(pkt->frags),
sizeof(struct zperf_udp_datagram),
diff --git a/subsys/net/buf.c b/subsys/net/buf.c
index 8d17030..e4fab0f 100644
--- a/subsys/net/buf.c
+++ b/subsys/net/buf.c
@@ -48,11 +48,11 @@
#define BUF_SIZE(pool) (sizeof(struct net_buf) + \
ROUND_UP(pool->buf_size, 4) + \
ROUND_UP(pool->user_data_size, 4))
-#define UNINIT_BUF(pool, n) (struct net_buf *)(((uint8_t *)(pool->__bufs)) + \
+#define UNINIT_BUF(pool, n) (struct net_buf *)(((u8_t *)(pool->__bufs)) + \
((n) * BUF_SIZE(pool)))
static inline struct net_buf *pool_get_uninit(struct net_buf_pool *pool,
- uint16_t uninit_count)
+ u16_t uninit_count)
{
struct net_buf *buf;
@@ -74,10 +74,10 @@
}
#if defined(CONFIG_NET_BUF_LOG)
-struct net_buf *net_buf_alloc_debug(struct net_buf_pool *pool, int32_t timeout,
+struct net_buf *net_buf_alloc_debug(struct net_buf_pool *pool, s32_t timeout,
const char *func, int line)
#else
-struct net_buf *net_buf_alloc(struct net_buf_pool *pool, int32_t timeout)
+struct net_buf *net_buf_alloc(struct net_buf_pool *pool, s32_t timeout)
#endif
{
struct net_buf *buf;
@@ -96,7 +96,7 @@
* with the allocation one way or another.
*/
if (pool->uninit_count) {
- uint16_t uninit_count;
+ u16_t uninit_count;
/* If this is not the first access to the pool, we can
* be opportunistic and try to fetch a previously used
@@ -121,7 +121,7 @@
#if defined(CONFIG_NET_BUF_LOG) && SYS_LOG_LEVEL >= SYS_LOG_LEVEL_WARNING
if (timeout == K_FOREVER) {
- uint32_t ref = k_uptime_get_32();
+ u32_t ref = k_uptime_get_32();
buf = k_lifo_get(&pool->free, K_NO_WAIT);
while (!buf) {
#if defined(CONFIG_NET_BUF_POOL_USAGE)
@@ -170,10 +170,10 @@
}
#if defined(CONFIG_NET_BUF_LOG)
-struct net_buf *net_buf_get_debug(struct k_fifo *fifo, int32_t timeout,
+struct net_buf *net_buf_get_debug(struct k_fifo *fifo, s32_t timeout,
const char *func, int line)
#else
-struct net_buf *net_buf_get(struct k_fifo *fifo, int32_t timeout)
+struct net_buf *net_buf_get(struct k_fifo *fifo, s32_t timeout)
#endif
{
struct net_buf *buf, *frag;
@@ -277,7 +277,7 @@
return buf;
}
-struct net_buf *net_buf_clone(struct net_buf *buf, int32_t timeout)
+struct net_buf *net_buf_clone(struct net_buf *buf, s32_t timeout)
{
struct net_buf *clone;
@@ -379,7 +379,7 @@
void *net_buf_simple_add(struct net_buf_simple *buf, size_t len)
{
- uint8_t *tail = net_buf_simple_tail(buf);
+ u8_t *tail = net_buf_simple_tail(buf);
NET_BUF_SIMPLE_DBG("buf %p len %zu", buf, len);
@@ -397,9 +397,9 @@
return memcpy(net_buf_simple_add(buf, len), mem, len);
}
-uint8_t *net_buf_simple_add_u8(struct net_buf_simple *buf, uint8_t val)
+u8_t *net_buf_simple_add_u8(struct net_buf_simple *buf, u8_t val)
{
- uint8_t *u8;
+ u8_t *u8;
NET_BUF_SIMPLE_DBG("buf %p val 0x%02x", buf, val);
@@ -409,7 +409,7 @@
return u8;
}
-void net_buf_simple_add_le16(struct net_buf_simple *buf, uint16_t val)
+void net_buf_simple_add_le16(struct net_buf_simple *buf, u16_t val)
{
NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val);
@@ -417,7 +417,7 @@
memcpy(net_buf_simple_add(buf, sizeof(val)), &val, sizeof(val));
}
-void net_buf_simple_add_be16(struct net_buf_simple *buf, uint16_t val)
+void net_buf_simple_add_be16(struct net_buf_simple *buf, u16_t val)
{
NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val);
@@ -425,7 +425,7 @@
memcpy(net_buf_simple_add(buf, sizeof(val)), &val, sizeof(val));
}
-void net_buf_simple_add_le32(struct net_buf_simple *buf, uint32_t val)
+void net_buf_simple_add_le32(struct net_buf_simple *buf, u32_t val)
{
NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val);
@@ -433,7 +433,7 @@
memcpy(net_buf_simple_add(buf, sizeof(val)), &val, sizeof(val));
}
-void net_buf_simple_add_be32(struct net_buf_simple *buf, uint32_t val)
+void net_buf_simple_add_be32(struct net_buf_simple *buf, u32_t val)
{
NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val);
@@ -452,7 +452,7 @@
return buf->data;
}
-void net_buf_simple_push_le16(struct net_buf_simple *buf, uint16_t val)
+void net_buf_simple_push_le16(struct net_buf_simple *buf, u16_t val)
{
NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val);
@@ -460,7 +460,7 @@
memcpy(net_buf_simple_push(buf, sizeof(val)), &val, sizeof(val));
}
-void net_buf_simple_push_be16(struct net_buf_simple *buf, uint16_t val)
+void net_buf_simple_push_be16(struct net_buf_simple *buf, u16_t val)
{
NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val);
@@ -468,9 +468,9 @@
memcpy(net_buf_simple_push(buf, sizeof(val)), &val, sizeof(val));
}
-void net_buf_simple_push_u8(struct net_buf_simple *buf, uint8_t val)
+void net_buf_simple_push_u8(struct net_buf_simple *buf, u8_t val)
{
- uint8_t *data = net_buf_simple_push(buf, 1);
+ u8_t *data = net_buf_simple_push(buf, 1);
*data = val;
}
@@ -485,9 +485,9 @@
return buf->data += len;
}
-uint8_t net_buf_simple_pull_u8(struct net_buf_simple *buf)
+u8_t net_buf_simple_pull_u8(struct net_buf_simple *buf)
{
- uint8_t val;
+ u8_t val;
val = buf->data[0];
net_buf_simple_pull(buf, 1);
@@ -495,41 +495,41 @@
return val;
}
-uint16_t net_buf_simple_pull_le16(struct net_buf_simple *buf)
+u16_t net_buf_simple_pull_le16(struct net_buf_simple *buf)
{
- uint16_t val;
+ u16_t val;
- val = UNALIGNED_GET((uint16_t *)buf->data);
+ val = UNALIGNED_GET((u16_t *)buf->data);
net_buf_simple_pull(buf, sizeof(val));
return sys_le16_to_cpu(val);
}
-uint16_t net_buf_simple_pull_be16(struct net_buf_simple *buf)
+u16_t net_buf_simple_pull_be16(struct net_buf_simple *buf)
{
- uint16_t val;
+ u16_t val;
- val = UNALIGNED_GET((uint16_t *)buf->data);
+ val = UNALIGNED_GET((u16_t *)buf->data);
net_buf_simple_pull(buf, sizeof(val));
return sys_be16_to_cpu(val);
}
-uint32_t net_buf_simple_pull_le32(struct net_buf_simple *buf)
+u32_t net_buf_simple_pull_le32(struct net_buf_simple *buf)
{
- uint32_t val;
+ u32_t val;
- val = UNALIGNED_GET((uint32_t *)buf->data);
+ val = UNALIGNED_GET((u32_t *)buf->data);
net_buf_simple_pull(buf, sizeof(val));
return sys_le32_to_cpu(val);
}
-uint32_t net_buf_simple_pull_be32(struct net_buf_simple *buf)
+u32_t net_buf_simple_pull_be32(struct net_buf_simple *buf)
{
- uint32_t val;
+ u32_t val;
- val = UNALIGNED_GET((uint32_t *)buf->data);
+ val = UNALIGNED_GET((u32_t *)buf->data);
net_buf_simple_pull(buf, sizeof(val));
return sys_be32_to_cpu(val);
diff --git a/subsys/net/ip/6lo.c b/subsys/net/ip/6lo.c
index 732bb83..923c612 100644
--- a/subsys/net/ip/6lo.c
+++ b/subsys/net/ip/6lo.c
@@ -26,19 +26,19 @@
struct net_6lo_context {
struct in6_addr prefix;
struct net_if *iface;
- uint16_t lifetime;
- uint8_t is_used : 1;
- uint8_t compress : 1;
- uint8_t cid : 4;
- uint8_t unused : 2;
+ u16_t lifetime;
+ u8_t is_used : 1;
+ u8_t compress : 1;
+ u8_t cid : 4;
+ u8_t unused : 2;
} __packed;
-static inline uint8_t get_6co_compress(struct net_icmpv6_nd_opt_6co *opt)
+static inline u8_t get_6co_compress(struct net_icmpv6_nd_opt_6co *opt)
{
return (opt->flag & 0x10) >> 4;
}
-static inline uint8_t get_6co_cid(struct net_icmpv6_nd_opt_6co *opt)
+static inline u8_t get_6co_cid(struct net_icmpv6_nd_opt_6co *opt)
{
return opt->flag & 0x0F;
}
@@ -87,7 +87,7 @@
#if defined(CONFIG_NET_6LO_CONTEXT)
/* RFC 6775, 4.2, 5.4.2, 5.4.3 and 7.2*/
-static inline void set_6lo_context(struct net_if *iface, uint8_t index,
+static inline void set_6lo_context(struct net_if *iface, u8_t index,
struct net_icmpv6_nd_opt_6co *context)
{
@@ -106,7 +106,7 @@
struct net_icmpv6_nd_opt_6co *context)
{
int unused = -1;
- uint8_t i;
+ u8_t i;
/* If the context information already exists, update or remove
* as per data.
@@ -142,9 +142,9 @@
/* Get the context by matching cid */
static inline struct net_6lo_context *
-get_6lo_context_by_cid(struct net_if *iface, uint8_t cid)
+get_6lo_context_by_cid(struct net_if *iface, u8_t cid)
{
- uint8_t i;
+ u8_t i;
for (i = 0; i < CONFIG_NET_MAX_6LO_CONTEXTS; i++) {
if (!ctx_6co[i].is_used) {
@@ -163,7 +163,7 @@
static inline struct net_6lo_context *
get_6lo_context_by_addr(struct net_if *iface, struct in6_addr *addr)
{
- uint8_t i;
+ u8_t i;
for (i = 0; i < CONFIG_NET_MAX_6LO_CONTEXTS; i++) {
if (!ctx_6co[i].is_used) {
@@ -195,11 +195,11 @@
* IPv6 traffic class format is DSCP, ECN.
* DSCP(6), ECN(2).
*/
-static inline uint8_t compress_tfl(struct net_ipv6_hdr *ipv6,
+static inline u8_t compress_tfl(struct net_ipv6_hdr *ipv6,
struct net_buf *frag,
- uint8_t offset)
+ u8_t offset)
{
- uint8_t tcl;
+ u8_t tcl;
tcl = ((ipv6->vtc & 0x0F) << 4) | ((ipv6->tcflow & 0xF0) >> 4);
tcl = (tcl << 6) | (tcl >> 2); /* ECN(2), DSCP(6) */
@@ -246,9 +246,9 @@
}
/* Helper to compress Hop limit */
-static inline uint8_t compress_hoplimit(struct net_ipv6_hdr *ipv6,
+static inline u8_t compress_hoplimit(struct net_ipv6_hdr *ipv6,
struct net_buf *frag,
- uint8_t offset)
+ u8_t offset)
{
/* Hop Limit */
switch (ipv6->hop_limit) {
@@ -270,8 +270,8 @@
}
/* Helper to compress Next header */
-static inline uint8_t compress_nh(struct net_ipv6_hdr *ipv6,
- struct net_buf *frag, uint8_t offset)
+static inline u8_t compress_nh(struct net_ipv6_hdr *ipv6,
+ struct net_buf *frag, u8_t offset)
{
/* Next header */
if (ipv6->nexthdr == IPPROTO_UDP) {
@@ -284,10 +284,10 @@
}
/* Helpers to compress Source Address */
-static inline uint8_t compress_sa(struct net_ipv6_hdr *ipv6,
+static inline u8_t compress_sa(struct net_ipv6_hdr *ipv6,
struct net_pkt *pkt,
struct net_buf *frag,
- uint8_t offset)
+ u8_t offset)
{
if (net_is_ipv6_addr_unspecified(&ipv6->src)) {
NET_DBG("SAM_00, SAC_1 unspecified src address");
@@ -349,10 +349,10 @@
}
#if defined(CONFIG_NET_6LO_CONTEXT)
-static inline uint8_t compress_sa_ctx(struct net_ipv6_hdr *ipv6,
+static inline u8_t compress_sa_ctx(struct net_ipv6_hdr *ipv6,
struct net_pkt *pkt,
struct net_buf *frag,
- uint8_t offset,
+ u8_t offset,
struct net_6lo_context *src)
{
if (!src) {
@@ -390,10 +390,10 @@
#endif
/* Helpers to compress Destination Address */
-static inline uint8_t compress_da_mcast(struct net_ipv6_hdr *ipv6,
+static inline u8_t compress_da_mcast(struct net_ipv6_hdr *ipv6,
struct net_pkt *pkt,
struct net_buf *frag,
- uint8_t offset)
+ u8_t offset)
{
IPHC[1] |= NET_6LO_IPHC_M_1;
@@ -441,10 +441,10 @@
}
-static inline uint8_t compress_da(struct net_ipv6_hdr *ipv6,
+static inline u8_t compress_da(struct net_ipv6_hdr *ipv6,
struct net_pkt *pkt,
struct net_buf *frag,
- uint8_t offset)
+ u8_t offset)
{
/* If destination address is multicast */
if (net_is_ipv6_addr_mcast(&ipv6->dst)) {
@@ -499,10 +499,10 @@
}
#if defined(CONFIG_NET_6LO_CONTEXT)
-static inline uint8_t compress_da_ctx(struct net_ipv6_hdr *ipv6,
+static inline u8_t compress_da_ctx(struct net_ipv6_hdr *ipv6,
struct net_pkt *pkt,
struct net_buf *frag,
- uint8_t offset,
+ u8_t offset,
struct net_6lo_context *dst)
{
if (!dst) {
@@ -542,10 +542,10 @@
#endif
/* Helper to compress Next header UDP */
-static inline uint8_t compress_nh_udp(struct net_udp_hdr *udp,
- struct net_buf *frag, uint8_t offset)
+static inline u8_t compress_nh_udp(struct net_udp_hdr *udp,
+ struct net_buf *frag, u8_t offset)
{
- uint8_t tmp;
+ u8_t tmp;
/* 4.3.3 UDP LOWPAN_NHC Format
* 0 1 2 3 4 5 6 7
@@ -576,10 +576,10 @@
IPHC[offset] |= NET_6LO_NHC_UDP_PORT_11;
offset++;
- tmp = (uint8_t)(htons(udp->src_port));
+ tmp = (u8_t)(htons(udp->src_port));
tmp = tmp << 4;
- tmp |= (((uint8_t)(htons(udp->dst_port))) & 0x0F);
+ tmp |= (((u8_t)(htons(udp->dst_port))) & 0x0F);
IPHC[offset++] = tmp;
} else if (((htons(udp->dst_port) >> 8) & 0xFF) ==
NET_6LO_NHC_UDP_8_BIT_PORT) {
@@ -594,7 +594,7 @@
memcpy(&IPHC[offset], &udp->src_port, 2);
offset += 2;
- IPHC[offset++] = (uint8_t)(htons(udp->dst_port));
+ IPHC[offset++] = (u8_t)(htons(udp->dst_port));
} else if (((htons(udp->src_port) >> 8) & 0xFF) ==
NET_6LO_NHC_UDP_8_BIT_PORT) {
@@ -605,7 +605,7 @@
IPHC[offset] |= NET_6LO_NHC_UDP_PORT_10;
offset++;
- IPHC[offset++] = (uint8_t)(htons(udp->src_port));
+ IPHC[offset++] = (u8_t)(htons(udp->src_port));
memcpy(&IPHC[offset], &udp->dst_port, 2);
offset += 2;
@@ -683,10 +683,10 @@
struct net_6lo_context *dst = NULL;
#endif
struct net_ipv6_hdr *ipv6 = NET_IPV6_HDR(pkt);
- uint8_t offset = 0;
+ u8_t offset = 0;
struct net_udp_hdr *udp;
struct net_buf *frag;
- uint8_t compressed;
+ u8_t compressed;
if (pkt->frags->len < NET_IPV6H_LEN) {
NET_ERR("Invalid length %d, min %d",
@@ -783,11 +783,11 @@
}
/* Helper to uncompress Traffic class and Flow label */
-static inline uint8_t uncompress_tfl(struct net_pkt *pkt,
+static inline u8_t uncompress_tfl(struct net_pkt *pkt,
struct net_ipv6_hdr *ipv6,
- uint8_t offset)
+ u8_t offset)
{
- uint8_t tcl;
+ u8_t tcl;
/* Uncompress tcl and flow label */
switch (CIPHC[0] & NET_6LO_IPHC_TF_11) {
@@ -835,9 +835,9 @@
}
/* Helper to uncompress Hoplimit */
-static inline uint8_t uncompress_hoplimit(struct net_pkt *pkt,
+static inline u8_t uncompress_hoplimit(struct net_pkt *pkt,
struct net_ipv6_hdr *ipv6,
- uint8_t offset)
+ u8_t offset)
{
switch (CIPHC[0] & NET_6LO_IPHC_HLIM255) {
case NET_6LO_IPHC_HLIM:
@@ -858,9 +858,9 @@
}
/* Helper to uncompress Source Address */
-static inline uint8_t uncompress_sa(struct net_pkt *pkt,
+static inline u8_t uncompress_sa(struct net_pkt *pkt,
struct net_ipv6_hdr *ipv6,
- uint8_t offset)
+ u8_t offset)
{
if (CIPHC[1] & NET_6LO_IPHC_SAC_1) {
NET_DBG("SAC_1");
@@ -908,9 +908,9 @@
}
#if defined(CONFIG_NET_6LO_CONTEXT)
-static inline uint8_t uncompress_sa_ctx(struct net_pkt *pkt,
+static inline u8_t uncompress_sa_ctx(struct net_pkt *pkt,
struct net_ipv6_hdr *ipv6,
- uint8_t offset,
+ u8_t offset,
struct net_6lo_context *ctx)
{
if (!ctx) {
@@ -965,9 +965,9 @@
#endif
/* Helpers to uncompress Destination Address */
-static inline uint8_t uncompress_da_mcast(struct net_pkt *pkt,
+static inline u8_t uncompress_da_mcast(struct net_pkt *pkt,
struct net_ipv6_hdr *ipv6,
- uint8_t offset)
+ u8_t offset)
{
NET_DBG("Dst is multicast");
@@ -1023,9 +1023,9 @@
}
/* Helper to uncompress Destination Address */
-static inline uint8_t uncompress_da(struct net_pkt *pkt,
+static inline u8_t uncompress_da(struct net_pkt *pkt,
struct net_ipv6_hdr *ipv6,
- uint8_t offset)
+ u8_t offset)
{
if (CIPHC[1] & NET_6LO_IPHC_M_1) {
return uncompress_da_mcast(pkt, ipv6, offset);
@@ -1076,9 +1076,9 @@
}
#if defined(CONFIG_NET_6LO_CONTEXT)
-static inline uint8_t uncompress_da_ctx(struct net_pkt *pkt,
+static inline u8_t uncompress_da_ctx(struct net_pkt *pkt,
struct net_ipv6_hdr *ipv6,
- uint8_t offset,
+ u8_t offset,
struct net_6lo_context *ctx)
{
if (!ctx) {
@@ -1145,9 +1145,9 @@
#endif
/* Helper to uncompress NH UDP */
-static inline uint8_t uncompress_nh_udp(struct net_pkt *pkt,
+static inline u8_t uncompress_nh_udp(struct net_pkt *pkt,
struct net_udp_hdr *udp,
- uint8_t offset)
+ u8_t offset)
{
/* Port uncompression
* 00: All 16 bits for src and dst are inlined
@@ -1173,14 +1173,14 @@
memcpy(&udp->src_port, &CIPHC[offset], 2);
offset += 2;
- udp->dst_port = htons(((uint16_t)NET_6LO_NHC_UDP_8_BIT_PORT
+ udp->dst_port = htons(((u16_t)NET_6LO_NHC_UDP_8_BIT_PORT
<< 8) | CIPHC[offset]);
offset++;
break;
case NET_6LO_NHC_UDP_PORT_10:
NET_DBG("src 8 bits, dst full inlined");
- udp->src_port = htons(((uint16_t)NET_6LO_NHC_UDP_8_BIT_PORT
+ udp->src_port = htons(((u16_t)NET_6LO_NHC_UDP_8_BIT_PORT
<< 8) | CIPHC[offset]);
offset++;
@@ -1208,7 +1208,7 @@
struct net_6lo_context **src,
struct net_6lo_context **dst)
{
- uint8_t cid;
+ u8_t cid;
/* Extract source and destination Context Index,
* Either src or dest address is context based or both.
@@ -1241,11 +1241,11 @@
static inline bool uncompress_IPHC_header(struct net_pkt *pkt)
{
struct net_udp_hdr *udp = NULL;
- uint8_t offset = 2;
- uint8_t chksum = 0;
+ u8_t offset = 2;
+ u8_t chksum = 0;
struct net_ipv6_hdr *ipv6;
struct net_buf *frag;
- uint16_t len;
+ u16_t len;
#if defined(CONFIG_NET_6LO_CONTEXT)
struct net_6lo_context *src = NULL;
struct net_6lo_context *dst = NULL;
@@ -1362,7 +1362,7 @@
/* Set IPv6 header and UDP (if next header is) length */
len = net_pkt_get_len(pkt) - NET_IPV6H_LEN;
ipv6->len[0] = len >> 8;
- ipv6->len[1] = (uint8_t)len;
+ ipv6->len[1] = (u8_t)len;
if (ipv6->nexthdr == IPPROTO_UDP && udp) {
udp->len = htons(len);
diff --git a/subsys/net/ip/connection.c b/subsys/net/ip/connection.c
index 57f3307..8f9154f 100644
--- a/subsys/net/ip/connection.c
+++ b/subsys/net/ip/connection.c
@@ -68,12 +68,12 @@
* 31 protocol
*/
struct conn_hash {
- uint32_t value;
- int32_t idx;
+ u32_t value;
+ s32_t idx;
};
struct conn_hash_neg {
- uint32_t value;
+ u32_t value;
};
/** Connection cache */
@@ -87,8 +87,8 @@
#define TAKE_BIT(val, bit, max, used) \
(((val & BIT(bit)) >> bit) << (max - used))
-static inline uint8_t ports_to_hash(uint16_t remote_port,
- uint16_t local_port)
+static inline u8_t ports_to_hash(u16_t remote_port,
+ u16_t local_port)
{
/* Note that we do not convert port value to network byte order */
return (remote_port & BIT(0)) |
@@ -101,7 +101,7 @@
((local_port & BIT(15)) >> 12)) << 4);
}
-static inline uint16_t ipv6_to_hash(struct in6_addr *addr)
+static inline u16_t ipv6_to_hash(struct in6_addr *addr)
{
/* There is 11 bits available for IPv6 address */
/* Use more bits from the lower part of address space */
@@ -126,7 +126,7 @@
TAKE_BIT(UNALIGNED_GET(&addr->s6_addr32[3]), 0, 11, 11);
}
-static inline uint16_t ipv4_to_hash(struct in_addr *addr)
+static inline u16_t ipv4_to_hash(struct in_addr *addr)
{
/* There is 11 bits available for IPv4 address */
/* Use more bits from the lower part of address space */
@@ -147,16 +147,16 @@
/* Return either the first free position in the cache (idx < 0) or
* the existing cached position (idx >= 0)
*/
-static int32_t check_hash(enum net_ip_protocol proto,
+static s32_t check_hash(enum net_ip_protocol proto,
sa_family_t family,
void *remote_addr,
void *local_addr,
- uint16_t remote_port,
- uint16_t local_port,
- uint32_t *cache_value)
+ u16_t remote_port,
+ u16_t local_port,
+ u32_t *cache_value)
{
int i, free_pos = -1;
- uint32_t value = 0;
+ u32_t value = 0;
value = ports_to_hash(remote_port, local_port);
@@ -208,10 +208,10 @@
return -ENOENT;
}
-static inline int32_t get_conn(enum net_ip_protocol proto,
+static inline s32_t get_conn(enum net_ip_protocol proto,
sa_family_t family,
struct net_pkt *pkt,
- uint32_t *cache_value)
+ u32_t *cache_value)
{
#if defined(CONFIG_NET_IPV4)
if (family == AF_INET) {
@@ -238,7 +238,7 @@
return -1;
}
-static inline void cache_add_neg(uint32_t cache_value)
+static inline void cache_add_neg(u32_t cache_value)
{
int i;
@@ -254,7 +254,7 @@
}
}
-static inline bool cache_check_neg(uint32_t cache_value)
+static inline bool cache_check_neg(u32_t cache_value)
{
int i;
@@ -281,8 +281,8 @@
static inline enum net_verdict cache_check(enum net_ip_protocol proto,
struct net_pkt *pkt,
- uint32_t *cache_value,
- int32_t *pos)
+ u32_t *cache_value,
+ s32_t *pos)
{
*pos = get_conn(proto, net_pkt_family(pkt), pkt, cache_value);
if (*pos >= 0) {
@@ -415,14 +415,14 @@
int net_conn_register(enum net_ip_protocol proto,
const struct sockaddr *remote_addr,
const struct sockaddr *local_addr,
- uint16_t remote_port,
- uint16_t local_port,
+ u16_t remote_port,
+ u16_t local_port,
net_conn_cb_t cb,
void *user_data,
struct net_conn_handle **handle)
{
int i;
- uint8_t rank = 0;
+ u8_t rank = 0;
for (i = 0; i < CONFIG_NET_MAX_CONN; i++) {
if (conns[i].flags & NET_CONN_IN_USE) {
@@ -629,12 +629,12 @@
enum net_verdict net_conn_input(enum net_ip_protocol proto, struct net_pkt *pkt)
{
int i, best_match = -1;
- int16_t best_rank = -1;
+ s16_t best_rank = -1;
#if defined(CONFIG_NET_CONN_CACHE)
enum net_verdict verdict;
- uint32_t cache_value = 0;
- int32_t pos;
+ u32_t cache_value = 0;
+ s32_t pos;
verdict = cache_check(proto, pkt, &cache_value, &pos);
if (verdict != NET_CONTINUE) {
@@ -643,7 +643,7 @@
#endif
if (IS_ENABLED(CONFIG_NET_DEBUG_CONN)) {
- uint16_t chksum;
+ u16_t chksum;
if (proto == IPPROTO_TCP) {
chksum = NET_TCP_HDR(pkt)->chksum;
diff --git a/subsys/net/ip/connection.h b/subsys/net/ip/connection.h
index 4675b62..266b1dc 100644
--- a/subsys/net/ip/connection.h
+++ b/subsys/net/ip/connection.h
@@ -58,10 +58,10 @@
void *user_data;
/** Connection protocol */
- uint8_t proto;
+ u8_t proto;
/** Flags for the connection */
- uint8_t flags;
+ u8_t flags;
/** Rank of this connection. Higher rank means more specific
* connection.
@@ -73,7 +73,7 @@
* bit 4 local address, bit set if specific address
* bit 5 remote address, bit set if specific address
*/
- uint8_t rank;
+ u8_t rank;
};
/**
@@ -94,8 +94,8 @@
int net_conn_register(enum net_ip_protocol proto,
const struct sockaddr *remote_addr,
const struct sockaddr *local_addr,
- uint16_t remote_port,
- uint16_t local_port,
+ u16_t remote_port,
+ u16_t local_port,
net_conn_cb_t cb,
void *user_data,
struct net_conn_handle **handle);
diff --git a/subsys/net/ip/dhcpv4.c b/subsys/net/ip/dhcpv4.c
index ceaa40c..567b44d 100644
--- a/subsys/net/ip/dhcpv4.c
+++ b/subsys/net/ip/dhcpv4.c
@@ -27,24 +27,24 @@
#include <net/dhcpv4.h>
struct dhcp_msg {
- uint8_t op; /* Message type, 1:BOOTREQUEST, 2:BOOTREPLY */
- uint8_t htype; /* Hardware Address Type */
- uint8_t hlen; /* Hardware Address length */
- uint8_t hops; /* used by relay agents when booting via relay
+ u8_t op; /* Message type, 1:BOOTREQUEST, 2:BOOTREPLY */
+ u8_t htype; /* Hardware Address Type */
+ u8_t hlen; /* Hardware Address length */
+ u8_t hops; /* used by relay agents when booting via relay
* agent, client sets zero
*/
- uint32_t xid; /* Transaction ID, random number */
- uint16_t secs; /* Seconds elapsed since client began address
+ u32_t xid; /* Transaction ID, random number */
+ u16_t secs; /* Seconds elapsed since client began address
* acquisition or renewal process
*/
- uint16_t flags; /* Broadcast or Unicast */
- uint8_t ciaddr[4]; /* Client IP Address */
- uint8_t yiaddr[4]; /* your (client) IP address */
- uint8_t siaddr[4]; /* IP address of next server to use in bootstrap
+ u16_t flags; /* Broadcast or Unicast */
+ u8_t ciaddr[4]; /* Client IP Address */
+ u8_t yiaddr[4]; /* your (client) IP address */
+ u8_t siaddr[4]; /* IP address of next server to use in bootstrap
* returned in DHCPOFFER, DHCPACK by server
*/
- uint8_t giaddr[4]; /* Relat agent IP address */
- uint8_t chaddr[16]; /* Client hardware address */
+ u8_t giaddr[4]; /* Relat agent IP address */
+ u8_t chaddr[16]; /* Client hardware address */
} __packed;
#define SIZE_OF_SNAME 64
@@ -113,7 +113,7 @@
#define DHCPV4_INITIAL_DELAY_MAX 10
/* RFC 1497 [17] */
-static const uint8_t magic_cookie[4] = { 0x63, 0x82, 0x53, 0x63 };
+static const u8_t magic_cookie[4] = { 0x63, 0x82, 0x53, 0x63 };
static void dhcpv4_timeout(struct k_work *work);
@@ -162,8 +162,8 @@
}
/* Add a an option with the form OPTION LENGTH VALUE. */
-static bool add_option_length_value(struct net_pkt *pkt, uint8_t option,
- uint8_t size, const uint8_t *value)
+static bool add_option_length_value(struct net_pkt *pkt, u8_t option,
+ u8_t size, const u8_t *value)
{
if (!net_pkt_append_u8(pkt, option)) {
return false;
@@ -181,7 +181,7 @@
}
/* Add DHCPv4 message type */
-static bool add_msg_type(struct net_pkt *pkt, uint8_t type)
+static bool add_msg_type(struct net_pkt *pkt, u8_t type)
{
return add_option_length_value(pkt, DHCPV4_OPTIONS_MSG_TYPE, 1, &type);
}
@@ -191,7 +191,7 @@
*/
static bool add_req_options(struct net_pkt *pkt)
{
- static const uint8_t data[5] = { DHCPV4_OPTIONS_REQ_LIST,
+ static const u8_t data[5] = { DHCPV4_OPTIONS_REQ_LIST,
3, /* Length */
DHCPV4_OPTIONS_SUBNET_MASK,
DHCPV4_OPTIONS_ROUTER,
@@ -221,7 +221,7 @@
/* File is empty ATM */
static inline bool add_file(struct net_pkt *pkt)
{
- uint8_t len = SIZE_OF_FILE;
+ u8_t len = SIZE_OF_FILE;
while (len-- > 0) {
if (!net_pkt_append_u8(pkt, 0)) {
@@ -235,7 +235,7 @@
/* SNAME is empty ATM */
static inline bool add_sname(struct net_pkt *pkt)
{
- uint8_t len = SIZE_OF_SNAME;
+ u8_t len = SIZE_OF_SNAME;
while (len-- > 0) {
if (!net_pkt_append_u8(pkt, 0)) {
@@ -251,7 +251,7 @@
{
struct net_ipv4_hdr *ipv4;
struct net_udp_hdr *udp;
- uint16_t len;
+ u16_t len;
ipv4 = NET_IPV4_HDR(pkt);
udp = NET_UDP_HDR(pkt);
@@ -265,7 +265,7 @@
ipv4->ttl = 0xFF;
ipv4->proto = IPPROTO_UDP;
ipv4->len[0] = len >> 8;
- ipv4->len[1] = (uint8_t)len;
+ ipv4->len[1] = (u8_t)len;
ipv4->chksum = ~net_calc_chksum_ipv4(pkt);
net_ipaddr_copy(&ipv4->dst, server_addr);
@@ -280,7 +280,7 @@
}
/* Prepare initial DHCPv4 message and add options as per message type */
-static struct net_pkt *prepare_message(struct net_if *iface, uint8_t type,
+static struct net_pkt *prepare_message(struct net_if *iface, u8_t type,
const struct in_addr *ciaddr)
{
struct net_pkt *pkt;
@@ -346,7 +346,7 @@
static void send_request(struct net_if *iface)
{
struct net_pkt *pkt;
- uint32_t timeout;
+ u32_t timeout;
const struct in_addr *server_addr = net_ipv4_broadcast_address();
const struct in_addr *ciaddr = NULL;
bool with_server_id = false;
@@ -450,7 +450,7 @@
static void send_discover(struct net_if *iface)
{
struct net_pkt *pkt;
- uint32_t timeout;
+ u32_t timeout;
iface->dhcpv4.xid++;
@@ -576,8 +576,8 @@
static void enter_bound(struct net_if *iface)
{
- uint32_t renewal_time;
- uint32_t rebinding_time;
+ u32_t renewal_time;
+ u32_t rebinding_time;
k_delayed_work_cancel(&iface->dhcpv4.timer);
@@ -664,16 +664,16 @@
*/
static enum net_verdict parse_options(struct net_if *iface,
struct net_buf *frag,
- uint16_t offset,
+ u16_t offset,
enum dhcpv4_msg_type *msg_type)
{
- uint8_t cookie[4];
- uint8_t length;
- uint8_t type;
- uint16_t pos;
+ u8_t cookie[4];
+ u8_t length;
+ u8_t type;
+ u16_t pos;
frag = net_frag_read(frag, offset, &pos, sizeof(magic_cookie),
- (uint8_t *)cookie);
+ (u8_t *)cookie);
if (!frag || memcmp(magic_cookie, cookie, sizeof(magic_cookie))) {
NET_DBG("Incorrect magic cookie");
@@ -797,7 +797,7 @@
net_sprint_ipv4_addr(&iface->dhcpv4.server_id));
break;
case DHCPV4_OPTIONS_MSG_TYPE: {
- uint8_t v;
+ u8_t v;
if (length != 1) {
NET_DBG("options_msg_type, bad length");
@@ -925,8 +925,8 @@
struct net_buf *frag;
struct net_if *iface;
enum dhcpv4_msg_type msg_type = 0;
- uint8_t min;
- uint16_t pos;
+ u8_t min;
+ u16_t pos;
if (!conn) {
NET_DBG("Invalid connection");
@@ -1006,8 +1006,8 @@
void net_dhcpv4_start(struct net_if *iface)
{
- uint32_t timeout;
- uint32_t entropy;
+ u32_t timeout;
+ u32_t entropy;
switch (iface->dhcpv4.state) {
case NET_DHCPV4_DISABLED:
diff --git a/subsys/net/ip/icmpv4.c b/subsys/net/ip/icmpv4.c
index bc24fe6..487ffcb 100644
--- a/subsys/net/ip/icmpv4.c
+++ b/subsys/net/ip/icmpv4.c
@@ -71,9 +71,9 @@
#define NET_ICMPV4_UNUSED_LEN 4
-static inline void setup_ipv4_header(struct net_pkt *pkt, uint8_t extra_len,
- uint8_t ttl, uint8_t icmp_type,
- uint8_t icmp_code)
+static inline void setup_ipv4_header(struct net_pkt *pkt, u8_t extra_len,
+ u8_t ttl, u8_t icmp_type,
+ u8_t icmp_code)
{
NET_IPV4_HDR(pkt)->vhl = 0x45;
NET_IPV4_HDR(pkt)->tos = 0x00;
@@ -100,8 +100,8 @@
int net_icmpv4_send_echo_request(struct net_if *iface,
struct in_addr *dst,
- uint16_t identifier,
- uint16_t sequence)
+ u16_t identifier,
+ u16_t sequence)
{
const struct in_addr *src;
struct net_pkt *pkt;
@@ -164,7 +164,7 @@
return -EIO;
}
-int net_icmpv4_send_error(struct net_pkt *orig, uint8_t type, uint8_t code)
+int net_icmpv4_send_error(struct net_pkt *orig, u8_t type, u8_t code)
{
struct net_pkt *pkt;
struct net_buf *frag;
@@ -281,7 +281,7 @@
}
enum net_verdict net_icmpv4_input(struct net_pkt *pkt,
- uint8_t type, uint8_t code)
+ u8_t type, u8_t code)
{
struct net_icmpv4_handler *cb;
diff --git a/subsys/net/ip/icmpv4.h b/subsys/net/ip/icmpv4.h
index 37208dc..102df26 100644
--- a/subsys/net/ip/icmpv4.h
+++ b/subsys/net/ip/icmpv4.h
@@ -26,8 +26,8 @@
#define NET_ICMPV4_DST_UNREACH_NO_PORT 3 /* Port unreachable */
struct net_icmpv4_echo_req {
- uint16_t identifier;
- uint16_t sequence;
+ u16_t identifier;
+ u16_t sequence;
} __packed;
#define NET_ICMPV4_ECHO_REQ(pkt) \
@@ -38,8 +38,8 @@
struct net_icmpv4_handler {
sys_snode_t node;
- uint8_t type;
- uint8_t code;
+ u8_t type;
+ u8_t code;
icmpv4_callback_handler_t handler;
};
@@ -50,7 +50,7 @@
* @param code Code of the type of the error message.
* @return Return 0 if the sending succeed, <0 otherwise.
*/
-int net_icmpv4_send_error(struct net_pkt *pkt, uint8_t type, uint8_t code);
+int net_icmpv4_send_error(struct net_pkt *pkt, u8_t type, u8_t code);
/**
* @brief Send ICMPv4 echo request message.
@@ -66,15 +66,15 @@
*/
int net_icmpv4_send_echo_request(struct net_if *iface,
struct in_addr *dst,
- uint16_t identifier,
- uint16_t sequence);
+ u16_t identifier,
+ u16_t sequence);
void net_icmpv4_register_handler(struct net_icmpv4_handler *handler);
void net_icmpv4_unregister_handler(struct net_icmpv4_handler *handler);
enum net_verdict net_icmpv4_input(struct net_pkt *pkt,
- uint8_t type, uint8_t code);
+ u8_t type, u8_t code);
#if defined(CONFIG_NET_IPV4)
void net_icmpv4_init(void);
diff --git a/subsys/net/ip/icmpv6.c b/subsys/net/ip/icmpv6.c
index ba22e27..845c132 100644
--- a/subsys/net/ip/icmpv6.c
+++ b/subsys/net/ip/icmpv6.c
@@ -74,9 +74,9 @@
sys_slist_find_and_remove(&handlers, &handler->node);
}
-static inline void setup_ipv6_header(struct net_pkt *pkt, uint16_t extra_len,
- uint8_t hop_limit, uint8_t icmp_type,
- uint8_t icmp_code)
+static inline void setup_ipv6_header(struct net_pkt *pkt, u16_t extra_len,
+ u8_t hop_limit, u8_t icmp_type,
+ u8_t icmp_code)
{
NET_IPV6_HDR(pkt)->vtc = 0x60;
NET_IPV6_HDR(pkt)->tcflow = 0;
@@ -129,7 +129,7 @@
struct net_pkt *pkt;
struct net_buf *frag;
struct net_if *iface;
- uint16_t payload_len;
+ u16_t payload_len;
echo_request_debug(orig);
@@ -189,7 +189,7 @@
if (NET_IPV6_HDR(pkt)->nexthdr == NET_IPV6_NEXTHDR_HBHO) {
#if defined(CONFIG_NET_RPL)
- uint16_t offset = NET_IPV6H_LEN;
+ u16_t offset = NET_IPV6H_LEN;
if (net_rpl_revert_header(pkt, offset, &offset) < 0) {
/* TODO: Handle error cases */
@@ -229,8 +229,8 @@
return NET_DROP;
}
-int net_icmpv6_send_error(struct net_pkt *orig, uint8_t type, uint8_t code,
- uint32_t param)
+int net_icmpv6_send_error(struct net_pkt *orig, u8_t type, u8_t code,
+ u32_t param)
{
struct net_pkt *pkt;
struct net_buf *frag;
@@ -354,8 +354,8 @@
int net_icmpv6_send_echo_request(struct net_if *iface,
struct in6_addr *dst,
- uint16_t identifier,
- uint16_t sequence)
+ u16_t identifier,
+ u16_t sequence)
{
const struct in6_addr *src;
struct net_pkt *pkt;
@@ -411,7 +411,7 @@
}
enum net_verdict net_icmpv6_input(struct net_pkt *pkt,
- uint8_t type, uint8_t code)
+ u8_t type, u8_t code)
{
struct net_icmpv6_handler *cb;
diff --git a/subsys/net/ip/icmpv6.h b/subsys/net/ip/icmpv6.h
index 2e6c304..9e7659f 100644
--- a/subsys/net/ip/icmpv6.h
+++ b/subsys/net/ip/icmpv6.h
@@ -20,58 +20,58 @@
#include <net/net_pkt.h>
struct net_icmpv6_ns_hdr {
- uint32_t reserved;
+ u32_t reserved;
struct in6_addr tgt;
} __packed;
struct net_icmpv6_nd_opt_hdr {
- uint8_t type;
- uint8_t len;
+ u8_t type;
+ u8_t len;
} __packed;
struct net_icmpv6_na_hdr {
- uint8_t flags;
- uint8_t reserved[3];
+ u8_t flags;
+ u8_t reserved[3];
struct in6_addr tgt;
} __packed;
struct net_icmpv6_rs_hdr {
- uint32_t reserved;
+ u32_t reserved;
} __packed;
struct net_icmpv6_ra_hdr {
- uint8_t cur_hop_limit;
- uint8_t flags;
- uint16_t router_lifetime;
- uint32_t reachable_time;
- uint32_t retrans_timer;
+ u8_t cur_hop_limit;
+ u8_t flags;
+ u16_t router_lifetime;
+ u32_t reachable_time;
+ u32_t retrans_timer;
} __packed;
struct net_icmpv6_nd_opt_mtu {
- uint8_t type;
- uint8_t len;
- uint16_t reserved;
- uint32_t mtu;
+ u8_t type;
+ u8_t len;
+ u16_t reserved;
+ u32_t mtu;
} __packed;
struct net_icmpv6_nd_opt_prefix_info {
- uint8_t type;
- uint8_t len;
- uint8_t prefix_len;
- uint8_t flags;
- uint32_t valid_lifetime;
- uint32_t preferred_lifetime;
- uint32_t reserved;
+ u8_t type;
+ u8_t len;
+ u8_t prefix_len;
+ u8_t flags;
+ u32_t valid_lifetime;
+ u32_t preferred_lifetime;
+ u32_t reserved;
struct in6_addr prefix;
} __packed;
struct net_icmpv6_nd_opt_6co {
- uint8_t type;
- uint8_t len;
- uint8_t context_len;
- uint8_t flag; /*res:3,c:1,cid:4 */
- uint16_t reserved;
- uint16_t lifetime;
+ u8_t type;
+ u8_t len;
+ u8_t context_len;
+ u8_t flag; /*res:3,c:1,cid:4 */
+ u16_t reserved;
+ u16_t lifetime;
struct in6_addr prefix;
} __packed;
@@ -154,8 +154,8 @@
struct net_icmpv6_handler {
sys_snode_t node;
- uint8_t type;
- uint8_t code;
+ u8_t type;
+ u8_t code;
icmpv6_callback_handler_t handler;
};
@@ -169,8 +169,8 @@
* what value to use.
* @return Return 0 if the sending succeed, <0 otherwise.
*/
-int net_icmpv6_send_error(struct net_pkt *pkt, uint8_t type, uint8_t code,
- uint32_t param);
+int net_icmpv6_send_error(struct net_pkt *pkt, u8_t type, u8_t code,
+ u32_t param);
/**
* @brief Send ICMPv6 echo request message.
@@ -186,13 +186,13 @@
*/
int net_icmpv6_send_echo_request(struct net_if *iface,
struct in6_addr *dst,
- uint16_t identifier,
- uint16_t sequence);
+ u16_t identifier,
+ u16_t sequence);
void net_icmpv6_register_handler(struct net_icmpv6_handler *handler);
void net_icmpv6_unregister_handler(struct net_icmpv6_handler *handler);
enum net_verdict net_icmpv6_input(struct net_pkt *pkt,
- uint8_t type, uint8_t code);
+ u8_t type, u8_t code);
#if defined(CONFIG_NET_IPV6)
void net_icmpv6_init(void);
#else
diff --git a/subsys/net/ip/ipv4.c b/subsys/net/ip/ipv4.c
index 47f4cd8..2ca17a1 100644
--- a/subsys/net/ip/ipv4.c
+++ b/subsys/net/ip/ipv4.c
@@ -28,7 +28,7 @@
const struct in_addr *src,
const struct in_addr *dst,
struct net_if *iface,
- uint8_t next_header)
+ u8_t next_header)
{
struct net_buf *header;
@@ -80,7 +80,7 @@
net_context_get_ip_proto(context));
}
-int net_ipv4_finalize_raw(struct net_pkt *pkt, uint8_t next_header)
+int net_ipv4_finalize_raw(struct net_pkt *pkt, u8_t next_header)
{
/* Set the length of the IPv4 header */
size_t total_len;
diff --git a/subsys/net/ip/ipv4.h b/subsys/net/ip/ipv4.h
index ce298f5..615a069 100644
--- a/subsys/net/ip/ipv4.h
+++ b/subsys/net/ip/ipv4.h
@@ -37,7 +37,7 @@
const struct in_addr *src,
const struct in_addr *dst,
struct net_if *iface,
- uint8_t next_header);
+ u8_t next_header);
/**
* @brief Create IPv4 packet in provided net_pkt.
@@ -65,7 +65,7 @@
*
* @return Return 0 on Success, < 0 on Failure.
*/
-int net_ipv4_finalize_raw(struct net_pkt *pkt, uint8_t next_header);
+int net_ipv4_finalize_raw(struct net_pkt *pkt, u8_t next_header);
/**
* @brief Finalize IPv4 packet. It should be called right before
diff --git a/subsys/net/ip/ipv6.c b/subsys/net/ip/ipv6.c
index f66b27e..3c8eab0 100644
--- a/subsys/net/ip/ipv6.c
+++ b/subsys/net/ip/ipv6.c
@@ -118,7 +118,7 @@
for (i = 0; i < CONFIG_NET_IPV6_MAX_NEIGHBORS; i++) {
struct net_nbr *nbr = get_nbr(i);
- if (nbr->data == (uint8_t *)data) {
+ if (nbr->data == (u8_t *)data) {
return nbr;
}
}
@@ -194,7 +194,7 @@
return NULL;
}
-struct net_ipv6_nbr_data *net_ipv6_get_nbr_by_index(uint8_t idx)
+struct net_ipv6_nbr_data *net_ipv6_get_nbr_by_index(u8_t idx)
{
struct net_nbr *nbr = get_nbr(idx);
@@ -334,7 +334,7 @@
out);
}
-static inline void dbg_update_neighbor_lladdr_raw(uint8_t *new_lladdr,
+static inline void dbg_update_neighbor_lladdr_raw(u8_t *new_lladdr,
struct net_linkaddr_storage *old_lladdr,
struct in6_addr *addr)
{
@@ -471,7 +471,7 @@
}
struct in6_addr *net_ipv6_nbr_lookup_by_index(struct net_if *iface,
- uint8_t idx)
+ u8_t idx)
{
int i;
@@ -504,10 +504,10 @@
struct net_ipv6_hdr *hdr = NET_IPV6_HDR(pkt);
struct net_buf *frag = pkt->frags;
int pos = 6; /* Initial value if no extension fragments were found */
- uint16_t offset;
- uint8_t next_hdr;
- uint8_t length;
- uint8_t next;
+ u16_t offset;
+ u8_t next_hdr;
+ u8_t length;
+ u8_t next;
offset = sizeof(struct net_ipv6_hdr);
next = hdr->nexthdr;
@@ -573,7 +573,7 @@
const struct in6_addr *src,
const struct in6_addr *dst,
struct net_if *iface,
- uint8_t next_header)
+ u8_t next_header)
{
struct net_buf *header;
@@ -632,7 +632,7 @@
net_context_get_ip_proto(context));
}
-int net_ipv6_finalize_raw(struct net_pkt *pkt, uint8_t next_header)
+int net_ipv6_finalize_raw(struct net_pkt *pkt, u8_t next_header)
{
/* Set the length of the IPv6 header */
size_t total_len;
@@ -718,7 +718,7 @@
/* We need to go through all the fragments and adjust the
* fragment data size.
*/
- uint16_t reserve, room_len, copy_len, pos;
+ u16_t reserve, room_len, copy_len, pos;
struct net_buf *orig_frag, *frag;
/* No need to do anything if we are forwarding the packet
@@ -968,7 +968,7 @@
return nbr_lookup(&net_neighbor.table, iface, addr);
}
-struct net_nbr *net_ipv6_get_nbr(struct net_if *iface, uint8_t idx)
+struct net_nbr *net_ipv6_get_nbr(struct net_if *iface, u8_t idx)
{
int i;
@@ -993,7 +993,7 @@
return NULL;
}
-static inline uint8_t get_llao_len(struct net_if *iface)
+static inline u8_t get_llao_len(struct net_if *iface)
{
if (iface->link_addr.len == 6) {
return 8;
@@ -1009,7 +1009,7 @@
}
static inline void set_llao(struct net_linkaddr *lladdr,
- uint8_t *llao, uint8_t llao_len, uint8_t type)
+ u8_t *llao, u8_t llao_len, u8_t type)
{
llao[NET_ICMPV6_OPT_TYPE_OFFSET] = type;
llao[NET_ICMPV6_OPT_LEN_OFFSET] = llao_len >> 3;
@@ -1020,8 +1020,8 @@
llao_len - lladdr->len - 2);
}
-static void setup_headers(struct net_pkt *pkt, uint8_t nd6_len,
- uint8_t icmp_type)
+static void setup_headers(struct net_pkt *pkt, u8_t nd6_len,
+ u8_t icmp_type)
{
NET_IPV6_HDR(pkt)->vtc = 0x60;
NET_IPV6_HDR(pkt)->tcflow = 0;
@@ -1041,7 +1041,7 @@
{
struct net_linkaddr lladdr = {
.len = 8 * hdr->len - 2,
- .addr = (uint8_t *)hdr + 2,
+ .addr = (u8_t *)hdr + 2,
};
/**
@@ -1058,11 +1058,11 @@
int net_ipv6_send_na(struct net_if *iface, struct in6_addr *src,
struct in6_addr *dst, struct in6_addr *tgt,
- uint8_t flags)
+ u8_t flags)
{
struct net_pkt *pkt;
struct net_buf *frag;
- uint8_t llao_len;
+ u8_t llao_len;
pkt = net_pkt_get_reserve_tx(net_if_get_ll_reserve(iface, dst),
K_FOREVER);
@@ -1127,10 +1127,10 @@
static enum net_verdict handle_ns_input(struct net_pkt *pkt)
{
- uint16_t total_len = net_pkt_get_len(pkt);
+ u16_t total_len = net_pkt_get_len(pkt);
struct net_icmpv6_nd_opt_hdr *hdr;
struct net_if_addr *ifaddr;
- uint8_t flags = 0, prev_opt_len = 0;
+ u8_t flags = 0, prev_opt_len = 0;
int ret;
size_t left_len;
@@ -1161,7 +1161,7 @@
/* The parsing gets tricky if the ND struct is split
* between two fragments. FIXME later.
*/
- if (pkt->frags->len < ((uint8_t *)hdr - pkt->frags->data)) {
+ if (pkt->frags->len < ((u8_t *)hdr - pkt->frags->data)) {
NET_DBG("NS struct split between fragments");
goto drop;
}
@@ -1387,7 +1387,7 @@
void net_ipv6_nbr_set_reachable_timer(struct net_if *iface, struct net_nbr *nbr)
{
- uint32_t time;
+ u32_t time;
time = net_if_ipv6_get_reachable_time(iface);
@@ -1403,7 +1403,7 @@
#if defined(CONFIG_NET_IPV6_NBR_CACHE)
static inline bool handle_na_neighbor(struct net_pkt *pkt,
struct net_icmpv6_nd_opt_hdr *hdr,
- uint8_t *tllao)
+ u8_t *tllao)
{
bool lladdr_changed = false;
struct net_nbr *nbr;
@@ -1572,11 +1572,11 @@
static enum net_verdict handle_na_input(struct net_pkt *pkt)
{
- uint16_t total_len = net_pkt_get_len(pkt);
+ u16_t total_len = net_pkt_get_len(pkt);
struct net_icmpv6_nd_opt_hdr *hdr;
struct net_if_addr *ifaddr;
- uint8_t *tllao = NULL;
- uint8_t prev_opt_len = 0;
+ u8_t *tllao = NULL;
+ u8_t prev_opt_len = 0;
size_t left_len;
dbg_addr_recv_tgt("Neighbor Advertisement",
@@ -1604,7 +1604,7 @@
/* The parsing gets tricky if the ND struct is split
* between two fragments. FIXME later.
*/
- if (pkt->frags->len < ((uint8_t *)hdr - pkt->frags->data)) {
+ if (pkt->frags->len < ((u8_t *)hdr - pkt->frags->data)) {
NET_DBG("NA struct split between fragments");
goto drop;
}
@@ -1621,7 +1621,7 @@
switch (hdr->type) {
case NET_ICMPV6_ND_OPT_TLLAO:
- tllao = (uint8_t *)hdr;
+ tllao = (u8_t *)hdr;
break;
default:
@@ -1686,7 +1686,7 @@
struct net_pkt *pkt;
struct net_buf *frag;
struct net_nbr *nbr;
- uint8_t llao_len;
+ u8_t llao_len;
pkt = net_pkt_get_reserve_tx(net_if_get_ll_reserve(iface, dst),
K_FOREVER);
@@ -1828,7 +1828,7 @@
struct net_pkt *pkt;
struct net_buf *frag;
bool unspec_src;
- uint8_t llao_len = 0;
+ u8_t llao_len = 0;
pkt = net_pkt_get_reserve_tx(net_if_get_ll_reserve(iface, NULL),
K_FOREVER);
@@ -1903,14 +1903,14 @@
static inline struct net_buf *handle_ra_neighbor(struct net_pkt *pkt,
struct net_buf *frag,
- uint8_t len,
- uint16_t offset, uint16_t *pos,
+ u8_t len,
+ u16_t offset, u16_t *pos,
struct net_nbr **nbr)
{
struct net_linkaddr lladdr;
struct net_linkaddr_storage llstorage;
- uint8_t padding;
+ u8_t padding;
if (!nbr) {
return NULL;
@@ -2011,7 +2011,7 @@
#define TWO_HOURS (2 * 60 * 60)
-static inline uint32_t remaining(struct k_delayed_work *work)
+static inline u32_t remaining(struct k_delayed_work *work)
{
return k_delayed_work_remaining_get(work) / MSEC_PER_SEC;
}
@@ -2073,8 +2073,8 @@
static inline struct net_buf *handle_ra_prefix(struct net_pkt *pkt,
struct net_buf *frag,
- uint8_t len,
- uint16_t offset, uint16_t *pos)
+ u8_t len,
+ u16_t offset, u16_t *pos)
{
struct net_icmpv6_nd_opt_prefix_info prefix_info;
@@ -2115,8 +2115,8 @@
/* 6lowpan Context Option RFC 6775, 4.2 */
static inline struct net_buf *handle_ra_6co(struct net_pkt *pkt,
struct net_buf *frag,
- uint8_t len,
- uint16_t offset, uint16_t *pos)
+ u8_t len,
+ u16_t offset, u16_t *pos)
{
struct net_icmpv6_nd_opt_6co context;
@@ -2179,18 +2179,18 @@
static enum net_verdict handle_ra_input(struct net_pkt *pkt)
{
- uint16_t total_len = net_pkt_get_len(pkt);
+ u16_t total_len = net_pkt_get_len(pkt);
struct net_nbr *nbr = NULL;
struct net_if_router *router;
struct net_buf *frag;
- uint16_t router_lifetime;
- uint32_t reachable_time;
- uint32_t retrans_timer;
- uint8_t hop_limit;
- uint16_t offset;
- uint8_t length;
- uint8_t type;
- uint32_t mtu;
+ u16_t router_lifetime;
+ u32_t reachable_time;
+ u32_t retrans_timer;
+ u8_t hop_limit;
+ u16_t offset;
+ u8_t length;
+ u8_t type;
+ u32_t mtu;
dbg_addr_recv("Router Advertisement",
&NET_IPV6_HDR(pkt)->src,
@@ -2382,8 +2382,8 @@
static struct net_pkt *create_mldv2(struct net_pkt *pkt,
const struct in6_addr *addr,
- uint16_t record_type,
- uint8_t num_sources)
+ u16_t record_type,
+ u8_t num_sources)
{
net_pkt_append_u8(pkt, record_type);
net_pkt_append_u8(pkt, 0); /* aux data len */
@@ -2405,7 +2405,7 @@
{
struct net_pkt *pkt;
struct in6_addr dst;
- uint16_t pos;
+ u16_t pos;
int ret;
/* Sent to all MLDv2-capable routers */
@@ -2480,7 +2480,7 @@
}
static int send_mldv2(struct net_if *iface, const struct in6_addr *addr,
- uint8_t mode)
+ u8_t mode)
{
struct net_pkt *pkt;
int ret;
@@ -2570,7 +2570,7 @@
}
if (count > 0) {
- uint16_t pos;
+ u16_t pos;
/* Write back the record count */
net_pkt_write_u8(pkt, pkt->frags, 0, &pos, count);
@@ -2585,10 +2585,10 @@
static enum net_verdict handle_mld_query(struct net_pkt *pkt)
{
- uint16_t total_len = net_pkt_get_len(pkt);
+ u16_t total_len = net_pkt_get_len(pkt);
struct in6_addr mcast;
- uint16_t max_rsp_code, num_src, pkt_len;
- uint16_t offset, pos;
+ u16_t max_rsp_code, num_src, pkt_len;
+ u16_t offset, pos;
struct net_buf *frag;
dbg_addr_recv("Multicast Listener Query",
@@ -2687,7 +2687,7 @@
},
};
-static struct net_ipv6_reassembly *reassembly_get(uint32_t id,
+static struct net_ipv6_reassembly *reassembly_get(u32_t id,
struct in6_addr *src,
struct in6_addr *dst)
{
@@ -2726,14 +2726,14 @@
return &reassembly[avail];
}
-static bool reassembly_cancel(uint32_t id,
+static bool reassembly_cancel(u32_t id,
struct in6_addr *src,
struct in6_addr *dst)
{
int i, j;
for (i = 0; i < CONFIG_NET_IPV6_FRAGMENT_MAX_COUNT; i++) {
- int32_t remaining;
+ s32_t remaining;
if (!k_work_pending(&reassembly[i].timer.work) ||
reassembly[i].id != id ||
@@ -2801,9 +2801,9 @@
{
struct net_pkt *pkt;
struct net_buf *last;
- uint8_t next_hdr;
+ u8_t next_hdr;
int i, len;
- uint16_t pos;
+ u16_t pos;
k_delayed_work_cancel(&reass->timer);
@@ -2925,7 +2925,7 @@
*/
static bool fragment_verify(struct net_ipv6_reassembly *reass)
{
- uint16_t offset;
+ u16_t offset;
int i, prev_len;
prev_len = net_pkt_get_len(reass->pkt[0]);
@@ -2957,15 +2957,15 @@
static enum net_verdict handle_fragment_hdr(struct net_pkt *pkt,
struct net_buf *frag,
int total_len,
- uint16_t buf_offset)
+ u16_t buf_offset)
{
struct net_ipv6_reassembly *reass;
- uint32_t id;
- uint16_t loc;
- uint16_t offset;
- uint16_t flag;
- uint8_t nexthdr;
- uint8_t more;
+ u32_t id;
+ u16_t loc;
+ u16_t offset;
+ u16_t flag;
+ u8_t nexthdr;
+ u8_t more;
bool found;
int i;
@@ -3090,16 +3090,16 @@
struct net_buf *orig,
struct net_buf *prev,
struct net_buf *frag,
- uint16_t ipv6_len,
- uint16_t offset,
+ u16_t ipv6_len,
+ u16_t offset,
int len,
bool final)
{
struct net_pkt *ipv6;
struct net_buf *rest = NULL, *end = NULL, *orig_copy = NULL;
struct net_ipv6_frag_hdr hdr;
- uint16_t pos, ext_len;
- uint8_t prev_hdr;
+ u16_t pos, ext_len;
+ u8_t prev_hdr;
int ret;
/* Prepare the pkt so that the IPv6 packet will be sent properly
@@ -3196,7 +3196,7 @@
NET_IPV6_NEXTHDR_FRAG);
/* Then just add the fragmentation header. */
- ret = net_pkt_append(ipv6, sizeof(hdr), (uint8_t *)&hdr,
+ ret = net_pkt_append(ipv6, sizeof(hdr), (u8_t *)&hdr,
FRAG_BUF_WAIT);
if (!ret) {
ret = -ENOMEM;
@@ -3247,15 +3247,15 @@
}
int net_ipv6_send_fragmented_pkt(struct net_if *iface, struct net_pkt *pkt,
- uint16_t pkt_len)
+ u16_t pkt_len)
{
struct net_buf *frag = pkt->frags;
struct net_buf *prev = NULL;
struct net_buf *orig_ipv6, *rest;
int curr_len = 0;
int status = false;
- uint16_t ipv6_len = 0, offset = 0;
- uint32_t id = sys_rand32_get();
+ u16_t ipv6_len = 0, offset = 0;
+ u32_t id = sys_rand32_get();
int ret;
/* Split the first fragment that contains the IPv6 header into
@@ -3341,8 +3341,8 @@
}
static inline struct net_pkt *check_unknown_option(struct net_pkt *pkt,
- uint8_t opt_type,
- uint16_t length)
+ u8_t opt_type,
+ u16_t length)
{
/* RFC 2460 chapter 4.2 tells how to handle the unknown
* options by the two highest order bits of the option:
@@ -3373,7 +3373,7 @@
case 0x80:
net_icmpv6_send_error(pkt, NET_ICMPV6_PARAM_PROBLEM,
NET_ICMPV6_PARAM_PROB_OPTION,
- (uint32_t)length);
+ (u32_t)length);
return NULL;
}
@@ -3383,13 +3383,13 @@
static inline struct net_buf *handle_ext_hdr_options(struct net_pkt *pkt,
struct net_buf *frag,
int total_len,
- uint16_t len,
- uint16_t offset,
- uint16_t *pos,
+ u16_t len,
+ u16_t offset,
+ u16_t *pos,
enum net_verdict *verdict)
{
- uint8_t opt_type, opt_len;
- uint16_t length = 0, loc;
+ u8_t opt_type, opt_len;
+ u16_t length = 0, loc;
#if defined(CONFIG_NET_RPL)
bool result;
#endif
@@ -3479,7 +3479,7 @@
return NULL;
}
-static inline bool is_upper_layer_protocol_header(uint8_t proto)
+static inline bool is_upper_layer_protocol_header(u8_t proto)
{
return (proto == IPPROTO_ICMPV6 || proto == IPPROTO_UDP ||
proto == IPPROTO_TCP);
@@ -3491,11 +3491,11 @@
int real_len = net_pkt_get_len(pkt);
int pkt_len = (hdr->len[0] << 8) + hdr->len[1] + sizeof(*hdr);
struct net_buf *frag;
- uint8_t start_of_ext, prev_hdr;
- uint8_t next, next_hdr, length;
- uint8_t first_option;
- uint16_t offset, total_len = 0;
- uint8_t ext_bitmap;
+ u8_t start_of_ext, prev_hdr;
+ u8_t next, next_hdr, length;
+ u8_t first_option;
+ u16_t offset, total_len = 0;
+ u8_t ext_bitmap;
if (real_len != pkt_len) {
NET_DBG("IPv6 packet size %d pkt len %d", pkt_len, real_len);
diff --git a/subsys/net/ip/ipv6.h b/subsys/net/ip/ipv6.h
index 4a6079a..4e26d05 100644
--- a/subsys/net/ip/ipv6.h
+++ b/subsys/net/ip/ipv6.h
@@ -95,10 +95,10 @@
enum net_ipv6_nbr_state state;
/** Link metric for the neighbor */
- uint16_t link_metric;
+ u16_t link_metric;
/** How many times we have sent NS */
- uint8_t ns_count;
+ u8_t ns_count;
/** Is the neighbor a router */
bool is_router;
@@ -116,7 +116,7 @@
*
* @return Return IPv6 neighbor information.
*/
-struct net_ipv6_nbr_data *net_ipv6_get_nbr_by_index(uint8_t idx);
+struct net_ipv6_nbr_data *net_ipv6_get_nbr_by_index(u8_t idx);
#if defined(CONFIG_NET_IPV6_DAD)
int net_ipv6_start_dad(struct net_if *iface, struct net_if_addr *ifaddr);
@@ -131,7 +131,7 @@
int net_ipv6_send_na(struct net_if *iface, struct in6_addr *src,
struct in6_addr *dst, struct in6_addr *tgt,
- uint8_t flags);
+ u8_t flags);
/**
* @brief Create IPv6 packet in provided net_pkt.
@@ -148,7 +148,7 @@
const struct in6_addr *src,
const struct in6_addr *dst,
struct net_if *iface,
- uint8_t next_header);
+ u8_t next_header);
/**
* @brief Create IPv6 packet in provided net_pkt.
@@ -176,7 +176,7 @@
*
* @return Return 0 on Success, < 0 on Failure.
*/
-int net_ipv6_finalize_raw(struct net_pkt *pkt, uint8_t next_header);
+int net_ipv6_finalize_raw(struct net_pkt *pkt, u8_t next_header);
/**
* @brief Finalize IPv6 packet. It should be called right before
@@ -260,7 +260,7 @@
*
* @return A valid pointer on a neighbor on success, NULL otherwise
*/
-struct net_nbr *net_ipv6_get_nbr(struct net_if *iface, uint8_t idx);
+struct net_nbr *net_ipv6_get_nbr(struct net_if *iface, u8_t idx);
/**
* @brief Look for a neighbor from it's link local address index
@@ -272,7 +272,7 @@
* @return A valid pointer on a neighbor on success, NULL otherwise
*/
struct in6_addr *net_ipv6_nbr_lookup_by_index(struct net_if *iface,
- uint8_t idx);
+ u8_t idx);
/**
* @brief Add a neighbor to neighbor cache
@@ -327,7 +327,7 @@
static inline
struct in6_addr *net_ipv6_nbr_lookup_by_index(struct net_if *iface,
- uint8_t idx)
+ u8_t idx)
{
return NULL;
}
@@ -394,7 +394,7 @@
struct net_pkt *pkt[NET_IPV6_FRAGMENTS_MAX_PKT];
/** IPv6 fragment identification */
- uint32_t id;
+ u32_t id;
};
/**
diff --git a/subsys/net/ip/l2/arp.c b/subsys/net/ip/l2/arp.c
index 65c373e..940501d 100644
--- a/subsys/net/ip/l2/arp.c
+++ b/subsys/net/ip/l2/arp.c
@@ -22,7 +22,7 @@
#include "net_private.h"
struct arp_entry {
- uint32_t time; /* FIXME - implement timeout functionality */
+ u32_t time; /* FIXME - implement timeout functionality */
struct net_if *iface;
struct net_pkt *pending;
struct in_addr ip;
@@ -44,7 +44,7 @@
NET_DBG("[%d] iface %p dst %s ll %s pending %p", i, iface,
net_sprint_ipv4_addr(&arp_table[i].ip),
- net_sprint_ll_addr((uint8_t *)&arp_table[i].eth.addr,
+ net_sprint_ll_addr((u8_t *)&arp_table[i].eth.addr,
sizeof(struct net_eth_addr)),
arp_table[i].pending);
@@ -56,7 +56,7 @@
if (arp_table[i].pending) {
NET_DBG("ARP already pending to %s ll %s",
net_sprint_ipv4_addr(dst),
- net_sprint_ll_addr((uint8_t *)
+ net_sprint_ll_addr((u8_t *)
&arp_table[i].eth.addr,
sizeof(struct net_eth_addr)));
*free_entry = NULL;
@@ -337,7 +337,7 @@
NET_DBG("[%d] iface %p dst %s ll %s pending %p", i, iface,
net_sprint_ipv4_addr(&arp_table[i].ip),
- net_sprint_ll_addr((uint8_t *)&arp_table[i].eth.addr,
+ net_sprint_ll_addr((u8_t *)&arp_table[i].eth.addr,
sizeof(struct net_eth_addr)),
arp_table[i].pending);
@@ -357,7 +357,7 @@
net_pkt_ll_dst(arp_table[i].pending)->len =
sizeof(struct net_eth_addr);
net_pkt_ll_dst(arp_table[i].pending)->addr =
- (uint8_t *)
+ (u8_t *)
&NET_ETH_HDR(arp_table[i].pending)->dst.addr;
send_pending(iface, &arp_table[i].pending);
@@ -457,7 +457,7 @@
NET_DBG("ARP request from %s [%s] for %s",
out,
net_sprint_ll_addr(
- (uint8_t *)&arp_hdr->src_hwaddr,
+ (u8_t *)&arp_hdr->src_hwaddr,
arp_hdr->hwlen),
net_sprint_ipv4_addr(&arp_hdr->dst_ipaddr));
} while (0);
diff --git a/subsys/net/ip/l2/bluetooth.c b/subsys/net/ip/l2/bluetooth.c
index 083cb82..8e2714d 100644
--- a/subsys/net/ip/l2/bluetooth.c
+++ b/subsys/net/ip/l2/bluetooth.c
@@ -83,7 +83,7 @@
return NET_OK;
}
-static inline uint16_t net_bt_reserve(struct net_if *iface, void *unused)
+static inline u16_t net_bt_reserve(struct net_if *iface, void *unused)
{
ARG_UNUSED(iface);
ARG_UNUSED(unused);
@@ -280,7 +280,7 @@
#if defined(CONFIG_NET_L2_BLUETOOTH_MGMT)
-static int bt_connect(uint32_t mgmt_request, struct net_if *iface, void *data,
+static int bt_connect(u32_t mgmt_request, struct net_if *iface, void *data,
size_t len)
{
struct bt_context *ctxt = net_if_get_device(iface)->driver_data;
@@ -307,7 +307,7 @@
return 0;
}
-static bool eir_found(uint8_t type, const uint8_t *data, uint8_t data_len,
+static bool eir_found(u8_t type, const u8_t *data, u8_t data_len,
void *user_data)
{
int i;
@@ -319,13 +319,13 @@
return false;
}
- if (data_len % sizeof(uint16_t) != 0) {
+ if (data_len % sizeof(u16_t) != 0) {
NET_ERR("AD malformed\n");
return false;
}
- for (i = 0; i < data_len; i += sizeof(uint16_t)) {
- uint16_t u16;
+ for (i = 0; i < data_len; i += sizeof(u16_t)) {
+ u16_t u16;
memcpy(&u16, &data[i], sizeof(u16));
if (sys_le16_to_cpu(u16) != BT_UUID_IPSS_VAL) {
@@ -348,13 +348,13 @@
}
static bool ad_parse(struct net_buf_simple *ad,
- bool (*func)(uint8_t type, const uint8_t *data,
- uint8_t data_len, void *user_data),
+ bool (*func)(u8_t type, const u8_t *data,
+ u8_t data_len, void *user_data),
void *user_data)
{
while (ad->len > 1) {
- uint8_t len = net_buf_simple_pull_u8(ad);
- uint8_t type;
+ u8_t len = net_buf_simple_pull_u8(ad);
+ u8_t type;
/* Check for early termination */
if (len == 0) {
@@ -378,7 +378,7 @@
return false;
}
-static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type,
+static void device_found(const bt_addr_le_t *addr, s8_t rssi, u8_t type,
struct net_buf_simple *ad)
{
/* We're only interested in connectable events */
@@ -417,7 +417,7 @@
}
}
-static int bt_scan(uint32_t mgmt_request, struct net_if *iface, void *data,
+static int bt_scan(u32_t mgmt_request, struct net_if *iface, void *data,
size_t len)
{
if (!strcmp(data, "on") || !strcmp(data, "active")) {
@@ -433,7 +433,7 @@
return 0;
}
-static int bt_disconnect(uint32_t mgmt_request, struct net_if *iface,
+static int bt_disconnect(u32_t mgmt_request, struct net_if *iface,
void *data, size_t len)
{
struct bt_context *ctxt = net_if_get_device(iface)->driver_data;
@@ -452,7 +452,7 @@
return bt_l2cap_chan_disconnect(&ctxt->ipsp_chan.chan);
}
-static void connected(struct bt_conn *conn, uint8_t err)
+static void connected(struct bt_conn *conn, u8_t err)
{
if (err) {
#if defined(CONFIG_NET_DEBUG_L2_BLUETOOTH)
@@ -473,7 +473,7 @@
L2CAP_IPSP_PSM);
}
-static void disconnected(struct bt_conn *conn, uint8_t reason)
+static void disconnected(struct bt_conn *conn, u8_t reason)
{
#if defined(CONFIG_NET_DEBUG_L2_BLUETOOTH)
char addr[BT_ADDR_LE_STR_LEN];
diff --git a/subsys/net/ip/l2/bluetooth_shell.c b/subsys/net/ip/l2/bluetooth_shell.c
index df9debf..949684f 100644
--- a/subsys/net/ip/l2/bluetooth_shell.c
+++ b/subsys/net/ip/l2/bluetooth_shell.c
@@ -23,7 +23,7 @@
#define BT_SHELL_MODULE "net_bt"
-static int char2hex(const char *c, uint8_t *x)
+static int char2hex(const char *c, u8_t *x)
{
if (*c >= '0' && *c <= '9') {
*x = *c - '0';
@@ -41,7 +41,7 @@
static int str2bt_addr_le(const char *str, const char *type, bt_addr_le_t *addr)
{
int i, j;
- uint8_t tmp;
+ u8_t tmp;
if (strlen(str) != 17) {
return -EINVAL;
diff --git a/subsys/net/ip/l2/dummy.c b/subsys/net/ip/l2/dummy.c
index 6b488e1..2b1c1b6 100644
--- a/subsys/net/ip/l2/dummy.c
+++ b/subsys/net/ip/l2/dummy.c
@@ -30,7 +30,7 @@
return NET_OK;
}
-static inline uint16_t dummy_reserve(struct net_if *iface, void *unused)
+static inline u16_t dummy_reserve(struct net_if *iface, void *unused)
{
ARG_UNUSED(iface);
ARG_UNUSED(unused);
diff --git a/subsys/net/ip/l2/ethernet.c b/subsys/net/ip/l2/ethernet.c
index b60ee00..b255349 100644
--- a/subsys/net/ip/l2/ethernet.c
+++ b/subsys/net/ip/l2/ethernet.c
@@ -52,7 +52,7 @@
static inline void ethernet_update_length(struct net_if *iface,
struct net_pkt *pkt)
{
- uint16_t len;
+ u16_t len;
/* Let's check IP payload's length. If it's smaller than 46 bytes,
* i.e. smaller than minimal Ethernet frame size minus ethernet
@@ -137,7 +137,7 @@
#ifdef CONFIG_NET_ARP
if (family == AF_INET && hdr->type == htons(NET_ETH_PTYPE_ARP)) {
NET_DBG("ARP packet from %s received",
- net_sprint_ll_addr((uint8_t *)hdr->src.addr,
+ net_sprint_ll_addr((u8_t *)hdr->src.addr,
sizeof(struct net_eth_addr)));
return net_arp_input(pkt);
}
@@ -155,7 +155,7 @@
if (net_ipv4_addr_cmp(&NET_IPV4_HDR(pkt)->dst,
net_ipv4_broadcast_address())) {
/* Broadcast address */
- net_pkt_ll_dst(pkt)->addr = (uint8_t *)broadcast_eth_addr.addr;
+ net_pkt_ll_dst(pkt)->addr = (u8_t *)broadcast_eth_addr.addr;
net_pkt_ll_dst(pkt)->len = sizeof(struct net_eth_addr);
net_pkt_ll_src(pkt)->addr = net_if_get_link_addr(iface)->addr;
net_pkt_ll_src(pkt)->len = sizeof(struct net_eth_addr);
@@ -185,7 +185,7 @@
{
struct net_eth_hdr *hdr = NET_ETH_HDR(pkt);
struct net_buf *frag;
- uint16_t ptype;
+ u16_t ptype;
#ifdef CONFIG_NET_ARP
if (net_pkt_family(pkt) == AF_INET) {
@@ -205,9 +205,9 @@
pkt = arp_pkt;
- net_pkt_ll_src(pkt)->addr = (uint8_t *)&NET_ETH_HDR(pkt)->src;
+ net_pkt_ll_src(pkt)->addr = (u8_t *)&NET_ETH_HDR(pkt)->src;
net_pkt_ll_src(pkt)->len = sizeof(struct net_eth_addr);
- net_pkt_ll_dst(pkt)->addr = (uint8_t *)&NET_ETH_HDR(pkt)->dst;
+ net_pkt_ll_dst(pkt)->addr = (u8_t *)&NET_ETH_HDR(pkt)->dst;
net_pkt_ll_dst(pkt)->len = sizeof(struct net_eth_addr);
/* For ARP message, we do not touch the packet further but will
@@ -242,18 +242,18 @@
net_is_ipv6_addr_mcast(&NET_IPV6_HDR(pkt)->dst)) {
struct net_eth_addr *dst = &NET_ETH_HDR(pkt)->dst;
- memcpy(dst, (uint8_t *)multicast_eth_addr.addr,
+ memcpy(dst, (u8_t *)multicast_eth_addr.addr,
sizeof(struct net_eth_addr) - 4);
- memcpy((uint8_t *)dst + 2,
- (uint8_t *)(&NET_IPV6_HDR(pkt)->dst) + 12,
+ memcpy((u8_t *)dst + 2,
+ (u8_t *)(&NET_IPV6_HDR(pkt)->dst) + 12,
sizeof(struct net_eth_addr) - 2);
- net_pkt_ll_dst(pkt)->addr = (uint8_t *)dst->addr;
+ net_pkt_ll_dst(pkt)->addr = (u8_t *)dst->addr;
} else
#endif
{
net_pkt_ll_dst(pkt)->addr =
- (uint8_t *)broadcast_eth_addr.addr;
+ (u8_t *)broadcast_eth_addr.addr;
}
net_pkt_ll_dst(pkt)->len = sizeof(struct net_eth_addr);
@@ -302,7 +302,7 @@
return NET_OK;
}
-static inline uint16_t ethernet_reserve(struct net_if *iface, void *unused)
+static inline u16_t ethernet_reserve(struct net_if *iface, void *unused)
{
ARG_UNUSED(iface);
ARG_UNUSED(unused);
diff --git a/subsys/net/ip/l2/ieee802154/ieee802154.c b/subsys/net/ip/l2/ieee802154/ieee802154.c
index f59869b..eba480f 100644
--- a/subsys/net/ip/l2/ieee802154/ieee802154.c
+++ b/subsys/net/ip/l2/ieee802154/ieee802154.c
@@ -34,7 +34,7 @@
#include <misc/printk.h>
-static inline void hexdump(uint8_t *pkt, uint16_t length, uint8_t reserve)
+static inline void hexdump(u8_t *pkt, u16_t length, u8_t reserve)
{
int i;
@@ -65,7 +65,7 @@
static void pkt_hexdump(struct net_pkt *pkt, bool each_frag_reserve)
{
- uint16_t reserve = each_frag_reserve ? net_pkt_ll_reserve(pkt) : 0;
+ u16_t reserve = each_frag_reserve ? net_pkt_ll_reserve(pkt) : 0;
struct net_buf *frag;
printk("IEEE 802.15.4 packet content:\n");
@@ -151,8 +151,8 @@
struct net_pkt *pkt)
{
enum net_verdict verdict = NET_CONTINUE;
- uint32_t src;
- uint32_t dst;
+ u32_t src;
+ u32_t dst;
/* Upper IP stack expects the link layer address to be in
* big endian format so we must swap it here.
@@ -270,7 +270,7 @@
struct net_pkt *pkt)
{
struct ieee802154_context *ctx = net_if_l2_data(iface);
- uint8_t reserved_space = net_pkt_ll_reserve(pkt);
+ u8_t reserved_space = net_pkt_ll_reserve(pkt);
struct net_buf *frag;
if (net_pkt_family(pkt) != AF_INET6) {
@@ -304,7 +304,7 @@
return NET_OK;
}
-static uint16_t ieee802154_reserve(struct net_if *iface, void *data)
+static u16_t ieee802154_reserve(struct net_if *iface, void *data)
{
return ieee802154_compute_header_size(iface, (struct in6_addr *)data);
}
@@ -317,8 +317,8 @@
struct ieee802154_context *ctx = net_if_l2_data(iface);
const struct ieee802154_radio_api *radio =
iface->dev->driver_api;
- const uint8_t *mac = iface->link_addr.addr;
- uint8_t long_addr[8];
+ const u8_t *mac = iface->link_addr.addr;
+ u8_t long_addr[8];
NET_DBG("Initializing IEEE 802.15.4 stack on iface %p", iface);
diff --git a/subsys/net/ip/l2/ieee802154/ieee802154_fragment.c b/subsys/net/ip/l2/ieee802154/ieee802154_fragment.c
index 2d389a4..66eb3fa 100644
--- a/subsys/net/ip/l2/ieee802154/ieee802154_fragment.c
+++ b/subsys/net/ip/l2/ieee802154/ieee802154_fragment.c
@@ -29,7 +29,7 @@
CONFIG_NET_L2_IEEE802154_REASSEMBLY_TIMEOUT)
#define REASS_CACHE_SIZE CONFIG_NET_L2_IEEE802154_FRAGMENT_REASS_CACHE_SIZE
-static uint16_t datagram_tag;
+static u16_t datagram_tag;
/**
* Reassemble cache : Depends on cache size it used for reassemble
@@ -38,8 +38,8 @@
struct frag_cache {
struct k_delayed_work timer; /* Reassemble timer */
struct net_pkt *pkt; /* Reassemble packet */
- uint16_t size; /* Datagram size */
- uint16_t tag; /* Datagram tag */
+ u16_t size; /* Datagram size */
+ u16_t tag; /* Datagram tag */
bool used;
};
@@ -79,7 +79,7 @@
*/
static inline struct net_buf *prepare_new_fragment(struct net_pkt *pkt,
- uint8_t offset)
+ u8_t offset)
{
struct net_buf *frag;
@@ -100,22 +100,22 @@
return frag;
}
-static inline void set_datagram_size(uint8_t *ptr, uint16_t size)
+static inline void set_datagram_size(u8_t *ptr, u16_t size)
{
ptr[0] |= ((size & 0x7FF) >> 8);
- ptr[1] = (uint8_t) size;
+ ptr[1] = (u8_t) size;
}
-static inline void set_datagram_tag(uint8_t *ptr, uint16_t tag)
+static inline void set_datagram_tag(u8_t *ptr, u16_t tag)
{
ptr[0] = tag >> 8;
- ptr[1] = (uint8_t) tag;
+ ptr[1] = (u8_t) tag;
}
-static inline void set_up_frag_hdr(struct net_buf *frag, uint16_t size,
- uint8_t offset)
+static inline void set_up_frag_hdr(struct net_buf *frag, u16_t size,
+ u8_t offset)
{
- uint8_t pos = 0;
+ u8_t pos = 0;
if (offset) {
frag->data[pos] = NET_6LO_DISPATCH_FRAGN;
@@ -134,11 +134,11 @@
}
}
-static inline uint8_t calc_max_payload(struct net_pkt *pkt,
+static inline u8_t calc_max_payload(struct net_pkt *pkt,
struct net_buf *frag,
- uint8_t offset)
+ u8_t offset)
{
- uint8_t max;
+ u8_t max;
max = frag->size - net_pkt_ll_reserve(pkt);
max -= offset ? NET_6LO_FRAGN_HDR_LEN : NET_6LO_FRAG1_HDR_LEN;
@@ -146,16 +146,16 @@
return (max & 0xF8);
}
-static inline uint8_t move_frag_data(struct net_buf *frag,
+static inline u8_t move_frag_data(struct net_buf *frag,
struct net_buf *next,
- uint8_t max,
+ u8_t max,
bool first,
int hdr_diff,
- uint8_t *room_left)
+ u8_t *room_left)
{
- uint8_t room;
- uint8_t move;
- uint8_t occupied;
+ u8_t room;
+ u8_t move;
+ u8_t occupied;
/* First fragment */
if (first) {
@@ -184,9 +184,9 @@
return move;
}
-static inline void compact_frag(struct net_buf *frag, uint8_t moved)
+static inline void compact_frag(struct net_buf *frag, u8_t moved)
{
- uint8_t remaining = frag->len - moved;
+ u8_t remaining = frag->len - moved;
/* Move remaining data next to fragmentation header,
* (leave space for header).
@@ -225,12 +225,12 @@
{
struct net_buf *frag;
struct net_buf *next;
- uint16_t processed;
- uint16_t offset;
- uint16_t size;
- uint8_t room;
- uint8_t move;
- uint8_t max;
+ u16_t processed;
+ u16_t offset;
+ u16_t size;
+ u8_t room;
+ u8_t move;
+ u8_t max;
bool first;
if (!pkt || !pkt->frags) {
@@ -296,37 +296,37 @@
return true;
}
-static inline uint16_t get_datagram_size(uint8_t *ptr)
+static inline u16_t get_datagram_size(u8_t *ptr)
{
return ((ptr[0] & 0x1F) << 8) | ptr[1];
}
-static inline uint16_t get_datagram_tag(uint8_t *ptr)
+static inline u16_t get_datagram_tag(u8_t *ptr)
{
return (ptr[0] << 8) | ptr[1];
}
-static inline void remove_frag_header(struct net_buf *frag, uint8_t hdr_len)
+static inline void remove_frag_header(struct net_buf *frag, u8_t hdr_len)
{
memmove(frag->data, frag->data + hdr_len, frag->len - hdr_len);
frag->len -= hdr_len;
}
-static void update_protocol_header_lengths(struct net_pkt *pkt, uint16_t size)
+static void update_protocol_header_lengths(struct net_pkt *pkt, u16_t size)
{
net_pkt_set_ip_hdr_len(pkt, NET_IPV6H_LEN);
NET_IPV6_HDR(pkt)->len[0] = (size - NET_IPV6H_LEN) >> 8;
- NET_IPV6_HDR(pkt)->len[1] = (uint8_t) (size - NET_IPV6H_LEN);
+ NET_IPV6_HDR(pkt)->len[1] = (u8_t) (size - NET_IPV6H_LEN);
if (NET_IPV6_HDR(pkt)->nexthdr == IPPROTO_UDP) {
NET_UDP_HDR(pkt)->len = htons(size - NET_IPV6H_LEN);
}
}
-static inline void clear_reass_cache(uint16_t size, uint16_t tag)
+static inline void clear_reass_cache(u16_t size, u16_t tag)
{
- uint8_t i;
+ u8_t i;
for (i = 0; i < REASS_CACHE_SIZE; i++) {
if (!(cache[i].size == size && cache[i].tag == tag)) {
@@ -369,7 +369,7 @@
* discard the fragments.
*/
static inline struct frag_cache *set_reass_cache(struct net_pkt *pkt,
- uint16_t size, uint16_t tag)
+ u16_t size, u16_t tag)
{
int i;
@@ -395,9 +395,9 @@
* Return cache if it matches with size and tag of stored caches,
* otherwise return NULL.
*/
-static inline struct frag_cache *get_reass_cache(uint16_t size, uint16_t tag)
+static inline struct frag_cache *get_reass_cache(u16_t size, u16_t tag)
{
- uint8_t i;
+ u8_t i;
for (i = 0; i < REASS_CACHE_SIZE; i++) {
if (cache[i].used) {
@@ -414,11 +414,11 @@
/* Helper function to write fragment data to Rx packet based on offset. */
static inline bool copy_frag(struct net_pkt *pkt,
struct net_buf *frag,
- uint16_t offset)
+ u16_t offset)
{
struct net_buf *input = frag;
struct net_buf *write;
- uint16_t pos = offset;
+ u16_t pos = offset;
write = pkt->frags;
@@ -456,10 +456,10 @@
{
struct frag_cache *cache;
struct net_buf *frag;
- uint16_t size;
- uint16_t tag;
- uint16_t offset = 0;
- uint8_t pos = 0;
+ u16_t size;
+ u16_t tag;
+ u16_t offset = 0;
+ u8_t pos = 0;
/* Parse total size of packet */
size = get_datagram_size(pkt->frags->data);
@@ -470,7 +470,7 @@
pos += NET_6LO_FRAG_DATAGRAM_OFFSET_LEN;
if (!first) {
- offset = ((uint16_t)pkt->frags->data[pos]) << 3;
+ offset = ((u16_t)pkt->frags->data[pos]) << 3;
pos++;
}
diff --git a/subsys/net/ip/l2/ieee802154/ieee802154_frame.c b/subsys/net/ip/l2/ieee802154/ieee802154_frame.c
index 8f8e44a..00dec39 100644
--- a/subsys/net/ip/l2/ieee802154/ieee802154_frame.c
+++ b/subsys/net/ip/l2/ieee802154/ieee802154_frame.c
@@ -30,7 +30,7 @@
#include "ieee802154_security.h"
#ifdef CONFIG_NET_L2_IEEE802154_SECURITY
-const uint8_t level_2_tag_size[4] = {
+const u8_t level_2_tag_size[4] = {
0,
IEEE8021254_AUTH_TAG_LENGTH_32,
IEEE8021254_AUTH_TAG_LENGTH_64,
@@ -39,7 +39,7 @@
#endif
static inline struct ieee802154_fcf_seq *
-validate_fc_seq(uint8_t *buf, uint8_t **p_buf)
+validate_fc_seq(u8_t *buf, u8_t **p_buf)
{
struct ieee802154_fcf_seq *fs = (struct ieee802154_fcf_seq *)buf;
@@ -87,7 +87,7 @@
}
static inline struct ieee802154_address_field *
-validate_addr(uint8_t *buf, uint8_t **p_buf,
+validate_addr(u8_t *buf, u8_t **p_buf,
enum ieee802154_addressing_mode mode,
bool pan_id_compression)
{
@@ -116,7 +116,7 @@
#ifdef CONFIG_NET_L2_IEEE802154_SECURITY
struct ieee802154_aux_security_hdr *
-ieee802154_validate_aux_security_hdr(uint8_t *buf, uint8_t **p_buf)
+ieee802154_validate_aux_security_hdr(u8_t *buf, u8_t **p_buf)
{
struct ieee802154_aux_security_hdr *ash =
(struct ieee802154_aux_security_hdr *)buf;
@@ -130,7 +130,7 @@
/* At least the asf is sized of: control field + frame counter */
*p_buf += sizeof(struct ieee802154_security_control_field) +
- sizeof(uint32_t);
+ sizeof(u32_t);
/* Explicit key must have a key index != 0x00, see Section 7.4.3.2 */
switch (ash->control.key_id_mode) {
@@ -167,10 +167,10 @@
#endif /* CONFIG_NET_L2_IEEE802154_SECURITY */
static inline bool
-validate_beacon(struct ieee802154_mpdu *mpdu, uint8_t *buf, uint8_t length)
+validate_beacon(struct ieee802154_mpdu *mpdu, u8_t *buf, u8_t length)
{
struct ieee802154_beacon *b = (struct ieee802154_beacon *)buf;
- uint8_t *p_buf = buf;
+ u8_t *p_buf = buf;
struct ieee802154_pas_spec *pas;
if (length < IEEE802154_BEACON_MIN_SIZE) {
@@ -207,9 +207,9 @@
static inline bool
validate_mac_command_cfi_to_mhr(struct ieee802154_mhr *mhr,
- uint8_t ar, uint8_t comp,
- uint8_t src, bool src_pan_brdcst_chk,
- uint8_t dst, bool dst_brdcst_chk)
+ u8_t ar, u8_t comp,
+ u8_t src, bool src_pan_brdcst_chk,
+ u8_t dst, bool dst_brdcst_chk)
{
if (mhr->fs->fc.ar != ar || mhr->fs->fc.pan_id_comp != comp) {
return false;
@@ -240,14 +240,14 @@
}
static inline bool
-validate_mac_command(struct ieee802154_mpdu *mpdu, uint8_t *buf, uint8_t length)
+validate_mac_command(struct ieee802154_mpdu *mpdu, u8_t *buf, u8_t length)
{
struct ieee802154_command *c = (struct ieee802154_command *)buf;
bool src_pan_brdcst_chk = false;
bool dst_brdcst_chk = false;
- uint8_t comp = 0;
- uint8_t ar = 0;
- uint8_t src, dst;
+ u8_t comp = 0;
+ u8_t ar = 0;
+ u8_t src, dst;
switch (c->cfi) {
case IEEE802154_CFI_UNKNOWN:
@@ -329,15 +329,15 @@
static inline bool
validate_payload_and_mfr(struct ieee802154_mpdu *mpdu,
- uint8_t *buf, uint8_t *p_buf, uint8_t length)
+ u8_t *buf, u8_t *p_buf, u8_t length)
{
- uint8_t type = mpdu->mhr.fs->fc.frame_type;
- uint8_t payload_length;
+ u8_t type = mpdu->mhr.fs->fc.frame_type;
+ u8_t payload_length;
payload_length = length - (p_buf - buf);
NET_DBG("Header size: %u, vs total length %u: payload size %u",
- (uint32_t)(p_buf - buf), length, payload_length);
+ (u32_t)(p_buf - buf), length, payload_length);
if (type == IEEE802154_FRAME_TYPE_BEACON) {
if (!validate_beacon(mpdu, p_buf, payload_length)) {
@@ -368,10 +368,10 @@
return true;
}
-bool ieee802154_validate_frame(uint8_t *buf, uint8_t length,
+bool ieee802154_validate_frame(u8_t *buf, u8_t length,
struct ieee802154_mpdu *mpdu)
{
- uint8_t *p_buf = NULL;
+ u8_t *p_buf = NULL;
if (length > IEEE802154_MTU || length < IEEE802154_MIN_LENGTH) {
NET_DBG("Wrong packet length: %d", length);
@@ -409,10 +409,10 @@
return validate_payload_and_mfr(mpdu, buf, p_buf, length);
}
-uint16_t ieee802154_compute_header_size(struct net_if *iface,
+u16_t ieee802154_compute_header_size(struct net_if *iface,
struct in6_addr *dst)
{
- uint16_t hdr_len = sizeof(struct ieee802154_fcf_seq);
+ u16_t hdr_len = sizeof(struct ieee802154_fcf_seq);
#ifdef CONFIG_NET_L2_IEEE802154_SECURITY
struct ieee802154_security_ctx *sec_ctx =
&((struct ieee802154_context *)net_if_l2_data(iface))->sec_ctx;
@@ -494,7 +494,7 @@
return hdr_len;
}
-static inline struct ieee802154_fcf_seq *generate_fcf_grounds(uint8_t **p_buf,
+static inline struct ieee802154_fcf_seq *generate_fcf_grounds(u8_t **p_buf,
bool ack)
{
struct ieee802154_fcf_seq *fs;
@@ -570,10 +570,10 @@
}
static
-uint8_t *generate_addressing_fields(struct ieee802154_context *ctx,
+u8_t *generate_addressing_fields(struct ieee802154_context *ctx,
struct ieee802154_fcf_seq *fs,
struct ieee802154_frame_params *params,
- uint8_t *p_buf)
+ u8_t *p_buf)
{
struct ieee802154_address_field *af;
struct ieee802154_address *src_addr;
@@ -624,8 +624,8 @@
#ifdef CONFIG_NET_L2_IEEE802154_SECURITY
static
-uint8_t *generate_aux_security_hdr(struct ieee802154_security_ctx *sec_ctx,
- uint8_t *p_buf)
+u8_t *generate_aux_security_hdr(struct ieee802154_security_ctx *sec_ctx,
+ u8_t *p_buf)
{
struct ieee802154_aux_security_hdr *aux_sec;
@@ -654,12 +654,12 @@
bool ieee802154_create_data_frame(struct ieee802154_context *ctx,
struct net_linkaddr *dst,
struct net_buf *frag,
- uint8_t reserved_len)
+ u8_t reserved_len)
{
struct ieee802154_frame_params params;
struct ieee802154_fcf_seq *fs;
- uint8_t *p_buf = frag->data - reserved_len;
- uint8_t *frag_start = p_buf;
+ u8_t *p_buf = frag->data - reserved_len;
+ u8_t *frag_start = p_buf;
bool broadcast;
fs = generate_fcf_grounds(&p_buf, ctx->ack_requested);
@@ -690,7 +690,7 @@
*/
if (ctx->sec_ctx.level != IEEE802154_SECURITY_LEVEL_NONE &&
ctx->sec_ctx.level != IEEE802154_SECURITY_LEVEL_ENC) {
- uint8_t level;
+ u8_t level;
level = ctx->sec_ctx.level;
if (level >= IEEE802154_SECURITY_LEVEL_ENC) {
@@ -785,9 +785,9 @@
return true;
}
-static inline uint8_t mac_command_length(enum ieee802154_cfi cfi)
+static inline u8_t mac_command_length(enum ieee802154_cfi cfi)
{
- uint8_t reserve = 1; /* cfi is at least present */
+ u8_t reserve = 1; /* cfi is at least present */
switch (cfi) {
case IEEE802154_CFI_ASSOCIATION_REQUEST:
@@ -816,7 +816,7 @@
struct ieee802154_fcf_seq *fs;
struct net_pkt *pkt;
struct net_buf *frag;
- uint8_t *p_buf;
+ u8_t *p_buf;
pkt = net_pkt_get_reserve_tx(0, K_FOREVER);
if (!pkt) {
@@ -873,9 +873,9 @@
#ifdef CONFIG_NET_L2_IEEE802154_ACK_REPLY
bool ieee802154_create_ack_frame(struct net_if *iface,
- struct net_pkt *pkt, uint8_t seq)
+ struct net_pkt *pkt, u8_t seq)
{
- uint8_t *p_buf = net_pkt_ll(pkt);
+ u8_t *p_buf = net_pkt_ll(pkt);
struct ieee802154_fcf_seq *fs;
if (!p_buf) {
@@ -899,7 +899,7 @@
struct ieee802154_mpdu *mpdu)
{
struct ieee802154_context *ctx = net_if_l2_data(iface);
- uint8_t level;
+ u8_t level;
if (!mpdu->mhr.fs->fc.security_enabled) {
return true;
diff --git a/subsys/net/ip/l2/ieee802154/ieee802154_frame.h b/subsys/net/ip/l2/ieee802154/ieee802154_frame.h
index 3134cf7..cc48290 100644
--- a/subsys/net/ip/l2/ieee802154/ieee802154_frame.h
+++ b/subsys/net/ip/l2/ieee802154/ieee802154_frame.h
@@ -77,40 +77,40 @@
struct ieee802154_fcf_seq {
struct {
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
- uint16_t frame_type :3;
- uint16_t security_enabled :1;
- uint16_t frame_pending :1;
- uint16_t ar :1;
- uint16_t pan_id_comp :1;
- uint16_t reserved :1;
- uint16_t seq_num_suppr :1;
- uint16_t ie_list :1;
- uint16_t dst_addr_mode :2;
- uint16_t frame_version :2;
- uint16_t src_addr_mode :2;
+ u16_t frame_type :3;
+ u16_t security_enabled :1;
+ u16_t frame_pending :1;
+ u16_t ar :1;
+ u16_t pan_id_comp :1;
+ u16_t reserved :1;
+ u16_t seq_num_suppr :1;
+ u16_t ie_list :1;
+ u16_t dst_addr_mode :2;
+ u16_t frame_version :2;
+ u16_t src_addr_mode :2;
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
- uint16_t reserved :1;
- uint16_t pan_id_comp :1;
- uint16_t ar :1;
- uint16_t frame_pending :1;
- uint16_t security_enabled :1;
- uint16_t frame_type :3;
- uint16_t src_addr_mode :2;
- uint16_t frame_version :2;
- uint16_t dst_addr_mode :2;
- uint16_t ie_list :1;
- uint16_t seq_num_suppr :1;
+ u16_t reserved :1;
+ u16_t pan_id_comp :1;
+ u16_t ar :1;
+ u16_t frame_pending :1;
+ u16_t security_enabled :1;
+ u16_t frame_type :3;
+ u16_t src_addr_mode :2;
+ u16_t frame_version :2;
+ u16_t dst_addr_mode :2;
+ u16_t ie_list :1;
+ u16_t seq_num_suppr :1;
#endif
} fc __packed;
- uint8_t sequence;
+ u8_t sequence;
} __packed;
struct ieee802154_address {
union {
- uint8_t simple_addr;
- uint16_t short_addr;
- uint8_t ext_addr[0];
+ u8_t simple_addr;
+ u16_t short_addr;
+ u8_t ext_addr[0];
};
} __packed;
@@ -119,7 +119,7 @@
} __packed;
struct ieee802154_address_field_plain {
- uint16_t pan_id;
+ u16_t pan_id;
struct ieee802154_address addr;
} __packed;
@@ -164,13 +164,13 @@
/* See Section 7.4.1 */
struct ieee802154_security_control_field {
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
- uint8_t security_level :3;
- uint8_t key_id_mode :2;
- uint8_t reserved :3;
+ u8_t security_level :3;
+ u8_t key_id_mode :2;
+ u8_t reserved :3;
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
- uint8_t reserved :3;
- uint8_t key_id_mode :2;
- uint8_t security_level :3;
+ u8_t reserved :3;
+ u8_t key_id_mode :2;
+ u8_t security_level :3;
#endif
} __packed;
@@ -181,17 +181,17 @@
union {
/* mode_0 being implicit, it holds no info here */
struct {
- uint8_t key_index;
+ u8_t key_index;
} mode_1;
struct {
- uint8_t key_src[4];
- uint8_t key_index;
+ u8_t key_src[4];
+ u8_t key_index;
} mode_2;
struct {
- uint8_t key_src[8];
- uint8_t key_index;
+ u8_t key_src[8];
+ u8_t key_index;
} mode_3;
};
} __packed;
@@ -202,7 +202,7 @@
*/
struct ieee802154_aux_security_hdr {
struct ieee802154_security_control_field control;
- uint32_t frame_counter;
+ u32_t frame_counter;
struct ieee802154_key_identifier_field kif;
} __packed;
@@ -219,93 +219,93 @@
};
struct ieee802154_mfr {
- uint16_t fcs;
+ u16_t fcs;
};
struct ieee802154_gts_dir {
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
- uint8_t mask : 7;
- uint8_t reserved : 1;
+ u8_t mask : 7;
+ u8_t reserved : 1;
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
- uint8_t reserved : 1;
- uint8_t mask : 7;
+ u8_t reserved : 1;
+ u8_t mask : 7;
#endif
} __packed;
struct ieee802154_gts {
- uint16_t short_address;
+ u16_t short_address;
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
- uint8_t starting_slot : 4;
- uint8_t length : 4;
+ u8_t starting_slot : 4;
+ u8_t length : 4;
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
- uint8_t length : 4;
- uint8_t starting_slot : 4;
+ u8_t length : 4;
+ u8_t starting_slot : 4;
#endif
} __packed;
struct ieee802154_gts_spec {
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
/* Descriptor Count */
- uint8_t desc_count : 3;
- uint8_t reserved : 4;
+ u8_t desc_count : 3;
+ u8_t reserved : 4;
/* GTS Permit */
- uint8_t permit : 1;
+ u8_t permit : 1;
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
/* GTS Permit */
- uint8_t permit : 1;
- uint8_t reserved : 4;
+ u8_t permit : 1;
+ u8_t reserved : 4;
/* Descriptor Count */
- uint8_t desc_count : 3;
+ u8_t desc_count : 3;
#endif
} __packed;
struct ieee802154_pas_spec {
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
/* Number of Short Addresses Pending */
- uint8_t nb_sap : 3;
- uint8_t reserved_1 : 1;
+ u8_t nb_sap : 3;
+ u8_t reserved_1 : 1;
/* Number of Extended Addresses Pending */
- uint8_t nb_eap : 3;
- uint8_t reserved_2 : 1;
+ u8_t nb_eap : 3;
+ u8_t reserved_2 : 1;
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
- uint8_t reserved_1 : 1;
+ u8_t reserved_1 : 1;
/* Number of Extended Addresses Pending */
- uint8_t nb_eap : 3;
- uint8_t reserved_2 : 1;
+ u8_t nb_eap : 3;
+ u8_t reserved_2 : 1;
/* Number of Short Addresses Pending */
- uint8_t nb_sap : 3;
+ u8_t nb_sap : 3;
#endif
} __packed;
struct ieee802154_beacon_sf {
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
/* Beacon Order*/
- uint16_t bc_order : 4;
+ u16_t bc_order : 4;
/* Superframe Order*/
- uint16_t sf_order : 4;
+ u16_t sf_order : 4;
/* Final CAP Slot */
- uint16_t cap_slot : 4;
+ u16_t cap_slot : 4;
/* Battery Life Extension */
- uint16_t ble : 1;
- uint16_t reserved : 1;
+ u16_t ble : 1;
+ u16_t reserved : 1;
/* PAN Coordinator */
- uint16_t coordinator : 1;
+ u16_t coordinator : 1;
/* Association Permit */
- uint16_t association : 1;
+ u16_t association : 1;
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
/* Superframe Order*/
- uint16_t sf_order : 4;
+ u16_t sf_order : 4;
/* Beacon Order*/
- uint16_t bc_order : 4;
+ u16_t bc_order : 4;
/* Association Permit */
- uint16_t association : 1;
+ u16_t association : 1;
/* PAN Coordinator */
- uint16_t coordinator : 1;
- uint16_t reserved : 1;
+ u16_t coordinator : 1;
+ u16_t reserved : 1;
/* Battery Life Extension */
- uint16_t ble : 1;
+ u16_t ble : 1;
/* Final CAP Slot */
- uint16_t cap_slot : 4;
+ u16_t cap_slot : 4;
#endif
} __packed;
@@ -320,21 +320,21 @@
struct ieee802154_cmd_assoc_req {
struct {
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
- uint8_t reserved_1 : 1;
- uint8_t dev_type : 1;
- uint8_t power_src : 1;
- uint8_t rx_on : 1;
- uint8_t reserved_2 : 2;
- uint8_t sec_capability : 1;
- uint8_t alloc_addr : 1;
+ u8_t reserved_1 : 1;
+ u8_t dev_type : 1;
+ u8_t power_src : 1;
+ u8_t rx_on : 1;
+ u8_t reserved_2 : 2;
+ u8_t sec_capability : 1;
+ u8_t alloc_addr : 1;
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
- uint8_t alloc_addr : 1;
- uint8_t sec_capability : 1;
- uint8_t reserved_2 : 2;
- uint8_t rx_on : 1;
- uint8_t power_src : 1;
- uint8_t dev_type : 1;
- uint8_t reserved_1 : 1;
+ u8_t alloc_addr : 1;
+ u8_t sec_capability : 1;
+ u8_t reserved_2 : 2;
+ u8_t rx_on : 1;
+ u8_t power_src : 1;
+ u8_t dev_type : 1;
+ u8_t reserved_1 : 1;
#endif
} ci;
} __packed;
@@ -349,8 +349,8 @@
};
struct ieee802154_cmd_assoc_res {
- uint16_t short_addr;
- uint8_t status;
+ u16_t short_addr;
+ u8_t status;
} __packed;
/* See Section 5.3.3 */
@@ -363,31 +363,31 @@
};
struct ieee802154_cmd_disassoc_note {
- uint8_t reason;
+ u8_t reason;
} __packed;
/* See Section 5.3.8 */
struct ieee802154_cmd_coord_realign {
- uint16_t pan_id;
- uint16_t coordinator_short_addr;
- uint8_t channel;
- uint16_t short_addr;
- uint8_t channel_page; /* Optional */
+ u16_t pan_id;
+ u16_t coordinator_short_addr;
+ u8_t channel;
+ u16_t short_addr;
+ u8_t channel_page; /* Optional */
} __packed;
/* See Section 5.3.9 */
struct ieee802154_gts_request {
struct {
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
- uint8_t length : 4;
- uint8_t direction : 1;
- uint8_t type : 1;
- uint8_t reserved : 2;
+ u8_t length : 4;
+ u8_t direction : 1;
+ u8_t type : 1;
+ u8_t reserved : 2;
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
- uint8_t reserved : 2;
- uint8_t type : 1;
- uint8_t direction : 1;
- uint8_t length : 4;
+ u8_t reserved : 2;
+ u8_t type : 1;
+ u8_t direction : 1;
+ u8_t length : 4;
#endif
} gts;
} __packed;
@@ -408,7 +408,7 @@
};
struct ieee802154_command {
- uint8_t cfi;
+ u8_t cfi;
union {
struct ieee802154_cmd_assoc_req assoc_req;
struct ieee802154_cmd_assoc_res assoc_res;
@@ -436,33 +436,33 @@
struct ieee802154_frame_params {
struct {
union {
- uint8_t *ext_addr;
- uint16_t short_addr;
+ u8_t *ext_addr;
+ u16_t short_addr;
};
- uint16_t len;
- uint16_t pan_id;
+ u16_t len;
+ u16_t pan_id;
} dst;
- uint16_t short_addr;
- uint16_t pan_id;
+ u16_t short_addr;
+ u16_t pan_id;
} __packed;
#ifdef CONFIG_NET_L2_IEEE802154_SECURITY
struct ieee802154_aux_security_hdr *
-ieee802154_validate_aux_security_hdr(uint8_t *buf, uint8_t **p_buf);
+ieee802154_validate_aux_security_hdr(u8_t *buf, u8_t **p_buf);
#endif
-bool ieee802154_validate_frame(uint8_t *buf, uint8_t length,
+bool ieee802154_validate_frame(u8_t *buf, u8_t length,
struct ieee802154_mpdu *mpdu);
-uint16_t ieee802154_compute_header_size(struct net_if *iface,
+u16_t ieee802154_compute_header_size(struct net_if *iface,
struct in6_addr *dst);
bool ieee802154_create_data_frame(struct ieee802154_context *ctx,
struct net_linkaddr *dst,
struct net_buf *frag,
- uint8_t reserved_len);
+ u8_t reserved_len);
struct net_pkt *
ieee802154_create_mac_cmd_frame(struct ieee802154_context *ctx,
@@ -477,7 +477,7 @@
#ifdef CONFIG_NET_L2_IEEE802154_ACK_REPLY
bool ieee802154_create_ack_frame(struct net_if *iface,
- struct net_pkt *pkt, uint8_t seq);
+ struct net_pkt *pkt, u8_t seq);
#endif
static inline bool ieee802154_ack_required(struct net_pkt *pkt)
diff --git a/subsys/net/ip/l2/ieee802154/ieee802154_mgmt.c b/subsys/net/ip/l2/ieee802154/ieee802154_mgmt.c
index 68418d0..3311802 100644
--- a/subsys/net/ip/l2/ieee802154/ieee802154_mgmt.c
+++ b/subsys/net/ip/l2/ieee802154/ieee802154_mgmt.c
@@ -61,7 +61,7 @@
return NET_OK;
}
-static int ieee802154_cancel_scan(uint32_t mgmt_request, struct net_if *iface,
+static int ieee802154_cancel_scan(u32_t mgmt_request, struct net_if *iface,
void *data, size_t len)
{
struct ieee802154_context *ctx = net_if_l2_data(iface);
@@ -79,7 +79,7 @@
NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_CANCEL_SCAN,
ieee802154_cancel_scan);
-static int ieee802154_scan(uint32_t mgmt_request, struct net_if *iface,
+static int ieee802154_scan(u32_t mgmt_request, struct net_if *iface,
void *data, size_t len)
{
struct ieee802154_radio_api *radio =
@@ -88,7 +88,7 @@
struct ieee802154_req_params *scan =
(struct ieee802154_req_params *)data;
struct net_pkt *pkt = NULL;
- uint8_t channel;
+ u8_t channel;
int ret;
NET_DBG("%s scan requested",
@@ -219,7 +219,7 @@
return NET_DROP;
}
-static int ieee802154_associate(uint32_t mgmt_request, struct net_if *iface,
+static int ieee802154_associate(u32_t mgmt_request, struct net_if *iface,
void *data, size_t len)
{
struct ieee802154_radio_api *radio =
@@ -299,7 +299,7 @@
NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_ASSOCIATE,
ieee802154_associate);
-static int ieee802154_disassociate(uint32_t mgmt_request, struct net_if *iface,
+static int ieee802154_disassociate(u32_t mgmt_request, struct net_if *iface,
void *data, size_t len)
{
struct ieee802154_context *ctx = net_if_l2_data(iface);
@@ -343,7 +343,7 @@
NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_DISASSOCIATE,
ieee802154_disassociate);
-static int ieee802154_set_ack(uint32_t mgmt_request, struct net_if *iface,
+static int ieee802154_set_ack(u32_t mgmt_request, struct net_if *iface,
void *data, size_t len)
{
struct ieee802154_context *ctx = net_if_l2_data(iface);
@@ -366,13 +366,13 @@
NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_UNSET_ACK,
ieee802154_set_ack);
-static int ieee802154_set_parameters(uint32_t mgmt_request,
+static int ieee802154_set_parameters(u32_t mgmt_request,
struct net_if *iface,
void *data, size_t len)
{
const struct ieee802154_radio_api *radio = iface->dev->driver_api;
struct ieee802154_context *ctx = net_if_l2_data(iface);
- uint16_t value;
+ u16_t value;
int ret = 0;
if (ctx->associated) {
@@ -380,11 +380,11 @@
}
if (mgmt_request != NET_REQUEST_IEEE802154_SET_EXT_ADDR &&
- (len != sizeof(uint16_t) || !data)) {
+ (len != sizeof(u16_t) || !data)) {
return -EINVAL;
}
- value = *((uint16_t *) data);
+ value = *((u16_t *) data);
if (mgmt_request == NET_REQUEST_IEEE802154_SET_CHANNEL) {
if (ctx->channel != value) {
@@ -406,7 +406,7 @@
}
if (memcmp(ctx->ext_addr, data, IEEE802154_EXT_ADDR_LENGTH)) {
- ret = radio->set_ieee_addr(iface->dev, (uint8_t *)data);
+ ret = radio->set_ieee_addr(iface->dev, (u8_t *)data);
if (!ret) {
memcpy(ctx->ext_addr, data,
IEEE802154_EXT_ADDR_LENGTH);
@@ -420,10 +420,10 @@
}
}
} else if (mgmt_request == NET_REQUEST_IEEE802154_SET_TX_POWER) {
- if (ctx->tx_power != (int16_t)value) {
- ret = radio->set_txpower(iface->dev, (int16_t)value);
+ if (ctx->tx_power != (s16_t)value) {
+ ret = radio->set_txpower(iface->dev, (s16_t)value);
if (!ret) {
- ctx->tx_power = (int16_t)value;
+ ctx->tx_power = (s16_t)value;
}
}
}
@@ -446,19 +446,19 @@
NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_SET_TX_POWER,
ieee802154_set_parameters);
-static int ieee802154_get_parameters(uint32_t mgmt_request,
+static int ieee802154_get_parameters(u32_t mgmt_request,
struct net_if *iface,
void *data, size_t len)
{
struct ieee802154_context *ctx = net_if_l2_data(iface);
- uint16_t *value;
+ u16_t *value;
if (mgmt_request != NET_REQUEST_IEEE802154_GET_EXT_ADDR &&
- (len != sizeof(uint16_t) || !data)) {
+ (len != sizeof(u16_t) || !data)) {
return -EINVAL;
}
- value = (uint16_t *)data;
+ value = (u16_t *)data;
if (mgmt_request == NET_REQUEST_IEEE802154_GET_CHANNEL) {
*value = ctx->channel;
@@ -473,7 +473,7 @@
} else if (mgmt_request == NET_REQUEST_IEEE802154_GET_SHORT_ADDR) {
*value = ctx->short_addr;
} else if (mgmt_request == NET_REQUEST_IEEE802154_GET_TX_POWER) {
- int16_t *s_value = (int16_t *)data;
+ s16_t *s_value = (s16_t *)data;
*s_value = ctx->tx_power;
}
@@ -498,7 +498,7 @@
#ifdef CONFIG_NET_L2_IEEE802154_SECURITY
-static int ieee802154_set_security_settings(uint32_t mgmt_request,
+static int ieee802154_set_security_settings(u32_t mgmt_request,
struct net_if *iface,
void *data, size_t len)
{
@@ -529,7 +529,7 @@
NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_SET_SECURITY_SETTINGS,
ieee802154_set_security_settings);
-static int ieee802154_get_security_settings(uint32_t mgmt_request,
+static int ieee802154_get_security_settings(u32_t mgmt_request,
struct net_if *iface,
void *data, size_t len)
{
diff --git a/subsys/net/ip/l2/ieee802154/ieee802154_radio_aloha.c b/subsys/net/ip/l2/ieee802154/ieee802154_radio_aloha.c
index b0366db..9099c33 100644
--- a/subsys/net/ip/l2/ieee802154/ieee802154_radio_aloha.c
+++ b/subsys/net/ip/l2/ieee802154/ieee802154_radio_aloha.c
@@ -23,7 +23,7 @@
struct net_pkt *pkt,
struct net_buf *frag)
{
- uint8_t retries = CONFIG_NET_L2_IEEE802154_RADIO_TX_RETRIES;
+ u8_t retries = CONFIG_NET_L2_IEEE802154_RADIO_TX_RETRIES;
struct ieee802154_context *ctx = net_if_l2_data(iface);
bool ack_required = prepare_for_ack(ctx, pkt);
const struct ieee802154_radio_api *radio = iface->dev->driver_api;
diff --git a/subsys/net/ip/l2/ieee802154/ieee802154_radio_csma_ca.c b/subsys/net/ip/l2/ieee802154/ieee802154_radio_csma_ca.c
index bc2e79c..a541e9b 100644
--- a/subsys/net/ip/l2/ieee802154/ieee802154_radio_csma_ca.c
+++ b/subsys/net/ip/l2/ieee802154/ieee802154_radio_csma_ca.c
@@ -26,14 +26,14 @@
struct net_pkt *pkt,
struct net_buf *frag)
{
- const uint8_t max_bo = CONFIG_NET_L2_IEEE802154_RADIO_CSMA_CA_MAX_BO;
- const uint8_t max_be = CONFIG_NET_L2_IEEE802154_RADIO_CSMA_CA_MAX_BE;
- uint8_t retries = CONFIG_NET_L2_IEEE802154_RADIO_TX_RETRIES;
+ const u8_t max_bo = CONFIG_NET_L2_IEEE802154_RADIO_CSMA_CA_MAX_BO;
+ const u8_t max_be = CONFIG_NET_L2_IEEE802154_RADIO_CSMA_CA_MAX_BE;
+ u8_t retries = CONFIG_NET_L2_IEEE802154_RADIO_TX_RETRIES;
struct ieee802154_context *ctx = net_if_l2_data(iface);
const struct ieee802154_radio_api *radio = iface->dev->driver_api;
bool ack_required = prepare_for_ack(ctx, pkt);
- uint8_t be = CONFIG_NET_L2_IEEE802154_RADIO_CSMA_CA_MIN_BE;
- uint8_t nb = 0;
+ u8_t be = CONFIG_NET_L2_IEEE802154_RADIO_CSMA_CA_MIN_BE;
+ u8_t nb = 0;
int ret = -EIO;
NET_DBG("frag %p", frag);
@@ -43,7 +43,7 @@
retries--;
if (be) {
- uint8_t bo_n = sys_rand32_get() & (2 << (be + 1));
+ u8_t bo_n = sys_rand32_get() & (2 << (be + 1));
k_busy_wait(bo_n * 20);
}
diff --git a/subsys/net/ip/l2/ieee802154/ieee802154_security.c b/subsys/net/ip/l2/ieee802154/ieee802154_security.c
index 80a6dea..3ca797e 100644
--- a/subsys/net/ip/l2/ieee802154/ieee802154_security.c
+++ b/subsys/net/ip/l2/ieee802154/ieee802154_security.c
@@ -15,13 +15,13 @@
#include "ieee802154_frame.h"
#include "ieee802154_security.h"
-extern const uint8_t level_2_tag_size[4];
+extern const u8_t level_2_tag_size[4];
int ieee802154_security_setup_session(struct ieee802154_security_ctx *sec_ctx,
- uint8_t level, uint8_t key_mode,
- uint8_t *key, uint8_t key_len)
+ u8_t level, u8_t key_mode,
+ u8_t *key, u8_t key_len)
{
- uint8_t tag_size;
+ u8_t tag_size;
if (level > IEEE802154_SECURITY_LEVEL_ENC_MIC_128 ||
key_mode > IEEE802154_KEY_ID_MODE_SRC_8_INDEX) {
@@ -62,15 +62,15 @@
}
bool ieee802154_decrypt_auth(struct ieee802154_security_ctx *sec_ctx,
- uint8_t *frame,
- uint8_t auth_payload_len,
- uint8_t decrypt_payload_len,
- uint8_t *src_ext_addr,
- uint32_t frame_counter)
+ u8_t *frame,
+ u8_t auth_payload_len,
+ u8_t decrypt_payload_len,
+ u8_t *src_ext_addr,
+ u32_t frame_counter)
{
struct cipher_aead_pkt apkt;
struct cipher_pkt pkt;
- uint8_t nonce[13];
+ u8_t nonce[13];
int ret;
if (!sec_ctx || sec_ctx->level == IEEE802154_SECURITY_LEVEL_NONE) {
@@ -79,10 +79,10 @@
/* See Section 7.3.2 */
memcpy(nonce, src_ext_addr, IEEE802154_EXT_ADDR_LENGTH);
- nonce[8] = (uint8_t)(frame_counter >> 24);
- nonce[9] = (uint8_t)(frame_counter >> 16);
- nonce[10] = (uint8_t)(frame_counter >> 8);
- nonce[11] = (uint8_t)frame_counter;
+ nonce[8] = (u8_t)(frame_counter >> 24);
+ nonce[9] = (u8_t)(frame_counter >> 16);
+ nonce[10] = (u8_t)(frame_counter >> 8);
+ nonce[11] = (u8_t)frame_counter;
nonce[12] = sec_ctx->level;
pkt.in_buf = decrypt_payload_len ? frame + auth_payload_len : NULL;
@@ -108,14 +108,14 @@
}
bool ieee802154_encrypt_auth(struct ieee802154_security_ctx *sec_ctx,
- uint8_t *frame,
- uint8_t auth_payload_len,
- uint8_t encrypt_payload_len,
- uint8_t *src_ext_addr)
+ u8_t *frame,
+ u8_t auth_payload_len,
+ u8_t encrypt_payload_len,
+ u8_t *src_ext_addr)
{
struct cipher_aead_pkt apkt;
struct cipher_pkt pkt;
- uint8_t nonce[13];
+ u8_t nonce[13];
int ret;
if (!sec_ctx || sec_ctx->level == IEEE802154_SECURITY_LEVEL_NONE) {
@@ -124,10 +124,10 @@
/* See Section 7.3.2 */
memcpy(nonce, src_ext_addr, IEEE802154_EXT_ADDR_LENGTH);
- nonce[8] = (uint8_t)(sec_ctx->frame_counter >> 24);
- nonce[9] = (uint8_t)(sec_ctx->frame_counter >> 16);
- nonce[10] = (uint8_t)(sec_ctx->frame_counter >> 8);
- nonce[11] = (uint8_t)sec_ctx->frame_counter;
+ nonce[8] = (u8_t)(sec_ctx->frame_counter >> 24);
+ nonce[9] = (u8_t)(sec_ctx->frame_counter >> 16);
+ nonce[10] = (u8_t)(sec_ctx->frame_counter >> 8);
+ nonce[11] = (u8_t)sec_ctx->frame_counter;
nonce[12] = sec_ctx->level;
pkt.in_buf = encrypt_payload_len ? frame + auth_payload_len : NULL;
diff --git a/subsys/net/ip/l2/ieee802154/ieee802154_security.h b/subsys/net/ip/l2/ieee802154/ieee802154_security.h
index 251c7a2..f8d8456 100644
--- a/subsys/net/ip/l2/ieee802154/ieee802154_security.h
+++ b/subsys/net/ip/l2/ieee802154/ieee802154_security.h
@@ -9,21 +9,21 @@
#include <net/ieee802154.h>
int ieee802154_security_setup_session(struct ieee802154_security_ctx *sec_ctx,
- uint8_t level, uint8_t key_mode,
- uint8_t *key, uint8_t key_len);
+ u8_t level, u8_t key_mode,
+ u8_t *key, u8_t key_len);
bool ieee802154_decrypt_auth(struct ieee802154_security_ctx *sec_ctx,
- uint8_t *frame,
- uint8_t auth_payload_len,
- uint8_t decrypt_payload_len,
- uint8_t *src_ext_addr,
- uint32_t frame_counter);
+ u8_t *frame,
+ u8_t auth_payload_len,
+ u8_t decrypt_payload_len,
+ u8_t *src_ext_addr,
+ u32_t frame_counter);
bool ieee802154_encrypt_auth(struct ieee802154_security_ctx *sec_ctx,
- uint8_t *frame,
- uint8_t auth_payload_len,
- uint8_t encrypt_payload_len,
- uint8_t *src_ext_addr);
+ u8_t *frame,
+ u8_t auth_payload_len,
+ u8_t encrypt_payload_len,
+ u8_t *src_ext_addr);
int ieee802154_security_init(struct ieee802154_security_ctx *sec_ctx);
diff --git a/subsys/net/ip/l2/ieee802154/ieee802154_shell.c b/subsys/net/ip/l2/ieee802154/ieee802154_shell.c
index 83541a1..222f244 100644
--- a/subsys/net/ip/l2/ieee802154/ieee802154_shell.c
+++ b/subsys/net/ip/l2/ieee802154/ieee802154_shell.c
@@ -46,7 +46,7 @@
return -EINVAL;
}
-static inline void parse_extended_address(char *addr, uint8_t *ext_addr)
+static inline void parse_extended_address(char *addr, u8_t *ext_addr)
{
char *p, *n;
int i = 0;
@@ -74,7 +74,7 @@
parse_extended_address(argv[2], params.addr);
params.len = IEEE802154_EXT_ADDR_LENGTH;
} else {
- params.short_addr = (uint16_t) atoi(argv[2]);
+ params.short_addr = (u16_t) atoi(argv[2]);
params.len = IEEE802154_SHORT_ADDR_LENGTH;
}
@@ -106,15 +106,15 @@
return 0;
}
-static inline uint32_t parse_channel_set(char *str_set)
+static inline u32_t parse_channel_set(char *str_set)
{
- uint32_t channel_set = 0;
+ u32_t channel_set = 0;
char *p, *n;
p = str_set;
do {
- uint32_t chan;
+ u32_t chan;
n = strchr(p, ':');
if (n) {
@@ -149,7 +149,7 @@
}
static void scan_result_cb(struct net_mgmt_event_callback *cb,
- uint32_t mgmt_event, struct net_if *iface)
+ u32_t mgmt_event, struct net_if *iface)
{
printk("\nChannel: %u\tPAN ID: %u\tCoordinator Address: ",
params.channel, params.pan_id);
@@ -160,7 +160,7 @@
static int shell_cmd_scan(int argc, char *argv[])
{
struct net_if *iface = net_if_get_default();
- uint32_t scan_type;
+ u32_t scan_type;
int ret;
memset(¶ms, 0, sizeof(struct ieee802154_req_params));
@@ -212,10 +212,10 @@
static int shell_cmd_set_chan(int argc, char *argv[])
{
struct net_if *iface = net_if_get_default();
- uint16_t channel = (uint16_t) atoi(argv[1]);
+ u16_t channel = (u16_t) atoi(argv[1]);
if (net_mgmt(NET_REQUEST_IEEE802154_SET_CHANNEL, iface,
- &channel, sizeof(uint16_t))) {
+ &channel, sizeof(u16_t))) {
printk("Could not set channel %u\n", channel);
} else {
printk("Channel %u set\n", channel);
@@ -227,10 +227,10 @@
static int shell_cmd_get_chan(int argc, char *argv[])
{
struct net_if *iface = net_if_get_default();
- uint16_t channel;
+ u16_t channel;
if (net_mgmt(NET_REQUEST_IEEE802154_GET_CHANNEL, iface,
- &channel, sizeof(uint16_t))) {
+ &channel, sizeof(u16_t))) {
printk("Could not get channel\n");
} else {
printk("Channel %u\n", channel);
@@ -242,10 +242,10 @@
static int shell_cmd_set_pan_id(int argc, char *argv[])
{
struct net_if *iface = net_if_get_default();
- uint16_t pan_id = (uint16_t) atoi(argv[1]);
+ u16_t pan_id = (u16_t) atoi(argv[1]);
if (net_mgmt(NET_REQUEST_IEEE802154_SET_PAN_ID, iface,
- &pan_id, sizeof(uint16_t))) {
+ &pan_id, sizeof(u16_t))) {
printk("Could not set PAN ID %u\n", pan_id);
} else {
printk("PAN ID %u set\n", pan_id);
@@ -257,10 +257,10 @@
static int shell_cmd_get_pan_id(int argc, char *argv[])
{
struct net_if *iface = net_if_get_default();
- uint16_t pan_id;
+ u16_t pan_id;
if (net_mgmt(NET_REQUEST_IEEE802154_GET_PAN_ID, iface,
- &pan_id, sizeof(uint16_t))) {
+ &pan_id, sizeof(u16_t))) {
printk("Could not get PAN ID\n");
} else {
printk("PAN ID %u\n", pan_id);
@@ -272,7 +272,7 @@
static int shell_cmd_set_ext_addr(int argc, char *argv[])
{
struct net_if *iface = net_if_get_default();
- uint8_t addr[IEEE802154_EXT_ADDR_LENGTH];
+ u8_t addr[IEEE802154_EXT_ADDR_LENGTH];
if (strlen(argv[2]) != 23) {
printk("23 characters needed\n");
@@ -294,7 +294,7 @@
static int shell_cmd_get_ext_addr(int argc, char *argv[])
{
struct net_if *iface = net_if_get_default();
- uint8_t addr[IEEE802154_EXT_ADDR_LENGTH];
+ u8_t addr[IEEE802154_EXT_ADDR_LENGTH];
if (net_mgmt(NET_REQUEST_IEEE802154_GET_EXT_ADDR, iface,
addr, IEEE802154_EXT_ADDR_LENGTH)) {
@@ -320,10 +320,10 @@
static int shell_cmd_set_short_addr(int argc, char *argv[])
{
struct net_if *iface = net_if_get_default();
- uint16_t short_addr = (uint16_t) atoi(argv[1]);
+ u16_t short_addr = (u16_t) atoi(argv[1]);
if (net_mgmt(NET_REQUEST_IEEE802154_SET_SHORT_ADDR, iface,
- &short_addr, sizeof(uint16_t))) {
+ &short_addr, sizeof(u16_t))) {
printk("Could not set short address %u\n", short_addr);
} else {
printk("Short address %u set\n", short_addr);
@@ -335,10 +335,10 @@
static int shell_cmd_get_short_addr(int argc, char *argv[])
{
struct net_if *iface = net_if_get_default();
- uint16_t short_addr;
+ u16_t short_addr;
if (net_mgmt(NET_REQUEST_IEEE802154_GET_SHORT_ADDR, iface,
- &short_addr, sizeof(uint16_t))) {
+ &short_addr, sizeof(u16_t))) {
printk("Could not get short address\n");
} else {
printk("Short address %u\n", short_addr);
@@ -350,10 +350,10 @@
static int shell_cmd_set_tx_power(int argc, char *argv[])
{
struct net_if *iface = net_if_get_default();
- int16_t tx_power = (int16_t) atoi(argv[1]);
+ s16_t tx_power = (s16_t) atoi(argv[1]);
if (net_mgmt(NET_REQUEST_IEEE802154_SET_TX_POWER, iface,
- &tx_power, sizeof(int16_t))) {
+ &tx_power, sizeof(s16_t))) {
printk("Could not set TX power %d\n", tx_power);
} else {
printk("TX power %d set\n", tx_power);
@@ -365,10 +365,10 @@
static int shell_cmd_get_tx_power(int argc, char *argv[])
{
struct net_if *iface = net_if_get_default();
- int16_t tx_power;
+ s16_t tx_power;
if (net_mgmt(NET_REQUEST_IEEE802154_GET_SHORT_ADDR, iface,
- &tx_power, sizeof(int16_t))) {
+ &tx_power, sizeof(s16_t))) {
printk("Could not get TX power\n");
} else {
printk("TX power (in dbm) %d\n", tx_power);
diff --git a/subsys/net/ip/nbr.c b/subsys/net/ip/nbr.c
index da555f8..5eac43f 100644
--- a/subsys/net/ip/nbr.c
+++ b/subsys/net/ip/nbr.c
@@ -178,7 +178,7 @@
return NULL;
}
-struct net_linkaddr_storage *net_nbr_get_lladdr(uint8_t idx)
+struct net_linkaddr_storage *net_nbr_get_lladdr(u8_t idx)
{
NET_ASSERT_INFO(idx < CONFIG_NET_IPV6_MAX_NEIGHBORS,
"idx %d >= max %d", idx,
diff --git a/subsys/net/ip/nbr.h b/subsys/net/ip/nbr.h
index 830726c..77865bc 100644
--- a/subsys/net/ip/nbr.h
+++ b/subsys/net/ip/nbr.h
@@ -31,7 +31,7 @@
struct net_linkaddr_storage lladdr;
/** Reference count. */
- uint8_t ref;
+ u8_t ref;
};
#define NET_NBR_LLADDR_INIT(_name, _count) \
@@ -45,25 +45,25 @@
*/
struct net_nbr {
/** Reference count. */
- uint8_t ref;
+ u8_t ref;
/** Link to ll address. This is the index into lladdr array.
* The value NET_NBR_LLADDR_UNKNOWN tells that this neighbor
* does not yet have lladdr linked to it.
*/
- uint8_t idx;
+ u8_t idx;
/** Amount of data that this neighbor buffer can store. */
- const uint16_t size;
+ const u16_t size;
/** Extra data size associated with this neighbor */
- const uint16_t extra_data_size;
+ const u16_t extra_data_size;
/** Interface this neighbor is found */
struct net_if *iface;
/** Pointer to the start of data in the neighbor table. */
- uint8_t *data;
+ u8_t *data;
/** Function to be called when the neighbor is removed. */
void (*const remove)(struct net_nbr *nbr);
@@ -71,15 +71,15 @@
/** Start of the data storage. Not to be accessed directly
* (the data pointer should be used instead).
*/
- uint8_t __nbr[0] __net_nbr_align;
+ u8_t __nbr[0] __net_nbr_align;
};
/* This is an array of struct net_nbr + some additional data */
#define NET_NBR_POOL_INIT(_name, _count, _size, _remove, _extra_size) \
struct { \
struct net_nbr nbr; \
- uint8_t data[ROUND_UP(_size, 4)] __net_nbr_align; \
- uint8_t extra[ROUND_UP(_extra_size, 4)] __net_nbr_align;\
+ u8_t data[ROUND_UP(_size, 4)] __net_nbr_align; \
+ u8_t extra[ROUND_UP(_extra_size, 4)] __net_nbr_align;\
} _name[_count] = { \
[0 ... (_count - 1)] = { .nbr = { \
.idx = NET_NBR_LLADDR_UNKNOWN, \
@@ -189,7 +189,7 @@
* @param idx Link layer address index in ll table.
* @return Pointer to link layer address storage, NULL if not found
*/
-struct net_linkaddr_storage *net_nbr_get_lladdr(uint8_t idx);
+struct net_linkaddr_storage *net_nbr_get_lladdr(u8_t idx);
/**
* @brief Clear table from all neighbors. After this the linking between
diff --git a/subsys/net/ip/net_context.c b/subsys/net/ip/net_context.c
index 47b6365..b097430 100644
--- a/subsys/net/ip/net_context.c
+++ b/subsys/net/ip/net_context.c
@@ -104,7 +104,7 @@
#endif
static int check_used_port(enum net_ip_protocol ip_proto,
- uint16_t local_port,
+ u16_t local_port,
const struct sockaddr *local_addr)
{
@@ -143,11 +143,11 @@
return 0;
}
-static uint16_t find_available_port(struct net_context *context,
+static u16_t find_available_port(struct net_context *context,
const struct sockaddr *addr)
{
if (!net_sin(addr)->sin_port) {
- uint16_t local_port;
+ u16_t local_port;
do {
local_port = sys_rand32_get() | 0x8000;
@@ -798,7 +798,7 @@
{
struct net_context *context = (struct net_context *)user_data;
enum net_verdict ret;
- uint8_t tcp_flags;
+ u8_t tcp_flags;
NET_ASSERT(context && context->tcp);
@@ -986,13 +986,13 @@
const struct sockaddr *addr,
socklen_t addrlen,
net_context_connect_cb_t cb,
- int32_t timeout,
+ s32_t timeout,
void *user_data)
{
#if defined(CONFIG_NET_TCP)
struct sockaddr *laddr = NULL;
struct sockaddr local_addr;
- uint16_t lport, rport;
+ u16_t lport, rport;
int ret;
#endif
@@ -1477,13 +1477,13 @@
int net_context_accept(struct net_context *context,
net_tcp_accept_cb_t cb,
- int32_t timeout,
+ s32_t timeout,
void *user_data)
{
#if defined(CONFIG_NET_TCP)
struct sockaddr local_addr;
struct sockaddr *laddr = NULL;
- uint16_t lport = 0;
+ u16_t lport = 0;
int ret;
#endif /* CONFIG_NET_TCP */
@@ -1579,7 +1579,7 @@
static int send_data(struct net_context *context,
struct net_pkt *pkt,
net_context_send_cb_t cb,
- int32_t timeout,
+ s32_t timeout,
void *token,
void *user_data)
{
@@ -1653,7 +1653,7 @@
const struct sockaddr *dst_addr,
socklen_t addrlen,
net_context_send_cb_t cb,
- int32_t timeout,
+ s32_t timeout,
void *token,
void *user_data)
{
@@ -1749,7 +1749,7 @@
int net_context_send(struct net_pkt *pkt,
net_context_send_cb_t cb,
- int32_t timeout,
+ s32_t timeout,
void *token,
void *user_data)
{
@@ -1795,7 +1795,7 @@
const struct sockaddr *dst_addr,
socklen_t addrlen,
net_context_send_cb_t cb,
- int32_t timeout,
+ s32_t timeout,
void *token,
void *user_data)
{
@@ -1892,14 +1892,14 @@
#if defined(CONFIG_NET_UDP)
static int recv_udp(struct net_context *context,
net_context_recv_cb_t cb,
- int32_t timeout,
+ s32_t timeout,
void *user_data)
{
struct sockaddr local_addr = {
.family = net_context_get_family(context),
};
struct sockaddr *laddr = NULL;
- uint16_t lport = 0;
+ u16_t lport = 0;
int ret;
ARG_UNUSED(timeout);
@@ -1955,7 +1955,7 @@
int net_context_recv(struct net_context *context,
net_context_recv_cb_t cb,
- int32_t timeout,
+ s32_t timeout,
void *user_data)
{
NET_ASSERT(context);
diff --git a/subsys/net/ip/net_if.c b/subsys/net/ip/net_if.c
index a0d467f..7e15e5b 100644
--- a/subsys/net/ip/net_if.c
+++ b/subsys/net/ip/net_if.c
@@ -543,7 +543,7 @@
}
void net_if_ipv6_addr_update_lifetime(struct net_if_addr *ifaddr,
- uint32_t vlifetime)
+ u32_t vlifetime)
{
NET_DBG("Updating expire time of %s by %u secs",
net_sprint_ipv6_addr(&ifaddr->address.in6_addr),
@@ -575,7 +575,7 @@
static inline void net_if_addr_init(struct net_if_addr *ifaddr,
struct in6_addr *addr,
enum net_addr_type addr_type,
- uint32_t vlifetime)
+ u32_t vlifetime)
{
ifaddr->is_used = true;
ifaddr->address.family = AF_INET6;
@@ -605,7 +605,7 @@
struct net_if_addr *net_if_ipv6_addr_add(struct net_if *iface,
struct in6_addr *addr,
enum net_addr_type addr_type,
- uint32_t vlifetime)
+ u32_t vlifetime)
{
struct net_if_addr *ifaddr;
int i;
@@ -770,7 +770,7 @@
static struct net_if_ipv6_prefix *ipv6_prefix_find(struct net_if *iface,
struct in6_addr *prefix,
- uint8_t prefix_len)
+ u8_t prefix_len)
{
int i;
@@ -800,8 +800,8 @@
}
static void net_if_ipv6_prefix_init(struct net_if_ipv6_prefix *prefix,
- struct in6_addr *addr, uint8_t len,
- uint32_t lifetime)
+ struct in6_addr *addr, u8_t len,
+ u32_t lifetime)
{
prefix->is_used = true;
prefix->len = len;
@@ -817,8 +817,8 @@
struct net_if_ipv6_prefix *net_if_ipv6_prefix_add(struct net_if *iface,
struct in6_addr *prefix,
- uint8_t len,
- uint32_t lifetime)
+ u8_t len,
+ u32_t lifetime)
{
struct net_if_ipv6_prefix *if_prefix;
int i;
@@ -848,7 +848,7 @@
}
bool net_if_ipv6_prefix_rm(struct net_if *iface, struct in6_addr *addr,
- uint8_t len)
+ u8_t len)
{
int i;
@@ -876,7 +876,7 @@
struct net_if_ipv6_prefix *net_if_ipv6_prefix_lookup(struct net_if *iface,
struct in6_addr *addr,
- uint8_t len)
+ u8_t len)
{
int i;
@@ -924,7 +924,7 @@
}
void net_if_ipv6_prefix_set_timer(struct net_if_ipv6_prefix *prefix,
- uint32_t lifetime)
+ u32_t lifetime)
{
/* The maximum lifetime might be shorter than expected
* because we have only 32-bit int to store the value and
@@ -932,7 +932,7 @@
* all bits set means infinite and that value is never set
* to timer.
*/
- uint32_t timeout = lifetime * MSEC_PER_SEC;
+ u32_t timeout = lifetime * MSEC_PER_SEC;
NET_ASSERT(lifetime != 0xffffffff);
@@ -1015,7 +1015,7 @@
}
void net_if_ipv6_router_update_lifetime(struct net_if_router *router,
- uint32_t lifetime)
+ u32_t lifetime)
{
NET_DBG("Updating expire time of %s by %u secs",
net_sprint_ipv6_addr(&router->address.in6_addr),
@@ -1027,7 +1027,7 @@
static inline void net_if_router_init(struct net_if_router *router,
struct net_if *iface,
- struct in6_addr *addr, uint16_t lifetime)
+ struct in6_addr *addr, u16_t lifetime)
{
router->is_used = true;
router->iface = iface;
@@ -1055,7 +1055,7 @@
struct net_if_router *net_if_ipv6_router_add(struct net_if *iface,
struct in6_addr *addr,
- uint16_t lifetime)
+ u16_t lifetime)
{
int i;
@@ -1194,10 +1194,10 @@
return NULL;
}
-static inline uint8_t get_length(struct in6_addr *src, struct in6_addr *dst)
+static inline u8_t get_length(struct in6_addr *src, struct in6_addr *dst)
{
- uint8_t j, k, xor;
- uint8_t len = 0;
+ u8_t j, k, xor;
+ u8_t len = 0;
for (j = 0; j < 16; j++) {
if (src->s6_addr[j] == dst->s6_addr[j]) {
@@ -1232,10 +1232,10 @@
static inline struct in6_addr *net_if_ipv6_get_best_match(struct net_if *iface,
struct in6_addr *dst,
- uint8_t *best_so_far)
+ u8_t *best_so_far)
{
struct in6_addr *src = NULL;
- uint8_t i, len;
+ u8_t i, len;
for (i = 0; i < NET_IF_MAX_IPV6_ADDR; i++) {
if (!is_proper_ipv6_address(&iface->ipv6.unicast[i])) {
@@ -1257,7 +1257,7 @@
struct in6_addr *dst)
{
struct in6_addr *src = NULL;
- uint8_t best_match = 0;
+ u8_t best_match = 0;
struct net_if *iface;
if (!net_is_ipv6_ll_addr(dst) && !net_is_ipv6_addr_mcast(dst)) {
@@ -1305,7 +1305,7 @@
return src;
}
-uint32_t net_if_ipv6_calc_reachable_time(struct net_if *iface)
+u32_t net_if_ipv6_calc_reachable_time(struct net_if *iface)
{
return MIN_RANDOM_FACTOR * iface->ipv6.base_reachable_time +
sys_rand32_get() %
@@ -1342,7 +1342,7 @@
struct net_if_router *net_if_ipv4_router_add(struct net_if *iface,
struct in_addr *addr,
bool is_default,
- uint16_t lifetime)
+ u16_t lifetime)
{
int i;
@@ -1382,7 +1382,7 @@
bool net_if_ipv4_addr_mask_cmp(struct net_if *iface,
struct in_addr *addr)
{
- uint32_t subnet = ntohl(addr->s_addr[0]) &
+ u32_t subnet = ntohl(addr->s_addr[0]) &
ntohl(iface->ipv4.netmask.s_addr[0]);
int i;
@@ -1451,7 +1451,7 @@
struct net_if_addr *net_if_ipv4_addr_add(struct net_if *iface,
struct in_addr *addr,
enum net_addr_type addr_type,
- uint32_t vlifetime)
+ u32_t vlifetime)
{
struct net_if_addr *ifaddr;
int i;
@@ -1550,7 +1550,7 @@
}
}
-struct net_if *net_if_get_by_index(uint8_t index)
+struct net_if *net_if_get_by_index(u8_t index)
{
if (&__net_if_start[index] >= __net_if_end) {
NET_DBG("Index %d is too large", index);
@@ -1560,7 +1560,7 @@
return &__net_if_start[index];
}
-uint8_t net_if_get_by_iface(struct net_if *iface)
+u8_t net_if_get_by_iface(struct net_if *iface)
{
NET_ASSERT(iface >= __net_if_start && iface < __net_if_end);
diff --git a/subsys/net/ip/net_mgmt.c b/subsys/net/ip/net_mgmt.c
index cffd93d..cf49a08 100644
--- a/subsys/net/ip/net_mgmt.c
+++ b/subsys/net/ip/net_mgmt.c
@@ -18,7 +18,7 @@
#include <net/net_mgmt.h>
struct mgmt_event_entry {
- uint32_t event;
+ u32_t event;
struct net_if *iface;
};
@@ -32,12 +32,12 @@
NET_STACK_DEFINE(MGMT, mgmt_stack, CONFIG_NET_MGMT_EVENT_STACK_SIZE,
CONFIG_NET_MGMT_EVENT_STACK_SIZE);
static struct mgmt_event_entry events[CONFIG_NET_MGMT_EVENT_QUEUE_SIZE];
-static uint32_t global_event_mask;
+static u32_t global_event_mask;
static sys_slist_t event_callbacks;
-static uint16_t in_event;
-static uint16_t out_event;
+static u16_t in_event;
+static u16_t out_event;
-static inline void mgmt_push_event(uint32_t mgmt_event, struct net_if *iface)
+static inline void mgmt_push_event(u32_t mgmt_event, struct net_if *iface)
{
events[in_event].event = mgmt_event;
events[in_event].iface = iface;
@@ -49,7 +49,7 @@
}
if (in_event == out_event) {
- uint16_t o_idx = out_event + 1;
+ u16_t o_idx = out_event + 1;
if (o_idx == CONFIG_NET_MGMT_EVENT_QUEUE_SIZE) {
o_idx = 0;
@@ -63,7 +63,7 @@
static inline struct mgmt_event_entry *mgmt_pop_event(void)
{
- uint16_t o_idx;
+ u16_t o_idx;
if (!events[out_event].event) {
return NULL;
@@ -85,7 +85,7 @@
mgmt_event->iface = NULL;
}
-static inline void mgmt_add_event_mask(uint32_t event_mask)
+static inline void mgmt_add_event_mask(u32_t event_mask)
{
global_event_mask |= event_mask;
}
@@ -101,7 +101,7 @@
}
}
-static inline bool mgmt_is_event_handled(uint32_t mgmt_event)
+static inline bool mgmt_is_event_handled(u32_t mgmt_event)
{
return ((mgmt_event & global_event_mask) == mgmt_event);
}
@@ -193,8 +193,8 @@
}
static int mgmt_event_wait_call(struct net_if *iface,
- uint32_t mgmt_event_mask,
- uint32_t *raised_event,
+ u32_t mgmt_event_mask,
+ u32_t *raised_event,
struct net_if **event_iface,
int timeout)
{
@@ -251,7 +251,7 @@
mgmt_rebuild_global_event_mask();
}
-void net_mgmt_event_notify(uint32_t mgmt_event, struct net_if *iface)
+void net_mgmt_event_notify(u32_t mgmt_event, struct net_if *iface)
{
if (mgmt_is_event_handled(mgmt_event)) {
NET_DBG("Notifying Event layer %u code %u type %u",
@@ -264,8 +264,8 @@
}
}
-int net_mgmt_event_wait(uint32_t mgmt_event_mask,
- uint32_t *raised_event,
+int net_mgmt_event_wait(u32_t mgmt_event_mask,
+ u32_t *raised_event,
struct net_if **iface,
int timeout)
{
@@ -274,8 +274,8 @@
}
int net_mgmt_event_wait_on_iface(struct net_if *iface,
- uint32_t mgmt_event_mask,
- uint32_t *raised_event,
+ u32_t mgmt_event_mask,
+ u32_t *raised_event,
int timeout)
{
NET_ASSERT(NET_MGMT_ON_IFACE(mgmt_event_mask));
diff --git a/subsys/net/ip/net_pkt.c b/subsys/net/ip/net_pkt.c
index da46595..97b8e91 100644
--- a/subsys/net/ip/net_pkt.c
+++ b/subsys/net/ip/net_pkt.c
@@ -106,9 +106,9 @@
};
const char *func_alloc;
const char *func_free;
- uint16_t line_alloc;
- uint16_t line_free;
- uint8_t in_use;
+ u16_t line_alloc;
+ u16_t line_free;
+ u8_t in_use;
bool is_pkt;
};
@@ -234,7 +234,7 @@
return "EDATA";
}
-static inline int16_t get_frees(struct net_buf_pool *pool)
+static inline s16_t get_frees(struct net_buf_pool *pool)
{
return pool->avail_count;
}
@@ -289,14 +289,14 @@
}
struct net_pkt *net_pkt_get_reserve_debug(struct k_mem_slab *slab,
- uint16_t reserve_head,
- int32_t timeout,
+ u16_t reserve_head,
+ s32_t timeout,
const char *caller,
int line)
#else /* CONFIG_NET_DEBUG_NET_PKT */
struct net_pkt *net_pkt_get_reserve(struct k_mem_slab *slab,
- uint16_t reserve_head,
- int32_t timeout)
+ u16_t reserve_head,
+ s32_t timeout)
#endif /* CONFIG_NET_DEBUG_NET_PKT */
{
struct net_pkt *pkt;
@@ -331,14 +331,14 @@
#if defined(CONFIG_NET_DEBUG_NET_PKT)
struct net_buf *net_pkt_get_reserve_data_debug(struct net_buf_pool *pool,
- uint16_t reserve_head,
- int32_t timeout,
+ u16_t reserve_head,
+ s32_t timeout,
const char *caller,
int line)
#else /* CONFIG_NET_DEBUG_NET_PKT */
struct net_buf *net_pkt_get_reserve_data(struct net_buf_pool *pool,
- uint16_t reserve_head,
- int32_t timeout)
+ u16_t reserve_head,
+ s32_t timeout)
#endif /* CONFIG_NET_DEBUG_NET_PKT */
{
struct net_buf *frag;
@@ -378,11 +378,11 @@
*/
#if defined(CONFIG_NET_DEBUG_NET_PKT)
struct net_buf *net_pkt_get_frag_debug(struct net_pkt *pkt,
- int32_t timeout,
+ s32_t timeout,
const char *caller, int line)
#else
struct net_buf *net_pkt_get_frag(struct net_pkt *pkt,
- int32_t timeout)
+ s32_t timeout)
#endif
{
#if defined(CONFIG_NET_CONTEXT_NET_PKT_POOL)
@@ -422,32 +422,32 @@
}
#if defined(CONFIG_NET_DEBUG_NET_PKT)
-struct net_pkt *net_pkt_get_reserve_rx_debug(uint16_t reserve_head,
- int32_t timeout,
+struct net_pkt *net_pkt_get_reserve_rx_debug(u16_t reserve_head,
+ s32_t timeout,
const char *caller, int line)
{
return net_pkt_get_reserve_debug(&rx_pkts, reserve_head, timeout,
caller, line);
}
-struct net_pkt *net_pkt_get_reserve_tx_debug(uint16_t reserve_head,
- int32_t timeout,
+struct net_pkt *net_pkt_get_reserve_tx_debug(u16_t reserve_head,
+ s32_t timeout,
const char *caller, int line)
{
return net_pkt_get_reserve_debug(&tx_pkts, reserve_head, timeout,
caller, line);
}
-struct net_buf *net_pkt_get_reserve_rx_data_debug(uint16_t reserve_head,
- int32_t timeout,
+struct net_buf *net_pkt_get_reserve_rx_data_debug(u16_t reserve_head,
+ s32_t timeout,
const char *caller, int line)
{
return net_pkt_get_reserve_data_debug(&rx_bufs, reserve_head,
timeout, caller, line);
}
-struct net_buf *net_pkt_get_reserve_tx_data_debug(uint16_t reserve_head,
- int32_t timeout,
+struct net_buf *net_pkt_get_reserve_tx_data_debug(u16_t reserve_head,
+ s32_t timeout,
const char *caller, int line)
{
return net_pkt_get_reserve_data_debug(&tx_bufs, reserve_head,
@@ -456,26 +456,26 @@
#else /* CONFIG_NET_DEBUG_NET_PKT */
-struct net_pkt *net_pkt_get_reserve_rx(uint16_t reserve_head,
- int32_t timeout)
+struct net_pkt *net_pkt_get_reserve_rx(u16_t reserve_head,
+ s32_t timeout)
{
return net_pkt_get_reserve(&rx_pkts, reserve_head, timeout);
}
-struct net_pkt *net_pkt_get_reserve_tx(uint16_t reserve_head,
- int32_t timeout)
+struct net_pkt *net_pkt_get_reserve_tx(u16_t reserve_head,
+ s32_t timeout)
{
return net_pkt_get_reserve(&tx_pkts, reserve_head, timeout);
}
-struct net_buf *net_pkt_get_reserve_rx_data(uint16_t reserve_head,
- int32_t timeout)
+struct net_buf *net_pkt_get_reserve_rx_data(u16_t reserve_head,
+ s32_t timeout)
{
return net_pkt_get_reserve_data(&rx_bufs, reserve_head, timeout);
}
-struct net_buf *net_pkt_get_reserve_tx_data(uint16_t reserve_head,
- int32_t timeout)
+struct net_buf *net_pkt_get_reserve_tx_data(u16_t reserve_head,
+ s32_t timeout)
{
return net_pkt_get_reserve_data(&tx_bufs, reserve_head, timeout);
}
@@ -486,12 +486,12 @@
#if defined(CONFIG_NET_DEBUG_NET_PKT)
static struct net_pkt *net_pkt_get_debug(struct k_mem_slab *slab,
struct net_context *context,
- int32_t timeout,
+ s32_t timeout,
const char *caller, int line)
#else
static struct net_pkt *net_pkt_get(struct k_mem_slab *slab,
struct net_context *context,
- int32_t timeout)
+ s32_t timeout)
#endif /* CONFIG_NET_DEBUG_NET_PKT */
{
struct in6_addr *addr6 = NULL;
@@ -534,12 +534,12 @@
#if defined(CONFIG_NET_DEBUG_NET_PKT)
static struct net_buf *_pkt_get_data_debug(struct net_buf_pool *pool,
struct net_context *context,
- int32_t timeout,
+ s32_t timeout,
const char *caller, int line)
#else
static struct net_buf *_pkt_get_data(struct net_buf_pool *pool,
struct net_context *context,
- int32_t timeout)
+ s32_t timeout)
#endif /* CONFIG_NET_DEBUG_NET_PKT */
{
struct in6_addr *addr6 = NULL;
@@ -597,14 +597,14 @@
#if defined(CONFIG_NET_DEBUG_NET_PKT)
struct net_pkt *net_pkt_get_rx_debug(struct net_context *context,
- int32_t timeout,
+ s32_t timeout,
const char *caller, int line)
{
return net_pkt_get_debug(&rx_pkts, context, timeout, caller, line);
}
struct net_pkt *net_pkt_get_tx_debug(struct net_context *context,
- int32_t timeout,
+ s32_t timeout,
const char *caller, int line)
{
struct k_mem_slab *slab = get_tx_slab(context);
@@ -614,7 +614,7 @@
}
struct net_buf *net_pkt_get_data_debug(struct net_context *context,
- int32_t timeout,
+ s32_t timeout,
const char *caller, int line)
{
struct net_buf_pool *pool = get_data_pool(context);
@@ -625,14 +625,14 @@
#else /* CONFIG_NET_DEBUG_NET_PKT */
-struct net_pkt *net_pkt_get_rx(struct net_context *context, int32_t timeout)
+struct net_pkt *net_pkt_get_rx(struct net_context *context, s32_t timeout)
{
NET_ASSERT_INFO(context, "RX context not set");
return net_pkt_get(&rx_pkts, context, timeout);
}
-struct net_pkt *net_pkt_get_tx(struct net_context *context, int32_t timeout)
+struct net_pkt *net_pkt_get_tx(struct net_context *context, s32_t timeout)
{
struct k_mem_slab *slab;
@@ -643,7 +643,7 @@
return net_pkt_get(slab ? slab : &tx_pkts, context, timeout);
}
-struct net_buf *net_pkt_get_data(struct net_context *context, int32_t timeout)
+struct net_buf *net_pkt_get_data(struct net_context *context, s32_t timeout)
{
struct net_buf_pool *pool;
@@ -879,10 +879,10 @@
}
struct net_buf *net_pkt_copy(struct net_pkt *pkt, size_t amount,
- size_t reserve, int32_t timeout)
+ size_t reserve, s32_t timeout)
{
struct net_buf *frag, *first, *orig;
- uint8_t *orig_data;
+ u8_t *orig_data;
size_t orig_len;
orig = pkt->frags;
@@ -977,10 +977,10 @@
}
int net_frag_linear_copy(struct net_buf *dst, struct net_buf *src,
- uint16_t offset, uint16_t len)
+ u16_t offset, u16_t len)
{
- uint16_t to_copy;
- uint16_t copied;
+ u16_t to_copy;
+ u16_t copied;
if (dst->size < len) {
return -ENOMEM;
@@ -1080,13 +1080,13 @@
* the buffer. It assumes that the buffer has at least one fragment.
*/
static inline bool net_pkt_append_bytes(struct net_pkt *pkt,
- const uint8_t *value,
- uint16_t len, int32_t timeout)
+ const u8_t *value,
+ u16_t len, s32_t timeout)
{
struct net_buf *frag = net_buf_frag_last(pkt->frags);
do {
- uint16_t count = min(len, net_buf_tailroom(frag));
+ u16_t count = min(len, net_buf_tailroom(frag));
void *data = net_buf_add(frag, count);
memcpy(data, value, count);
@@ -1108,8 +1108,8 @@
return false;
}
-bool net_pkt_append(struct net_pkt *pkt, uint16_t len, const uint8_t *data,
- int32_t timeout)
+bool net_pkt_append(struct net_pkt *pkt, u16_t len, const u8_t *data,
+ s32_t timeout)
{
struct net_buf *frag;
@@ -1134,9 +1134,9 @@
* next fragment and set offset = 0.
*/
static inline struct net_buf *net_frag_read_byte(struct net_buf *frag,
- uint16_t offset,
- uint16_t *pos,
- uint8_t *data)
+ u16_t offset,
+ u16_t *pos,
+ u8_t *data)
{
if (data) {
*data = frag->data[offset];
@@ -1157,7 +1157,7 @@
* if given offset is more than current fragment length.
*/
static inline struct net_buf *adjust_offset(struct net_buf *frag,
- uint16_t offset, uint16_t *pos)
+ u16_t offset, u16_t *pos)
{
if (!frag) {
NET_ERR("Invalid fragment");
@@ -1184,10 +1184,10 @@
return NULL;
}
-struct net_buf *net_frag_read(struct net_buf *frag, uint16_t offset,
- uint16_t *pos, uint16_t len, uint8_t *data)
+struct net_buf *net_frag_read(struct net_buf *frag, u16_t offset,
+ u16_t *pos, u16_t len, u8_t *data)
{
- uint16_t copy = 0;
+ u16_t copy = 0;
frag = adjust_offset(frag, offset, pos);
if (!frag) {
@@ -1217,26 +1217,26 @@
return NULL;
}
-struct net_buf *net_frag_read_be16(struct net_buf *frag, uint16_t offset,
- uint16_t *pos, uint16_t *value)
+struct net_buf *net_frag_read_be16(struct net_buf *frag, u16_t offset,
+ u16_t *pos, u16_t *value)
{
struct net_buf *ret_frag;
- uint8_t v16[2];
+ u8_t v16[2];
- ret_frag = net_frag_read(frag, offset, pos, sizeof(uint16_t), v16);
+ ret_frag = net_frag_read(frag, offset, pos, sizeof(u16_t), v16);
*value = v16[0] << 8 | v16[1];
return ret_frag;
}
-struct net_buf *net_frag_read_be32(struct net_buf *frag, uint16_t offset,
- uint16_t *pos, uint32_t *value)
+struct net_buf *net_frag_read_be32(struct net_buf *frag, u16_t offset,
+ u16_t *pos, u32_t *value)
{
struct net_buf *ret_frag;
- uint8_t v32[4];
+ u8_t v32[4];
- ret_frag = net_frag_read(frag, offset, pos, sizeof(uint32_t), v32);
+ ret_frag = net_frag_read(frag, offset, pos, sizeof(u32_t), v32);
*value = v32[0] << 24 | v32[1] << 16 | v32[2] << 8 | v32[3];
@@ -1245,7 +1245,7 @@
static inline struct net_buf *check_and_create_data(struct net_pkt *pkt,
struct net_buf *data,
- int32_t timeout)
+ s32_t timeout)
{
struct net_buf *frag;
@@ -1265,11 +1265,11 @@
static inline struct net_buf *adjust_write_offset(struct net_pkt *pkt,
struct net_buf *frag,
- uint16_t offset,
- uint16_t *pos,
- int32_t timeout)
+ u16_t offset,
+ u16_t *pos,
+ s32_t timeout)
{
- uint16_t tailroom;
+ u16_t tailroom;
do {
frag = check_and_create_data(pkt, frag, timeout);
@@ -1350,9 +1350,9 @@
}
struct net_buf *net_pkt_write(struct net_pkt *pkt, struct net_buf *frag,
- uint16_t offset, uint16_t *pos,
- uint16_t len, uint8_t *data,
- int32_t timeout)
+ u16_t offset, u16_t *pos,
+ u16_t len, u8_t *data,
+ s32_t timeout)
{
if (!pkt) {
NET_ERR("Invalid packet");
@@ -1366,8 +1366,8 @@
}
do {
- uint16_t space = frag->size - net_buf_headroom(frag) - offset;
- uint16_t count = min(len, space);
+ u16_t space = frag->size - net_buf_headroom(frag) - offset;
+ u16_t count = min(len, space);
int size_to_add;
memcpy(frag->data + offset, data, count);
@@ -1408,14 +1408,14 @@
}
static inline bool insert_data(struct net_pkt *pkt, struct net_buf *frag,
- struct net_buf *temp, uint16_t offset,
- uint16_t len, uint8_t *data,
- int32_t timeout)
+ struct net_buf *temp, u16_t offset,
+ u16_t len, u8_t *data,
+ s32_t timeout)
{
struct net_buf *insert;
do {
- uint16_t count = min(len, net_buf_tailroom(frag));
+ u16_t count = min(len, net_buf_tailroom(frag));
/* Copy insert data */
memcpy(frag->data + offset, data, count);
@@ -1456,8 +1456,8 @@
}
static inline struct net_buf *adjust_insert_offset(struct net_buf *frag,
- uint16_t offset,
- uint16_t *pos)
+ u16_t offset,
+ u16_t *pos)
{
if (!frag) {
NET_ERR("Invalid fragment");
@@ -1493,11 +1493,11 @@
}
bool net_pkt_insert(struct net_pkt *pkt, struct net_buf *frag,
- uint16_t offset, uint16_t len, uint8_t *data,
- int32_t timeout)
+ u16_t offset, u16_t len, u8_t *data,
+ s32_t timeout)
{
struct net_buf *temp = NULL;
- uint16_t bytes;
+ u16_t bytes;
if (!pkt) {
return false;
@@ -1528,8 +1528,8 @@
}
int net_pkt_split(struct net_pkt *pkt, struct net_buf *orig_frag,
- uint16_t len, struct net_buf **fragA,
- struct net_buf **fragB, int32_t timeout)
+ u16_t len, struct net_buf **fragA,
+ struct net_buf **fragB, s32_t timeout)
{
if (!pkt || !orig_frag) {
return -EINVAL;
diff --git a/subsys/net/ip/net_private.h b/subsys/net/ip/net_private.h
index 93e846b..5d441e9 100644
--- a/subsys/net/ip/net_private.h
+++ b/subsys/net/ip/net_private.h
@@ -25,41 +25,41 @@
#if defined(CONFIG_NET_IPV6_FRAGMENT)
int net_ipv6_send_fragmented_pkt(struct net_if *iface, struct net_pkt *pkt,
- uint16_t pkt_len);
+ u16_t pkt_len);
#endif
extern const char *net_proto2str(enum net_ip_protocol proto);
-extern char *net_byte_to_hex(char *ptr, uint8_t byte, char base, bool pad);
-extern char *net_sprint_ll_addr_buf(const uint8_t *ll, uint8_t ll_len,
+extern char *net_byte_to_hex(char *ptr, u8_t byte, char base, bool pad);
+extern char *net_sprint_ll_addr_buf(const u8_t *ll, u8_t ll_len,
char *buf, int buflen);
-extern uint16_t net_calc_chksum(struct net_pkt *pkt, uint8_t proto);
+extern u16_t net_calc_chksum(struct net_pkt *pkt, u8_t proto);
#if defined(CONFIG_NET_IPV4)
-extern uint16_t net_calc_chksum_ipv4(struct net_pkt *pkt);
+extern u16_t net_calc_chksum_ipv4(struct net_pkt *pkt);
#endif /* CONFIG_NET_IPV4 */
-static inline uint16_t net_calc_chksum_icmpv6(struct net_pkt *pkt)
+static inline u16_t net_calc_chksum_icmpv6(struct net_pkt *pkt)
{
return net_calc_chksum(pkt, IPPROTO_ICMPV6);
}
-static inline uint16_t net_calc_chksum_icmpv4(struct net_pkt *pkt)
+static inline u16_t net_calc_chksum_icmpv4(struct net_pkt *pkt)
{
return net_calc_chksum(pkt, IPPROTO_ICMP);
}
-static inline uint16_t net_calc_chksum_udp(struct net_pkt *pkt)
+static inline u16_t net_calc_chksum_udp(struct net_pkt *pkt)
{
return net_calc_chksum(pkt, IPPROTO_UDP);
}
-static inline uint16_t net_calc_chksum_tcp(struct net_pkt *pkt)
+static inline u16_t net_calc_chksum_tcp(struct net_pkt *pkt)
{
return net_calc_chksum(pkt, IPPROTO_TCP);
}
#if NET_LOG_ENABLED > 0
-static inline char *net_sprint_ll_addr(const uint8_t *ll, uint8_t ll_len)
+static inline char *net_sprint_ll_addr(const u8_t *ll, u8_t ll_len)
{
static char buf[sizeof("xx:xx:xx:xx:xx:xx:xx:xx")];
@@ -110,7 +110,7 @@
return NULL;
}
-static inline void net_hexdump(const char *str, const uint8_t *packet,
+static inline void net_hexdump(const char *str, const u8_t *packet,
size_t length)
{
int n = 0;
@@ -182,7 +182,7 @@
#else /* NET_LOG_ENABLED */
-static inline char *net_sprint_ll_addr(const uint8_t *ll, uint8_t ll_len)
+static inline char *net_sprint_ll_addr(const u8_t *ll, u8_t ll_len)
{
ARG_UNUSED(ll);
ARG_UNUSED(ll_len);
diff --git a/subsys/net/ip/net_shell.c b/subsys/net/ip/net_shell.c
index bf9f51c..576eb27 100644
--- a/subsys/net/ip/net_shell.c
+++ b/subsys/net/ip/net_shell.c
@@ -530,7 +530,7 @@
static void tcp_cb(struct net_tcp *tcp, void *user_data)
{
int *count = user_data;
- uint16_t recv_mss = net_tcp_get_recv_mss(tcp);
+ u16_t recv_mss = net_tcp_get_recv_mss(tcp);
printk("%p %5u %5u %10u %10u %5u %s\n",
tcp,
@@ -769,7 +769,7 @@
printk("Pending queries:\n");
for (i = 0; i < CONFIG_DNS_NUM_CONCUR_QUERIES; i++) {
- int32_t remaining;
+ s32_t remaining;
if (!ctx->queries[i].cb) {
continue;
@@ -1446,7 +1446,7 @@
}
}
-static int tcp_connect(char *host, uint16_t port, struct net_context **ctx)
+static int tcp_connect(char *host, u16_t port, struct net_context **ctx)
{
struct sockaddr addr;
struct sockaddr myaddr;
@@ -1542,7 +1542,7 @@
if (!strcmp(argv[arg], "connect")) {
/* tcp connect <ip> port */
char *ip;
- uint16_t port;
+ u16_t port;
if (tcp_ctx && net_context_is_used(tcp_ctx)) {
printk("Already connected\n");
diff --git a/subsys/net/ip/net_stats.c b/subsys/net/ip/net_stats.c
index 5ed71a6..7b4f700 100644
--- a/subsys/net/ip/net_stats.c
+++ b/subsys/net/ip/net_stats.c
@@ -25,12 +25,12 @@
void net_print_statistics(void)
{
- static int64_t next_print;
- int64_t curr = k_uptime_get();
+ static s64_t next_print;
+ s64_t curr = k_uptime_get();
if (!next_print || (next_print < curr &&
(!((curr - next_print) > PRINT_STATISTICS_INTERVAL)))) {
- int64_t new_print;
+ s64_t new_print;
#if defined(CONFIG_NET_STATISTICS_IPV6)
NET_INFO("IPv6 recv %d\tsent\t%d\tdrop\t%d\tforwarded\t%d",
@@ -133,7 +133,7 @@
#if defined(CONFIG_NET_STATISTICS_USER_API)
-static int net_stats_get(uint32_t mgmt_request, struct net_if *iface,
+static int net_stats_get(u32_t mgmt_request, struct net_if *iface,
void *data, size_t len)
{
size_t len_chk = 0;
diff --git a/subsys/net/ip/net_stats.h b/subsys/net/ip/net_stats.h
index 5320050..a9d6cd0 100644
--- a/subsys/net/ip/net_stats.h
+++ b/subsys/net/ip/net_stats.h
@@ -32,12 +32,12 @@
net_stats.ip_errors.vhlerr++;
}
-static inline void net_stats_update_bytes_recv(uint32_t bytes)
+static inline void net_stats_update_bytes_recv(u32_t bytes)
{
net_stats.bytes.received += bytes;
}
-static inline void net_stats_update_bytes_sent(uint32_t bytes)
+static inline void net_stats_update_bytes_sent(u32_t bytes)
{
net_stats.bytes.sent += bytes;
}
diff --git a/subsys/net/ip/route.c b/subsys/net/ip/route.c
index e188c04..6018741 100644
--- a/subsys/net/ip/route.c
+++ b/subsys/net/ip/route.c
@@ -134,7 +134,7 @@
continue;
}
- if (nbr->data == (uint8_t *)route) {
+ if (nbr->data == (u8_t *)route) {
if (!nbr->ref) {
return NULL;
}
@@ -183,7 +183,7 @@
static struct net_nbr *nbr_new(struct net_if *iface,
struct in6_addr *addr,
- uint8_t prefix_len)
+ u8_t prefix_len)
{
struct net_nbr *nbr = net_nbr_get(&net_nbr_routes.table);
@@ -264,7 +264,7 @@
struct in6_addr *dst)
{
struct net_route_entry *route, *found = NULL;
- uint8_t longest_match = 0;
+ u8_t longest_match = 0;
int i;
for (i = 0; i < CONFIG_NET_MAX_ROUTES && longest_match < 128; i++) {
@@ -281,8 +281,8 @@
route = net_route_data(nbr);
if (route->prefix_len >= longest_match &&
- net_is_ipv6_prefix((uint8_t *)dst,
- (uint8_t *)&route->addr,
+ net_is_ipv6_prefix((u8_t *)dst,
+ (u8_t *)&route->addr,
route->prefix_len)) {
found = route;
longest_match = route->prefix_len;
@@ -300,7 +300,7 @@
struct net_route_entry *net_route_add(struct net_if *iface,
struct in6_addr *addr,
- uint8_t prefix_len,
+ u8_t prefix_len,
struct in6_addr *nexthop)
{
struct net_linkaddr_storage *nexthop_lladdr;
diff --git a/subsys/net/ip/route.h b/subsys/net/ip/route.h
index 498500b..e8e4ff9 100644
--- a/subsys/net/ip/route.h
+++ b/subsys/net/ip/route.h
@@ -60,7 +60,7 @@
struct in6_addr addr;
/** IPv6 address/prefix length. */
- uint8_t prefix_len;
+ u8_t prefix_len;
};
/**
@@ -87,7 +87,7 @@
*/
struct net_route_entry *net_route_add(struct net_if *iface,
struct in6_addr *addr,
- uint8_t prefix_len,
+ u8_t prefix_len,
struct in6_addr *nexthop);
/**
@@ -178,7 +178,7 @@
struct in6_addr group;
/** Routing entry lifetime in seconds. */
- uint32_t lifetime;
+ u32_t lifetime;
/** Is this entry in user or not */
bool is_used;
diff --git a/subsys/net/ip/rpl-mrhof.c b/subsys/net/ip/rpl-mrhof.c
index 27388aa..0df7306 100644
--- a/subsys/net/ip/rpl-mrhof.c
+++ b/subsys/net/ip/rpl-mrhof.c
@@ -72,14 +72,14 @@
#define MRHOF_ETX_SCALE 100
#define MRHOF_ETX_ALPHA 90
-static uint16_t net_rpl_mrhof_get(void)
+static u16_t net_rpl_mrhof_get(void)
{
return 1;
}
-uint16_t net_rpl_of_get(void) ALIAS_OF(net_rpl_mrhof_get);
+u16_t net_rpl_of_get(void) ALIAS_OF(net_rpl_mrhof_get);
-static bool net_rpl_mrhof_find(uint16_t ocp)
+static bool net_rpl_mrhof_find(u16_t ocp)
{
if (ocp != 1) {
return false;
@@ -88,7 +88,7 @@
return true;
}
-bool net_rpl_of_find(uint16_t ocp) ALIAS_OF(net_rpl_mrhof_find);
+bool net_rpl_of_find(u16_t ocp) ALIAS_OF(net_rpl_mrhof_find);
static void net_rpl_mrhof_reset(struct net_rpl_dag *dag)
{
@@ -101,11 +101,11 @@
struct net_rpl_parent *parent,
int status, int numtx)
{
- uint16_t packet_etx = numtx * NET_RPL_MC_ETX_DIVISOR;
- uint16_t recorded_etx = 0;
+ u16_t packet_etx = numtx * NET_RPL_MC_ETX_DIVISOR;
+ u16_t recorded_etx = 0;
struct net_nbr *nbr = NULL;
struct net_nbr *ipv6_nbr;
- uint16_t new_etx;
+ u16_t new_etx;
nbr = net_rpl_get_nbr(parent);
if (!nbr) {
@@ -137,8 +137,8 @@
/* We already have a valid link metric,
* use weighted moving average to update it
*/
- new_etx = ((uint32_t)recorded_etx * MRHOF_ETX_ALPHA +
- (uint32_t)packet_etx *
+ new_etx = ((u32_t)recorded_etx * MRHOF_ETX_ALPHA +
+ (u32_t)packet_etx *
(MRHOF_ETX_SCALE - MRHOF_ETX_ALPHA)) /
MRHOF_ETX_SCALE;
} else {
@@ -168,7 +168,7 @@
int status, int numtx)
ALIAS_OF(net_rpl_mrhof_neighbor_link_cb);
-static uint16_t calculate_path_metric(struct net_rpl_parent *parent)
+static u16_t calculate_path_metric(struct net_rpl_parent *parent)
{
struct net_nbr *nbr;
@@ -203,9 +203,9 @@
struct net_rpl_parent *parent2)
{
struct net_rpl_dag *dag;
- uint16_t min_diff;
- uint16_t p1_metric;
- uint16_t p2_metric;
+ u16_t min_diff;
+ u16_t p1_metric;
+ u16_t p2_metric;
dag = parent1->dag; /* Both parents are in the same DAG. */
@@ -258,11 +258,11 @@
struct net_rpl_dag *dag2)
ALIAS_OF(net_rpl_mrhof_best_dag);
-static uint16_t net_rpl_mrhof_calc_rank(struct net_rpl_parent *parent,
- uint16_t base_rank)
+static u16_t net_rpl_mrhof_calc_rank(struct net_rpl_parent *parent,
+ u16_t base_rank)
{
- uint16_t new_rank;
- uint16_t rank_increase;
+ u16_t new_rank;
+ u16_t rank_increase;
struct net_nbr *nbr;
nbr = net_rpl_get_nbr(parent);
@@ -293,8 +293,8 @@
return new_rank;
}
-uint16_t net_rpl_of_calc_rank(struct net_rpl_parent *parent,
- uint16_t base_rank)
+u16_t net_rpl_of_calc_rank(struct net_rpl_parent *parent,
+ u16_t base_rank)
ALIAS_OF(net_rpl_mrhof_calc_rank);
static int net_rpl_mrhof_update_mc(struct net_rpl_instance *instance)
@@ -303,11 +303,11 @@
instance->mc.type = NET_RPL_MC_NONE;
return 0;
#else
- uint16_t path_metric;
+ u16_t path_metric;
struct net_rpl_dag *dag;
#if defined(CONFIG_NET_RPL_MC_ENERGY)
- uint8_t type;
+ u8_t type;
instance->mc.type = NET_RPL_MC_ENERGY;
#else
diff --git a/subsys/net/ip/rpl-of0.c b/subsys/net/ip/rpl-of0.c
index 51eb13a..6846d6b 100644
--- a/subsys/net/ip/rpl-of0.c
+++ b/subsys/net/ip/rpl-of0.c
@@ -61,14 +61,14 @@
#define MIN_DIFFERENCE (CONFIG_NET_RPL_MIN_HOP_RANK_INC + \
CONFIG_NET_RPL_MIN_HOP_RANK_INC / 2)
-static uint16_t net_rpl_of0_get(void)
+static u16_t net_rpl_of0_get(void)
{
return 0;
}
-uint16_t net_rpl_of_get(void) ALIAS_OF(net_rpl_of0_get);
+u16_t net_rpl_of_get(void) ALIAS_OF(net_rpl_of0_get);
-static bool net_rpl_of0_find(uint16_t ocp)
+static bool net_rpl_of0_find(u16_t ocp)
{
if (ocp != 0) {
return false;
@@ -77,7 +77,7 @@
return true;
}
-bool net_rpl_of_find(uint16_t ocp) ALIAS_OF(net_rpl_of0_find);
+bool net_rpl_of_find(u16_t ocp) ALIAS_OF(net_rpl_of0_find);
static void net_rpl_of0_reset(struct net_rpl_dag *dag)
{
@@ -103,7 +103,7 @@
struct net_rpl_parent *parent1,
struct net_rpl_parent *parent2)
{
- uint16_t rank1, rank2;
+ u16_t rank1, rank2;
struct net_rpl_dag *dag;
struct net_nbr *nbr1, *nbr2;
@@ -199,10 +199,10 @@
struct net_rpl_dag *dag2)
ALIAS_OF(net_rpl_of0_best_dag);
-static uint16_t net_rpl_of0_calc_rank(struct net_rpl_parent *parent,
- uint16_t base_rank)
+static u16_t net_rpl_of0_calc_rank(struct net_rpl_parent *parent,
+ u16_t base_rank)
{
- uint16_t increment;
+ u16_t increment;
if (base_rank == 0) {
if (!parent) {
@@ -215,7 +215,7 @@
increment = parent ? parent->dag->instance->min_hop_rank_inc :
DEFAULT_RANK_INCREMENT;
- if ((uint16_t)(base_rank + increment) < base_rank) {
+ if ((u16_t)(base_rank + increment) < base_rank) {
NET_DBG("OF0 rank %d incremented to infinite rank due to "
"wrapping", base_rank);
@@ -225,8 +225,8 @@
return base_rank + increment;
}
-uint16_t net_rpl_of_calc_rank(struct net_rpl_parent *parent,
- uint16_t base_rank)
+u16_t net_rpl_of_calc_rank(struct net_rpl_parent *parent,
+ u16_t base_rank)
ALIAS_OF(net_rpl_of0_calc_rank);
static int net_rpl_of0_update_mc(struct net_rpl_instance *instance)
diff --git a/subsys/net/ip/rpl.c b/subsys/net/ip/rpl.c
index 2500edf..d6ba84c 100644
--- a/subsys/net/ip/rpl.c
+++ b/subsys/net/ip/rpl.c
@@ -111,7 +111,7 @@
static struct net_rpl_instance *rpl_default_instance;
static enum net_rpl_mode rpl_mode = NET_RPL_MODE_MESH;
static net_rpl_join_callback_t rpl_join_callback;
-static uint8_t rpl_dao_sequence;
+static u8_t rpl_dao_sequence;
#if NET_RPL_MULTICAST
static void send_mcast_dao(struct net_rpl_instance *instance);
@@ -127,7 +127,7 @@
/* This is set to true if we are able and ready to send any DIOs */
static bool rpl_dio_send_ok;
-static int dao_send(struct net_rpl_parent *parent, uint8_t lifetime,
+static int dao_send(struct net_rpl_parent *parent, u8_t lifetime,
struct net_if *iface);
static void dao_send_timer(struct k_work *work);
static void set_dao_lifetime_timer(struct net_rpl_instance *instance);
@@ -137,7 +137,7 @@
struct in6_addr *addr);
static void remove_parents(struct net_if *iface,
struct net_rpl_dag *dag,
- uint16_t minimum_rank);
+ u16_t minimum_rank);
static void net_rpl_schedule_dao_now(struct net_rpl_instance *instance);
static void net_rpl_local_repair(struct net_if *iface,
@@ -192,10 +192,10 @@
}
}
-static inline uint32_t net_rpl_lifetime(struct net_rpl_instance *instance,
- uint8_t lifetime)
+static inline u32_t net_rpl_lifetime(struct net_rpl_instance *instance,
+ u8_t lifetime)
{
- return (uint32_t)instance->lifetime_unit * (uint32_t)lifetime;
+ return (u32_t)instance->lifetime_unit * (u32_t)lifetime;
}
static void net_rpl_neighbor_data_remove(struct net_nbr *nbr)
@@ -273,7 +273,7 @@
for (i = 0; i < CONFIG_NET_IPV6_MAX_NEIGHBORS; i++) {
struct net_nbr *nbr = get_nbr(i);
- if (nbr->data == (uint8_t *)data) {
+ if (nbr->data == (u8_t *)data) {
return nbr;
}
}
@@ -333,7 +333,7 @@
if (rpl_default_instance && rpl_default_instance->current_dag) {
int curr_interval = rpl_default_instance->dio_interval_current;
int curr_rank = rpl_default_instance->current_dag->rank;
- uint32_t now = k_uptime_get_32();
+ u32_t now = k_uptime_get_32();
struct net_rpl_parent *parent;
int i;
@@ -418,8 +418,8 @@
return route;
}
-static inline void setup_icmpv6_hdr(struct net_pkt *pkt, uint8_t type,
- uint8_t code)
+static inline void setup_icmpv6_hdr(struct net_pkt *pkt, u8_t type,
+ u8_t code)
{
net_pkt_append_u8(pkt, type);
net_pkt_append_u8(pkt, code);
@@ -434,7 +434,7 @@
struct net_rpl_dag *dag = instance->current_dag;
struct in6_addr addr, *dst_addr;
struct net_pkt *pkt;
- uint16_t value;
+ u16_t value;
int ret;
pkt = net_pkt_get_reserve_tx(net_if_get_ll_reserve(iface, dst),
@@ -641,7 +641,7 @@
static void new_dio_interval(struct net_rpl_instance *instance)
{
- uint32_t time;
+ u32_t time;
time = 1 << instance->dio_interval_current;
@@ -704,7 +704,7 @@
struct in6_addr addr, *dst_addr;
const struct in6_addr *src;
struct net_pkt *pkt;
- uint16_t pos;
+ u16_t pos;
int ret;
if (!iface) {
@@ -790,7 +790,7 @@
return NET_OK;
}
-static struct net_rpl_instance *net_rpl_get_instance(uint8_t instance_id)
+static struct net_rpl_instance *net_rpl_get_instance(u8_t instance_id)
{
int i;
@@ -827,12 +827,12 @@
* (2) selecting the least recently updated parent
*/
struct net_rpl_parent *probing_target = NULL;
- uint16_t probing_target_rank = NET_RPL_INFINITE_RANK;
+ u16_t probing_target_rank = NET_RPL_INFINITE_RANK;
/* min_last_tx is the clock time NET_RPL_PROBING_EXPIRATION_TIME in
* the past
*/
- uint32_t min_last_tx = k_uptime_get_32();
+ u32_t min_last_tx = k_uptime_get_32();
struct net_rpl_parent *parent;
int i;
@@ -860,7 +860,7 @@
if (parent->dag == dag &&
parent->last_tx_time < min_last_tx) {
/* parent is in our dag and needs probing */
- uint16_t parent_rank =
+ u16_t parent_rank =
net_rpl_of_calc_rank(parent, 0);
if (!probing_target ||
@@ -1016,7 +1016,7 @@
#endif
static inline void net_rpl_instance_init(struct net_rpl_instance *instance,
- uint8_t id)
+ u8_t id)
{
memset(instance, 0, sizeof(struct net_rpl_instance));
@@ -1036,7 +1036,7 @@
#endif
}
-static struct net_rpl_instance *net_rpl_alloc_instance(uint8_t instance_id)
+static struct net_rpl_instance *net_rpl_alloc_instance(u8_t instance_id)
{
int i;
@@ -1056,7 +1056,7 @@
return NULL;
}
-static struct net_rpl_dag *alloc_dag(uint8_t instance_id,
+static struct net_rpl_dag *alloc_dag(u8_t instance_id,
struct in6_addr *dag_id)
{
struct net_rpl_instance *instance;
@@ -1094,7 +1094,7 @@
return NULL;
}
-static struct net_rpl_dag *get_dag(uint8_t instance_id,
+static struct net_rpl_dag *get_dag(u8_t instance_id,
struct in6_addr *dag_id)
{
struct net_rpl_instance *instance;
@@ -1264,9 +1264,9 @@
static
struct net_rpl_dag *net_rpl_set_root_with_version(struct net_if *iface,
- uint8_t instance_id,
+ u8_t instance_id,
struct in6_addr *dag_id,
- uint8_t version)
+ u8_t version)
{
struct net_rpl_dag *dag;
struct net_rpl_instance *instance;
@@ -1372,7 +1372,7 @@
}
struct net_rpl_dag *net_rpl_set_root(struct net_if *iface,
- uint8_t instance_id,
+ u8_t instance_id,
struct in6_addr *dag_id)
{
return net_rpl_set_root_with_version(iface, instance_id, dag_id,
@@ -1399,9 +1399,9 @@
bool net_rpl_set_prefix(struct net_if *iface,
struct net_rpl_dag *dag,
struct in6_addr *prefix,
- uint8_t prefix_len)
+ u8_t prefix_len)
{
- uint8_t last_len = dag->prefix_info.length;
+ u8_t last_len = dag->prefix_info.length;
struct net_rpl_prefix last_prefix;
if (prefix_len > 128) {
@@ -1503,7 +1503,7 @@
*/
static void remove_parents(struct net_if *iface,
struct net_rpl_dag *dag,
- uint16_t minimum_rank)
+ u16_t minimum_rank)
{
int i;
@@ -1599,10 +1599,10 @@
*/
if (instance && instance->lifetime_unit != 0xffff &&
instance->default_lifetime != 0xff) {
- uint32_t expiration_time;
+ u32_t expiration_time;
- expiration_time = (uint32_t)instance->default_lifetime *
- (uint32_t)instance->lifetime_unit *
+ expiration_time = (u32_t)instance->default_lifetime *
+ (u32_t)instance->lifetime_unit *
MSEC_PER_SEC / 2;
instance->dao_lifetime_timer_active = true;
@@ -1779,7 +1779,7 @@
return best;
}
-static int acceptable_rank(struct net_rpl_dag *dag, uint16_t rank)
+static int acceptable_rank(struct net_rpl_dag *dag, u16_t rank)
{
return rank != NET_RPL_INFINITE_RANK &&
(dag->instance->max_rank_inc == 0 ||
@@ -1795,7 +1795,7 @@
{
struct net_rpl_parent *last_parent;
struct net_rpl_dag *best_dag;
- uint16_t old_rank;
+ u16_t old_rank;
old_rank = instance->current_dag->rank;
last_parent = instance->current_dag->preferred_parent;
@@ -1911,7 +1911,7 @@
static void nullify_parents(struct net_if *iface,
struct net_rpl_dag *dag,
- uint16_t minimum_rank)
+ u16_t minimum_rank)
{
int i;
@@ -1962,7 +1962,7 @@
bool ret = true;
#if defined(CONFIG_NET_DEBUG_RPL)
- uint16_t old_rank = instance->current_dag->rank;
+ u16_t old_rank = instance->current_dag->rank;
#endif
if (!acceptable_rank(parent->dag, parent->rank)) {
@@ -2017,7 +2017,7 @@
return ret;
}
-static bool net_rpl_repair_root(uint8_t instance_id)
+static bool net_rpl_repair_root(u8_t instance_id)
{
struct net_rpl_instance *instance;
@@ -2147,7 +2147,7 @@
static void send_mcast_dao(struct net_rpl_instance *instance)
{
struct in6_addr *addr = NULL;
- uint8_t i;
+ u8_t i;
/* Send a DAO for own multicast addresses */
for (i = 0; i < NET_IF_MAX_IPV6_MADDR; i++) {
@@ -2533,7 +2533,7 @@
if (dag && instance) {
if (lollipop_greater_than(dio->version, dag->version)) {
if (dag->rank == NET_RPL_ROOT_RANK(instance)) {
- uint8_t version;
+ u8_t version;
NET_DBG("Root received inconsistent DIO "
"version number %d rank %d",
@@ -2715,9 +2715,9 @@
struct net_rpl_dio dio = { 0 };
struct net_buf *frag;
struct net_nbr *nbr;
- uint16_t offset, pos;
- uint8_t subopt_type;
- uint8_t flags, len, tmp;
+ u16_t offset, pos;
+ u8_t subopt_type;
+ u8_t flags, len, tmp;
net_rpl_info(pkt, "DODAG Information Object");
@@ -2977,16 +2977,16 @@
int net_rpl_dao_send(struct net_if *iface,
struct net_rpl_parent *parent,
struct in6_addr *prefix,
- uint8_t lifetime)
+ u8_t lifetime)
{
- uint16_t value = 0;
+ u16_t value = 0;
struct net_rpl_instance *instance;
const struct in6_addr *src;
struct net_rpl_dag *dag;
struct in6_addr *dst;
struct net_pkt *pkt;
- uint8_t prefix_bytes;
- uint8_t prefixlen;
+ u8_t prefix_bytes;
+ u8_t prefixlen;
int ret;
/* No DAOs in feather mode. */
@@ -3090,7 +3090,7 @@
}
static int dao_send(struct net_rpl_parent *parent,
- uint8_t lifetime,
+ u8_t lifetime,
struct net_if *iface)
{
struct in6_addr *prefix;
@@ -3147,8 +3147,8 @@
struct in6_addr *dst,
struct net_if *iface,
struct net_rpl_instance *instance,
- uint8_t sequence,
- uint8_t status)
+ u8_t sequence,
+ u8_t status)
{
struct net_pkt *pkt;
int ret;
@@ -3196,8 +3196,8 @@
static int forwarding_dao(struct net_rpl_instance *instance,
struct net_rpl_dag *dag,
struct net_pkt *pkt,
- uint8_t sequence,
- uint8_t flags,
+ u8_t sequence,
+ u8_t flags,
char *str)
{
struct in6_addr *paddr;
@@ -3242,15 +3242,15 @@
struct net_buf *frag;
struct in6_addr addr;
struct net_nbr *nbr;
- uint16_t offset;
- uint16_t pos;
- uint8_t sequence;
- uint8_t instance_id;
- uint8_t lifetime;
- uint8_t target_len;
- uint8_t flags;
- uint8_t subopt_type;
- uint8_t len;
+ u16_t offset;
+ u16_t pos;
+ u8_t sequence;
+ u8_t instance_id;
+ u8_t lifetime;
+ u8_t target_len;
+ u8_t flags;
+ u8_t subopt_type;
+ u8_t len;
int r = -EINVAL;
net_rpl_info(pkt, "Destination Advertisement Object");
@@ -3511,11 +3511,11 @@
{
struct net_rpl_instance *instance;
struct net_buf *frag;
- uint16_t offset;
- uint16_t pos;
- uint8_t instance_id;
- uint8_t sequence;
- uint8_t status;
+ u16_t offset;
+ u16_t pos;
+ u8_t instance_id;
+ u8_t sequence;
+ u8_t status;
net_rpl_info(pkt, "Destination Advertisement Object Ack");
@@ -3601,13 +3601,13 @@
int net_rpl_update_header(struct net_pkt *pkt, struct in6_addr *addr)
{
- uint16_t pos = 0;
+ u16_t pos = 0;
struct net_rpl_parent *parent;
struct net_buf *frag;
- uint16_t sender_rank;
- uint16_t offset;
- uint8_t opt;
- uint8_t len;
+ u16_t sender_rank;
+ u16_t offset;
+ u8_t opt;
+ u8_t len;
if (NET_IPV6_HDR(pkt)->nexthdr != NET_IPV6_NEXTHDR_HBHO) {
return 0;
@@ -3644,7 +3644,7 @@
offset = pos;
frag = net_frag_skip(frag, pos, &pos, 1); /* flags */
frag = net_frag_skip(frag, pos, &pos, 1); /* instance */
- frag = net_frag_read(frag, pos, &pos, 2, (uint8_t *)&sender_rank);
+ frag = net_frag_read(frag, pos, &pos, 2, (u8_t *)&sender_rank);
if (!frag && pos) {
return -EMSGSIZE;
}
@@ -3678,12 +3678,12 @@
}
struct net_buf *net_rpl_verify_header(struct net_pkt *pkt, struct net_buf *frag,
- uint16_t offset, uint16_t *pos,
+ u16_t offset, u16_t *pos,
bool *result)
{
struct net_rpl_instance *instance;
- uint16_t sender_rank;
- uint8_t instance_id, flags;
+ u16_t sender_rank;
+ u8_t instance_id, flags;
bool down, sender_closer;
frag = net_frag_read_u8(frag, offset, pos, &flags);
@@ -3781,7 +3781,7 @@
return frag;
}
-static inline int add_rpl_opt(struct net_pkt *pkt, uint16_t offset)
+static inline int add_rpl_opt(struct net_pkt *pkt, u16_t offset)
{
int ext_len = net_pkt_ipv6_ext_len(pkt);
bool ret;
@@ -3843,16 +3843,16 @@
static int net_rpl_update_header_empty(struct net_pkt *pkt)
{
- uint16_t offset = sizeof(struct net_ipv6_hdr);
- uint8_t next = NET_IPV6_HDR(pkt)->nexthdr;
+ u16_t offset = sizeof(struct net_ipv6_hdr);
+ u8_t next = NET_IPV6_HDR(pkt)->nexthdr;
struct net_buf *frag = pkt->frags;
struct net_rpl_instance *instance;
struct net_rpl_parent *parent;
struct net_route_entry *route;
- uint8_t next_hdr, len, length;
- uint8_t opt_type = 0, opt_len;
- uint8_t instance_id, flags;
- uint16_t pos;
+ u8_t next_hdr, len, length;
+ u8_t opt_type = 0, opt_len;
+ u8_t instance_id, flags;
+ u16_t pos;
NET_DBG("Verifying the presence of the RPL header option");
@@ -3998,16 +3998,16 @@
return 0;
}
-int net_rpl_revert_header(struct net_pkt *pkt, uint16_t offset, uint16_t *pos)
+int net_rpl_revert_header(struct net_pkt *pkt, u16_t offset, u16_t *pos)
{
struct net_rpl_instance *instance;
struct net_buf *frag;
- uint16_t sender_rank;
- uint16_t revert_pos;
- uint8_t instance_id;
- uint8_t opt_len;
- uint8_t flags;
- uint8_t opt;
+ u16_t sender_rank;
+ u16_t revert_pos;
+ u8_t instance_id;
+ u8_t opt_len;
+ u8_t flags;
+ u8_t opt;
/* Skip HBHO next header and length */
frag = net_frag_skip(pkt->frags, offset, pos, 2);
@@ -4075,7 +4075,7 @@
#if defined(CONFIG_NET_RPL_DIS_SEND)
static void dis_timeout(struct k_work *work)
{
- uint32_t dis_interval;
+ u32_t dis_interval;
NET_DBG("DIS Timer triggered at %u", k_uptime_get_32());
@@ -4091,11 +4091,11 @@
{
#if defined(CONFIG_NET_RPL_DIS_SEND)
/* Randomize the first DIS sending*/
- uint32_t dis_interval;
+ u32_t dis_interval;
dis_interval = (CONFIG_NET_RPL_DIS_INTERVAL / 2 +
- ((uint32_t)CONFIG_NET_RPL_DIS_INTERVAL *
- (uint32_t)sys_rand32_get()) / UINT_MAX -
+ ((u32_t)CONFIG_NET_RPL_DIS_INTERVAL *
+ (u32_t)sys_rand32_get()) / UINT_MAX -
NET_RPL_DIS_START_DELAY) * MSEC_PER_SEC;
k_delayed_work_init(&dis_timer, dis_timeout);
diff --git a/subsys/net/ip/rpl.h b/subsys/net/ip/rpl.h
index b6e4b38..26324c1 100644
--- a/subsys/net/ip/rpl.h
+++ b/subsys/net/ip/rpl.h
@@ -153,13 +153,13 @@
#define NET_RPL_LOLLIPOP_CIRCULAR_REGION 127
#define NET_RPL_LOLLIPOP_SEQUENCE_WINDOWS 16
-static inline uint8_t net_rpl_lollipop_init(void)
+static inline u8_t net_rpl_lollipop_init(void)
{
return NET_RPL_LOLLIPOP_MAX_VALUE -
NET_RPL_LOLLIPOP_SEQUENCE_WINDOWS + 1;
}
-static inline void net_rpl_lollipop_increment(uint8_t *counter)
+static inline void net_rpl_lollipop_increment(u8_t *counter)
{
if (*counter > NET_RPL_LOLLIPOP_CIRCULAR_REGION) {
*counter = (*counter + 1) & NET_RPL_LOLLIPOP_MAX_VALUE;
@@ -168,7 +168,7 @@
}
}
-static inline bool net_rpl_lollipop_is_init(uint8_t counter)
+static inline bool net_rpl_lollipop_is_init(u8_t counter)
{
return counter > NET_RPL_LOLLIPOP_CIRCULAR_REGION;
}
@@ -184,13 +184,13 @@
struct in6_addr prefix;
/** Lifetime of the prefix */
- uint32_t lifetime;
+ u32_t lifetime;
/** Length of the prefix */
- uint8_t length;
+ u8_t length;
/** Prefix flags */
- uint8_t flags;
+ u8_t flags;
};
/**
@@ -198,10 +198,10 @@
*/
struct net_rpl_node_energy_object {
/** Energy node flags */
- uint8_t flags;
+ u8_t flags;
/** Energy estimation */
- uint8_t estimation;
+ u8_t estimation;
};
/**
@@ -209,27 +209,27 @@
*/
struct net_rpl_metric_container {
/** Type of the container */
- uint8_t type;
+ u8_t type;
/** Container flags */
- uint8_t flags;
+ u8_t flags;
/** Aggregated value (A field) */
- uint8_t aggregated;
+ u8_t aggregated;
/**
* Precedence of this Routing Metric/Constraint object relative
* to other objects in the container.
*/
- uint8_t precedence;
+ u8_t precedence;
/** Length of the object body */
- uint8_t length;
+ u8_t length;
/** Metric container information */
union metric_object {
struct net_rpl_node_energy_object energy;
- uint16_t etx;
+ u16_t etx;
} obj;
};
@@ -244,16 +244,16 @@
struct net_rpl_metric_container mc;
/** When last transmit happened */
- uint32_t last_tx_time;
+ u32_t last_tx_time;
/** Rank of the parent */
- uint16_t rank;
+ u16_t rank;
/** Destination Advertisement Trigger Sequence Number */
- uint8_t dtsn;
+ u8_t dtsn;
/** Parent flags */
- uint8_t flags;
+ u8_t flags;
};
/**
@@ -273,27 +273,27 @@
struct net_rpl_instance *instance;
/** Minimum rank */
- uint16_t min_rank;
+ u16_t min_rank;
/** DAG rank */
- uint16_t rank;
+ u16_t rank;
/** DAG version. */
- uint8_t version;
+ u8_t version;
/** DODAG preference. */
- uint8_t preference : 3;
+ u8_t preference : 3;
/** Is this DAG used or not. */
- uint8_t is_used : 1;
+ u8_t is_used : 1;
/** Is DAG grounded or floating. */
- uint8_t is_grounded : 1;
+ u8_t is_grounded : 1;
/** Is DAG joined or not. */
- uint8_t is_joined : 1;
+ u8_t is_joined : 1;
- uint8_t _unused : 2;
+ u8_t _unused : 2;
};
/**
@@ -369,8 +369,8 @@
* added to the base rank. Otherwise, the OF uses information known
* about parent to select an increment to the base rank.
*/
-extern uint16_t net_rpl_of_calc_rank(struct net_rpl_parent *parent,
- uint16_t rank);
+extern u16_t net_rpl_of_calc_rank(struct net_rpl_parent *parent,
+ u16_t rank);
/**
* @brief RPL object function (OF) update metric container.
@@ -392,14 +392,14 @@
*
* @return true if OF is supported, false otherwise.
*/
-extern bool net_rpl_of_find(uint16_t ocp);
+extern bool net_rpl_of_find(u16_t ocp);
/**
* @brief Return RPL object function (OF) objective code point used.
*
* @return OCP (Objective Code Point) value used.
*/
-extern uint16_t net_rpl_of_get(void);
+extern u16_t net_rpl_of_get(void);
/**
* @brief RPL instance structure
@@ -432,7 +432,7 @@
struct k_delayed_work dao_retransmit_timer;
/** DAO number of retransmissions */
- uint8_t dao_transmissions;
+ u8_t dao_transmissions;
#endif
/** Network interface to send DAO */
@@ -445,33 +445,33 @@
struct net_if_router *default_route;
/** Amount of time for completion of dio interval */
- uint32_t dio_next_delay;
+ u32_t dio_next_delay;
/** Objective Code Point (Used objective function) */
- uint16_t ocp;
+ u16_t ocp;
/** MaxRankIncrease, RFC 6550, ch 6.7.6 */
- uint16_t max_rank_inc;
+ u16_t max_rank_inc;
/** MinHopRankIncrease, RFC 6550, ch 6.7.6 */
- uint16_t min_hop_rank_inc;
+ u16_t min_hop_rank_inc;
/**
* Provides the unit in seconds that is used to express route
* lifetimes in RPL. For very stable networks, it can be hours
* to days. RFC 6550, ch 6.7.6
*/
- uint16_t lifetime_unit;
+ u16_t lifetime_unit;
#if defined(CONFIG_NET_STATISTICS_RPL)
/** Number of DIO intervals for this RPL instance. */
- uint16_t dio_intervals;
+ u16_t dio_intervals;
/** Number of DIOs sent for this RPL instance. */
- uint16_t dio_send_pkt;
+ u16_t dio_send_pkt;
/** Number of DIOs received for this RPL instance. */
- uint16_t dio_recv_pkt;
+ u16_t dio_recv_pkt;
#endif /* CONFIG_NET_STATISTICS_RPL */
/**
@@ -480,31 +480,31 @@
* lifetime in seconds is (Default Lifetime) * (Lifetime Unit)
* RFC 6550, ch 6.7.6
*/
- uint8_t default_lifetime;
+ u8_t default_lifetime;
/** Instance ID of this RPL instance */
- uint8_t instance_id;
+ u8_t instance_id;
/** Destination Advertisement Trigger Sequence Number */
- uint8_t dtsn;
+ u8_t dtsn;
/** Mode of operation */
- uint8_t mop;
+ u8_t mop;
/** DIOIntervalDoublings, RFC 6550, ch 6.7.6 */
- uint8_t dio_interval_doublings;
+ u8_t dio_interval_doublings;
/** DIOIntervalMin, RFC 6550, ch 6.7.6 */
- uint8_t dio_interval_min;
+ u8_t dio_interval_min;
/** Current DIO interval */
- uint8_t dio_interval_current;
+ u8_t dio_interval_current;
/** DIORedundancyConstant, ch 6.7.6 */
- uint8_t dio_redundancy;
+ u8_t dio_redundancy;
/** Current number of DIOs received (temp var) */
- uint8_t dio_counter;
+ u8_t dio_counter;
/** Keep track of whether we can send DIOs or not (true if we can send)
*/
@@ -539,22 +539,22 @@
struct net_rpl_prefix destination_prefix;
/** Objective Code Point (OF being used) */
- uint16_t ocp;
+ u16_t ocp;
/** Current rank */
- uint16_t rank;
+ u16_t rank;
/** MaxRankIncrease, RFC 6550, ch 6.7.6 */
- uint16_t max_rank_inc;
+ u16_t max_rank_inc;
/** MinHopRankIncrease, RFC 6550, ch 6.7.6 */
- uint16_t min_hop_rank_inc;
+ u16_t min_hop_rank_inc;
/**
* Provides the unit in seconds that is used to express route
* lifetimes in RPL. For very stable networks, it can be hours
* to days. RFC 6550, ch 6.7.6
*/
- uint16_t lifetime_unit;
+ u16_t lifetime_unit;
/**
* This is the lifetime that is used as default for all RPL routes.
@@ -562,37 +562,37 @@
* lifetime in seconds is (Default Lifetime) * (Lifetime Unit)
* RFC 6550, ch 6.7.6
*/
- uint8_t default_lifetime;
+ u8_t default_lifetime;
/** Instance ID of this RPL instance */
- uint8_t instance_id;
+ u8_t instance_id;
/** Destination Advertisement Trigger Sequence Number */
- uint8_t dtsn;
+ u8_t dtsn;
/** Mode of operation */
- uint8_t mop;
+ u8_t mop;
/** DAG interval doublings */
- uint8_t dag_interval_doublings;
+ u8_t dag_interval_doublings;
/** DAG interval min */
- uint8_t dag_interval_min;
+ u8_t dag_interval_min;
/** DAG interval */
- uint8_t dag_interval_current;
+ u8_t dag_interval_current;
/** DAG redundancy constant */
- uint8_t dag_redundancy;
+ u8_t dag_redundancy;
/** Is this DAG grounded or floating */
- uint8_t grounded;
+ u8_t grounded;
/** DODAG preference */
- uint8_t preference;
+ u8_t preference;
/** DODAG version number */
- uint8_t version;
+ u8_t version;
};
/**
@@ -615,7 +615,7 @@
struct net_rpl_dag *dag;
/** Lifetime for this route entry (in seconds) */
- uint32_t lifetime;
+ u32_t lifetime;
/** Where this route came from */
enum net_rpl_route_source route_source;
@@ -782,7 +782,7 @@
* @return preference value
*/
static inline
-uint8_t net_rpl_dag_get_preference(struct net_rpl_dag *dag)
+u8_t net_rpl_dag_get_preference(struct net_rpl_dag *dag)
{
NET_ASSERT(dag);
@@ -799,7 +799,7 @@
*/
static inline
void net_rpl_dag_set_preference(struct net_rpl_dag *dag,
- uint8_t preference)
+ u8_t preference)
{
NET_ASSERT(dag && preference <= 8);
@@ -846,7 +846,7 @@
int net_rpl_dao_send(struct net_if *iface,
struct net_rpl_parent *parent,
struct in6_addr *prefix,
- uint8_t lifetime);
+ u8_t lifetime);
/**
* @brief Send a DODAG Information Object message.
@@ -874,7 +874,7 @@
* @return DAG object or NULL if creation failed.
*/
struct net_rpl_dag *net_rpl_set_root(struct net_if *iface,
- uint8_t instance_id,
+ u8_t instance_id,
struct in6_addr *dag_id);
/**
@@ -897,7 +897,7 @@
bool net_rpl_set_prefix(struct net_if *iface,
struct net_rpl_dag *dag,
struct in6_addr *prefix,
- uint8_t prefix_len);
+ u8_t prefix_len);
/**
* @brief Do global repair for this route.
@@ -928,7 +928,7 @@
* @return frag Returns the fragment where this call finished reading.
*/
struct net_buf *net_rpl_verify_header(struct net_pkt *pkt, struct net_buf *frag,
- uint16_t offset, uint16_t *pos,
+ u16_t offset, u16_t *pos,
bool *result);
/**
@@ -950,7 +950,7 @@
*
* @return 0 if ok, <0 if error.
*/
-int net_rpl_revert_header(struct net_pkt *pkt, uint16_t offset, uint16_t *pos);
+int net_rpl_revert_header(struct net_pkt *pkt, u16_t offset, u16_t *pos);
/**
* @brief Get parent IPv6 address.
diff --git a/subsys/net/ip/tcp.c b/subsys/net/ip/tcp.c
index 4df6ef5..ccd39e4 100644
--- a/subsys/net/ip/tcp.c
+++ b/subsys/net/ip/tcp.c
@@ -52,11 +52,11 @@
#endif
struct tcp_segment {
- uint32_t seq;
- uint32_t ack;
- uint16_t wnd;
- uint8_t flags;
- uint8_t optlen;
+ u32_t seq;
+ u32_t ack;
+ u16_t wnd;
+ u8_t flags;
+ u8_t optlen;
void *options;
struct sockaddr_ptr *src_addr;
const struct sockaddr *dst_addr;
@@ -74,8 +74,8 @@
static void net_tcp_trace(struct net_pkt *pkt, struct net_tcp *tcp)
{
- uint8_t flags = NET_TCP_FLAGS(pkt);
- uint32_t rel_ack, ack;
+ u8_t flags = NET_TCP_FLAGS(pkt);
+ u32_t rel_ack, ack;
ack = sys_get_be32(NET_TCP_HDR(pkt)->ack);
@@ -107,15 +107,15 @@
#define net_tcp_trace(...)
#endif /* CONFIG_NET_DEBUG_TCP */
-static inline uint32_t init_isn(void)
+static inline u32_t init_isn(void)
{
/* Randomise initial seq number */
return sys_rand32_get();
}
-static inline uint32_t retry_timeout(const struct net_tcp *tcp)
+static inline u32_t retry_timeout(const struct net_tcp *tcp)
{
- return ((uint32_t)1 << tcp->retry_timeout_shift) * INIT_RETRY_MS;
+ return ((u32_t)1 << tcp->retry_timeout_shift) * INIT_RETRY_MS;
}
#define is_6lo_technology(pkt) \
@@ -230,10 +230,10 @@
return 0;
}
-static inline uint8_t net_tcp_add_options(struct net_buf *header, size_t len,
+static inline u8_t net_tcp_add_options(struct net_buf *header, size_t len,
void *data)
{
- uint8_t optlen;
+ u8_t optlen;
memcpy(net_buf_add(header, len), data, len);
@@ -272,8 +272,8 @@
struct net_buf *header, *tail = NULL;
struct net_tcp_hdr *tcphdr;
struct net_context *context = tcp->context;
- uint16_t dst_port, src_port;
- uint8_t optlen = 0;
+ u16_t dst_port, src_port;
+ u8_t optlen = 0;
NET_ASSERT(context);
@@ -353,7 +353,7 @@
return pkt;
}
-static inline uint32_t get_recv_wnd(struct net_tcp *tcp)
+static inline u32_t get_recv_wnd(struct net_tcp *tcp)
{
ARG_UNUSED(tcp);
@@ -369,20 +369,20 @@
/* True if the (signed!) difference "seq1 - seq2" is positive and less
* than 2^29. That is, seq1 is "after" seq2.
*/
-static inline bool seq_greater(uint32_t seq1, uint32_t seq2)
+static inline bool seq_greater(u32_t seq1, u32_t seq2)
{
int d = (int)(seq1 - seq2);
return d > 0 && d < 0x20000000;
}
-int net_tcp_prepare_segment(struct net_tcp *tcp, uint8_t flags,
+int net_tcp_prepare_segment(struct net_tcp *tcp, u8_t flags,
void *options, size_t optlen,
const struct sockaddr_ptr *local,
const struct sockaddr *remote,
struct net_pkt **send_pkt)
{
- uint32_t seq;
- uint16_t wnd;
+ u32_t seq;
+ u16_t wnd;
struct tcp_segment segment = { 0 };
if (!local) {
@@ -451,9 +451,9 @@
return 0;
}
-static inline uint32_t get_size(uint32_t pos1, uint32_t pos2)
+static inline u32_t get_size(u32_t pos1, u32_t pos2)
{
- uint32_t size;
+ u32_t size;
if (pos1 <= pos2) {
size = pos2 - pos1;
@@ -482,7 +482,7 @@
#define ip_max_packet_len(...) 0
#endif /* CONFIG_NET_IPV4 */
-uint16_t net_tcp_get_recv_mss(const struct net_tcp *tcp)
+u16_t net_tcp_get_recv_mss(const struct net_tcp *tcp)
{
sa_family_t family = net_context_get_family(tcp->context);
@@ -509,10 +509,10 @@
return 0;
}
-static void net_tcp_set_syn_opt(struct net_tcp *tcp, uint8_t *options,
- uint8_t *optionlen)
+static void net_tcp_set_syn_opt(struct net_tcp *tcp, u8_t *options,
+ u8_t *optionlen)
{
- uint16_t recv_mss;
+ u16_t recv_mss;
*optionlen = 0;
@@ -523,8 +523,8 @@
recv_mss = 0;
}
- UNALIGNED_PUT(htonl((uint32_t)recv_mss | NET_TCP_MSS_HEADER),
- (uint32_t *)(options + *optionlen));
+ UNALIGNED_PUT(htonl((u32_t)recv_mss | NET_TCP_MSS_HEADER),
+ (u32_t *)(options + *optionlen));
*optionlen += NET_TCP_MSS_SIZE;
}
@@ -532,8 +532,8 @@
int net_tcp_prepare_ack(struct net_tcp *tcp, const struct sockaddr *remote,
struct net_pkt **pkt)
{
- uint8_t options[NET_TCP_MAX_OPT_SIZE];
- uint8_t optionlen;
+ u8_t options[NET_TCP_MAX_OPT_SIZE];
+ u8_t optionlen;
switch (net_tcp_get_state(tcp)) {
case NET_TCP_SYN_RCVD:
@@ -776,14 +776,14 @@
return 0;
}
-void net_tcp_ack_received(struct net_context *ctx, uint32_t ack)
+void net_tcp_ack_received(struct net_context *ctx, u32_t ack)
{
struct net_tcp *tcp = ctx->tcp;
sys_slist_t *list = &ctx->tcp->sent_list;
sys_snode_t *head;
struct net_pkt *pkt;
struct net_tcp_hdr *tcphdr;
- uint32_t seq;
+ u32_t seq;
bool valid_ack = false;
while (!sys_slist_is_empty(list)) {
@@ -850,7 +850,7 @@
static void validate_state_transition(enum net_tcp_state current,
enum net_tcp_state new)
{
- static const uint16_t valid_transitions[] = {
+ static const u16_t valid_transitions[] = {
[NET_TCP_CLOSED] = 1 << NET_TCP_LISTEN |
1 << NET_TCP_SYN_SENT,
[NET_TCP_LISTEN] = 1 << NET_TCP_SYN_RCVD |
diff --git a/subsys/net/ip/tcp.h b/subsys/net/ip/tcp.h
index a4201db..844c9f2 100644
--- a/subsys/net/ip/tcp.h
+++ b/subsys/net/ip/tcp.h
@@ -111,36 +111,36 @@
sys_slist_t sent_list;
/** Max acknowledgment. */
- uint32_t recv_max_ack;
+ u32_t recv_max_ack;
/** Current sequence number. */
- uint32_t send_seq;
+ u32_t send_seq;
/** Acknowledgment number to send in next packet. */
- uint32_t send_ack;
+ u32_t send_ack;
/** Last ACK value sent */
- uint32_t sent_ack;
+ u32_t sent_ack;
/** Current retransmit period */
- uint32_t retry_timeout_shift : 5;
+ u32_t retry_timeout_shift : 5;
/** Flags for the TCP */
- uint32_t flags : 8;
+ u32_t flags : 8;
/** Current TCP state */
- uint32_t state : 4;
+ u32_t state : 4;
/* A FIN packet has been queued for transmission */
- uint32_t fin_queued : 1;
+ u32_t fin_queued : 1;
/* An outbound FIN packet has been sent */
- uint32_t fin_sent : 1;
+ u32_t fin_sent : 1;
/* An inbound FIN packet has been received */
- uint32_t fin_rcvd : 1;
+ u32_t fin_rcvd : 1;
/* Tells if ack timer has been already cancelled. It might happen
* that the timer is executed even if it is cancelled, this is because
* of various timing issues when timer is scheduled to run.
*/
- uint32_t ack_timer_cancelled : 1;
- /** Remaining bits in this uint32_t */
- uint32_t _padding : 11;
+ u32_t ack_timer_cancelled : 1;
+ /** Remaining bits in this u32_t */
+ u32_t _padding : 11;
/** Accept callback to be called when the connection has been
* established.
@@ -176,8 +176,8 @@
*/
static inline int net_tcp_register(const struct sockaddr *remote_addr,
const struct sockaddr *local_addr,
- uint16_t remote_port,
- uint16_t local_port,
+ u16_t remote_port,
+ u16_t local_port,
net_conn_cb_t cb,
void *user_data,
struct net_conn_handle **handle)
@@ -243,7 +243,7 @@
*
* @return 0 if ok, < 0 if error
*/
-int net_tcp_prepare_segment(struct net_tcp *tcp, uint8_t flags,
+int net_tcp_prepare_segment(struct net_tcp *tcp, u8_t flags,
void *options, size_t optlen,
const struct sockaddr_ptr *local,
const struct sockaddr *remote,
@@ -317,7 +317,7 @@
* @param cts Context
* @param seq Received ACK sequence number
*/
-void net_tcp_ack_received(struct net_context *ctx, uint32_t ack);
+void net_tcp_ack_received(struct net_context *ctx, u32_t ack);
/**
* @brief Calculates and returns the MSS for a given TCP context
@@ -326,7 +326,7 @@
*
* @return Maximum Segment Size
*/
-uint16_t net_tcp_get_recv_mss(const struct net_tcp *tcp);
+u16_t net_tcp_get_recv_mss(const struct net_tcp *tcp);
/**
* @brief Obtains the state for a TCP context
diff --git a/subsys/net/ip/trickle.c b/subsys/net/ip/trickle.c
index 943e3f7..ad7405b 100644
--- a/subsys/net/ip/trickle.c
+++ b/subsys/net/ip/trickle.c
@@ -34,13 +34,13 @@
(trickle->c < trickle->k);
}
-static inline uint32_t get_end(struct net_trickle *trickle)
+static inline u32_t get_end(struct net_trickle *trickle)
{
return trickle->Istart + trickle->I;
}
/* Returns a random time point t in [I/2 , I) */
-static uint32_t get_t(uint32_t I)
+static u32_t get_t(u32_t I)
{
I >>= 1;
@@ -54,10 +54,10 @@
struct net_trickle *trickle = CONTAINER_OF(work,
struct net_trickle,
timer);
- uint32_t rand_time;
+ u32_t rand_time;
#if defined(CONFIG_NET_DEBUG_TRICKLE)
- uint32_t last_end = get_end(trickle);
+ u32_t last_end = get_end(trickle);
#endif
trickle->c = 0;
@@ -91,8 +91,8 @@
static inline void reschedule(struct net_trickle *trickle)
{
- uint32_t now = k_uptime_get_32();
- uint32_t diff = get_end(trickle) - now;
+ u32_t now = k_uptime_get_32();
+ u32_t diff = get_end(trickle) - now;
NET_DBG("now %d end in %d", now, diff);
@@ -129,7 +129,7 @@
static void setup_new_interval(struct net_trickle *trickle)
{
- uint32_t t;
+ u32_t t;
trickle->c = 0;
@@ -150,9 +150,9 @@
((Imin < 2) || (Imin > (TICK_MAX >> 1)))
int net_trickle_create(struct net_trickle *trickle,
- uint32_t Imin,
- uint8_t Imax,
- uint8_t k)
+ u32_t Imin,
+ u8_t Imax,
+ u8_t k)
{
NET_ASSERT(trickle && Imax > 0 && k > 0 && !CHECK_IMIN(Imin));
diff --git a/subsys/net/ip/udp.h b/subsys/net/ip/udp.h
index 27f20c2..6a8d112 100644
--- a/subsys/net/ip/udp.h
+++ b/subsys/net/ip/udp.h
@@ -37,8 +37,8 @@
* @return Return network packet that contains the UDP packet.
*/
static inline struct net_pkt *net_udp_append_raw(struct net_pkt *pkt,
- uint16_t src_port,
- uint16_t dst_port)
+ u16_t src_port,
+ u16_t dst_port)
{
NET_UDP_HDR(pkt)->src_port = htons(src_port);
NET_UDP_HDR(pkt)->dst_port = htons(dst_port);
@@ -65,7 +65,7 @@
*/
static inline struct net_pkt *net_udp_append(struct net_context *context,
struct net_pkt *pkt,
- uint16_t port)
+ u16_t port)
{
return net_udp_append_raw(pkt,
ntohs(net_sin((struct sockaddr *)
@@ -93,8 +93,8 @@
*/
static inline int net_udp_register(const struct sockaddr *remote_addr,
const struct sockaddr *local_addr,
- uint16_t remote_port,
- uint16_t local_port,
+ u16_t remote_port,
+ u16_t local_port,
net_conn_cb_t cb,
void *user_data,
struct net_conn_handle **handle)
diff --git a/subsys/net/ip/utils.c b/subsys/net/ip/utils.c
index a3b1fa2..f9e3e1d 100644
--- a/subsys/net/ip/utils.c
+++ b/subsys/net/ip/utils.c
@@ -42,7 +42,7 @@
return "UNK_PROTO";
}
-char *net_byte_to_hex(char *ptr, uint8_t byte, char base, bool pad)
+char *net_byte_to_hex(char *ptr, u8_t byte, char base, bool pad)
{
int i, val;
@@ -62,10 +62,10 @@
return ptr;
}
-char *net_sprint_ll_addr_buf(const uint8_t *ll, uint8_t ll_len,
+char *net_sprint_ll_addr_buf(const u8_t *ll, u8_t ll_len,
char *buf, int buflen)
{
- uint8_t i, len, blen;
+ u8_t i, len, blen;
char *ptr = buf;
switch (ll_len) {
@@ -94,9 +94,9 @@
return buf;
}
-static int net_value_to_udec(char *buf, uint32_t value, int precision)
+static int net_value_to_udec(char *buf, u32_t value, int precision)
{
- uint32_t divisor;
+ u32_t divisor;
int i;
int temp;
char *start = buf;
@@ -122,23 +122,23 @@
{
struct in_addr *addr;
struct in6_addr *addr6;
- uint16_t *w;
- uint8_t i, bl, bh, longest = 1;
- int8_t pos = -1;
+ u16_t *w;
+ u8_t i, bl, bh, longest = 1;
+ s8_t pos = -1;
char delim = ':';
unsigned char zeros[8] = { 0 };
char *ptr = dst;
int len = -1;
- uint16_t value;
+ u16_t value;
bool needcolon = false;
if (family == AF_INET6) {
addr6 = (struct in6_addr *)src;
- w = (uint16_t *)addr6->s6_addr16;
+ w = (u16_t *)addr6->s6_addr16;
len = 8;
for (i = 0; i < 8; i++) {
- uint8_t j;
+ u8_t j;
for (j = i; j < 8; j++) {
if (UNALIGNED_GET(&w[j]) != 0) {
@@ -171,9 +171,9 @@
for (i = 0; i < len; i++) {
/* IPv4 address a.b.c.d */
if (len == 4) {
- uint8_t l;
+ u8_t l;
- value = (uint32_t)addr->s4_addr[i];
+ value = (u32_t)addr->s4_addr[i];
/* net_byte_to_udec() eats 0 */
if (value == 0) {
@@ -208,7 +208,7 @@
needcolon = false;
}
- value = (uint32_t)sys_be16_to_cpu(UNALIGNED_GET(&w[i]));
+ value = (u32_t)sys_be16_to_cpu(UNALIGNED_GET(&w[i]));
bh = value >> 8;
bl = value & 0xff;
@@ -373,10 +373,10 @@
return 0;
}
-static uint16_t calc_chksum(uint16_t sum, const uint8_t *ptr, uint16_t len)
+static u16_t calc_chksum(u16_t sum, const u8_t *ptr, u16_t len)
{
- uint16_t tmp;
- const uint8_t *end;
+ u16_t tmp;
+ const u8_t *end;
end = ptr + len - 1;
@@ -400,14 +400,14 @@
return sum;
}
-static inline uint16_t calc_chksum_pkt(uint16_t sum, struct net_pkt *pkt,
- uint16_t upper_layer_len)
+static inline u16_t calc_chksum_pkt(u16_t sum, struct net_pkt *pkt,
+ u16_t upper_layer_len)
{
struct net_buf *frag = pkt->frags;
- uint16_t proto_len = net_pkt_ip_hdr_len(pkt) +
+ u16_t proto_len = net_pkt_ip_hdr_len(pkt) +
net_pkt_ipv6_ext_len(pkt);
- int16_t len = frag->len - proto_len;
- uint8_t *ptr = frag->data + proto_len;
+ s16_t len = frag->len - proto_len;
+ u8_t *ptr = frag->data + proto_len;
ARG_UNUSED(upper_layer_len);
@@ -428,7 +428,7 @@
/* Do we need to take first byte from next fragment */
if (len % 2) {
- uint16_t tmp = *ptr;
+ u16_t tmp = *ptr;
sum += tmp;
if (sum < tmp) {
sum++;
@@ -443,10 +443,10 @@
return sum;
}
-uint16_t net_calc_chksum(struct net_pkt *pkt, uint8_t proto)
+u16_t net_calc_chksum(struct net_pkt *pkt, u8_t proto)
{
- uint16_t upper_layer_len;
- uint16_t sum;
+ u16_t upper_layer_len;
+ u16_t sum;
switch (net_pkt_family(pkt)) {
#if defined(CONFIG_NET_IPV4)
@@ -462,7 +462,7 @@
upper_layer_len));
} else {
sum = calc_chksum(upper_layer_len + proto,
- (uint8_t *)&NET_IPV4_HDR(pkt)->src,
+ (u8_t *)&NET_IPV4_HDR(pkt)->src,
2 * sizeof(struct in_addr));
}
break;
@@ -472,7 +472,7 @@
upper_layer_len = (NET_IPV6_HDR(pkt)->len[0] << 8) +
NET_IPV6_HDR(pkt)->len[1] - net_pkt_ipv6_ext_len(pkt);
sum = calc_chksum(upper_layer_len + proto,
- (uint8_t *)&NET_IPV6_HDR(pkt)->src,
+ (u8_t *)&NET_IPV6_HDR(pkt)->src,
2 * sizeof(struct in6_addr));
break;
#endif
@@ -489,11 +489,11 @@
}
#if defined(CONFIG_NET_IPV4)
-uint16_t net_calc_chksum_ipv4(struct net_pkt *pkt)
+u16_t net_calc_chksum_ipv4(struct net_pkt *pkt)
{
- uint16_t sum;
+ u16_t sum;
- sum = calc_chksum(0, (uint8_t *)NET_IPV4_HDR(pkt), NET_IPV4H_LEN);
+ sum = calc_chksum(0, (u8_t *)NET_IPV4_HDR(pkt), NET_IPV4H_LEN);
sum = (sum == 0) ? 0xffff : htons(sum);
diff --git a/subsys/net/lib/dns/dns_pack.c b/subsys/net/lib/dns/dns_pack.c
index cdf2bcd..7ddd361 100644
--- a/subsys/net/lib/dns/dns_pack.c
+++ b/subsys/net/lib/dns/dns_pack.c
@@ -34,22 +34,22 @@
#define DNS_FLAGS1 DNS_RECURSION /* QR, Opcode, AA, and TC = 0 */
#define DNS_FLAGS2 0 /* RA, Z and RCODE = 0 */
-static inline uint16_t dns_strlen(const char *str)
+static inline u16_t dns_strlen(const char *str)
{
if (str == NULL) {
return 0;
}
- return (uint16_t)strlen(str);
+ return (u16_t)strlen(str);
}
-int dns_msg_pack_qname(uint16_t *len, uint8_t *buf, uint16_t size,
+int dns_msg_pack_qname(u16_t *len, u8_t *buf, u16_t size,
const char *domain_name)
{
- uint16_t dn_size;
- uint16_t lb_start;
- uint16_t lb_index;
- uint16_t lb_size;
- uint16_t i;
+ u16_t dn_size;
+ u16_t lb_start;
+ u16_t lb_index;
+ u16_t lb_size;
+ u16_t i;
lb_start = 0;
lb_index = 1;
@@ -90,19 +90,19 @@
}
static inline void set_dns_msg_response(struct dns_msg_t *dns_msg, int type,
- uint16_t pos, uint16_t len)
+ u16_t pos, u16_t len)
{
dns_msg->response_type = type;
dns_msg->response_position = pos;
dns_msg->response_length = len;
}
-int dns_unpack_answer(struct dns_msg_t *dns_msg, int dname_ptr, uint32_t *ttl)
+int dns_unpack_answer(struct dns_msg_t *dns_msg, int dname_ptr, u32_t *ttl)
{
- uint16_t buf_size;
- uint16_t pos;
- uint16_t len;
- uint8_t *answer;
+ u16_t buf_size;
+ u16_t pos;
+ u16_t len;
+ u8_t *answer;
int ptr;
answer = dns_msg->msg + dns_msg->answer_offset;
@@ -166,8 +166,8 @@
int dns_unpack_response_header(struct dns_msg_t *msg, int src_id)
{
- uint8_t *dns_header;
- uint16_t size;
+ u8_t *dns_header;
+ u16_t size;
int qdcount;
int ancount;
int rc;
@@ -213,15 +213,15 @@
return 0;
}
-static int dns_msg_pack_query_header(uint8_t *buf, uint16_t size, uint16_t id)
+static int dns_msg_pack_query_header(u8_t *buf, u16_t size, u16_t id)
{
- uint16_t offset;
+ u16_t offset;
if (size < DNS_MSG_HEADER_SIZE) {
return -ENOMEM;
}
- UNALIGNED_PUT(htons(id), (uint16_t *)(buf));
+ UNALIGNED_PUT(htons(id), (u16_t *)(buf));
/* RD = 1, TC = 0, AA = 0, Opcode = 0, QR = 0 <-> 0x01 (1B)
* RCode = 0, Z = 0, RA = 0 <-> 0x00 (1B)
@@ -238,25 +238,25 @@
offset += DNS_HEADER_FLAGS_LEN;
/* set question counter */
- UNALIGNED_PUT(htons(1), (uint16_t *)(buf + offset));
+ UNALIGNED_PUT(htons(1), (u16_t *)(buf + offset));
offset += DNS_QDCOUNT_LEN;
/* set answer and ns rr */
- UNALIGNED_PUT(0, (uint32_t *)(buf + offset));
+ UNALIGNED_PUT(0, (u32_t *)(buf + offset));
offset += DNS_ANCOUNT_LEN + DNS_NSCOUNT_LEN;
/* set the additional records */
- UNALIGNED_PUT(0, (uint16_t *)(buf + offset));
+ UNALIGNED_PUT(0, (u16_t *)(buf + offset));
return 0;
}
-int dns_msg_pack_query(uint8_t *buf, uint16_t *len, uint16_t size,
- uint8_t *qname, uint16_t qname_len, uint16_t id,
+int dns_msg_pack_query(u8_t *buf, u16_t *len, u16_t size,
+ u8_t *qname, u16_t qname_len, u16_t id,
enum dns_rr_type qtype)
{
- uint16_t msg_size;
- uint16_t offset;
+ u16_t msg_size;
+ u16_t offset;
int rc;
msg_size = DNS_MSG_HEADER_SIZE + DNS_QTYPE_LEN + DNS_QCLASS_LEN;
@@ -275,18 +275,18 @@
offset += qname_len;
/* QType */
- UNALIGNED_PUT(htons(qtype), (uint16_t *)(buf + offset + 0));
+ UNALIGNED_PUT(htons(qtype), (u16_t *)(buf + offset + 0));
offset += DNS_QTYPE_LEN;
/* QClass */
- UNALIGNED_PUT(htons(DNS_CLASS_IN), (uint16_t *)(buf + offset));
+ UNALIGNED_PUT(htons(DNS_CLASS_IN), (u16_t *)(buf + offset));
*len = offset + DNS_QCLASS_LEN;
return 0;
}
-static int dns_find_null(int *qname_size, uint8_t *buf, uint16_t size)
+static int dns_find_null(int *qname_size, u8_t *buf, u16_t size)
{
*qname_size = 0;
while (*qname_size < size) {
@@ -300,8 +300,8 @@
int dns_unpack_response_query(struct dns_msg_t *dns_msg)
{
- uint8_t *dns_query;
- uint8_t *buf;
+ u8_t *dns_query;
+ u8_t *buf;
int remaining_size;
int qname_size;
int offset;
@@ -341,12 +341,12 @@
return 0;
}
-int dns_copy_qname(uint8_t *buf, uint16_t *len, uint16_t size,
- struct dns_msg_t *dns_msg, uint16_t pos)
+int dns_copy_qname(u8_t *buf, u16_t *len, u16_t size,
+ struct dns_msg_t *dns_msg, u16_t pos)
{
- uint16_t msg_size = dns_msg->msg_size;
- uint8_t *msg = dns_msg->msg;
- uint16_t lb_size;
+ u16_t msg_size = dns_msg->msg_size;
+ u8_t *msg = dns_msg->msg;
+ u16_t lb_size;
int rc = -EINVAL;
int i = 0;
@@ -365,7 +365,7 @@
/* pointer */
if (lb_size > DNS_LABEL_MAX_SIZE) {
- uint8_t mask = DNS_LABEL_MAX_SIZE;
+ u8_t mask = DNS_LABEL_MAX_SIZE;
if (pos + 1 >= msg_size) {
rc = -ENOMEM;
diff --git a/subsys/net/lib/dns/dns_pack.h b/subsys/net/lib/dns/dns_pack.h
index 3d41a7d..7712104 100644
--- a/subsys/net/lib/dns/dns_pack.h
+++ b/subsys/net/lib/dns/dns_pack.h
@@ -35,15 +35,15 @@
* + response_length: this is an offset. It holds the response's length.
*/
struct dns_msg_t {
- uint8_t *msg;
- uint16_t msg_size;
+ u8_t *msg;
+ u16_t msg_size;
int response_type;
- uint16_t response_position;
- uint16_t response_length;
+ u16_t response_position;
+ u16_t response_length;
- uint16_t query_offset;
- uint16_t answer_offset;
+ u16_t query_offset;
+ u16_t answer_offset;
};
#define DNS_MSG_INIT(b, s) {.msg = b, .msg_size = s, \
@@ -84,123 +84,123 @@
};
/** It returns the ID field in the DNS msg header */
-static inline int dns_header_id(uint8_t *header)
+static inline int dns_header_id(u8_t *header)
{
- return htons(UNALIGNED_GET((uint16_t *)(header)));
+ return htons(UNALIGNED_GET((u16_t *)(header)));
}
/* inline unpack routines are used to unpack data from network
* order to cpu. Similar routines without the unpack prefix are
* used for cpu to network order.
*/
-static inline int dns_unpack_header_id(uint8_t *header)
+static inline int dns_unpack_header_id(u8_t *header)
{
- return ntohs(UNALIGNED_GET((uint16_t *)(header)));
+ return ntohs(UNALIGNED_GET((u16_t *)(header)));
}
/** It returns the QR field in the DNS msg header */
-static inline int dns_header_qr(uint8_t *header)
+static inline int dns_header_qr(u8_t *header)
{
return ((*(header + 2)) & 0x80) ? 1 : 0;
}
/** It returns the OPCODE field in the DNS msg header */
-static inline int dns_header_opcode(uint8_t *header)
+static inline int dns_header_opcode(u8_t *header)
{
return ((*(header + 2)) & 0x70) >> 1;
}
/** It returns the AA field in the DNS msg header */
-static inline int dns_header_aa(uint8_t *header)
+static inline int dns_header_aa(u8_t *header)
{
return ((*(header + 2)) & 0x04) ? 1 : 0;
}
/** It returns the TC field in the DNS msg header */
-static inline int dns_header_tc(uint8_t *header)
+static inline int dns_header_tc(u8_t *header)
{
return ((*(header + 2)) & 0x02) ? 1 : 0;
}
/** It returns the RD field in the DNS msg header */
-static inline int dns_header_rd(uint8_t *header)
+static inline int dns_header_rd(u8_t *header)
{
return ((*(header + 2)) & 0x01) ? 1 : 0;
}
/** It returns the RA field in the DNS msg header */
-static inline int dns_header_ra(uint8_t *header)
+static inline int dns_header_ra(u8_t *header)
{
return ((*(header + 3)) & 0x80) >> 7;
}
/** It returns the Z field in the DNS msg header */
-static inline int dns_header_z(uint8_t *header)
+static inline int dns_header_z(u8_t *header)
{
return ((*(header + 3)) & 0x70) >> 4;
}
/** It returns the RCODE field in the DNS msg header */
-static inline int dns_header_rcode(uint8_t *header)
+static inline int dns_header_rcode(u8_t *header)
{
return ((*(header + 3)) & 0x0F);
}
/** It returns the QDCOUNT field in the DNS msg header */
-static inline int dns_header_qdcount(uint8_t *header)
+static inline int dns_header_qdcount(u8_t *header)
{
- return htons(UNALIGNED_GET((uint16_t *)(header + 4)));
+ return htons(UNALIGNED_GET((u16_t *)(header + 4)));
}
-static inline int dns_unpack_header_qdcount(uint8_t *header)
+static inline int dns_unpack_header_qdcount(u8_t *header)
{
- return ntohs(UNALIGNED_GET((uint16_t *)(header + 4)));
+ return ntohs(UNALIGNED_GET((u16_t *)(header + 4)));
}
/** It returns the ANCOUNT field in the DNS msg header */
-static inline int dns_header_ancount(uint8_t *header)
+static inline int dns_header_ancount(u8_t *header)
{
- return htons(UNALIGNED_GET((uint16_t *)(header + 6)));
+ return htons(UNALIGNED_GET((u16_t *)(header + 6)));
}
-static inline int dns_unpack_header_ancount(uint8_t *header)
+static inline int dns_unpack_header_ancount(u8_t *header)
{
- return ntohs(UNALIGNED_GET((uint16_t *)(header + 6)));
+ return ntohs(UNALIGNED_GET((u16_t *)(header + 6)));
}
/** It returns the NSCOUNT field in the DNS msg header */
-static inline int dns_header_nscount(uint8_t *header)
+static inline int dns_header_nscount(u8_t *header)
{
- return htons(UNALIGNED_GET((uint16_t *)(header + 8)));
+ return htons(UNALIGNED_GET((u16_t *)(header + 8)));
}
/** It returns the ARCOUNT field in the DNS msg header */
-static inline int dns_header_arcount(uint8_t *header)
+static inline int dns_header_arcount(u8_t *header)
{
- return htons(UNALIGNED_GET((uint16_t *)(header + 10)));
+ return htons(UNALIGNED_GET((u16_t *)(header + 10)));
}
-static inline int dns_query_qtype(uint8_t *question)
+static inline int dns_query_qtype(u8_t *question)
{
- return htons(UNALIGNED_GET((uint16_t *)(question + 0)));
+ return htons(UNALIGNED_GET((u16_t *)(question + 0)));
}
-static inline int dns_unpack_query_qtype(uint8_t *question)
+static inline int dns_unpack_query_qtype(u8_t *question)
{
- return ntohs(UNALIGNED_GET((uint16_t *)(question + 0)));
+ return ntohs(UNALIGNED_GET((u16_t *)(question + 0)));
}
-static inline int dns_query_qclass(uint8_t *question)
+static inline int dns_query_qclass(u8_t *question)
{
- return htons(UNALIGNED_GET((uint16_t *)(question + 2)));
+ return htons(UNALIGNED_GET((u16_t *)(question + 2)));
}
-static inline int dns_unpack_query_qclass(uint8_t *question)
+static inline int dns_unpack_query_qclass(u8_t *question)
{
- return ntohs(UNALIGNED_GET((uint16_t *)(question + 2)));
+ return ntohs(UNALIGNED_GET((u16_t *)(question + 2)));
}
-static inline int dns_answer_type(uint16_t dname_size, uint8_t *answer)
+static inline int dns_answer_type(u16_t dname_size, u8_t *answer)
{
/** Future versions must consider byte 0
* 4.1.3. Resource record format
@@ -209,7 +209,7 @@
return *(answer + dname_size + 1);
}
-static inline int dns_answer_class(uint16_t dname_size, uint8_t *answer)
+static inline int dns_answer_class(u16_t dname_size, u8_t *answer)
{
/** Future versions must consider byte 2
* 4.1.3. Resource record format
@@ -218,15 +218,15 @@
return *(answer + dname_size + 3);
}
-static inline int dns_answer_ttl(uint16_t dname_size, uint8_t *answer)
+static inline int dns_answer_ttl(u16_t dname_size, u8_t *answer)
{
- return ntohl(UNALIGNED_GET((uint32_t *)(answer + dname_size + 4)));
+ return ntohl(UNALIGNED_GET((u32_t *)(answer + dname_size + 4)));
}
-static inline int dns_answer_rdlength(uint16_t dname_size,
- uint8_t *answer)
+static inline int dns_answer_rdlength(u16_t dname_size,
+ u8_t *answer)
{
- return ntohs(UNALIGNED_GET((uint16_t *)(answer + dname_size + 8)));
+ return ntohs(UNALIGNED_GET((u16_t *)(answer + dname_size + 8)));
}
/**
@@ -240,7 +240,7 @@
* @retval -ENOMEM if there is no enough space to store the resultant QNAME
* @retval -EINVAL if an invalid parameter was passed as an argument
*/
-int dns_msg_pack_qname(uint16_t *len, uint8_t *buf, uint16_t size,
+int dns_msg_pack_qname(u16_t *len, u8_t *buf, u16_t size,
const char *domain_name);
/**
@@ -253,7 +253,7 @@
* @retval 0 on success
* @retval -ENOMEM on error
*/
-int dns_unpack_answer(struct dns_msg_t *dns_msg, int dname_ptr, uint32_t *ttl);
+int dns_unpack_answer(struct dns_msg_t *dns_msg, int dname_ptr, u32_t *ttl);
/**
* Unpacks the header's response.
@@ -288,8 +288,8 @@
* @retval On error, a negative value is returned.
* See: dns_msg_pack_query_header and dns_msg_pack_qname.
*/
-int dns_msg_pack_query(uint8_t *buf, uint16_t *len, uint16_t size,
- uint8_t *qname, uint16_t qname_len, uint16_t id,
+int dns_msg_pack_query(u8_t *buf, u16_t *len, u16_t size,
+ u8_t *qname, u16_t qname_len, u16_t id,
enum dns_rr_type qtype);
/**
@@ -325,7 +325,7 @@
* @retval -EINVAL if an invalid parameter was passed as an argument
* @retval -ENOMEM if the label's size is corrupted
*/
-int dns_copy_qname(uint8_t *buf, uint16_t *len, uint16_t size,
- struct dns_msg_t *dns_msg, uint16_t pos);
+int dns_copy_qname(u8_t *buf, u16_t *len, u16_t size,
+ struct dns_msg_t *dns_msg, u16_t pos);
#endif
diff --git a/subsys/net/lib/dns/resolve.c b/subsys/net/lib/dns/resolve.c
index c26a36b..c2b7716 100644
--- a/subsys/net/lib/dns/resolve.c
+++ b/subsys/net/lib/dns/resolve.c
@@ -88,7 +88,7 @@
struct sockaddr *local_addr = NULL;
socklen_t addr_len = 0;
int i = 0, idx = 0;
- uint16_t port = 0;
+ u16_t port = 0;
int ret, count;
if (!ctx) {
@@ -344,7 +344,7 @@
}
static inline int get_slot_by_id(struct dns_resolve_context *ctx,
- uint16_t dns_id)
+ u16_t dns_id)
{
int i;
@@ -360,14 +360,14 @@
static int dns_read(struct dns_resolve_context *ctx,
struct net_pkt *pkt,
struct net_buf *dns_data,
- uint16_t *dns_id,
+ u16_t *dns_id,
struct net_buf *dns_cname,
struct dns_addrinfo *info)
{
/* Helper struct to track the dns msg received from the server */
struct dns_msg_t dns_msg;
- uint32_t ttl; /* RR ttl, so far it is not passed to caller */
- uint8_t *src, *addr;
+ u32_t ttl; /* RR ttl, so far it is not passed to caller */
+ u8_t *src, *addr;
int address_size;
/* index that points to the current answer being analyzed */
int answer_ptr;
@@ -429,13 +429,13 @@
if (ctx->queries[query_idx].query_type == DNS_QUERY_TYPE_A) {
address_size = DNS_IPV4_LEN;
- addr = (uint8_t *)&net_sin(&info->ai_addr)->sin_addr;
+ addr = (u8_t *)&net_sin(&info->ai_addr)->sin_addr;
info->ai_family = AF_INET;
info->ai_addr.family = AF_INET;
info->ai_addrlen = sizeof(struct sockaddr_in);
} else if (ctx->queries[query_idx].query_type == DNS_QUERY_TYPE_AAAA) {
address_size = DNS_IPV6_LEN;
- addr = (uint8_t *)&net_sin6(&info->ai_addr)->sin6_addr;
+ addr = (u8_t *)&net_sin6(&info->ai_addr)->sin6_addr;
info->ai_family = AF_INET6;
info->ai_addr.family = AF_INET6;
info->ai_addrlen = sizeof(struct sockaddr_in6);
@@ -496,7 +496,7 @@
*/
if (items == 0) {
if (dns_msg.response_type == DNS_RESPONSE_CNAME_NO_IP) {
- uint16_t pos = dns_msg.response_position;
+ u16_t pos = dns_msg.response_position;
ret = dns_copy_qname(dns_cname->data, &dns_cname->len,
dns_cname->size, &dns_msg, pos);
@@ -548,7 +548,7 @@
struct dns_addrinfo info = { 0 };
struct net_buf *dns_cname = NULL;
struct net_buf *dns_data = NULL;
- uint16_t dns_id = 0;
+ u16_t dns_id = 0;
int ret, i;
ARG_UNUSED(net_ctx);
@@ -645,7 +645,7 @@
struct sockaddr *server;
struct net_pkt *pkt;
int server_addr_len;
- uint16_t dns_id;
+ u16_t dns_id;
int ret;
net_ctx = ctx->servers[server_idx].net_ctx;
@@ -711,7 +711,7 @@
return ret;
}
-int dns_resolve_cancel(struct dns_resolve_context *ctx, uint16_t dns_id)
+int dns_resolve_cancel(struct dns_resolve_context *ctx, u16_t dns_id)
{
int i;
@@ -745,10 +745,10 @@
int dns_resolve_name(struct dns_resolve_context *ctx,
const char *query,
enum dns_query_type type,
- uint16_t *dns_id,
+ u16_t *dns_id,
dns_resolve_cb_t cb,
void *user_data,
- int32_t timeout)
+ s32_t timeout)
{
struct net_buf *dns_data;
struct net_buf *dns_qname = NULL;
diff --git a/subsys/net/lib/http/http_client.c b/subsys/net/lib/http/http_client.c
index cbf574f..53c8786 100644
--- a/subsys/net/lib/http/http_client.c
+++ b/subsys/net/lib/http/http_client.c
@@ -16,7 +16,7 @@
#define HTTP_CONTENT_TYPE "Content-Type: "
#define HTTP_CONT_LEN_SIZE 64
-int http_request(struct net_context *net_ctx, int32_t timeout,
+int http_request(struct net_context *net_ctx, s32_t timeout,
struct http_client_request *req)
{
struct net_pkt *tx;
@@ -27,36 +27,36 @@
return -ENOMEM;
}
- if (!net_pkt_append(tx, strlen(req->method), (uint8_t *)req->method,
+ if (!net_pkt_append(tx, strlen(req->method), (u8_t *)req->method,
timeout)) {
goto lb_exit;
}
- if (!net_pkt_append(tx, strlen(req->url), (uint8_t *)req->url,
+ if (!net_pkt_append(tx, strlen(req->url), (u8_t *)req->url,
timeout)) {
goto lb_exit;
}
if (!net_pkt_append(tx, strlen(req->protocol),
- (uint8_t *)req->protocol, timeout)) {
+ (u8_t *)req->protocol, timeout)) {
goto lb_exit;
}
if (!net_pkt_append(tx, strlen(req->header_fields),
- (uint8_t *)req->header_fields,
+ (u8_t *)req->header_fields,
timeout)) {
goto lb_exit;
}
if (req->content_type_value) {
if (!net_pkt_append(tx, strlen(HTTP_CONTENT_TYPE),
- (uint8_t *)HTTP_CONTENT_TYPE,
+ (u8_t *)HTTP_CONTENT_TYPE,
timeout)) {
goto lb_exit;
}
if (!net_pkt_append(tx, strlen(req->content_type_value),
- (uint8_t *)req->content_type_value,
+ (u8_t *)req->content_type_value,
timeout)) {
goto lb_exit;
}
@@ -73,14 +73,14 @@
goto lb_exit;
}
- if (!net_pkt_append(tx, rc, (uint8_t *)content_len_str,
+ if (!net_pkt_append(tx, rc, (u8_t *)content_len_str,
timeout)) {
rc = -ENOMEM;
goto lb_exit;
}
if (!net_pkt_append(tx, req->payload_size,
- (uint8_t *)req->payload,
+ (u8_t *)req->payload,
timeout)) {
rc = -ENOMEM;
goto lb_exit;
@@ -88,7 +88,7 @@
} else {
if (!net_pkt_append(tx, strlen(HTTP_EOF),
- (uint8_t *)HTTP_EOF,
+ (u8_t *)HTTP_EOF,
timeout)) {
goto lb_exit;
}
@@ -102,7 +102,7 @@
return rc;
}
-int http_request_get(struct net_context *net_ctx, int32_t timeout, char *url,
+int http_request_get(struct net_context *net_ctx, s32_t timeout, char *url,
char *header_fields)
{
struct http_client_request req = {
@@ -114,7 +114,7 @@
return http_request(net_ctx, timeout, &req);
}
-int http_request_head(struct net_context *net_ctx, int32_t timeout, char *url,
+int http_request_head(struct net_context *net_ctx, s32_t timeout, char *url,
char *header_fields)
{
struct http_client_request req = {
@@ -126,7 +126,7 @@
return http_request(net_ctx, timeout, &req);
}
-int http_request_options(struct net_context *net_ctx, int32_t timeout,
+int http_request_options(struct net_context *net_ctx, s32_t timeout,
char *url, char *header_fields)
{
struct http_client_request req = {
@@ -138,7 +138,7 @@
return http_request(net_ctx, timeout, &req);
}
-int http_request_post(struct net_context *net_ctx, int32_t timeout, char *url,
+int http_request_post(struct net_context *net_ctx, s32_t timeout, char *url,
char *header_fields, char *content_type_value,
char *payload)
{
diff --git a/subsys/net/lib/http/http_parser.c b/subsys/net/lib/http/http_parser.c
index 07139b8..36a3378 100644
--- a/subsys/net/lib/http/http_parser.c
+++ b/subsys/net/lib/http/http_parser.c
@@ -30,7 +30,7 @@
#include <limits.h>
#ifndef ULLONG_MAX
-# define ULLONG_MAX ((uint64_t) -1) /* 2^64-1 */
+# define ULLONG_MAX ((u64_t) -1) /* 2^64-1 */
#endif
#ifndef MIN
@@ -159,7 +159,7 @@
static const
-int8_t unhex[256] = {
+s8_t unhex[256] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -178,7 +178,7 @@
#endif
-static const uint8_t normal_url_char[32] = {
+static const u8_t normal_url_char[32] = {
/* 0 nul 1 soh 2 stx 3 etx 4 eot 5 enq 6 ack 7 bel */
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0,
/* 8 bs 9 ht 10 nl 11 vt 12 np 13 cr 14 so 15 si */
@@ -805,8 +805,8 @@
break;
case h_content_length: {
- uint64_t t;
- uint64_t value;
+ u64_t t;
+ u64_t value;
if (ch == ' ') {
break;
@@ -1005,7 +1005,7 @@
const char *url_mark = 0;
const char *body_mark = 0;
const char *status_mark = 0;
- int8_t unhex_val;
+ s8_t unhex_val;
int rc;
char ch;
char c;
@@ -1461,7 +1461,7 @@
; /* nada */
} else if (IS_ALPHA(ch)) {
- uint64_t sw_option = parser->method << 16 |
+ u64_t sw_option = parser->method << 16 |
parser->index << 8 | ch;
switch (sw_option) {
case (HTTP_POST << 16 | 1 << 8 | 'U'):
@@ -2235,8 +2235,8 @@
}
case s_body_identity: {
- uint64_t to_read = MIN(parser->content_length,
- (uint64_t) ((data + len) - p));
+ u64_t to_read = MIN(parser->content_length,
+ (u64_t) ((data + len) - p));
assert(parser->content_length != 0
&& parser->content_length != ULLONG_MAX);
@@ -2331,7 +2331,7 @@
}
case s_chunk_size: {
- uint64_t t;
+ u64_t t;
assert(parser->flags & F_CHUNKED);
@@ -2359,7 +2359,7 @@
/* Overflow? Test against a conservative limit for
* simplicity.
*/
- uint64_t ulong_value = (ULLONG_MAX - 16) / 16;
+ u64_t ulong_value = (ULLONG_MAX - 16) / 16;
if (UNLIKELY(ulong_value < parser->content_length)) {
SET_ERRNO(HPE_INVALID_CONTENT_LENGTH);
@@ -2408,8 +2408,8 @@
}
case s_chunk_data: {
- uint64_t to_read = MIN(parser->content_length,
- (uint64_t) ((data + len) - p));
+ u64_t to_read = MIN(parser->content_length,
+ (u64_t) ((data + len) - p));
assert(parser->flags & F_CHUNKED);
assert(parser->content_length != 0
@@ -2900,7 +2900,7 @@
return 1;
}
- u->port = (uint16_t) v;
+ u->port = (u16_t) v;
}
return 0;
diff --git a/subsys/net/lib/http/http_server.c b/subsys/net/lib/http/http_server.c
index 7c3630b..5428c72 100644
--- a/subsys/net/lib/http/http_server.c
+++ b/subsys/net/lib/http/http_server.c
@@ -23,7 +23,7 @@
#define HTTP_STATUS_404_NF "HTTP/1.1 404 Not Found\r\n" \
"\r\n"
-static inline uint16_t http_strlen(const char *str)
+static inline u16_t http_strlen(const char *str)
{
if (str) {
return strlen(str);
@@ -32,20 +32,20 @@
return 0;
}
-static int http_add_header(struct net_pkt *tx, int32_t timeout, const char *str)
+static int http_add_header(struct net_pkt *tx, s32_t timeout, const char *str)
{
- if (net_pkt_append(tx, strlen(str), (uint8_t *)str, timeout)) {
+ if (net_pkt_append(tx, strlen(str), (u8_t *)str, timeout)) {
return 0;
}
return -ENOMEM;
}
-static int http_add_chunk(struct net_pkt *tx, int32_t timeout, const char *str)
+static int http_add_chunk(struct net_pkt *tx, s32_t timeout, const char *str)
{
char chunk_header[16];
char *rn = "\r\n";
- uint16_t str_len;
+ u16_t str_len;
str_len = http_strlen(str);
@@ -56,7 +56,7 @@
}
if (str_len > 0) {
- if (!net_pkt_append(tx, str_len, (uint8_t *)str, timeout)) {
+ if (!net_pkt_append(tx, str_len, (u8_t *)str, timeout)) {
return -ENOMEM;
}
}
diff --git a/subsys/net/lib/mqtt/mqtt.c b/subsys/net/lib/mqtt/mqtt.c
index 9a4f696..f6049a8 100644
--- a/subsys/net/lib/mqtt/mqtt.c
+++ b/subsys/net/lib/mqtt/mqtt.c
@@ -71,8 +71,8 @@
{
struct net_pkt *tx = NULL;
/* DISCONNECT is a zero length message: 2 bytes required, no payload */
- uint8_t msg[2];
- uint16_t len;
+ u8_t msg[2];
+ u16_t len;
int rc;
rc = mqtt_pack_disconnect(msg, &len, sizeof(msg));
@@ -125,12 +125,12 @@
* @retval -EIO on network error
*/
static
-int mqtt_tx_pub_msgs(struct mqtt_ctx *ctx, uint16_t id,
+int mqtt_tx_pub_msgs(struct mqtt_ctx *ctx, u16_t id,
enum mqtt_packet pkt_type)
{
struct net_pkt *tx = NULL;
- uint8_t msg[4];
- uint16_t len;
+ u8_t msg[4];
+ u16_t len;
int rc;
switch (pkt_type) {
@@ -180,22 +180,22 @@
return rc;
}
-int mqtt_tx_puback(struct mqtt_ctx *ctx, uint16_t id)
+int mqtt_tx_puback(struct mqtt_ctx *ctx, u16_t id)
{
return mqtt_tx_pub_msgs(ctx, id, MQTT_PUBACK);
}
-int mqtt_tx_pubcomp(struct mqtt_ctx *ctx, uint16_t id)
+int mqtt_tx_pubcomp(struct mqtt_ctx *ctx, u16_t id)
{
return mqtt_tx_pub_msgs(ctx, id, MQTT_PUBCOMP);
}
-int mqtt_tx_pubrec(struct mqtt_ctx *ctx, uint16_t id)
+int mqtt_tx_pubrec(struct mqtt_ctx *ctx, u16_t id)
{
return mqtt_tx_pub_msgs(ctx, id, MQTT_PUBREC);
}
-int mqtt_tx_pubrel(struct mqtt_ctx *ctx, uint16_t id)
+int mqtt_tx_pubrel(struct mqtt_ctx *ctx, u16_t id)
{
return mqtt_tx_pub_msgs(ctx, id, MQTT_PUBREL);
}
@@ -245,8 +245,8 @@
int mqtt_tx_pingreq(struct mqtt_ctx *ctx)
{
struct net_pkt *tx = NULL;
- uint8_t msg[2];
- uint16_t len;
+ u8_t msg[2];
+ u16_t len;
int rc;
rc = mqtt_pack_pingreq(msg, &len, sizeof(msg));
@@ -281,7 +281,7 @@
return rc;
}
-int mqtt_tx_subscribe(struct mqtt_ctx *ctx, uint16_t pkt_id, uint8_t items,
+int mqtt_tx_subscribe(struct mqtt_ctx *ctx, u16_t pkt_id, u8_t items,
const char *topics[], const enum mqtt_qos qos[])
{
struct net_buf *data = NULL;
@@ -326,7 +326,7 @@
return rc;
}
-int mqtt_tx_unsubscribe(struct mqtt_ctx *ctx, uint16_t pkt_id, uint8_t items,
+int mqtt_tx_unsubscribe(struct mqtt_ctx *ctx, u16_t pkt_id, u8_t items,
const char *topics[])
{
struct net_buf *data = NULL;
@@ -372,10 +372,10 @@
int mqtt_rx_connack(struct mqtt_ctx *ctx, struct net_buf *rx, int clean_session)
{
- uint16_t len;
- uint8_t connect_rc;
- uint8_t session;
- uint8_t *data;
+ u16_t len;
+ u8_t connect_rc;
+ u8_t session;
+ u8_t *data;
int rc;
data = rx->data;
@@ -439,11 +439,11 @@
int mqtt_rx_pub_msgs(struct mqtt_ctx *ctx, struct net_buf *rx,
enum mqtt_packet type)
{
- int (*unpack)(uint8_t *, uint16_t, uint16_t *) = NULL;
- int (*response)(struct mqtt_ctx *, uint16_t) = NULL;
- uint16_t pkt_id;
- uint16_t len;
- uint8_t *data;
+ int (*unpack)(u8_t *, u16_t, u16_t *) = NULL;
+ int (*response)(struct mqtt_ctx *, u16_t) = NULL;
+ u16_t pkt_id;
+ u16_t len;
+ u8_t *data;
int rc;
switch (type) {
@@ -542,10 +542,10 @@
int mqtt_rx_suback(struct mqtt_ctx *ctx, struct net_buf *rx)
{
enum mqtt_qos suback_qos[CONFIG_MQTT_SUBSCRIBE_MAX_TOPICS];
- uint16_t pkt_id;
- uint16_t len;
- uint8_t items;
- uint8_t *data;
+ u16_t pkt_id;
+ u16_t len;
+ u8_t items;
+ u8_t *data;
int rc;
data = rx->data;
@@ -571,9 +571,9 @@
int mqtt_rx_unsuback(struct mqtt_ctx *ctx, struct net_buf *rx)
{
- uint16_t pkt_id;
- uint16_t len;
- uint8_t *data;
+ u16_t pkt_id;
+ u16_t len;
+ u8_t *data;
int rc;
data = rx->data;
@@ -641,11 +641,11 @@
*/
static
struct net_buf *mqtt_linearize_packet(struct mqtt_ctx *ctx, struct net_pkt *rx,
- uint16_t min_size)
+ u16_t min_size)
{
struct net_buf *data = NULL;
- uint16_t data_len;
- uint16_t offset;
+ u16_t data_len;
+ u16_t offset;
int rc;
/* CONFIG_MQTT_MSG_MAX_SIZE is defined via Kconfig. So here it's
@@ -694,7 +694,7 @@
static
int mqtt_publisher_parser(struct mqtt_ctx *ctx, struct net_pkt *rx)
{
- uint16_t pkt_type = MQTT_INVALID;
+ u16_t pkt_type = MQTT_INVALID;
struct net_buf *data = NULL;
int rc = -EINVAL;
@@ -760,7 +760,7 @@
static
int mqtt_subscriber_parser(struct mqtt_ctx *ctx, struct net_pkt *rx)
{
- uint16_t pkt_type = MQTT_INVALID;
+ u16_t pkt_type = MQTT_INVALID;
struct net_buf *data = NULL;
int rc = 0;
diff --git a/subsys/net/lib/mqtt/mqtt_pkt.c b/subsys/net/lib/mqtt/mqtt_pkt.c
index 08cf82f..53150e5 100644
--- a/subsys/net/lib/mqtt/mqtt_pkt.c
+++ b/subsys/net/lib/mqtt/mqtt_pkt.c
@@ -68,10 +68,10 @@
* @retval strlen otherwise
*/
static inline
-uint16_t mqtt_strlen(const char *str)
+u16_t mqtt_strlen(const char *str)
{
if (str) {
- return (uint16_t)strlen(str);
+ return (u16_t)strlen(str);
}
return 0;
@@ -87,7 +87,7 @@
* @retval -EINVAL
*/
static
-int compute_rlen_size(uint16_t *size, uint32_t len)
+int compute_rlen_size(u16_t *size, u32_t len)
{
if (len <= 127) {
*size = 1;
@@ -112,10 +112,10 @@
*
* @retval 0 always
*/
-static int rlen_encode(uint8_t *buf, uint32_t len)
+static int rlen_encode(u8_t *buf, u32_t len)
{
- uint8_t encoded;
- uint8_t i;
+ u8_t encoded;
+ u8_t i;
i = 0;
do {
@@ -144,13 +144,13 @@
* @retval 0 on success
* @retval -ENOMEM if size < 4
*/
-static int rlen_decode(uint32_t *rlen, uint16_t *rlen_size,
- uint8_t *buf, uint16_t size)
+static int rlen_decode(u32_t *rlen, u16_t *rlen_size,
+ u8_t *buf, u16_t size)
{
- uint32_t value = 0;
- uint32_t mult = 1;
- uint16_t i = 0;
- uint8_t encoded;
+ u32_t value = 0;
+ u32_t mult = 1;
+ u16_t i = 0;
+ u8_t encoded;
do {
if (i >= ENCLENBUF_MAX_SIZE || i >= size) {
@@ -168,8 +168,8 @@
return 0;
}
-int mqtt_pack_connack(uint8_t *buf, uint16_t *length, uint16_t size,
- uint8_t session_present, uint8_t ret_code)
+int mqtt_pack_connack(u8_t *buf, u16_t *length, u16_t size,
+ u8_t session_present, u8_t ret_code)
{
if (size < CONNACK_SIZE) {
return -ENOMEM;
@@ -203,8 +203,8 @@
* @retval -ENOMEM if size < 4
*/
static
-int pack_pkt_id(uint8_t *buf, uint16_t *length, uint16_t size,
- enum mqtt_packet type, uint8_t reserved, uint16_t pkt_id)
+int pack_pkt_id(u8_t *buf, u16_t *length, u16_t size,
+ enum mqtt_packet type, u8_t reserved, u16_t pkt_id)
{
if (size < MSG_PKTID_ONLY_SIZE) {
return -ENOMEM;
@@ -212,51 +212,51 @@
buf[0] = (type << 4) + (reserved & 0x0F);
buf[1] = PACKET_ID_SIZE;
- UNALIGNED_PUT(htons(pkt_id), (uint16_t *)(buf + PACKET_ID_SIZE));
+ UNALIGNED_PUT(htons(pkt_id), (u16_t *)(buf + PACKET_ID_SIZE));
*length = MSG_PKTID_ONLY_SIZE;
return 0;
}
-int mqtt_pack_puback(uint8_t *buf, uint16_t *length, uint16_t size,
- uint16_t pkt_id)
+int mqtt_pack_puback(u8_t *buf, u16_t *length, u16_t size,
+ u16_t pkt_id)
{
return pack_pkt_id(buf, length, size, MQTT_PUBACK, 0, pkt_id);
}
-int mqtt_pack_pubrec(uint8_t *buf, uint16_t *length, uint16_t size,
- uint16_t pkt_id)
+int mqtt_pack_pubrec(u8_t *buf, u16_t *length, u16_t size,
+ u16_t pkt_id)
{
return pack_pkt_id(buf, length, size, MQTT_PUBREC, 0, pkt_id);
}
-int mqtt_pack_pubrel(uint8_t *buf, uint16_t *length, uint16_t size,
- uint16_t pkt_id)
+int mqtt_pack_pubrel(u8_t *buf, u16_t *length, u16_t size,
+ u16_t pkt_id)
{
return pack_pkt_id(buf, length, size, MQTT_PUBREL, PUBREL_RESERVED,
pkt_id);
}
-int mqtt_pack_pubcomp(uint8_t *buf, uint16_t *length, uint16_t size,
- uint16_t pkt_id)
+int mqtt_pack_pubcomp(u8_t *buf, u16_t *length, u16_t size,
+ u16_t pkt_id)
{
return pack_pkt_id(buf, length, size, MQTT_PUBCOMP, 0, pkt_id);
}
-int mqtt_pack_unsuback(uint8_t *buf, uint16_t *length, uint16_t size,
- uint16_t pkt_id)
+int mqtt_pack_unsuback(u8_t *buf, u16_t *length, u16_t size,
+ u16_t pkt_id)
{
return pack_pkt_id(buf, length, size, MQTT_UNSUBACK, 0, pkt_id);
}
-int mqtt_pack_suback(uint8_t *buf, uint16_t *length, uint16_t size,
- uint16_t pkt_id, uint8_t elements,
+int mqtt_pack_suback(u8_t *buf, u16_t *length, u16_t size,
+ u16_t pkt_id, u8_t elements,
enum mqtt_qos granted_qos[])
{
- uint16_t rlen_size;
- uint16_t offset;
- uint16_t rlen;
- uint8_t i;
+ u16_t rlen_size;
+ u16_t offset;
+ u16_t rlen;
+ u8_t i;
int rc;
@@ -276,7 +276,7 @@
rlen_encode(buf + PACKET_TYPE_SIZE, rlen);
offset = PACKET_TYPE_SIZE + rlen_size;
- UNALIGNED_PUT(htons(pkt_id), (uint16_t *)(buf + offset));
+ UNALIGNED_PUT(htons(pkt_id), (u16_t *)(buf + offset));
offset += PACKET_ID_SIZE;
for (i = 0; i < elements; i++) {
@@ -286,13 +286,13 @@
return 0;
}
-int mqtt_pack_connect(uint8_t *buf, uint16_t *length, uint16_t size,
+int mqtt_pack_connect(u8_t *buf, u16_t *length, u16_t size,
struct mqtt_connect_msg *msg)
{
- uint16_t total_buf_size;
- uint16_t rlen_size;
- uint16_t pkt_size;
- uint16_t offset;
+ u16_t total_buf_size;
+ u16_t rlen_size;
+ u16_t pkt_size;
+ u16_t offset;
int rc;
/* ----------- Payload size ----------- */
@@ -364,27 +364,27 @@
(msg->will_flag ? 1 << 2 : 0) |
(msg->clean_session ? 1 << 1 : 0);
- UNALIGNED_PUT(htons(msg->keep_alive), (uint16_t *)(buf + offset + 8));
+ UNALIGNED_PUT(htons(msg->keep_alive), (u16_t *)(buf + offset + 8));
offset += 8 + INT_SIZE;
/* end of the CONNECT's Variable Header */
/* Payload */
UNALIGNED_PUT(htons(msg->client_id_len),
- (uint16_t *)(buf + offset));
+ (u16_t *)(buf + offset));
offset += INT_SIZE;
memcpy(buf + offset, msg->client_id, msg->client_id_len);
offset += msg->client_id_len;
if (msg->will_flag) {
UNALIGNED_PUT(htons(msg->will_topic_len),
- (uint16_t *)(buf + offset));
+ (u16_t *)(buf + offset));
offset += INT_SIZE;
memcpy(buf + offset, msg->will_topic,
msg->will_topic_len);
offset += msg->will_topic_len;
UNALIGNED_PUT(htons(msg->will_msg_len),
- (uint16_t *)(buf + offset));
+ (u16_t *)(buf + offset));
offset += INT_SIZE;
memcpy(buf + offset, msg->will_msg, msg->will_msg_len);
offset += msg->will_msg_len;
@@ -392,7 +392,7 @@
if (msg->user_name) {
UNALIGNED_PUT(htons(msg->user_name_len),
- (uint16_t *)(buf + offset));
+ (u16_t *)(buf + offset));
offset += INT_SIZE;
memcpy(buf + offset, msg->user_name, msg->user_name_len);
offset += msg->user_name_len;
@@ -400,7 +400,7 @@
if (msg->password) {
UNALIGNED_PUT(htons(msg->password_len),
- (uint16_t *)(buf + offset));
+ (u16_t *)(buf + offset));
offset += INT_SIZE;
memcpy(buf + offset, msg->password, msg->password_len);
offset += msg->password_len;
@@ -423,16 +423,16 @@
* @retval -EINVAL
*/
static
-int recover_value_len(uint8_t *buf, uint16_t length, uint8_t **val,
- uint16_t *val_len)
+int recover_value_len(u8_t *buf, u16_t length, u8_t **val,
+ u16_t *val_len)
{
- uint16_t val_u16;
+ u16_t val_u16;
if (length < INT_SIZE) {
return -EINVAL;
}
- val_u16 = UNALIGNED_GET((uint16_t *)buf);
+ val_u16 = UNALIGNED_GET((u16_t *)buf);
*val_len = ntohs(val_u16);
/* malformed packet: avoid buffer overflows */
@@ -444,15 +444,15 @@
return 0;
}
-int mqtt_unpack_connect(uint8_t *buf, uint16_t length,
+int mqtt_unpack_connect(u8_t *buf, u16_t length,
struct mqtt_connect_msg *msg)
{
- uint8_t user_name_flag;
- uint8_t password_flag;
- uint16_t rlen_size;
- uint16_t val_u16;
- uint32_t rlen;
- uint8_t offset;
+ u8_t user_name_flag;
+ u8_t password_flag;
+ u16_t rlen_size;
+ u16_t val_u16;
+ u32_t rlen;
+ u8_t offset;
int rc;
memset(msg, 0x00, sizeof(struct mqtt_connect_msg));
@@ -514,12 +514,12 @@
offset += FLAGS_SIZE;
- val_u16 = UNALIGNED_GET((uint16_t *)(buf + offset));
+ val_u16 = UNALIGNED_GET((u16_t *)(buf + offset));
msg->keep_alive = ntohs(val_u16);
offset += KEEP_ALIVE_SIZE;
rc = recover_value_len(buf + offset, length - offset,
- (uint8_t **)&msg->client_id,
+ (u8_t **)&msg->client_id,
&msg->client_id_len);
if (rc != 0) {
return -EINVAL;
@@ -529,7 +529,7 @@
if (msg->will_flag) {
rc = recover_value_len(buf + offset, length - offset,
- (uint8_t **)&msg->will_topic,
+ (u8_t **)&msg->will_topic,
&msg->will_topic_len);
if (rc != 0) {
return -EINVAL;
@@ -549,7 +549,7 @@
if (user_name_flag) {
rc = recover_value_len(buf + offset, length - offset,
- (uint8_t **)&msg->user_name,
+ (u8_t **)&msg->user_name,
&msg->user_name_len);
if (rc != 0) {
return -EINVAL;
@@ -584,10 +584,10 @@
* @retval -EINVAL on error
*/
static
-int subscribe_size(uint16_t *rlen_size, uint16_t *payload_size, uint8_t items,
+int subscribe_size(u16_t *rlen_size, u16_t *payload_size, u8_t items,
const char *topics[], enum mqtt_qos with_qos)
{
- uint8_t i;
+ u8_t i;
int rc;
*payload_size = PACKET_ID_SIZE;
@@ -623,16 +623,16 @@
* @retval -EINVAL
* @retval -ENOMEM
*/
-static int mqtt_pack_subscribe_unsubscribe(uint8_t *buf, uint16_t *length,
- uint16_t size, uint16_t pkt_id,
- uint8_t items, const char *topics[],
+static int mqtt_pack_subscribe_unsubscribe(u8_t *buf, u16_t *length,
+ u16_t size, u16_t pkt_id,
+ u8_t items, const char *topics[],
const enum mqtt_qos qos[],
enum mqtt_packet type)
{
- uint16_t rlen_size;
- uint16_t payload;
- uint16_t offset;
- uint8_t i;
+ u16_t rlen_size;
+ u16_t payload;
+ u16_t offset;
+ u8_t i;
int rc;
if (items <= 0) {
@@ -666,13 +666,13 @@
offset = PACKET_TYPE_SIZE + rlen_size;
- UNALIGNED_PUT(htons(pkt_id), (uint16_t *)(buf + offset));
+ UNALIGNED_PUT(htons(pkt_id), (u16_t *)(buf + offset));
offset += PACKET_ID_SIZE;
for (i = 0; i < items; i++) {
- uint16_t topic_len = mqtt_strlen(topics[i]);
+ u16_t topic_len = mqtt_strlen(topics[i]);
- UNALIGNED_PUT(htons(topic_len), (uint16_t *)(buf + offset));
+ UNALIGNED_PUT(htons(topic_len), (u16_t *)(buf + offset));
offset += INT_SIZE;
memcpy(buf + offset, topics[i], topic_len);
@@ -689,8 +689,8 @@
return 0;
}
-int mqtt_pack_subscribe(uint8_t *buf, uint16_t *length, uint16_t size,
- uint16_t pkt_id, uint8_t items, const char *topics[],
+int mqtt_pack_subscribe(u8_t *buf, u16_t *length, u16_t size,
+ u16_t pkt_id, u8_t items, const char *topics[],
const enum mqtt_qos qos[])
{
@@ -699,23 +699,23 @@
MQTT_SUBSCRIBE);
}
-int mqtt_pack_unsubscribe(uint8_t *buf, uint16_t *length, uint16_t size,
- uint16_t pkt_id, uint8_t items, const char *topics[])
+int mqtt_pack_unsubscribe(u8_t *buf, u16_t *length, u16_t size,
+ u16_t pkt_id, u8_t items, const char *topics[])
{
return mqtt_pack_subscribe_unsubscribe(buf, length, size, pkt_id,
items, topics, NULL,
MQTT_UNSUBSCRIBE);
}
-int mqtt_unpack_subscribe(uint8_t *buf, uint16_t length, uint16_t *pkt_id,
- uint8_t *items, uint8_t elements, char *topics[],
- uint16_t topic_len[], enum mqtt_qos qos[])
+int mqtt_unpack_subscribe(u8_t *buf, u16_t length, u16_t *pkt_id,
+ u8_t *items, u8_t elements, char *topics[],
+ u16_t topic_len[], enum mqtt_qos qos[])
{
- uint16_t rmlen_size;
- uint16_t val_u16;
- uint32_t rmlen;
- uint16_t offset;
- uint8_t i;
+ u16_t rmlen_size;
+ u16_t val_u16;
+ u32_t rmlen;
+ u16_t offset;
+ u8_t i;
int rc;
rc = rlen_decode(&rmlen, &rmlen_size, buf + PACKET_TYPE_SIZE,
@@ -742,7 +742,7 @@
offset = PACKET_TYPE_SIZE + rmlen_size;
- val_u16 = UNALIGNED_GET((uint16_t *)(buf + offset));
+ val_u16 = UNALIGNED_GET((u16_t *)(buf + offset));
*pkt_id = ntohs(val_u16);
offset += PACKET_ID_SIZE;
@@ -752,7 +752,7 @@
return -EINVAL;
}
- val_u16 = UNALIGNED_GET((uint16_t *)(buf + offset));
+ val_u16 = UNALIGNED_GET((u16_t *)(buf + offset));
topic_len[i] = ntohs(val_u16);
offset += INT_SIZE;
/* invalid topic length found: malformed message */
@@ -775,16 +775,16 @@
return 0;
}
-int mqtt_unpack_suback(uint8_t *buf, uint16_t length, uint16_t *pkt_id,
- uint8_t *items, uint8_t elements,
+int mqtt_unpack_suback(u8_t *buf, u16_t length, u16_t *pkt_id,
+ u8_t *items, u8_t elements,
enum mqtt_qos granted_qos[])
{
- uint16_t rlen_size;
+ u16_t rlen_size;
enum mqtt_qos qos;
- uint16_t val_u16;
- uint32_t rlen;
- uint16_t offset;
- uint8_t i;
+ u16_t val_u16;
+ u32_t rlen;
+ u16_t offset;
+ u8_t i;
int rc;
*pkt_id = 0;
@@ -811,7 +811,7 @@
offset = PACKET_TYPE_SIZE + rlen_size;
- val_u16 = UNALIGNED_GET((uint16_t *)(buf + offset));
+ val_u16 = UNALIGNED_GET((u16_t *)(buf + offset));
*pkt_id = ntohs(val_u16);
offset += PACKET_ID_SIZE;
@@ -835,12 +835,12 @@
return 0;
}
-int mqtt_pack_publish(uint8_t *buf, uint16_t *length, uint16_t size,
+int mqtt_pack_publish(u8_t *buf, u16_t *length, u16_t size,
struct mqtt_publish_msg *msg)
{
- uint16_t offset;
- uint16_t rlen_size;
- uint16_t payload;
+ u16_t offset;
+ u16_t rlen_size;
+ u16_t payload;
int rc;
if (msg->qos < MQTT_QoS0 || msg->qos > MQTT_QoS2) {
@@ -875,7 +875,7 @@
rlen_encode(buf + PACKET_TYPE_SIZE, payload);
offset = PACKET_TYPE_SIZE + rlen_size;
- UNALIGNED_PUT(htons(msg->topic_len), (uint16_t *)(buf + offset));
+ UNALIGNED_PUT(htons(msg->topic_len), (u16_t *)(buf + offset));
offset += INT_SIZE;
memcpy(buf + offset, msg->topic, msg->topic_len);
@@ -883,7 +883,7 @@
/* packet id is only present for QoS 1 and 2 */
if (msg->qos > MQTT_QoS0) {
- UNALIGNED_PUT(htons(msg->pkt_id), (uint16_t *)(buf + offset));
+ UNALIGNED_PUT(htons(msg->pkt_id), (u16_t *)(buf + offset));
offset += PACKET_ID_SIZE;
}
@@ -895,13 +895,13 @@
return 0;
}
-int mqtt_unpack_publish(uint8_t *buf, uint16_t length,
+int mqtt_unpack_publish(u8_t *buf, u16_t length,
struct mqtt_publish_msg *msg)
{
- uint16_t rmlen_size;
- uint16_t val_u16;
- uint16_t offset;
- uint32_t rmlen;
+ u16_t rmlen_size;
+ u16_t val_u16;
+ u16_t offset;
+ u32_t rmlen;
int rc;
if (buf[0] >> 4 != MQTT_PUBLISH) {
@@ -923,7 +923,7 @@
}
offset = PACKET_TYPE_SIZE + rmlen_size;
- val_u16 = UNALIGNED_GET((uint16_t *)(buf + offset));
+ val_u16 = UNALIGNED_GET((u16_t *)(buf + offset));
msg->topic_len = ntohs(val_u16);
offset += INT_SIZE;
@@ -934,7 +934,7 @@
msg->topic = (char *)(buf + offset);
offset += msg->topic_len;
- val_u16 = UNALIGNED_GET((uint16_t *)(buf + offset));
+ val_u16 = UNALIGNED_GET((u16_t *)(buf + offset));
if (msg->qos == MQTT_QoS1 || msg->qos == MQTT_QoS2) {
msg->pkt_id = ntohs(val_u16);
offset += PACKET_ID_SIZE;
@@ -948,8 +948,8 @@
return 0;
}
-int mqtt_unpack_connack(uint8_t *buf, uint16_t length, uint8_t *session,
- uint8_t *connect_rc)
+int mqtt_unpack_connack(u8_t *buf, u16_t length, u8_t *session,
+ u8_t *connect_rc)
{
if (length < CONNACK_SIZE) {
return -EINVAL;
@@ -986,8 +986,8 @@
* @retval -ENOMEM
*/
static
-int pack_zerolen(uint8_t *buf, uint16_t *length, uint16_t size,
- enum mqtt_packet pkt_type, uint8_t reserved)
+int pack_zerolen(u8_t *buf, u16_t *length, u16_t size,
+ enum mqtt_packet pkt_type, u8_t reserved)
{
if (size < MSG_ZEROLEN_SIZE) {
return -ENOMEM;
@@ -1000,17 +1000,17 @@
return 0;
}
-int mqtt_pack_pingreq(uint8_t *buf, uint16_t *length, uint16_t size)
+int mqtt_pack_pingreq(u8_t *buf, u16_t *length, u16_t size)
{
return pack_zerolen(buf, length, size, MQTT_PINGREQ, 0x00);
}
-int mqtt_pack_pingresp(uint8_t *buf, uint16_t *length, uint16_t size)
+int mqtt_pack_pingresp(u8_t *buf, u16_t *length, u16_t size)
{
return pack_zerolen(buf, length, size, MQTT_PINGRESP, 0x00);
}
-int mqtt_pack_disconnect(uint8_t *buf, uint16_t *length, uint16_t size)
+int mqtt_pack_disconnect(u8_t *buf, u16_t *length, u16_t size)
{
return pack_zerolen(buf, length, size, MQTT_DISCONNECT, 0x00);
}
@@ -1028,8 +1028,8 @@
* @retval -EINVAL
*/
static
-int unpack_pktid(uint8_t *buf, uint16_t length, enum mqtt_packet *type,
- uint8_t *reserved, uint16_t *pkt_id)
+int unpack_pktid(u8_t *buf, u16_t length, enum mqtt_packet *type,
+ u8_t *reserved, u16_t *pkt_id)
{
if (length < MSG_PKTID_ONLY_SIZE) {
return -EINVAL;
@@ -1041,7 +1041,7 @@
*type = buf[0] >> 4;
*reserved = buf[0] & 0x0F;
- *pkt_id = ntohs(*(uint16_t *)(buf + 2));
+ *pkt_id = ntohs(*(u16_t *)(buf + 2));
return 0;
}
@@ -1065,11 +1065,11 @@
* @retval -EINVAL
*/
static
-int unpack_pktid_validate(uint8_t *buf, uint16_t length, uint16_t *pkt_id,
- uint8_t expected_type, uint8_t expected_reserv)
+int unpack_pktid_validate(u8_t *buf, u16_t length, u16_t *pkt_id,
+ u8_t expected_type, u8_t expected_reserv)
{
enum mqtt_packet type;
- uint8_t reserved;
+ u8_t reserved;
int rc;
rc = unpack_pktid(buf, length, &type, &reserved, pkt_id);
@@ -1084,31 +1084,31 @@
return 0;
}
-int mqtt_unpack_puback(uint8_t *buf, uint16_t length, uint16_t *pkt_id)
+int mqtt_unpack_puback(u8_t *buf, u16_t length, u16_t *pkt_id)
{
return unpack_pktid_validate(buf, length, pkt_id, MQTT_PUBACK,
PUBACK_RESERVED);
}
-int mqtt_unpack_pubrec(uint8_t *buf, uint16_t length, uint16_t *pkt_id)
+int mqtt_unpack_pubrec(u8_t *buf, u16_t length, u16_t *pkt_id)
{
return unpack_pktid_validate(buf, length, pkt_id, MQTT_PUBREC,
PUBREC_RESERVED);
}
-int mqtt_unpack_pubrel(uint8_t *buf, uint16_t length, uint16_t *pkt_id)
+int mqtt_unpack_pubrel(u8_t *buf, u16_t length, u16_t *pkt_id)
{
return unpack_pktid_validate(buf, length, pkt_id, MQTT_PUBREL,
PUBREL_RESERVED);
}
-int mqtt_unpack_pubcomp(uint8_t *buf, uint16_t length, uint16_t *pkt_id)
+int mqtt_unpack_pubcomp(u8_t *buf, u16_t length, u16_t *pkt_id)
{
return unpack_pktid_validate(buf, length, pkt_id, MQTT_PUBCOMP,
PUBCOMP_RESERVED);
}
-int mqtt_unpack_unsuback(uint8_t *buf, uint16_t length, uint16_t *pkt_id)
+int mqtt_unpack_unsuback(u8_t *buf, u16_t length, u16_t *pkt_id)
{
return unpack_pktid_validate(buf, length, pkt_id, MQTT_UNSUBACK,
UNSUBACK_RESERVED);
@@ -1126,8 +1126,8 @@
* @retval -EINVAL
*/
static
-int unpack_zerolen(uint8_t *buf, uint16_t length, enum mqtt_packet *pkt_type,
- uint8_t *reserved)
+int unpack_zerolen(u8_t *buf, u16_t length, enum mqtt_packet *pkt_type,
+ u8_t *reserved)
{
if (length < MSG_ZEROLEN_SIZE) {
return -EINVAL;
@@ -1155,12 +1155,12 @@
* @retval -EINVAL
*/
static
-int unpack_zerolen_validate(uint8_t *buf, uint16_t length,
+int unpack_zerolen_validate(u8_t *buf, u16_t length,
enum mqtt_packet expected_type,
- uint8_t expected_reserved)
+ u8_t expected_reserved)
{
enum mqtt_packet pkt_type;
- uint8_t reserved;
+ u8_t reserved;
int rc;
rc = unpack_zerolen(buf, length, &pkt_type, &reserved);
@@ -1175,17 +1175,17 @@
return 0;
}
-int mqtt_unpack_pingreq(uint8_t *buf, uint16_t length)
+int mqtt_unpack_pingreq(u8_t *buf, u16_t length)
{
return unpack_zerolen_validate(buf, length, MQTT_PINGREQ, 0x00);
}
-int mqtt_unpack_pingresp(uint8_t *buf, uint16_t length)
+int mqtt_unpack_pingresp(u8_t *buf, u16_t length)
{
return unpack_zerolen_validate(buf, length, MQTT_PINGRESP, 0x00);
}
-int mqtt_unpack_disconnect(uint8_t *buf, uint16_t length)
+int mqtt_unpack_disconnect(u8_t *buf, u16_t length)
{
return unpack_zerolen_validate(buf, length, MQTT_DISCONNECT, 0x00);
}
diff --git a/subsys/net/lib/mqtt/mqtt_pkt.h b/subsys/net/lib/mqtt/mqtt_pkt.h
index 0987c2c..25305bf 100644
--- a/subsys/net/lib/mqtt/mqtt_pkt.h
+++ b/subsys/net/lib/mqtt/mqtt_pkt.h
@@ -37,8 +37,8 @@
* @retval 0 on success
* @retval -ENOMEM if size < 4
*/
-int mqtt_pack_connack(uint8_t *buf, uint16_t *length, uint16_t size,
- uint8_t session_present, uint8_t ret_code);
+int mqtt_pack_connack(u8_t *buf, u16_t *length, u16_t size,
+ u8_t session_present, u8_t ret_code);
/**
* Packs the MQTT PUBACK message
@@ -51,8 +51,8 @@
* @retval 0 on success
* @retval -ENOMEM if size < 4
*/
-int mqtt_pack_puback(uint8_t *buf, uint16_t *length, uint16_t size,
- uint16_t pkt_id);
+int mqtt_pack_puback(u8_t *buf, u16_t *length, u16_t size,
+ u16_t pkt_id);
/**
* Packs the MQTT PUBREC message
@@ -65,8 +65,8 @@
* @retval 0 on success
* @retval -ENOMEM if size < 4
*/
-int mqtt_pack_pubrec(uint8_t *buf, uint16_t *length, uint16_t size,
- uint16_t pkt_id);
+int mqtt_pack_pubrec(u8_t *buf, u16_t *length, u16_t size,
+ u16_t pkt_id);
/**
* Packs the MQTT PUBREL message
@@ -79,8 +79,8 @@
* @retval 0 on success
* @retval -ENOMEM if size < 4
*/
-int mqtt_pack_pubrel(uint8_t *buf, uint16_t *length, uint16_t size,
- uint16_t pkt_id);
+int mqtt_pack_pubrel(u8_t *buf, u16_t *length, u16_t size,
+ u16_t pkt_id);
/**
* Packs the MQTT PUBCOMP message
@@ -93,8 +93,8 @@
* @retval 0 on success
* @retval -ENOMEM if size < 4
*/
-int mqtt_pack_pubcomp(uint8_t *buf, uint16_t *length, uint16_t size,
- uint16_t pkt_id);
+int mqtt_pack_pubcomp(u8_t *buf, u16_t *length, u16_t size,
+ u16_t pkt_id);
/**
* Packs the MQTT SUBACK message
@@ -110,8 +110,8 @@
* @retval -EINVAL
* @retval -ENOMEM
*/
-int mqtt_pack_suback(uint8_t *buf, uint16_t *length, uint16_t size,
- uint16_t pkt_id, uint8_t elements,
+int mqtt_pack_suback(u8_t *buf, u16_t *length, u16_t size,
+ u16_t pkt_id, u8_t elements,
enum mqtt_qos granted_qos[]);
/**
@@ -126,7 +126,7 @@
* @retval -EINVAL
* @retval -ENOMEM
*/
-int mqtt_pack_connect(uint8_t *buf, uint16_t *length, uint16_t size,
+int mqtt_pack_connect(u8_t *buf, u16_t *length, u16_t size,
struct mqtt_connect_msg *msg);
/**
@@ -139,7 +139,7 @@
* @retval 0 on success
* @retval -EINVAL
*/
-int mqtt_unpack_connect(uint8_t *buf, uint16_t length,
+int mqtt_unpack_connect(u8_t *buf, u16_t length,
struct mqtt_connect_msg *msg);
/**
@@ -161,8 +161,8 @@
* @retval -EINVAL
* @retval -ENOMEM
*/
-int mqtt_pack_subscribe(uint8_t *buf, uint16_t *length, uint16_t size,
- uint16_t pkt_id, uint8_t items, const char *topics[],
+int mqtt_pack_subscribe(u8_t *buf, u16_t *length, u16_t size,
+ u16_t pkt_id, u8_t items, const char *topics[],
const enum mqtt_qos qos[]);
/**
@@ -180,8 +180,8 @@
* @retval -EINVAL
* @retval -ENOMEM
*/
-int mqtt_pack_unsubscribe(uint8_t *buf, uint16_t *length, uint16_t size,
- uint16_t pkt_id, uint8_t items, const char *topics[]);
+int mqtt_pack_unsubscribe(u8_t *buf, u16_t *length, u16_t size,
+ u16_t pkt_id, u8_t items, const char *topics[]);
/**
* Unpacks the MQTT SUBSCRIBE message
@@ -199,9 +199,9 @@
* @retval 0 on success
* @retval -EINVAL
*/
-int mqtt_unpack_subscribe(uint8_t *buf, uint16_t length, uint16_t *pkt_id,
- uint8_t *items, uint8_t elements, char *topics[],
- uint16_t topic_len[], enum mqtt_qos qos[]);
+int mqtt_unpack_subscribe(u8_t *buf, u16_t length, u16_t *pkt_id,
+ u8_t *items, u8_t elements, char *topics[],
+ u16_t topic_len[], enum mqtt_qos qos[]);
/**
* Unpacks the MQTT SUBACK message
@@ -216,8 +216,8 @@
* @retval 0 on success
* @retval -EINVAL
*/
-int mqtt_unpack_suback(uint8_t *buf, uint16_t length, uint16_t *pkt_id,
- uint8_t *items, uint8_t elements,
+int mqtt_unpack_suback(u8_t *buf, u16_t length, u16_t *pkt_id,
+ u8_t *items, u8_t elements,
enum mqtt_qos granted_qos[]);
/**
@@ -232,7 +232,7 @@
* @retval -EINVAL
* @retval -ENOMEM
*/
-int mqtt_pack_publish(uint8_t *buf, uint16_t *length, uint16_t size,
+int mqtt_pack_publish(u8_t *buf, u16_t *length, u16_t size,
struct mqtt_publish_msg *msg);
/**
@@ -245,7 +245,7 @@
* @retval 0 on success
* @retval -EINVAL
*/
-int mqtt_unpack_publish(uint8_t *buf, uint16_t length,
+int mqtt_unpack_publish(u8_t *buf, u16_t length,
struct mqtt_publish_msg *msg);
/**
@@ -259,8 +259,8 @@
* @retval 0 on success
* @retval -EINVAL
*/
-int mqtt_unpack_connack(uint8_t *buf, uint16_t length, uint8_t *session,
- uint8_t *connect_rc);
+int mqtt_unpack_connack(u8_t *buf, u16_t length, u8_t *session,
+ u8_t *connect_rc);
/**
* Packs the MQTT PINGREQ message
@@ -272,7 +272,7 @@
* @retval 0 on success
* @retval -ENOMEM
*/
-int mqtt_pack_pingreq(uint8_t *buf, uint16_t *length, uint16_t size);
+int mqtt_pack_pingreq(u8_t *buf, u16_t *length, u16_t size);
/**
* Packs the MQTT PINGRESP message
@@ -284,7 +284,7 @@
* @retval 0 on success
* @retval -ENOMEM
*/
-int mqtt_pack_pingresp(uint8_t *buf, uint16_t *length, uint16_t size);
+int mqtt_pack_pingresp(u8_t *buf, u16_t *length, u16_t size);
/**
* Packs the MQTT DISCONNECT message
@@ -296,7 +296,7 @@
* @retval 0 on success
* @retval -ENOMEM
*/
-int mqtt_pack_disconnect(uint8_t *buf, uint16_t *length, uint16_t size);
+int mqtt_pack_disconnect(u8_t *buf, u16_t *length, u16_t size);
/**
* Packs the MQTT UNSUBACK message
@@ -309,8 +309,8 @@
* @retval 0 on success
* @retval -ENOMEM if size < 4
*/
-int mqtt_pack_unsuback(uint8_t *buf, uint16_t *length, uint16_t size,
- uint16_t pkt_id);
+int mqtt_pack_unsuback(u8_t *buf, u16_t *length, u16_t size,
+ u16_t pkt_id);
/**
* Unpacks the MQTT PUBACK message
@@ -322,7 +322,7 @@
* @retval 0 on success
* @retval -EINVAL
*/
-int mqtt_unpack_puback(uint8_t *buf, uint16_t length, uint16_t *pkt_id);
+int mqtt_unpack_puback(u8_t *buf, u16_t length, u16_t *pkt_id);
/**
* Unpacks the MQTT PUBREC message
@@ -334,7 +334,7 @@
* @retval 0 on success
* @retval -EINVAL
*/
-int mqtt_unpack_pubrec(uint8_t *buf, uint16_t length, uint16_t *pkt_id);
+int mqtt_unpack_pubrec(u8_t *buf, u16_t length, u16_t *pkt_id);
/**
* Unpacks the MQTT PUBREL message
@@ -346,7 +346,7 @@
* @retval 0 on success
* @retval -EINVAL
*/
-int mqtt_unpack_pubrel(uint8_t *buf, uint16_t length, uint16_t *pkt_id);
+int mqtt_unpack_pubrel(u8_t *buf, u16_t length, u16_t *pkt_id);
/**
* Unpacks the MQTT PUBCOMP message
@@ -358,7 +358,7 @@
* @retval 0 on success
* @retval -EINVAL
*/
-int mqtt_unpack_pubcomp(uint8_t *buf, uint16_t length, uint16_t *pkt_id);
+int mqtt_unpack_pubcomp(u8_t *buf, u16_t length, u16_t *pkt_id);
/**
* Unpacks the MQTT UNSUBACK message
@@ -370,7 +370,7 @@
* @retval 0 on success
* @retval -EINVAL
*/
-int mqtt_unpack_unsuback(uint8_t *buf, uint16_t length, uint16_t *pkt_id);
+int mqtt_unpack_unsuback(u8_t *buf, u16_t length, u16_t *pkt_id);
/**
* Unpacks the MQTT PINGREQ message
@@ -381,7 +381,7 @@
* @retval 0 on success
* @retval -EINVAL
*/
-int mqtt_unpack_pingreq(uint8_t *buf, uint16_t length);
+int mqtt_unpack_pingreq(u8_t *buf, u16_t length);
/**
* Unpacks the MQTT PINGRESP message
@@ -392,7 +392,7 @@
* @retval 0 on success
* @retval -EINVAL
*/
-int mqtt_unpack_pingresp(uint8_t *buf, uint16_t length);
+int mqtt_unpack_pingresp(u8_t *buf, u16_t length);
/**
* Unpacks the MQTT DISCONNECT message
@@ -403,6 +403,6 @@
* @retval 0 on success
* @retval -EINVAL
*/
-int mqtt_unpack_disconnect(uint8_t *buf, uint16_t length);
+int mqtt_unpack_disconnect(u8_t *buf, u16_t length);
#endif
diff --git a/subsys/net/lib/zoap/zoap.c b/subsys/net/lib/zoap/zoap.c
index f0282a1..22a4de0 100644
--- a/subsys/net/lib/zoap/zoap.c
+++ b/subsys/net/lib/zoap/zoap.c
@@ -19,7 +19,7 @@
#include <net/zoap.h>
struct option_context {
- uint8_t *buf;
+ u8_t *buf;
int delta;
int used; /* size used of options */
int buflen;
@@ -31,28 +31,28 @@
#define BASIC_HEADER_SIZE 4
-static uint8_t coap_option_header_get_delta(uint8_t buf)
+static u8_t coap_option_header_get_delta(u8_t buf)
{
return (buf & 0xF0) >> 4;
}
-static uint8_t coap_option_header_get_len(uint8_t buf)
+static u8_t coap_option_header_get_len(u8_t buf)
{
return buf & 0x0F;
}
-static void coap_option_header_set_delta(uint8_t *buf, uint8_t delta)
+static void coap_option_header_set_delta(u8_t *buf, u8_t delta)
{
*buf = (delta & 0xF) << 4;
}
-static void coap_option_header_set_len(uint8_t *buf, uint8_t len)
+static void coap_option_header_set_len(u8_t *buf, u8_t len)
{
*buf |= (len & 0xF);
}
-static int decode_delta(int num, const uint8_t *buf, int16_t buflen,
- uint16_t *decoded)
+static int decode_delta(int num, const u8_t *buf, s16_t buflen,
+ u16_t *decoded)
{
int hdrlen = 0;
@@ -84,9 +84,9 @@
static int coap_parse_option(const struct zoap_packet *zpkt,
struct option_context *context,
- uint8_t **value, uint16_t *vlen)
+ u8_t **value, u16_t *vlen)
{
- uint16_t delta, len;
+ u16_t delta, len;
int r;
if (context->buflen < 1) {
@@ -163,7 +163,7 @@
return context.used;
}
-static uint8_t coap_header_get_tkl(const struct zoap_packet *zpkt)
+static u8_t coap_header_get_tkl(const struct zoap_packet *zpkt)
{
return zpkt->pkt->frags->data[0] & 0xF;
}
@@ -171,7 +171,7 @@
static int coap_get_header_len(const struct zoap_packet *zpkt)
{
unsigned int hdrlen;
- uint8_t tkl;
+ u8_t tkl;
hdrlen = BASIC_HEADER_SIZE;
@@ -229,9 +229,9 @@
return 0;
}
-static int delta_encode(int num, uint8_t *value, uint8_t *buf, size_t buflen)
+static int delta_encode(int num, u8_t *value, u8_t *buf, size_t buflen)
{
- uint16_t v;
+ u16_t v;
if (num < 13) {
*value = num;
@@ -260,11 +260,11 @@
return 2;
}
-static int coap_option_encode(struct option_context *context, uint16_t code,
- const void *value, uint16_t len)
+static int coap_option_encode(struct option_context *context, u16_t code,
+ const void *value, u16_t len)
{
int delta, offset, r;
- uint8_t data;
+ u8_t data;
delta = code - context->delta;
@@ -406,7 +406,7 @@
struct zoap_pending *pendings, size_t len)
{
struct zoap_pending *p;
- uint16_t resp_id = zoap_header_get_id(response);
+ u16_t resp_id = zoap_header_get_id(response);
size_t i;
for (i = 0, p = pendings; i < len; i++, p++) {
@@ -442,7 +442,7 @@
#define LAST_TIMEOUT (2345 * 4)
-static int32_t next_timeout(int32_t previous)
+static s32_t next_timeout(s32_t previous)
{
switch (previous) {
case 0:
@@ -460,7 +460,7 @@
bool zoap_pending_cycle(struct zoap_pending *pending)
{
- int32_t old = pending->timeout;
+ s32_t old = pending->timeout;
bool cont;
pending->timeout = next_timeout(pending->timeout);
@@ -489,7 +489,7 @@
const char * const *path)
{
struct zoap_option options[16];
- uint16_t count = 16;
+ u16_t count = 16;
int i, r;
r = zoap_find_options(zpkt, ZOAP_OPTION_URI_PATH, options, count);
@@ -517,7 +517,7 @@
}
static zoap_method_t method_from_code(const struct zoap_resource *resource,
- uint8_t code)
+ u8_t code)
{
switch (code) {
case ZOAP_METHOD_GET:
@@ -535,7 +535,7 @@
static bool is_request(const struct zoap_packet *zpkt)
{
- uint8_t code = zoap_header_get_code(zpkt);
+ u8_t code = zoap_header_get_code(zpkt);
return !(code & ~ZOAP_REQUEST_MASK);
}
@@ -552,7 +552,7 @@
for (resource = resources; resource && resource->path; resource++) {
zoap_method_t method;
- uint8_t code;
+ u8_t code;
/* FIXME: deal with hierarchical resources */
if (!uri_path_eq(zpkt, resource->path)) {
@@ -597,7 +597,7 @@
static int get_observe_option(const struct zoap_packet *zpkt)
{
struct zoap_option option = {};
- uint16_t count = 1;
+ u16_t count = 1;
int r;
r = zoap_find_options(zpkt, ZOAP_OPTION_OBSERVE, &option, count);
@@ -614,8 +614,8 @@
struct zoap_reply *replies, size_t len)
{
struct zoap_reply *r;
- const uint8_t *token;
- uint8_t tkl;
+ const u8_t *token;
+ u8_t tkl;
size_t i;
token = zoap_header_get_token(response, &tkl);
@@ -654,8 +654,8 @@
void zoap_reply_init(struct zoap_reply *reply,
const struct zoap_packet *request)
{
- const uint8_t *token;
- uint8_t tkl;
+ const u8_t *token;
+ u8_t tkl;
int age;
token = zoap_header_get_token(request, &tkl);
@@ -704,8 +704,8 @@
const struct zoap_packet *request,
const struct sockaddr *addr)
{
- const uint8_t *token;
- uint8_t tkl;
+ const u8_t *token;
+ u8_t tkl;
token = zoap_header_get_token(request, &tkl);
@@ -797,10 +797,10 @@
return NULL;
}
-uint8_t *zoap_packet_get_payload(struct zoap_packet *zpkt, uint16_t *len)
+u8_t *zoap_packet_get_payload(struct zoap_packet *zpkt, u16_t *len)
{
- uint8_t *appdata = zpkt->pkt->frags->data;
- uint16_t appdatalen = zpkt->pkt->frags->len;
+ u8_t *appdata = zpkt->pkt->frags->data;
+ u16_t appdatalen = zpkt->pkt->frags->len;
if (!zpkt || !len) {
return NULL;
@@ -822,7 +822,7 @@
return zpkt->start;
}
-int zoap_packet_set_used(struct zoap_packet *zpkt, uint16_t len)
+int zoap_packet_set_used(struct zoap_packet *zpkt, u16_t len)
{
if ((zpkt->pkt->frags->len + len) >
net_buf_tailroom(zpkt->pkt->frags)) {
@@ -834,8 +834,8 @@
return 0;
}
-int zoap_add_option(struct zoap_packet *zpkt, uint16_t code,
- const void *value, uint16_t len)
+int zoap_add_option(struct zoap_packet *zpkt, u16_t code,
+ const void *value, u16_t len)
{
struct net_buf *frag = zpkt->pkt->frags;
struct option_context context = { .delta = 0,
@@ -883,16 +883,16 @@
return 0;
}
-int zoap_add_option_int(struct zoap_packet *zpkt, uint16_t code,
+int zoap_add_option_int(struct zoap_packet *zpkt, u16_t code,
unsigned int val)
{
- uint8_t data[4], len;
+ u8_t data[4], len;
if (val == 0) {
data[0] = 0;
len = 0;
} else if (val < 0xFF) {
- data[0] = (uint8_t) val;
+ data[0] = (u8_t) val;
len = 1;
} else if (val < 0xFFFF) {
sys_put_be16(val, data);
@@ -909,14 +909,14 @@
return zoap_add_option(zpkt, code, data, len);
}
-int zoap_find_options(const struct zoap_packet *zpkt, uint16_t code,
- struct zoap_option *options, uint16_t veclen)
+int zoap_find_options(const struct zoap_packet *zpkt, u16_t code,
+ struct zoap_option *options, u16_t veclen)
{
struct net_buf *frag = zpkt->pkt->frags;
struct option_context context = { .delta = 0,
.used = 0 };
int hdrlen, count = 0;
- uint16_t len;
+ u16_t len;
hdrlen = coap_get_header_len(zpkt);
if (hdrlen < 0) {
@@ -924,11 +924,11 @@
}
context.buflen = frag->len - hdrlen;
- context.buf = (uint8_t *)frag->data + hdrlen;
+ context.buf = (u8_t *)frag->data + hdrlen;
while (context.delta <= code && count < veclen) {
int used = coap_parse_option(zpkt, &context,
- (uint8_t **)&options[count].value,
+ (u8_t **)&options[count].value,
&len);
options[count].len = len;
if (used < 0) {
@@ -949,26 +949,26 @@
return count;
}
-uint8_t zoap_header_get_version(const struct zoap_packet *zpkt)
+u8_t zoap_header_get_version(const struct zoap_packet *zpkt)
{
return (zpkt->pkt->frags->data[0] & 0xC0) >> 6;
}
-uint8_t zoap_header_get_type(const struct zoap_packet *zpkt)
+u8_t zoap_header_get_type(const struct zoap_packet *zpkt)
{
return (zpkt->pkt->frags->data[0] & 0x30) >> 4;
}
-uint8_t coap_header_get_code(const struct zoap_packet *zpkt)
+u8_t coap_header_get_code(const struct zoap_packet *zpkt)
{
return zpkt->pkt->frags->data[1];
}
-const uint8_t *zoap_header_get_token(const struct zoap_packet *zpkt,
- uint8_t *len)
+const u8_t *zoap_header_get_token(const struct zoap_packet *zpkt,
+ u8_t *len)
{
struct net_buf *frag = zpkt->pkt->frags;
- uint8_t tkl = coap_header_get_tkl(zpkt);
+ u8_t tkl = coap_header_get_tkl(zpkt);
if (len) {
*len = 0;
@@ -982,12 +982,12 @@
*len = tkl;
}
- return (uint8_t *)frag->data + BASIC_HEADER_SIZE;
+ return (u8_t *)frag->data + BASIC_HEADER_SIZE;
}
-uint8_t zoap_header_get_code(const struct zoap_packet *zpkt)
+u8_t zoap_header_get_code(const struct zoap_packet *zpkt)
{
- uint8_t code = coap_header_get_code(zpkt);
+ u8_t code = coap_header_get_code(zpkt);
switch (code) {
/* Methods are encoded in the code field too */
@@ -1025,26 +1025,26 @@
}
}
-uint16_t zoap_header_get_id(const struct zoap_packet *zpkt)
+u16_t zoap_header_get_id(const struct zoap_packet *zpkt)
{
return sys_get_be16(&zpkt->pkt->frags->data[2]);
}
-void zoap_header_set_version(struct zoap_packet *zpkt, uint8_t ver)
+void zoap_header_set_version(struct zoap_packet *zpkt, u8_t ver)
{
zpkt->pkt->frags->data[0] |= (ver & 0x3) << 6;
}
-void zoap_header_set_type(struct zoap_packet *zpkt, uint8_t type)
+void zoap_header_set_type(struct zoap_packet *zpkt, u8_t type)
{
zpkt->pkt->frags->data[0] |= (type & 0x3) << 4;
}
-int zoap_header_set_token(struct zoap_packet *zpkt, const uint8_t *token,
- uint8_t tokenlen)
+int zoap_header_set_token(struct zoap_packet *zpkt, const u8_t *token,
+ u8_t tokenlen)
{
struct net_buf *frag = zpkt->pkt->frags;
- uint8_t *appdata = frag->data;
+ u8_t *appdata = frag->data;
if (net_buf_tailroom(frag) < BASIC_HEADER_SIZE + tokenlen) {
return -EINVAL;
@@ -1063,12 +1063,12 @@
return 0;
}
-void zoap_header_set_code(struct zoap_packet *zpkt, uint8_t code)
+void zoap_header_set_code(struct zoap_packet *zpkt, u8_t code)
{
zpkt->pkt->frags->data[1] = code;
}
-void zoap_header_set_id(struct zoap_packet *zpkt, uint16_t id)
+void zoap_header_set_id(struct zoap_packet *zpkt, u16_t id)
{
sys_put_be16(id, &zpkt->pkt->frags->data[2]);
}
@@ -1095,7 +1095,7 @@
int zoap_add_block1_option(struct zoap_packet *zpkt,
struct zoap_block_context *ctx)
{
- uint16_t bytes = zoap_block_size_to_bytes(ctx->block_size);
+ u16_t bytes = zoap_block_size_to_bytes(ctx->block_size);
unsigned int val = 0;
int r;
@@ -1117,7 +1117,7 @@
struct zoap_block_context *ctx)
{
int r, val = 0;
- uint16_t bytes = zoap_block_size_to_bytes(ctx->block_size);
+ u16_t bytes = zoap_block_size_to_bytes(ctx->block_size);
if (is_request(zpkt)) {
SET_BLOCK_SIZE(val, ctx->block_size);
@@ -1151,7 +1151,7 @@
bool more;
};
-static int get_block_option(const struct zoap_packet *zpkt, uint16_t code)
+static int get_block_option(const struct zoap_packet *zpkt, u16_t code)
{
struct zoap_option option;
unsigned int val;
@@ -1284,12 +1284,12 @@
return ctx->current;
}
-uint8_t *zoap_next_token(void)
+u8_t *zoap_next_token(void)
{
- static uint32_t rand[2];
+ static u32_t rand[2];
rand[0] = sys_rand32_get();
rand[1] = sys_rand32_get();
- return (uint8_t *) rand;
+ return (u8_t *) rand;
}
diff --git a/subsys/net/lib/zoap/zoap_link_format.c b/subsys/net/lib/zoap/zoap_link_format.c
index daa2e84..544a999 100644
--- a/subsys/net/lib/zoap/zoap_link_format.c
+++ b/subsys/net/lib/zoap/zoap_link_format.c
@@ -34,7 +34,7 @@
strncpy(str, prefix, sizeof(prefix) - 1);
for (p = path; p && *p; ) {
- uint16_t path_len = strlen(*p);
+ u16_t path_len = strlen(*p);
str = net_buf_add(buf, path_len);
strncpy(str, *p, path_len);
@@ -109,7 +109,7 @@
}
static bool match_path_uri(const char * const *path,
- const char *uri, uint16_t len)
+ const char *uri, u16_t len)
{
const char * const *p = NULL;
int i, j, plen;
@@ -171,7 +171,7 @@
* resources with resource type lux or temperature.
*/
for (attr = attributes; attr && *attr; attr++) {
- uint16_t attr_len = strlen(*attr);
+ u16_t attr_len = strlen(*attr);
if (query->len != attr_len) {
continue;
@@ -209,7 +209,7 @@
!strncmp((char *) query->value, "href", href_len)) {
/* The stuff after 'href=' */
const char *uri = (char *) query->value + href_len + 1;
- uint16_t uri_len = query->len - (href_len + 1);
+ u16_t uri_len = query->len - (href_len + 1);
return match_path_uri(resource->path, uri, uri_len);
}
@@ -225,7 +225,7 @@
struct zoap_packet response;
struct net_pkt *pkt;
struct net_buf *frag;
- uint16_t id;
+ u16_t id;
int r;
id = zoap_header_get_id(request);
@@ -275,10 +275,10 @@
struct zoap_option query;
struct net_pkt *pkt;
struct net_buf *frag;
- const uint8_t *token;
+ const u8_t *token;
unsigned int num_queries;
- uint16_t id;
- uint8_t tkl, format = 40; /* application/link-format */
+ u16_t id;
+ u8_t tkl, format = 40; /* application/link-format */
int r;
id = zoap_header_get_id(request);
@@ -337,7 +337,7 @@
*/
while (resource++ && resource->path) {
struct net_buf *temp;
- uint8_t *str;
+ u8_t *str;
if (!match_queries_resource(resource, &query, num_queries)) {
continue;
diff --git a/tests/net/6lo/src/main.c b/tests/net/6lo/src/main.c
index 5edadbd..529d4a3 100644
--- a/tests/net/6lo/src/main.c
+++ b/tests/net/6lo/src/main.c
@@ -91,8 +91,8 @@
{ { { 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbb, 0xaa } } }
-uint8_t src_mac[8] = { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xbb };
-uint8_t dst_mac[8] = { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbb, 0xaa };
+u8_t src_mac[8] = { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xbb };
+u8_t dst_mac[8] = { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbb, 0xaa };
/* Source and Destination addresses are contect related addresses. */
#if defined(CONFIG_NET_6LO_CONTEXT)
@@ -217,10 +217,10 @@
static bool compare_data(struct net_pkt *pkt, struct net_6lo_data *data)
{
struct net_buf *frag;
- uint8_t bytes;
- uint8_t compare;
- uint8_t pos = 0;
- uint8_t offset = 0;
+ u8_t bytes;
+ u8_t compare;
+ u8_t pos = 0;
+ u8_t offset = 0;
int remaining = data->small ? SIZE_OF_SMALL_DATA : SIZE_OF_LARGE_DATA;
if (data->nh_udp) {
@@ -258,17 +258,17 @@
frag = pkt->frags;
if (data->nh_udp) {
- if (memcmp(frag->data, (uint8_t *)data, NET_IPV6UDPH_LEN)) {
+ if (memcmp(frag->data, (u8_t *)data, NET_IPV6UDPH_LEN)) {
TC_PRINT("mismatch headers\n");
return false;
}
} else if (data->nh_icmp) {
- if (memcmp(frag->data, (uint8_t *)data, NET_IPV6ICMPH_LEN)) {
+ if (memcmp(frag->data, (u8_t *)data, NET_IPV6ICMPH_LEN)) {
TC_PRINT("mismatch headers\n");
return false;
}
} else {
- if (memcmp(frag->data, (uint8_t *)data, NET_IPV6H_LEN)) {
+ if (memcmp(frag->data, (u8_t *)data, NET_IPV6H_LEN)) {
TC_PRINT("mismatch headers\n");
return false;
}
@@ -305,8 +305,8 @@
{
struct net_pkt *pkt;
struct net_buf *frag;
- uint8_t bytes, pos;
- uint16_t len;
+ u8_t bytes, pos;
+ u16_t len;
int remaining;
pkt = net_pkt_get_reserve_tx(0, K_FOREVER);
@@ -330,14 +330,14 @@
}
if (data->nh_udp) {
- memcpy(frag->data, (uint8_t *) data, NET_IPV6UDPH_LEN);
+ memcpy(frag->data, (u8_t *) data, NET_IPV6UDPH_LEN);
net_buf_add(frag, NET_IPV6UDPH_LEN);
} else if (data->nh_icmp) {
- memcpy(frag->data, (uint8_t *) data, NET_IPV6ICMPH_LEN);
+ memcpy(frag->data, (u8_t *) data, NET_IPV6ICMPH_LEN);
net_buf_add(frag, NET_IPV6ICMPH_LEN);
} else {
- memcpy(frag->data, (uint8_t *) data, NET_IPV6H_LEN);
+ memcpy(frag->data, (u8_t *) data, NET_IPV6H_LEN);
net_buf_add(frag, NET_IPV6H_LEN);
}
@@ -355,20 +355,20 @@
/* length is not set in net_6lo_data data pointer, calculate and set
* in ipv6, udp and in data pointer too (it's required in comparison) */
frag->data[4] = len >> 8;
- frag->data[5] = (uint8_t) len;
+ frag->data[5] = (u8_t) len;
data->ipv6.len[0] = len >> 8;
- data->ipv6.len[1] = (uint8_t) len;
+ data->ipv6.len[1] = (u8_t) len;
if (data->nh_udp) {
frag->data[44] = len >> 8;
- frag->data[45] = (uint8_t) len;
+ frag->data[45] = (u8_t) len;
data->nh.udp.len = htons(len);
}
while (remaining > 0) {
- uint8_t copy;
+ u8_t copy;
bytes = net_buf_tailroom(frag);
copy = remaining > bytes ? bytes : remaining;
diff --git a/tests/net/arp/src/main.c b/tests/net/arp/src/main.c
index 4ab3159..d4029f8 100644
--- a/tests/net/arp/src/main.c
+++ b/tests/net/arp/src/main.c
@@ -30,7 +30,7 @@
static char *app_data = "0123456789";
struct net_arp_context {
- uint8_t mac_addr[sizeof(struct net_eth_addr)];
+ u8_t mac_addr[sizeof(struct net_eth_addr)];
struct net_linkaddr ll_addr;
};
@@ -43,7 +43,7 @@
return 0;
}
-static uint8_t *net_arp_get_mac(struct device *dev)
+static u8_t *net_arp_get_mac(struct device *dev)
{
struct net_arp_context *context = dev->driver_data;
@@ -62,7 +62,7 @@
static void net_arp_iface_init(struct net_if *iface)
{
- uint8_t *mac = net_arp_get_mac(net_if_get_device(iface));
+ u8_t *mac = net_arp_get_mac(net_if_get_device(iface));
net_if_set_link_addr(iface, mac, 6, NET_LINK_ETHERNET);
}
@@ -107,12 +107,12 @@
char out[sizeof("xx:xx:xx:xx:xx:xx")];
snprintk(out, sizeof(out), "%s",
net_sprint_ll_addr(
- (uint8_t *)&hdr->dst,
+ (u8_t *)&hdr->dst,
sizeof(struct net_eth_addr)));
printk("Invalid hwaddr %s, should be %s\n",
out,
net_sprint_ll_addr(
- (uint8_t *)&hwaddr,
+ (u8_t *)&hwaddr,
sizeof(struct net_eth_addr)));
send_status = -EINVAL;
return send_status;
@@ -124,12 +124,12 @@
char out[sizeof("xx:xx:xx:xx:xx:xx")];
snprintk(out, sizeof(out), "%s",
net_sprint_ll_addr(
- (uint8_t *)&hdr->src,
+ (u8_t *)&hdr->src,
sizeof(struct net_eth_addr)));
printk("Invalid hwaddr %s, should be %s\n",
out,
net_sprint_ll_addr(
- (uint8_t *)&hwaddr,
+ (u8_t *)&hwaddr,
sizeof(struct net_eth_addr)));
send_status = -EINVAL;
return send_status;
@@ -270,7 +270,7 @@
}
static void setup_eth_header(struct net_if *iface, struct net_pkt *pkt,
- struct net_eth_addr *hwaddr, uint16_t type)
+ struct net_eth_addr *hwaddr, u16_t type)
{
struct net_eth_hdr *hdr = (struct net_eth_hdr *)net_pkt_ll(pkt);
@@ -402,7 +402,7 @@
net_hexdump("ETH dest wrong ", net_pkt_ll(pkt2),
sizeof(struct net_eth_addr));
net_hexdump("ETH dest correct",
- (uint8_t *)net_eth_broadcast_addr(),
+ (u8_t *)net_eth_broadcast_addr(),
sizeof(struct net_eth_addr));
return false;
}
diff --git a/tests/net/buf/src/main.c b/tests/net/buf/src/main.c
index 4404862..531835f 100644
--- a/tests/net/buf/src/main.c
+++ b/tests/net/buf/src/main.c
@@ -21,18 +21,18 @@
void *hci_sync;
union {
- uint16_t hci_opcode;
- uint16_t acl_handle;
+ u16_t hci_opcode;
+ u16_t acl_handle;
};
- uint8_t type;
+ u8_t type;
};
struct in6_addr {
union {
- uint8_t u6_addr8[16];
- uint16_t u6_addr16[8]; /* In big endian */
- uint32_t u6_addr32[4]; /* In big endian */
+ u8_t u6_addr8[16];
+ u16_t u6_addr16[8]; /* In big endian */
+ u32_t u6_addr32[4]; /* In big endian */
} in6_u;
#define s6_addr in6_u.u6_addr8
#define s6_addr16 in6_u.u6_addr16
@@ -40,21 +40,21 @@
};
struct ipv6_hdr {
- uint8_t vtc;
- uint8_t tcflow;
- uint16_t flow;
- uint8_t len[2];
- uint8_t nexthdr;
- uint8_t hop_limit;
+ u8_t vtc;
+ u8_t tcflow;
+ u16_t flow;
+ u8_t len[2];
+ u8_t nexthdr;
+ u8_t hop_limit;
struct in6_addr src;
struct in6_addr dst;
} __attribute__((__packed__));
struct udp_hdr {
- uint16_t src_port;
- uint16_t dst_port;
- uint16_t len;
- uint16_t chksum;
+ u16_t src_port;
+ u16_t dst_port;
+ u16_t len;
+ u16_t chksum;
} __attribute__((__packed__));
static int destroy_called;
diff --git a/tests/net/context/src/main.c b/tests/net/context/src/main.c
index 089bfbb..5c082cd 100644
--- a/tests/net/context/src/main.c
+++ b/tests/net/context/src/main.c
@@ -1026,7 +1026,7 @@
}
struct net_context_test {
- uint8_t mac_addr[sizeof(struct net_eth_addr)];
+ u8_t mac_addr[sizeof(struct net_eth_addr)];
struct net_linkaddr ll_addr;
};
@@ -1035,7 +1035,7 @@
return 0;
}
-static uint8_t *net_context_get_mac(struct device *dev)
+static u8_t *net_context_get_mac(struct device *dev)
{
struct net_context_test *context = dev->driver_data;
@@ -1054,7 +1054,7 @@
static void net_context_iface_init(struct net_if *iface)
{
- uint8_t *mac = net_context_get_mac(net_if_get_device(iface));
+ u8_t *mac = net_context_get_mac(net_if_get_device(iface));
net_if_set_link_addr(iface, mac, sizeof(struct net_eth_addr),
NET_LINK_ETHERNET);
@@ -1080,7 +1080,7 @@
/* We need to swap the IP addresses because otherwise
* the packet will be dropped.
*/
- uint16_t port;
+ u16_t port;
if (net_pkt_family(pkt) == AF_INET6) {
struct in6_addr addr;
diff --git a/tests/net/dhcpv4/src/main.c b/tests/net/dhcpv4/src/main.c
index 23c21e3..6750823 100644
--- a/tests/net/dhcpv4/src/main.c
+++ b/tests/net/dhcpv4/src/main.c
@@ -146,8 +146,8 @@
#define REQUEST 3
struct dhcp_msg {
- uint32_t xid;
- uint8_t type;
+ u32_t xid;
+ u8_t type;
};
static void test_result(bool pass)
@@ -162,7 +162,7 @@
}
struct net_dhcpv4_context {
- uint8_t mac_addr[sizeof(struct net_eth_addr)];
+ u8_t mac_addr[sizeof(struct net_eth_addr)];
struct net_linkaddr ll_addr;
};
@@ -175,7 +175,7 @@
return 0;
}
-static uint8_t *net_dhcpv4_get_mac(struct device *dev)
+static u8_t *net_dhcpv4_get_mac(struct device *dev)
{
struct net_dhcpv4_context *context = dev->driver_data;
@@ -194,7 +194,7 @@
static void net_dhcpv4_iface_init(struct net_if *iface)
{
- uint8_t *mac = net_dhcpv4_get_mac(net_if_get_device(iface));
+ u8_t *mac = net_dhcpv4_get_mac(net_if_get_device(iface));
net_if_set_link_addr(iface, mac, 6, NET_LINK_ETHERNET);
}
@@ -223,7 +223,7 @@
static void set_ipv4_header(struct net_pkt *pkt)
{
struct net_ipv4_hdr *ipv4;
- uint16_t length;
+ u16_t length;
ipv4 = NET_IPV4_HDR(pkt);
@@ -248,7 +248,7 @@
static void set_udp_header(struct net_pkt *pkt)
{
struct net_udp_hdr *udp;
- uint16_t length;
+ u16_t length;
udp = NET_UDP_HDR(pkt);
udp->src_port = htons(SERVER_PORT);
@@ -259,12 +259,12 @@
udp->chksum = 0;
}
-struct net_pkt *prepare_dhcp_offer(struct net_if *iface, uint32_t xid)
+struct net_pkt *prepare_dhcp_offer(struct net_if *iface, u32_t xid)
{
struct net_pkt *pkt;
struct net_buf *frag;
int bytes, remaining = sizeof(offer), pos = 0;
- uint16_t offset;
+ u16_t offset;
pkt = net_pkt_get_reserve_rx(0, K_FOREVER);
if (!pkt) {
@@ -329,12 +329,12 @@
return NULL;
}
-struct net_pkt *prepare_dhcp_ack(struct net_if *iface, uint32_t xid)
+struct net_pkt *prepare_dhcp_ack(struct net_if *iface, u32_t xid)
{
struct net_pkt *pkt;
struct net_buf *frag;
int bytes, remaining = sizeof(ack), pos = 0;
- uint16_t offset;
+ u16_t offset;
pkt = net_pkt_get_reserve_rx(0, K_FOREVER);
if (!pkt) {
@@ -402,8 +402,8 @@
static int parse_dhcp_message(struct net_pkt *pkt, struct dhcp_msg *msg)
{
struct net_buf *frag = pkt->frags;
- uint8_t type;
- uint16_t offset;
+ u8_t type;
+ u16_t offset;
frag = net_frag_skip(frag, 0, &offset,
/* size of op, htype, hlen, hops */
@@ -426,7 +426,7 @@
}
while (frag) {
- uint8_t length;
+ u8_t length;
frag = net_frag_read_u8(frag, offset, &offset, &type);
if (!frag) {
@@ -519,7 +519,7 @@
static struct net_mgmt_event_callback rx_cb;
static void receiver_cb(struct net_mgmt_event_callback *cb,
- uint32_t nm_event, struct net_if *iface)
+ u32_t nm_event, struct net_if *iface)
{
test_result(true);
}
diff --git a/tests/net/ieee802154/crypto/src/ieee802154_crypto_test.c b/tests/net/ieee802154/crypto/src/ieee802154_crypto_test.c
index 52860a4..a5c566b 100644
--- a/tests/net/ieee802154/crypto/src/ieee802154_crypto_test.c
+++ b/tests/net/ieee802154/crypto/src/ieee802154_crypto_test.c
@@ -26,7 +26,7 @@
struct cipher_ctx dec;
struct cipher_pkt pkt;
struct cipher_aead_pkt apkt;
-uint8_t buf[128];
+u8_t buf[128];
static void print_caps(struct device *dev)
{
@@ -47,7 +47,7 @@
}
}
-static void print_buffer(uint8_t *buf, uint8_t len)
+static void print_buffer(u8_t *buf, u8_t len)
{
int i;
@@ -67,8 +67,8 @@
printk("\n");
}
-static bool verify_result(uint8_t *result, int result_len,
- uint8_t *verify, int verify_len)
+static bool verify_result(u8_t *result, int result_len,
+ u8_t *verify, int verify_len)
{
if (result_len != verify_len) {
NET_ERR("Result and verification length don't match (%i vs %i)",
@@ -91,41 +91,41 @@
static void ds_test(struct device *dev)
{
- uint8_t key[] = { 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
+ u8_t key[] = { 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf };
- uint8_t auth_nonce[] = { 0xac, 0xde, 0x48, 0x00, 0x00, 0x00, 0x00,
+ u8_t auth_nonce[] = { 0xac, 0xde, 0x48, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x05, 0x02 };
- uint8_t auth_data[] = { 0x08, 0xd0, 0x84, 0x21, 0x43, 0x01, 0x00,
+ u8_t auth_data[] = { 0x08, 0xd0, 0x84, 0x21, 0x43, 0x01, 0x00,
0x00, 0x00, 0x00, 0x48, 0xde, 0xac, 0x02,
0x05, 0x00, 0x00, 0x00, 0x55, 0xcf, 0x00,
0x00, 0x51, 0x52, 0x53, 0x54 };
- uint8_t auth_result[] = { 0x08, 0xd0, 0x84, 0x21, 0x43, 0x01, 0x00,
+ u8_t auth_result[] = { 0x08, 0xd0, 0x84, 0x21, 0x43, 0x01, 0x00,
0x00, 0x00, 0x00, 0x48, 0xde, 0xac, 0x02,
0x05, 0x00, 0x00, 0x00, 0x55, 0xcf, 0x00,
0x00, 0x51, 0x52, 0x53, 0x54, 0xca, 0x45,
0x91, 0x8d, 0x3d, 0x82, 0xe5, 0xd0};
- uint8_t enc_dec_nonce[] = { 0xac, 0xde, 0x48, 0x00, 0x00, 0x00, 0x00,
+ u8_t enc_dec_nonce[] = { 0xac, 0xde, 0x48, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x05, 0x04 };
- uint8_t enc_dec_data[] = { 0x69, 0xdc, 0x84, 0x21, 0x43, 0x02, 0x00,
+ u8_t enc_dec_data[] = { 0x69, 0xdc, 0x84, 0x21, 0x43, 0x02, 0x00,
0x00, 0x00, 0x00, 0x48, 0xde, 0xac, 0x01,
0x00, 0x00, 0x00, 0x00, 0x48, 0xde, 0xac,
0x04, 0x05, 0x00, 0x00, 0x00, 0x61, 0x62,
0x63, 0x64 };
- uint8_t enc_dec_result[] = { 0x69, 0xdc, 0x84, 0x21, 0x43, 0x02, 0x00,
+ u8_t enc_dec_result[] = { 0x69, 0xdc, 0x84, 0x21, 0x43, 0x02, 0x00,
0x00, 0x00, 0x00, 0x48, 0xde, 0xac, 0x01,
0x00, 0x00, 0x00, 0x00, 0x48, 0xde, 0xac,
0x04, 0x05, 0x00, 0x00, 0x00, 0x7c, 0x64,
0xc5, 0x0a };
- uint8_t both_op_nonce[] = { 0xac, 0xde, 0x48, 0x00, 0x00, 0x00, 0x00,
+ u8_t both_op_nonce[] = { 0xac, 0xde, 0x48, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x05, 0x06 };
- uint8_t both_op_data[] = { 0x2b, 0xdc, 0x84, 0x21, 0x43, 0x02, 0x00,
+ u8_t both_op_data[] = { 0x2b, 0xdc, 0x84, 0x21, 0x43, 0x02, 0x00,
0x00, 0x00, 0x00, 0x48, 0xde, 0xac, 0xff,
0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x48,
0xde, 0xac, 0x06, 0x05, 0x00, 0x00, 0x00,
0x01, 0xce };
- uint8_t both_op_result[] = { 0x2b, 0xdc, 0x84, 0x21, 0x43, 0x02, 0x00,
+ u8_t both_op_result[] = { 0x2b, 0xdc, 0x84, 0x21, 0x43, 0x02, 0x00,
0x00, 0x00, 0x00, 0x48, 0xde, 0xac, 0xff,
0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x48,
0xde, 0xac, 0x06, 0x05, 0x00, 0x00, 0x00,
diff --git a/tests/net/ieee802154/fragment/src/main.c b/tests/net/ieee802154/fragment/src/main.c
index 8f89ad5..d8adc03 100644
--- a/tests/net/ieee802154/fragment/src/main.c
+++ b/tests/net/ieee802154/fragment/src/main.c
@@ -150,7 +150,7 @@
static void net_fragment_iface_init(struct net_if *iface)
{
- uint8_t mac[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xbb};
+ u8_t mac[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xbb};
net_if_set_link_addr(iface, mac, 8, NET_LINK_IEEE802154);
}
@@ -175,7 +175,7 @@
static bool compare_data(struct net_pkt *pkt, struct net_fragment_data *data)
{
struct net_buf *frag;
- uint8_t bytes, pos, compare, offset = 0;
+ u8_t bytes, pos, compare, offset = 0;
int remaining = data->len;
if (net_pkt_get_len(pkt) != (NET_IPV6UDPH_LEN + remaining)) {
@@ -187,7 +187,7 @@
frag = pkt->frags;
- if (memcmp(frag->data, (uint8_t *)data, NET_IPV6UDPH_LEN)) {
+ if (memcmp(frag->data, (u8_t *)data, NET_IPV6UDPH_LEN)) {
printk("mismatch headers\n");
return false;
}
@@ -218,8 +218,8 @@
{
struct net_pkt *pkt;
struct net_buf *frag;
- uint8_t bytes, pos;
- uint16_t len;
+ u8_t bytes, pos;
+ u16_t len;
int remaining;
pkt = net_pkt_get_reserve_tx(0, K_FOREVER);
@@ -237,7 +237,7 @@
return NULL;
}
- memcpy(frag->data, (uint8_t *) data, NET_IPV6UDPH_LEN);
+ memcpy(frag->data, (u8_t *) data, NET_IPV6UDPH_LEN);
net_buf_add(frag, NET_IPV6UDPH_LEN);
pos = 0;
@@ -247,16 +247,16 @@
/* length is not set in net_fragment_data data pointer, calculate and set
* in ipv6, udp and in data pointer too (it's required in comparison) */
frag->data[4] = len >> 8;
- frag->data[5] = (uint8_t) len;
+ frag->data[5] = (u8_t) len;
frag->data[44] = len >> 8;
- frag->data[45] = (uint8_t) len;
+ frag->data[45] = (u8_t) len;
data->ipv6.len[0] = len >> 8;
- data->ipv6.len[1] = (uint8_t) len;
+ data->ipv6.len[1] = (u8_t) len;
data->udp.len = htons(len);
while (remaining > 0) {
- uint8_t copy;
+ u8_t copy;
bytes = net_buf_tailroom(frag);
copy = remaining > bytes ? bytes : remaining;
memcpy(net_buf_add(frag, copy), &user_data[pos], copy);
diff --git a/tests/net/ieee802154/l2/src/ieee802154_fake_driver.c b/tests/net/ieee802154/l2/src/ieee802154_fake_driver.c
index cc762f0..b7a6d73 100644
--- a/tests/net/ieee802154/l2/src/ieee802154_fake_driver.c
+++ b/tests/net/ieee802154/l2/src/ieee802154_fake_driver.c
@@ -24,28 +24,28 @@
return 0;
}
-static int fake_set_channel(struct device *dev, uint16_t channel)
+static int fake_set_channel(struct device *dev, u16_t channel)
{
NET_INFO("Channel %u\n", channel);
return 0;
}
-static int fake_set_pan_id(struct device *dev, uint16_t pan_id)
+static int fake_set_pan_id(struct device *dev, u16_t pan_id)
{
NET_INFO("PAN id 0x%x\n", pan_id);
return 0;
}
-static int fake_set_short_addr(struct device *dev, uint16_t short_addr)
+static int fake_set_short_addr(struct device *dev, u16_t short_addr)
{
NET_INFO("Short address: 0x%x\n", short_addr);
return 0;
}
-static int fake_set_ieee_addr(struct device *dev, const uint8_t *ieee_addr)
+static int fake_set_ieee_addr(struct device *dev, const u8_t *ieee_addr)
{
NET_INFO("IEEE address %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
ieee_addr[0], ieee_addr[1], ieee_addr[2], ieee_addr[3],
@@ -54,7 +54,7 @@
return 0;
}
-static int fake_set_txpower(struct device *dev, int16_t dbm)
+static int fake_set_txpower(struct device *dev, s16_t dbm)
{
NET_INFO("TX power %d dbm\n", dbm);
@@ -112,7 +112,7 @@
static void fake_iface_init(struct net_if *iface)
{
struct ieee802154_context *ctx = net_if_l2_data(iface);
- static uint8_t mac[8] = { 0x00, 0x12, 0x4b, 0x00,
+ static u8_t mac[8] = { 0x00, 0x12, 0x4b, 0x00,
0x00, 0x9e, 0xa3, 0xc2 };
net_if_set_link_addr(iface, mac, 8, NET_LINK_IEEE802154);
diff --git a/tests/net/ieee802154/l2/src/ieee802154_test.c b/tests/net/ieee802154/l2/src/ieee802154_test.c
index 1fed0bc..057e452 100644
--- a/tests/net/ieee802154/l2/src/ieee802154_test.c
+++ b/tests/net/ieee802154/l2/src/ieee802154_test.c
@@ -22,8 +22,8 @@
char *name;
struct in6_addr src;
struct in6_addr dst;
- uint8_t *pkt;
- uint8_t length;
+ u8_t *pkt;
+ u8_t length;
struct {
struct ieee802154_fcf_seq *fc_seq;
struct ieee802154_address_field *dst_addr;
@@ -31,7 +31,7 @@
} mhr_check;
};
-uint8_t ns_pkt[] = {
+u8_t ns_pkt[] = {
0x41, 0xd8, 0x3e, 0xcd, 0xab, 0xff, 0xff, 0xc2, 0xa3, 0x9e, 0x00,
0x00, 0x4b, 0x12, 0x00, 0x7b, 0x09, 0x3a, 0x20, 0x01, 0x0d, 0xb8,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -55,7 +55,7 @@
.mhr_check.src_addr = (struct ieee802154_address_field *)(ns_pkt + 7),
};
-uint8_t ack_pkt[] = { 0x02, 0x10, 0x16 };
+u8_t ack_pkt[] = { 0x02, 0x10, 0x16 };
struct ieee802154_pkt_test test_ack_pkt = {
.name = "ACK frame",
@@ -66,7 +66,7 @@
.mhr_check.src_addr = NULL,
};
-uint8_t beacon_pkt[] = {
+u8_t beacon_pkt[] = {
0x00, 0xd0, 0x11, 0xcd, 0xab, 0xc2, 0xa3, 0x9e, 0x00, 0x00, 0x4b,
0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
@@ -81,7 +81,7 @@
(struct ieee802154_address_field *) (beacon_pkt + 3),
};
-uint8_t sec_data_pkt[] = {
+u8_t sec_data_pkt[] = {
0x49, 0xd8, 0x03, 0xcd, 0xab, 0xff, 0xff, 0x02, 0x6d, 0xbb, 0xa7,
0x00, 0x4b, 0x12, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xd3, 0x8e,
0x49, 0xa7, 0xe2, 0x00, 0x67, 0xd4, 0x00, 0x42, 0x52, 0x6f, 0x01,
@@ -104,7 +104,7 @@
struct k_sem driver_lock;
struct net_if *iface;
-static void pkt_hexdump(uint8_t *pkt, uint8_t length)
+static void pkt_hexdump(u8_t *pkt, u8_t length)
{
int i;
@@ -124,7 +124,7 @@
}
}
-static void ieee_addr_hexdump(uint8_t *addr, uint8_t length)
+static void ieee_addr_hexdump(u8_t *addr, u8_t length)
{
int i;
@@ -200,7 +200,7 @@
static bool test_ack_reply(struct ieee802154_pkt_test *t)
{
- static uint8_t data_pkt[] = {
+ static u8_t data_pkt[] = {
0x61, 0xdc, 0x16, 0xcd, 0xab, 0x26, 0x11, 0x32, 0x00, 0x00, 0x4b,
0x12, 0x00, 0x26, 0x18, 0x32, 0x00, 0x00, 0x4b, 0x12, 0x00, 0x7b,
0x00, 0x3a, 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00,
diff --git a/tests/net/iface/src/main.c b/tests/net/iface/src/main.c
index fef9d07..1c6f621 100644
--- a/tests/net/iface/src/main.c
+++ b/tests/net/iface/src/main.c
@@ -61,8 +61,8 @@
#define WAIT_TIME 250
struct net_if_test {
- uint8_t idx;
- uint8_t mac_addr[sizeof(struct net_eth_addr)];
+ u8_t idx;
+ u8_t mac_addr[sizeof(struct net_eth_addr)];
struct net_linkaddr ll_addr;
};
@@ -71,7 +71,7 @@
return 0;
}
-static uint8_t *net_iface_get_mac(struct device *dev)
+static u8_t *net_iface_get_mac(struct device *dev)
{
struct net_if_test *data = dev->driver_data;
@@ -93,7 +93,7 @@
static void net_iface_init(struct net_if *iface)
{
- uint8_t *mac = net_iface_get_mac(net_if_get_device(iface));
+ u8_t *mac = net_iface_get_mac(net_if_get_device(iface));
net_if_set_link_addr(iface, mac, sizeof(struct net_eth_addr),
NET_LINK_ETHERNET);
@@ -280,7 +280,7 @@
static bool send_iface(struct net_if *iface, int val, bool expect_fail)
{
- static uint8_t data[] = { 't', 'e', 's', 't', '\0' };
+ static u8_t data[] = { 't', 'e', 's', 't', '\0' };
struct net_pkt *pkt;
int ret;
diff --git a/tests/net/ip-addr/src/main.c b/tests/net/ip-addr/src/main.c
index 614778f..b346727 100644
--- a/tests/net/ip-addr/src/main.c
+++ b/tests/net/ip-addr/src/main.c
@@ -45,7 +45,7 @@
#define TEST_LL_6(a, b, c, d, e, f, expected) \
do { \
- uint8_t ll[] = { a, b, c, d, e, f }; \
+ u8_t ll[] = { a, b, c, d, e, f }; \
if (strcmp(net_sprint_ll_addr(ll, sizeof(ll)), \
expected)) { \
printk("Test %s failed.\n", expected); \
@@ -55,7 +55,7 @@
#define TEST_LL_8(a, b, c, d, e, f, g, h, expected) \
do { \
- uint8_t ll[] = { a, b, c, d, e, f, g, h }; \
+ u8_t ll[] = { a, b, c, d, e, f, g, h }; \
if (strcmp(net_sprint_ll_addr(ll, sizeof(ll)), \
expected)) { \
printk("Test %s failed.\n", expected); \
@@ -65,8 +65,8 @@
#define TEST_LL_6_TWO(a, b, c, d, e, f, expected) \
do { \
- uint8_t ll1[] = { a, b, c, d, e, f }; \
- uint8_t ll2[] = { f, e, d, c, b, a }; \
+ u8_t ll1[] = { a, b, c, d, e, f }; \
+ u8_t ll2[] = { f, e, d, c, b, a }; \
char out[2 * sizeof("xx:xx:xx:xx:xx:xx") + 1 + 1]; \
snprintk(out, sizeof(out), "%s ", \
net_sprint_ll_addr(ll1, sizeof(ll1))); \
@@ -101,7 +101,7 @@
} while (0)
struct net_test_context {
- uint8_t mac_addr[6];
+ u8_t mac_addr[6];
struct net_linkaddr ll_addr;
};
@@ -114,7 +114,7 @@
return 0;
}
-static uint8_t *net_test_get_mac(struct device *dev)
+static u8_t *net_test_get_mac(struct device *dev)
{
struct net_test_context *context = dev->driver_data;
@@ -133,7 +133,7 @@
static void net_test_iface_init(struct net_if *iface)
{
- uint8_t *mac = net_test_get_mac(net_if_get_device(iface));
+ u8_t *mac = net_test_get_mac(net_if_get_device(iface));
net_if_set_link_addr(iface, mac, 6, NET_LINK_ETHERNET);
}
@@ -258,29 +258,29 @@
return false;
}
- if (!net_is_ipv6_prefix((uint8_t *)&addr6_pref1,
- (uint8_t *)&addr6_pref2,
+ if (!net_is_ipv6_prefix((u8_t *)&addr6_pref1,
+ (u8_t *)&addr6_pref2,
64)) {
printk("Same IPv6 prefix test failed\n");
return false;
}
- if (net_is_ipv6_prefix((uint8_t *)&addr6_pref1,
- (uint8_t *)&addr6_pref3,
+ if (net_is_ipv6_prefix((u8_t *)&addr6_pref1,
+ (u8_t *)&addr6_pref3,
64)) {
printk("Different IPv6 prefix test failed\n");
return false;
}
- if (net_is_ipv6_prefix((uint8_t *)&addr6_pref1,
- (uint8_t *)&addr6_pref2,
+ if (net_is_ipv6_prefix((u8_t *)&addr6_pref1,
+ (u8_t *)&addr6_pref2,
128)) {
printk("Different full IPv6 prefix test failed\n");
return false;
}
- if (net_is_ipv6_prefix((uint8_t *)&addr6_pref1,
- (uint8_t *)&addr6_pref3,
+ if (net_is_ipv6_prefix((u8_t *)&addr6_pref1,
+ (u8_t *)&addr6_pref3,
255)) {
printk("Too long prefix test failed\n");
return false;
diff --git a/tests/net/ipv6/src/main.c b/tests/net/ipv6/src/main.c
index 093fe5e..236d408 100644
--- a/tests/net/ipv6/src/main.c
+++ b/tests/net/ipv6/src/main.c
@@ -129,7 +129,7 @@
#define PEER_PORT 16233
struct net_test_ipv6 {
- uint8_t mac_addr[sizeof(struct net_eth_addr)];
+ u8_t mac_addr[sizeof(struct net_eth_addr)];
struct net_linkaddr ll_addr;
};
@@ -138,7 +138,7 @@
return 0;
}
-static uint8_t *net_test_get_mac(struct device *dev)
+static u8_t *net_test_get_mac(struct device *dev)
{
struct net_test_ipv6 *context = dev->driver_data;
@@ -157,7 +157,7 @@
static void net_test_iface_init(struct net_if *iface)
{
- uint8_t *mac = net_test_get_mac(net_if_get_device(iface));
+ u8_t *mac = net_test_get_mac(net_if_get_device(iface));
net_if_set_link_addr(iface, mac, sizeof(struct net_eth_addr),
NET_LINK_ETHERNET);
@@ -281,13 +281,13 @@
struct in6_addr prefix2 = { { { 0x20, 0x01, 0x0d, 0xb8, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0x2 } } };
- st = net_is_ipv6_prefix((uint8_t *)&prefix1, (uint8_t *)&prefix2, 64);
+ st = net_is_ipv6_prefix((u8_t *)&prefix1, (u8_t *)&prefix2, 64);
if (!st) {
TC_ERROR("Prefix /64 compare failed\n");
return false;
}
- st = net_is_ipv6_prefix((uint8_t *)&prefix1, (uint8_t *)&prefix2, 65);
+ st = net_is_ipv6_prefix((u8_t *)&prefix1, (u8_t *)&prefix2, 65);
if (!st) {
TC_ERROR("Prefix /65 compare failed\n");
return false;
@@ -296,7 +296,7 @@
/* Set one extra bit in the other prefix for testing /65 */
prefix1.s6_addr[8] = 0x80;
- st = net_is_ipv6_prefix((uint8_t *)&prefix1, (uint8_t *)&prefix2, 65);
+ st = net_is_ipv6_prefix((u8_t *)&prefix1, (u8_t *)&prefix2, 65);
if (st) {
TC_ERROR("Prefix /65 compare should have failed\n");
return false;
@@ -305,7 +305,7 @@
/* Set two bits in prefix2, it is now /66 */
prefix2.s6_addr[8] = 0xc0;
- st = net_is_ipv6_prefix((uint8_t *)&prefix1, (uint8_t *)&prefix2, 65);
+ st = net_is_ipv6_prefix((u8_t *)&prefix1, (u8_t *)&prefix2, 65);
if (!st) {
TC_ERROR("Prefix /65 compare failed\n");
return false;
@@ -314,21 +314,21 @@
/* Set all remaining bits in prefix2, it is now /128 */
memset(&prefix2.s6_addr[8], 0xff, 8);
- st = net_is_ipv6_prefix((uint8_t *)&prefix1, (uint8_t *)&prefix2, 65);
+ st = net_is_ipv6_prefix((u8_t *)&prefix1, (u8_t *)&prefix2, 65);
if (!st) {
TC_ERROR("Prefix /65 compare failed\n");
return false;
}
/* Comparing /64 should be still ok */
- st = net_is_ipv6_prefix((uint8_t *)&prefix1, (uint8_t *)&prefix2, 64);
+ st = net_is_ipv6_prefix((u8_t *)&prefix1, (u8_t *)&prefix2, 64);
if (!st) {
TC_ERROR("Prefix /64 compare failed\n");
return false;
}
/* But comparing /66 should should fail */
- st = net_is_ipv6_prefix((uint8_t *)&prefix1, (uint8_t *)&prefix2, 66);
+ st = net_is_ipv6_prefix((u8_t *)&prefix1, (u8_t *)&prefix2, 66);
if (st) {
TC_ERROR("Prefix /66 compare should have failed\n");
return false;
@@ -479,7 +479,7 @@
struct net_if_ipv6_prefix *prefix;
struct in6_addr addr = { { { 0x20, 1, 0x0d, 0xb8, 42, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0 } } };
- uint32_t lifetime = 1;
+ u32_t lifetime = 1;
int len = 64;
prefix = net_if_ipv6_prefix_add(net_if_get_default(),
@@ -594,7 +594,7 @@
static bool net_test_change_ll_addr(void)
{
- uint8_t new_mac[] = { 00, 01, 02, 03, 04, 05 };
+ u8_t new_mac[] = { 00, 01, 02, 03, 04, 05 };
struct net_linkaddr_storage *ll;
struct net_linkaddr *ll_iface;
struct net_pkt *pkt;
@@ -602,7 +602,7 @@
struct in6_addr dst;
struct net_if *iface;
struct net_nbr *nbr;
- uint32_t flags;
+ u32_t flags;
int ret;
net_ipv6_addr_create(&dst, 0xff02, 0, 0, 0, 0, 0, 0, 1);
diff --git a/tests/net/lib/dns_packet/src/dns_packet.c b/tests/net/lib/dns_packet/src/dns_packet.c
index 6b57b76..3afae81 100644
--- a/tests/net/lib/dns_packet/src/dns_packet.c
+++ b/tests/net/lib/dns_packet/src/dns_packet.c
@@ -13,11 +13,11 @@
/* RFC 1035, 4.1.1. Header section format */
#define DNS_HEADER_SIZE 12
-static uint8_t buf[MAX_BUF_SIZE];
-static uint16_t buf_len;
+static u8_t buf[MAX_BUF_SIZE];
+static u16_t buf_len;
-static uint8_t qname[MAX_BUF_SIZE];
-static uint16_t qname_len;
+static u8_t qname[MAX_BUF_SIZE];
+static u16_t qname_len;
/* Domain: www.zephyrproject.org
@@ -25,19 +25,19 @@
* Transaction ID: 0xda0f
* Recursion desired
*/
-static uint8_t query_ipv4[] = { 0xda, 0x0f, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00,
+static u8_t query_ipv4[] = { 0xda, 0x0f, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x77, 0x77, 0x77,
0x0d, 0x7a, 0x65, 0x70, 0x68, 0x79, 0x72, 0x70,
0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x03, 0x6f,
0x72, 0x67, 0x00, 0x00, 0x01, 0x00, 0x01 };
#define DNAME1 "www.zephyrproject.org"
-static uint16_t tid1 = 0xda0f;
+static u16_t tid1 = 0xda0f;
-static int eval_query(const char *dname, uint16_t tid, enum dns_rr_type type,
- uint8_t *expected, uint16_t expected_len)
+static int eval_query(const char *dname, u16_t tid, enum dns_rr_type type,
+ u8_t *expected, u16_t expected_len)
{
- uint8_t *question;
+ u8_t *question;
int rc;
rc = dns_msg_pack_qname(&qname_len, qname, MAX_BUF_SIZE, dname);
@@ -174,24 +174,24 @@
const char *dname;
/* expected result */
- uint8_t *res;
+ u8_t *res;
/* expected result length */
- uint16_t res_len;
+ u16_t res_len;
/* transaction id */
- uint16_t tid;
+ u16_t tid;
/* A, AAAA */
- uint8_t answer_type;
+ u8_t answer_type;
/* answer counter */
- uint8_t ancount;
+ u8_t ancount;
/* answer TTL */
- uint32_t ttl;
+ u32_t ttl;
/* recursion available */
- uint8_t ra;
+ u8_t ra;
/* data len */
- uint8_t rdlen;
+ u8_t rdlen;
/* data */
- const uint8_t *rdata;
+ const u8_t *rdata;
};
/* This routine evaluates DNS responses with one RR, and assumes that the
@@ -199,8 +199,8 @@
*/
static int eval_response1(struct dns_response_test *resp)
{
- uint8_t *ptr = resp->res;
- uint16_t offset;
+ u8_t *ptr = resp->res;
+ u16_t offset;
int rc;
if (resp->res_len < RESPONSE_MIN_SIZE) {
@@ -405,7 +405,7 @@
* RD len: 4 (IPv4 Address)
* RData: 140.211.169.8
*/
-static uint8_t resp_ipv4[] = { 0xb0, 0x41, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01,
+static u8_t resp_ipv4[] = { 0xb0, 0x41, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x03, 0x77, 0x77, 0x77,
0x0d, 0x7a, 0x65, 0x70, 0x68, 0x79, 0x72, 0x70,
0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x03, 0x6f,
@@ -413,7 +413,7 @@
0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x0b,
0xd4, 0x00, 0x04, 0x8c, 0xd3, 0xa9, 0x08 };
-static const uint8_t resp_ipv4_addr[] = {140, 211, 169, 8};
+static const u8_t resp_ipv4_addr[] = {140, 211, 169, 8};
void test_dns_response(void)
{
diff --git a/tests/net/lib/dns_resolve/src/main.c b/tests/net/lib/dns_resolve/src/main.c
index ef1053b..edb438e 100644
--- a/tests/net/lib/dns_resolve/src/main.c
+++ b/tests/net/lib/dns_resolve/src/main.c
@@ -56,15 +56,15 @@
static bool timeout_query;
static struct k_sem wait_data;
static struct k_sem wait_data2;
-static uint16_t current_dns_id;
+static u16_t current_dns_id;
static struct dns_addrinfo addrinfo;
/* this must be higher that the DNS_TIMEOUT */
#define WAIT_TIME (DNS_TIMEOUT + 300)
struct net_if_test {
- uint8_t idx;
- uint8_t mac_addr[sizeof(struct net_eth_addr)];
+ u8_t idx;
+ u8_t mac_addr[sizeof(struct net_eth_addr)];
struct net_linkaddr ll_addr;
};
@@ -73,7 +73,7 @@
return 0;
}
-static uint8_t *net_iface_get_mac(struct device *dev)
+static u8_t *net_iface_get_mac(struct device *dev)
{
struct net_if_test *data = dev->driver_data;
@@ -95,14 +95,14 @@
static void net_iface_init(struct net_if *iface)
{
- uint8_t *mac = net_iface_get_mac(net_if_get_device(iface));
+ u8_t *mac = net_iface_get_mac(net_if_get_device(iface));
net_if_set_link_addr(iface, mac, sizeof(struct net_eth_addr),
NET_LINK_ETHERNET);
}
static inline int get_slot_by_id(struct dns_resolve_context *ctx,
- uint16_t dns_id)
+ u16_t dns_id)
{
int i;
@@ -504,7 +504,7 @@
static void dns_query_ipv4_cancel(void)
{
int expected_status = DNS_EAI_CANCELED;
- uint16_t dns_id;
+ u16_t dns_id;
int ret;
timeout_query = true;
@@ -530,7 +530,7 @@
static void dns_query_ipv6_cancel(void)
{
int expected_status = DNS_EAI_CANCELED;
- uint16_t dns_id;
+ u16_t dns_id;
int ret;
timeout_query = true;
diff --git a/tests/net/lib/mqtt_packet/src/mqtt_packet.c b/tests/net/lib/mqtt_packet/src/mqtt_packet.c
index 29a99cd..d6d6dcb 100644
--- a/tests/net/lib/mqtt_packet/src/mqtt_packet.c
+++ b/tests/net/lib/mqtt_packet/src/mqtt_packet.c
@@ -21,8 +21,8 @@
/* MQTT messages in this test are under 256 bytes */
#define BUF_SIZE 256
-static uint8_t buf[BUF_SIZE];
-static uint16_t buf_len;
+static u8_t buf[BUF_SIZE];
+static u16_t buf_len;
/**
* @brief MQTT test structure
@@ -42,10 +42,10 @@
int (*eval_fcn)(struct mqtt_test *);
/* expected result */
- uint8_t *expected;
+ u8_t *expected;
/* length of 'expected' */
- uint16_t expected_len;
+ u16_t expected_len;
};
#define MAX_TOPICS 4
@@ -54,7 +54,7 @@
* @brief MQTT SUBSCRIBE msg
*/
struct msg_subscribe {
- uint16_t pkt_id;
+ u16_t pkt_id;
int items;
const char *topics[MAX_TOPICS];
enum mqtt_qos qos[MAX_TOPICS];
@@ -64,7 +64,7 @@
* @brief MQTT SUBACK msg
*/
struct msg_suback {
- uint16_t pkt_id;
+ u16_t pkt_id;
int elements;
enum mqtt_qos qos[MAX_TOPICS];
};
@@ -74,7 +74,7 @@
* PUBACK, PUBREC, PUBREL, PUBCOMP, UNSUBACK
*/
struct msg_pkt_id {
- uint16_t pkt_id;
+ u16_t pkt_id;
};
/**
@@ -195,15 +195,15 @@
* @return TC_PASS on success
* @return TC_FAIL on error and prints both buffers
*/
-static int eval_buffers(uint8_t *buf, uint16_t buf_len,
- uint8_t *expected, uint16_t len);
+static int eval_buffers(u8_t *buf, u16_t buf_len,
+ u8_t *expected, u16_t len);
/**
* @brief print_array Prints the array 'a' of 'size' elements
* @param a The array
* @param size Array's size
*/
-static void print_array(uint8_t *a, uint16_t size);
+static void print_array(u8_t *a, u16_t size);
/**
* @brief test_strlen Computes the C string length allowing NULL as
@@ -224,7 +224,7 @@
* mosquitto_sub -V mqttv311 -i zephyr -k 0 -t sensors
*/
static
-uint8_t connect1[] = {0x10, 0x12, 0x00, 0x04, 0x4d, 0x51, 0x54, 0x54,
+u8_t connect1[] = {0x10, 0x12, 0x00, 0x04, 0x4d, 0x51, 0x54, 0x54,
0x04, 0x02, 0x00, 0x00, 0x00, 0x06, 0x7a, 0x65,
0x70, 0x68, 0x79, 0x72};
@@ -246,7 +246,7 @@
* mosquitto_sub -V mqttv311 -i zephyr -k 365 -t sensors
*/
static
-uint8_t connect2[] = {0x10, 0x12, 0x00, 0x04, 0x4d, 0x51, 0x54, 0x54,
+u8_t connect2[] = {0x10, 0x12, 0x00, 0x04, 0x4d, 0x51, 0x54, 0x54,
0x04, 0x02, 0x01, 0x6d, 0x00, 0x06, 0x7a, 0x65,
0x70, 0x68, 0x79, 0x72};
@@ -271,7 +271,7 @@
* --will-qos 0 --will-payload bye
*/
static
-uint8_t connect3[] = {0x10, 0x21, 0x00, 0x04, 0x4d, 0x51, 0x54, 0x54,
+u8_t connect3[] = {0x10, 0x21, 0x00, 0x04, 0x4d, 0x51, 0x54, 0x54,
0x04, 0x06, 0x00, 0x00, 0x00, 0x06, 0x7a, 0x65,
0x70, 0x68, 0x79, 0x72, 0x00, 0x08, 0x71, 0x75,
0x69, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x00, 0x03,
@@ -283,7 +283,7 @@
.will_flag = 1,
.will_qos = 0, .will_retain = 0, .will_topic = WILL_TOPIC,
.will_topic_len = WILL_TOPIC_LEN,
- .will_msg = (uint8_t *)"bye",
+ .will_msg = (u8_t *)"bye",
.will_msg_len = 3,
.keep_alive = 0, .user_name = NULL,
.password = NULL, .password_len = 0
@@ -298,7 +298,7 @@
* --will-qos 0 --will-payload bye --will-retain
*/
static
-uint8_t connect4[] = {0x10, 0x21, 0x00, 0x04, 0x4d, 0x51, 0x54, 0x54,
+u8_t connect4[] = {0x10, 0x21, 0x00, 0x04, 0x4d, 0x51, 0x54, 0x54,
0x04, 0x26, 0x00, 0x00, 0x00, 0x06, 0x7a, 0x65,
0x70, 0x68, 0x79, 0x72, 0x00, 0x08, 0x71, 0x75,
0x69, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x00, 0x03,
@@ -310,7 +310,7 @@
.will_flag = 1,
.will_qos = 0, .will_retain = 1, .will_topic = WILL_TOPIC,
.will_topic_len = WILL_TOPIC_LEN,
- .will_msg = (uint8_t *)"bye",
+ .will_msg = (u8_t *)"bye",
.will_msg_len = 3,
.keep_alive = 0, .user_name = NULL,
.password = NULL, .password_len = 0
@@ -325,7 +325,7 @@
* --will-qos 1 --will-payload bye
*/
static
-uint8_t connect5[] = {0x10, 0x21, 0x00, 0x04, 0x4d, 0x51, 0x54, 0x54,
+u8_t connect5[] = {0x10, 0x21, 0x00, 0x04, 0x4d, 0x51, 0x54, 0x54,
0x04, 0x0e, 0x00, 0x00, 0x00, 0x06, 0x7a, 0x65,
0x70, 0x68, 0x79, 0x72, 0x00, 0x08, 0x71, 0x75,
0x69, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x00, 0x03,
@@ -337,7 +337,7 @@
.will_flag = 1,
.will_qos = 1, .will_retain = 0, .will_topic = WILL_TOPIC,
.will_topic_len = WILL_TOPIC_LEN,
- .will_msg = (uint8_t *)"bye",
+ .will_msg = (u8_t *)"bye",
.will_msg_len = 3,
.keep_alive = 0, .user_name = NULL,
.password = NULL, .password_len = 0
@@ -352,7 +352,7 @@
* --will-qos 1 --will-payload bye --will-retain
*/
static
-uint8_t connect6[] = {0x10, 0x21, 0x00, 0x04, 0x4d, 0x51, 0x54, 0x54,
+u8_t connect6[] = {0x10, 0x21, 0x00, 0x04, 0x4d, 0x51, 0x54, 0x54,
0x04, 0x2e, 0x00, 0x00, 0x00, 0x06, 0x7a, 0x65,
0x70, 0x68, 0x79, 0x72, 0x00, 0x08, 0x71, 0x75,
0x69, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x00, 0x03,
@@ -364,7 +364,7 @@
.will_flag = 1,
.will_qos = 1, .will_retain = 1, .will_topic = WILL_TOPIC,
.will_topic_len = WILL_TOPIC_LEN,
- .will_msg = (uint8_t *)"bye",
+ .will_msg = (u8_t *)"bye",
.will_msg_len = 3,
.keep_alive = 0, .user_name = NULL,
.password = NULL, .password_len = 0
@@ -380,7 +380,7 @@
* --will-qos 1 --will-payload bye --will-retain -u zephyr1 -P password
*/
static
-uint8_t connect7[] = {0x10, 0x34, 0x00, 0x04, 0x4d, 0x51, 0x54, 0x54,
+u8_t connect7[] = {0x10, 0x34, 0x00, 0x04, 0x4d, 0x51, 0x54, 0x54,
0x04, 0xee, 0x00, 0x00, 0x00, 0x06, 0x7a, 0x65,
0x70, 0x68, 0x79, 0x72, 0x00, 0x08, 0x71, 0x75,
0x69, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x00, 0x03,
@@ -394,16 +394,16 @@
.will_flag = 1,
.will_qos = 1, .will_retain = 1, .will_topic = WILL_TOPIC,
.will_topic_len = WILL_TOPIC_LEN,
- .will_msg = (uint8_t *)"bye",
+ .will_msg = (u8_t *)"bye",
.will_msg_len = 3,
.keep_alive = 0, .user_name = USERNAME,
.user_name_len = USERNAME_LEN,
- .password = (uint8_t *)"password",
+ .password = (u8_t *)"password",
.password_len = 8
};
static
-uint8_t disconnect1[] = {0xe0, 0x00};
+u8_t disconnect1[] = {0xe0, 0x00};
/*
* MQTT PUBLISH msg:
@@ -413,14 +413,14 @@
* mosquitto_pub -V mqttv311 -i zephyr -t sensors -q 0 -m "OK"
*/
static
-uint8_t publish1[] = {0x30, 0x0b, 0x00, 0x07, 0x73, 0x65, 0x6e, 0x73,
+u8_t publish1[] = {0x30, 0x0b, 0x00, 0x07, 0x73, 0x65, 0x6e, 0x73,
0x6f, 0x72, 0x73, 0x4f, 0x4b};
static struct mqtt_publish_msg msg_publish1 = {
.dup = 0, .qos = 0, .retain = 0, .topic = TOPIC,
.topic_len = TOPIC_LEN,
.pkt_id = 0,
- .msg = (uint8_t *)"OK",
+ .msg = (u8_t *)"OK",
.msg_len = 2,
};
@@ -432,14 +432,14 @@
* mosquitto_pub -V mqttv311 -i zephyr -t sensors -q 0 -m "OK" -r
*/
static
-uint8_t publish2[] = {0x31, 0x0b, 0x00, 0x07, 0x73, 0x65, 0x6e, 0x73,
+u8_t publish2[] = {0x31, 0x0b, 0x00, 0x07, 0x73, 0x65, 0x6e, 0x73,
0x6f, 0x72, 0x73, 0x4f, 0x4b};
static struct mqtt_publish_msg msg_publish2 = {
.dup = 0, .qos = 0, .retain = 1, .topic = TOPIC,
.topic_len = TOPIC_LEN,
.pkt_id = 0,
- .msg = (uint8_t *)"OK",
+ .msg = (u8_t *)"OK",
.msg_len = 2
};
@@ -451,14 +451,14 @@
* mosquitto_pub -V mqttv311 -i zephyr -t sensors -q 1 -m "OK" -r
*/
static
-uint8_t publish3[] = {0x33, 0x0d, 0x00, 0x07, 0x73, 0x65, 0x6e, 0x73,
+u8_t publish3[] = {0x33, 0x0d, 0x00, 0x07, 0x73, 0x65, 0x6e, 0x73,
0x6f, 0x72, 0x73, 0x00, 0x01, 0x4f, 0x4b};
static struct mqtt_publish_msg msg_publish3 = {
.dup = 0, .qos = 1, .retain = 1, .topic = TOPIC,
.topic_len = TOPIC_LEN,
.pkt_id = 1,
- .msg = (uint8_t *)"OK",
+ .msg = (u8_t *)"OK",
.msg_len = 2
};
@@ -470,13 +470,13 @@
* mosquitto_pub -V mqttv311 -i zephyr -t sensors -q 2 -m "OK"
*/
static
-uint8_t publish4[] = {0x34, 0x0d, 0x00, 0x07, 0x73, 0x65, 0x6e, 0x73,
+u8_t publish4[] = {0x34, 0x0d, 0x00, 0x07, 0x73, 0x65, 0x6e, 0x73,
0x6f, 0x72, 0x73, 0x00, 0x01, 0x4f, 0x4b};
static struct mqtt_publish_msg msg_publish4 = {
.dup = 0, .qos = 2, .retain = 0, .topic = TOPIC,
.topic_len = TOPIC_LEN,
.pkt_id = 1,
- .msg = (uint8_t *)"OK",
+ .msg = (u8_t *)"OK",
.msg_len = 2
};
@@ -488,7 +488,7 @@
* mosquitto_sub -V mqttv311 -i zephyr -t sensors -q 0
*/
static
-uint8_t subscribe1[] = {0x82, 0x0c, 0x00, 0x01, 0x00, 0x07, 0x73, 0x65,
+u8_t subscribe1[] = {0x82, 0x0c, 0x00, 0x01, 0x00, 0x07, 0x73, 0x65,
0x6e, 0x73, 0x6f, 0x72, 0x73, 0x00};
static struct msg_subscribe msg_subscribe1 = {
.pkt_id = 1, .items = 1,
@@ -503,7 +503,7 @@
* mosquitto_sub -V mqttv311 -i zephyr -t sensors -q 1
*/
static
-uint8_t subscribe2[] = {0x82, 0x0c, 0x00, 0x01, 0x00, 0x07, 0x73, 0x65,
+u8_t subscribe2[] = {0x82, 0x0c, 0x00, 0x01, 0x00, 0x07, 0x73, 0x65,
0x6e, 0x73, 0x6f, 0x72, 0x73, 0x01};
static struct msg_subscribe msg_subscribe2 = {
.pkt_id = 1, .items = 1,
@@ -518,7 +518,7 @@
* mosquitto_sub -V mqttv311 -i zephyr -t sensors -q 2
*/
static
-uint8_t subscribe3[] = {0x82, 0x0c, 0x00, 0x01, 0x00, 0x07, 0x73, 0x65,
+u8_t subscribe3[] = {0x82, 0x0c, 0x00, 0x01, 0x00, 0x07, 0x73, 0x65,
0x6e, 0x73, 0x6f, 0x72, 0x73, 0x02};
static struct msg_subscribe msg_subscribe3 = {
.pkt_id = 1, .items = 1,
@@ -533,7 +533,7 @@
* mosquitto_sub -V mqttv311 -i zephyr -t sensors -q 0
*/
static
-uint8_t suback1[] = {0x90, 0x03, 0x00, 0x01, 0x00};
+u8_t suback1[] = {0x90, 0x03, 0x00, 0x01, 0x00};
static struct msg_suback msg_suback1 = {
.pkt_id = 1, .elements = 1, .qos = {MQTT_QoS0}
};
@@ -546,7 +546,7 @@
* mosquitto_sub -V mqttv311 -i zephyr -t sensors -q 1
*/
static
-uint8_t suback2[] = {0x90, 0x03, 0x00, 0x01, 0x01};
+u8_t suback2[] = {0x90, 0x03, 0x00, 0x01, 0x01};
static struct msg_suback msg_suback2 = {
.pkt_id = 1, .elements = 1, .qos = {MQTT_QoS1}
};
@@ -559,35 +559,35 @@
* mosquitto_sub -V mqttv311 -i zephyr -t sensors -q 2
*/
static
-uint8_t suback3[] = {0x90, 0x03, 0x00, 0x01, 0x02};
+u8_t suback3[] = {0x90, 0x03, 0x00, 0x01, 0x02};
static struct msg_suback msg_suback3 = {
.pkt_id = 1, .elements = 1, .qos = {MQTT_QoS2}
};
static
-uint8_t pingreq1[] = {0xc0, 0x00};
+u8_t pingreq1[] = {0xc0, 0x00};
static
-uint8_t pingresp1[] = {0xd0, 0x00};
+u8_t pingresp1[] = {0xd0, 0x00};
static
-uint8_t puback1[] = {0x40, 0x02, 0x00, 0x01};
+u8_t puback1[] = {0x40, 0x02, 0x00, 0x01};
static struct msg_pkt_id msg_puback1 = {.pkt_id = 1};
static
-uint8_t pubrec1[] = {0x50, 0x02, 0x00, 0x01};
+u8_t pubrec1[] = {0x50, 0x02, 0x00, 0x01};
static struct msg_pkt_id msg_pubrec1 = {.pkt_id = 1};
static
-uint8_t pubrel1[] = {0x62, 0x02, 0x00, 0x01};
+u8_t pubrel1[] = {0x62, 0x02, 0x00, 0x01};
static struct msg_pkt_id msg_pubrel1 = {.pkt_id = 1};
static
-uint8_t pubcomp1[] = {0x70, 0x02, 0x00, 0x01};
+u8_t pubcomp1[] = {0x70, 0x02, 0x00, 0x01};
static struct msg_pkt_id msg_pubcomp1 = {.pkt_id = 1};
static
-uint8_t unsuback1[] = {0xb0, 0x02, 0x00, 0x01};
+u8_t unsuback1[] = {0xb0, 0x02, 0x00, 0x01};
static struct msg_pkt_id msg_unsuback1 = {.pkt_id = 1};
static
@@ -696,9 +696,9 @@
{.test_name = NULL}
};
-static void print_array(uint8_t *a, uint16_t size)
+static void print_array(u8_t *a, u16_t size)
{
- uint16_t i;
+ u16_t i;
TC_PRINT("\n");
for (i = 0; i < size; i++) {
@@ -720,8 +720,8 @@
}
static
-int eval_buffers(uint8_t *buf, uint16_t buf_len, uint8_t *expected,
- uint16_t len)
+int eval_buffers(u8_t *buf, u16_t buf_len, u8_t *expected,
+ u16_t len)
{
if (buf_len != len) {
goto exit_eval;
@@ -950,10 +950,10 @@
static
int eval_msg_packet_id(struct mqtt_test *mqtt_test, enum mqtt_packet type)
{
- int (*pack)(uint8_t *, uint16_t *, uint16_t, uint16_t) = NULL;
- int (*unpack)(uint8_t *, uint16_t, uint16_t *) = NULL;
+ int (*pack)(u8_t *, u16_t *, u16_t, u16_t) = NULL;
+ int (*unpack)(u8_t *, u16_t, u16_t *) = NULL;
struct msg_pkt_id *msg = (struct msg_pkt_id *)mqtt_test->msg;
- uint16_t pkt_id;
+ u16_t pkt_id;
int rc;
switch (type) {
diff --git a/tests/net/lib/mqtt_publisher/src/test_mqtt_publish.c b/tests/net/lib/mqtt_publisher/src/test_mqtt_publish.c
index 07275ad..2d9129e 100644
--- a/tests/net/lib/mqtt_publisher/src/test_mqtt_publish.c
+++ b/tests/net/lib/mqtt_publisher/src/test_mqtt_publish.c
@@ -64,7 +64,7 @@
/* This routine sets some basic properties for the network context variable */
static int network_setup(struct net_context **net_ctx, const char *local_addr,
- const char *server_addr, uint16_t server_port);
+ const char *server_addr, u16_t server_port);
/* The signature of this routine must match the connect callback declared at
* the mqtt.h header.
@@ -117,7 +117,7 @@
* unknown pkt_id, this routine must return an error, for example -EINVAL or
* any negative value.
*/
-static int publish_cb(struct mqtt_ctx *mqtt_ctx, uint16_t pkt_id,
+static int publish_cb(struct mqtt_ctx *mqtt_ctx, u16_t pkt_id,
enum mqtt_packet type)
{
struct mqtt_client_ctx *client_ctx;
@@ -157,7 +157,7 @@
* The signature of this routine must match the malformed callback declared at
* the mqtt.h header.
*/
-static void malformed_cb(struct mqtt_ctx *mqtt_ctx, uint16_t pkt_type)
+static void malformed_cb(struct mqtt_ctx *mqtt_ctx, u16_t pkt_type)
{
TC_PRINT("[%s:%d] pkt_type: %u\n", __func__, __LINE__, pkt_type);
}
@@ -178,9 +178,9 @@
enum mqtt_qos qos)
{
/* MQTT message payload may be anything, we we use C strings */
- pub_msg->msg = (uint8_t *)get_mqtt_payload(qos);
+ pub_msg->msg = (u8_t *)get_mqtt_payload(qos);
/* Payload's length */
- pub_msg->msg_len = (uint16_t)strlen((char *)client_ctx.pub_msg.msg);
+ pub_msg->msg_len = (u16_t)strlen((char *)client_ctx.pub_msg.msg);
/* MQTT Quality of Service */
pub_msg->qos = qos;
/* Message's topic */
@@ -327,7 +327,7 @@
return TC_PASS;
}
-static int set_addr(struct sockaddr *sock_addr, const char *addr, uint16_t port)
+static int set_addr(struct sockaddr *sock_addr, const char *addr, u16_t port)
{
void *ptr;
int rc;
@@ -352,7 +352,7 @@
}
static int network_setup(struct net_context **net_ctx, const char *local_addr,
- const char *server_addr, uint16_t server_port)
+ const char *server_addr, u16_t server_port)
{
#ifdef CONFIG_NET_IPV6
socklen_t addr_len = sizeof(struct sockaddr_in6);
diff --git a/tests/net/lib/mqtt_subscriber/src/test_mqtt_subscribe.c b/tests/net/lib/mqtt_subscriber/src/test_mqtt_subscribe.c
index 15afd89..1b923a7 100644
--- a/tests/net/lib/mqtt_subscriber/src/test_mqtt_subscribe.c
+++ b/tests/net/lib/mqtt_subscriber/src/test_mqtt_subscribe.c
@@ -68,7 +68,7 @@
/* This routine sets some basic properties for the network context variable */
static int network_setup(struct net_context **net_ctx, const char *local_addr,
- const char *server_addr, uint16_t server_port);
+ const char *server_addr, u16_t server_port);
/* The signature of this routine must match the connect callback declared at
* the mqtt.h header.
@@ -122,7 +122,7 @@
* any negative value.
*/
static int publish_rx_cb(struct mqtt_ctx *mqtt_ctx, struct mqtt_publish_msg
- *msg, uint16_t pkt_id, enum mqtt_packet type)
+ *msg, u16_t pkt_id, enum mqtt_packet type)
{
struct mqtt_client_ctx *client_ctx;
const char *str;
@@ -160,8 +160,8 @@
* The signature of this routine must match the subscribe callback declared at
* the mqtt.h header.
*/
-static int subscriber_cb(struct mqtt_ctx *mqtt_ctx, uint16_t pkt_id,
- uint8_t items, enum mqtt_qos qos[])
+static int subscriber_cb(struct mqtt_ctx *mqtt_ctx, u16_t pkt_id,
+ u8_t items, enum mqtt_qos qos[])
{
struct mqtt_client_ctx *client_ctx;
@@ -184,7 +184,7 @@
* The signature of this routine must match the unsubscribe callback declared at
* the mqtt.h header.
*/
-static int unsubscribe_cb(struct mqtt_ctx *mqtt_ctx, uint16_t pkt_id)
+static int unsubscribe_cb(struct mqtt_ctx *mqtt_ctx, u16_t pkt_id)
{
struct mqtt_client_ctx *client_ctx;
@@ -206,7 +206,7 @@
* The signature of this routine must match the malformed callback declared at
* the mqtt.h header.
*/
-static void malformed_cb(struct mqtt_ctx *mqtt_ctx, uint16_t pkt_type)
+static void malformed_cb(struct mqtt_ctx *mqtt_ctx, u16_t pkt_type)
{
printk("[%s:%d] pkt_type: %u\n", __func__, __LINE__, pkt_type);
}
@@ -323,7 +323,7 @@
{
int rc;
const char *topic_sub = get_mqtt_topic();
- uint16_t pkt_id_sub = sys_rand32_get();
+ u16_t pkt_id_sub = sys_rand32_get();
static enum mqtt_qos mqtt_qos_sub[1];
rc = mqtt_tx_subscribe(&client_ctx.mqtt_ctx, pkt_id_sub, 1,
@@ -340,7 +340,7 @@
{
int rc;
const char *topic_sub = get_mqtt_topic();
- uint16_t pkt_id_unsub = sys_rand32_get();
+ u16_t pkt_id_unsub = sys_rand32_get();
rc = mqtt_tx_unsubscribe(&client_ctx.mqtt_ctx, pkt_id_unsub,
1, &topic_sub);
@@ -364,7 +364,7 @@
return TC_PASS;
}
-static int set_addr(struct sockaddr *sock_addr, const char *addr, uint16_t port)
+static int set_addr(struct sockaddr *sock_addr, const char *addr, u16_t port)
{
void *ptr;
int rc;
@@ -389,7 +389,7 @@
}
static int network_setup(struct net_context **net_ctx, const char *local_addr,
- const char *server_addr, uint16_t server_port)
+ const char *server_addr, u16_t server_port)
{
#ifdef CONFIG_NET_IPV6
socklen_t addr_len = sizeof(struct sockaddr_in6);
diff --git a/tests/net/lib/zoap/src/main.c b/tests/net/lib/zoap/src/main.c
index cf36555..041bcb4 100644
--- a/tests/net/lib/zoap/src/main.c
+++ b/tests/net/lib/zoap/src/main.c
@@ -62,7 +62,7 @@
static int test_build_empty_pdu(void)
{
- uint8_t result_pdu[] = { 0x40, 0x01, 0x0, 0x0 };
+ u8_t result_pdu[] = { 0x40, 0x01, 0x0, 0x0 };
struct zoap_packet zpkt;
struct net_pkt *pkt;
struct net_buf *frag;
@@ -116,16 +116,16 @@
static int test_build_simple_pdu(void)
{
- uint8_t result_pdu[] = { 0x55, 0xA5, 0x12, 0x34, 't', 'o', 'k', 'e',
+ u8_t result_pdu[] = { 0x55, 0xA5, 0x12, 0x34, 't', 'o', 'k', 'e',
'n', 0xC1, 0x00, 0xFF, 'p', 'a', 'y', 'l',
'o', 'a', 'd', 0x00 };
struct zoap_packet zpkt;
struct net_pkt *pkt;
struct net_buf *frag;
const char token[] = "token";
- uint8_t *appdata, payload[] = "payload";
- uint16_t buflen;
- uint8_t format = 0;
+ u8_t *appdata, payload[] = "payload";
+ u16_t buflen;
+ u8_t format = 0;
int result = TC_FAIL;
int r;
@@ -155,7 +155,7 @@
ZOAP_RESPONSE_CODE_PROXYING_NOT_SUPPORTED);
zoap_header_set_id(&zpkt, 0x1234);
- r = zoap_header_set_token(&zpkt, (uint8_t *)token, strlen(token));
+ r = zoap_header_set_token(&zpkt, (u8_t *)token, strlen(token));
if (r) {
TC_PRINT("Could not set token\n");
goto done;
@@ -220,7 +220,7 @@
struct net_pkt *pkt;
struct net_buf *frag;
const char token[] = "token";
- uint8_t format = 0;
+ u8_t format = 0;
int result = TC_FAIL;
int r;
@@ -250,7 +250,7 @@
ZOAP_RESPONSE_CODE_PROXYING_NOT_SUPPORTED);
zoap_header_set_id(&zpkt, 0x1234);
- r = zoap_header_set_token(&zpkt, (uint8_t *)token, strlen(token));
+ r = zoap_header_set_token(&zpkt, (u8_t *)token, strlen(token));
if (r) {
TC_PRINT("Could not set token\n");
goto done;
@@ -276,12 +276,12 @@
static int test_parse_empty_pdu(void)
{
- uint8_t pdu[] = { 0x40, 0x01, 0, 0 };
+ u8_t pdu[] = { 0x40, 0x01, 0, 0 };
struct net_pkt *pkt;
struct net_buf *frag;
struct zoap_packet zpkt;
- uint8_t ver, type, code;
- uint16_t id;
+ u8_t ver, type, code;
+ u16_t id;
int result = TC_FAIL;
int r;
@@ -345,16 +345,16 @@
static int test_parse_simple_pdu(void)
{
- uint8_t pdu[] = { 0x55, 0xA5, 0x12, 0x34, 't', 'o', 'k', 'e',
+ u8_t pdu[] = { 0x55, 0xA5, 0x12, 0x34, 't', 'o', 'k', 'e',
'n', 0x00, 0xc1, 0x00, 0xff, 'p', 'a', 'y',
'l', 'o', 'a', 'd', 0x00 };
struct zoap_packet zpkt;
struct net_pkt *pkt;
struct net_buf *frag;
struct zoap_option options[16];
- uint8_t ver, type, code, tkl;
- const uint8_t *token, *payload;
- uint16_t id, len;
+ u8_t ver, type, code, tkl;
+ const u8_t *token, *payload;
+ u16_t id, len;
int result = TC_FAIL;
int r, count = 16;
@@ -435,7 +435,7 @@
goto done;
}
- if (((uint8_t *)options[0].value)[0] != 0) {
+ if (((u8_t *)options[0].value)[0] != 0) {
TC_PRINT("Option value doesn't match the reference\n");
goto done;
}
@@ -476,7 +476,7 @@
struct net_buf *frag;
int result = TC_FAIL;
int r;
- uint16_t id;
+ u16_t id;
pkt = net_pkt_get_reserve(&zoap_pkt_slab, 0, K_NO_WAIT);
if (!pkt) {
@@ -621,9 +621,9 @@
struct net_pkt *pkt;
struct net_buf *frag;
char payload[] = "This is the payload";
- const uint8_t *token;
- uint8_t tkl, *p;
- uint16_t id, len;
+ const u8_t *token;
+ u8_t tkl, *p;
+ u16_t id, len;
int r;
if (!zoap_request_is_observe(request)) {
@@ -689,13 +689,13 @@
static int test_observer_server(void)
{
- uint8_t valid_request_pdu[] = {
+ u8_t valid_request_pdu[] = {
0x45, 0x01, 0x12, 0x34,
't', 'o', 'k', 'e', 'n',
0x60, /* enable observe option */
0x51, 's', 0x01, '1', /* path */
};
- uint8_t not_found_request_pdu[] = {
+ u8_t not_found_request_pdu[] = {
0x45, 0x01, 0x12, 0x34,
't', 'o', 'k', 'e', 'n',
0x60, /* enable observe option */
@@ -835,7 +835,7 @@
zoap_header_set_code(&req, ZOAP_METHOD_GET);
zoap_header_set_id(&req, zoap_next_id());
zoap_header_set_token(&req,
- (const uint8_t *) token, strlen(token));
+ (const u8_t *) token, strlen(token));
/* Enable observing the resource. */
r = zoap_add_option_int(&req, ZOAP_OPTION_OBSERVE,
@@ -918,8 +918,8 @@
struct net_pkt *pkt = NULL;
struct net_buf *frag;
const char token[] = "rndtoken";
- uint8_t *payload;
- uint16_t len;
+ u8_t *payload;
+ u16_t len;
int result = TC_FAIL;
int r;
@@ -951,7 +951,7 @@
zoap_header_set_code(&req, ZOAP_METHOD_POST);
zoap_header_set_id(&req, zoap_next_id());
zoap_header_set_token(&req,
- (const uint8_t *) token, strlen(token));
+ (const u8_t *) token, strlen(token));
zoap_add_block1_option(&req, &req_ctx);
zoap_add_size1_option(&req, &req_ctx);
@@ -1021,7 +1021,7 @@
zoap_header_set_code(&req, ZOAP_METHOD_POST);
zoap_header_set_id(&req, zoap_next_id());
zoap_header_set_token(&req,
- (const uint8_t *) token, strlen(token));
+ (const u8_t *) token, strlen(token));
zoap_add_block1_option(&req, &req_ctx);
diff --git a/tests/net/mgmt/src/mgmt.c b/tests/net/mgmt/src/mgmt.c
index ef2008f..f24dd79 100644
--- a/tests/net/mgmt/src/mgmt.c
+++ b/tests/net/mgmt/src/mgmt.c
@@ -18,28 +18,28 @@
#define TEST_MGMT_EVENT_UNHANDLED 0x97AB4321
/* Notifier infra */
-static uint32_t event2throw;
-static uint32_t throw_times;
+static u32_t event2throw;
+static u32_t throw_times;
static int throw_sleep;
static char __noinit __stack thrower_stack[512];
static struct k_sem thrower_lock;
/* Receiver infra */
-static uint32_t rx_event;
-static uint32_t rx_calls;
+static u32_t rx_event;
+static u32_t rx_calls;
static struct net_mgmt_event_callback rx_cb;
static struct in6_addr addr6 = { { { 0xfe, 0x80, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0x1 } } };
-static int test_mgmt_request(uint32_t mgmt_request,
- struct net_if *iface, void *data, uint32_t len)
+static int test_mgmt_request(u32_t mgmt_request,
+ struct net_if *iface, void *data, u32_t len)
{
- uint32_t *test_data = data;
+ u32_t *test_data = data;
ARG_UNUSED(iface);
- if (len == sizeof(uint32_t)) {
+ if (len == sizeof(u32_t)) {
*test_data = 1;
return 0;
@@ -59,7 +59,7 @@
static void fake_iface_init(struct net_if *iface)
{
- uint8_t mac[8] = { 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0b, 0x0c, 0x0d};
+ u8_t mac[8] = { 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0b, 0x0c, 0x0d};
net_if_set_link_addr(iface, mac, 8, NET_LINK_DUMMY);
}
@@ -82,7 +82,7 @@
static inline int test_requesting_nm(void)
{
- uint32_t data = 0;
+ u32_t data = 0;
TC_PRINT("- Request Net MGMT\n");
@@ -111,7 +111,7 @@
}
static void receiver_cb(struct net_mgmt_event_callback *cb,
- uint32_t nm_event, struct net_if *iface)
+ u32_t nm_event, struct net_if *iface)
{
TC_PRINT("\t\tReceived event 0x%08X\n", nm_event);
@@ -119,7 +119,7 @@
rx_calls++;
}
-static inline int test_sending_event(uint32_t times, bool receiver)
+static inline int test_sending_event(u32_t times, bool receiver)
{
int ret = TC_PASS;
@@ -156,9 +156,9 @@
return ret;
}
-static int test_synchronous_event_listener(uint32_t times, bool on_iface)
+static int test_synchronous_event_listener(u32_t times, bool on_iface)
{
- uint32_t event_mask;
+ u32_t event_mask;
int ret;
TC_PRINT("- Synchronous event listener %s\n",
@@ -210,7 +210,7 @@
NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
}
-static int test_core_event(uint32_t event, bool (*func)(void))
+static int test_core_event(u32_t event, bool (*func)(void))
{
int ret = TC_PASS;
diff --git a/tests/net/mld/src/main.c b/tests/net/mld/src/main.c
index dcf2a4a..2c3c1d7 100644
--- a/tests/net/mld/src/main.c
+++ b/tests/net/mld/src/main.c
@@ -57,7 +57,7 @@
#define PEER_PORT 13856
struct net_test_mld {
- uint8_t mac_addr[sizeof(struct net_eth_addr)];
+ u8_t mac_addr[sizeof(struct net_eth_addr)];
struct net_linkaddr ll_addr;
};
@@ -66,7 +66,7 @@
return 0;
}
-static uint8_t *net_test_get_mac(struct device *dev)
+static u8_t *net_test_get_mac(struct device *dev)
{
struct net_test_mld *context = dev->driver_data;
@@ -85,7 +85,7 @@
static void net_test_iface_init(struct net_if *iface)
{
- uint8_t *mac = net_test_get_mac(net_if_get_device(iface));
+ u8_t *mac = net_test_get_mac(net_if_get_device(iface));
net_if_set_link_addr(iface, mac, sizeof(struct net_eth_addr),
NET_LINK_ETHERNET);
@@ -133,7 +133,7 @@
127);
static void group_joined(struct net_mgmt_event_callback *cb,
- uint32_t nm_event, struct net_if *iface)
+ u32_t nm_event, struct net_if *iface)
{
is_group_joined = true;
@@ -141,7 +141,7 @@
}
static void group_left(struct net_mgmt_event_callback *cb,
- uint32_t nm_event, struct net_if *iface)
+ u32_t nm_event, struct net_if *iface)
{
is_group_left = true;
@@ -149,7 +149,7 @@
}
static struct mgmt_events {
- uint32_t event;
+ u32_t event;
net_mgmt_event_handler_t handler;
struct net_mgmt_event_callback cb;
} mgmt_events[] = {
@@ -288,7 +288,7 @@
{
struct net_pkt *pkt;
struct in6_addr dst;
- uint16_t pos;
+ u16_t pos;
/* Sent to all MLDv2-capable routers */
net_ipv6_addr_create(&dst, 0xff02, 0, 0, 0, 0, 0, 0, 0x0016);
@@ -326,7 +326,7 @@
net_pkt_append_be16(pkt, 0); /* reserved field */
net_pkt_append(pkt, sizeof(struct in6_addr),
- (const uint8_t *)net_ipv6_unspecified_address(),
+ (const u8_t *)net_ipv6_unspecified_address(),
K_FOREVER); /* multicast address */
net_pkt_append_be16(pkt, 0); /* Resv, S, QRV and QQIC */
diff --git a/tests/net/net_pkt/src/main.c b/tests/net/net_pkt/src/main.c
index 179634e..163ca02 100644
--- a/tests/net/net_pkt/src/main.c
+++ b/tests/net/net_pkt/src/main.c
@@ -24,27 +24,27 @@
#define FRAG_COUNT 7
struct ipv6_hdr {
- uint8_t vtc;
- uint8_t tcflow;
- uint16_t flow;
- uint8_t len[2];
- uint8_t nexthdr;
- uint8_t hop_limit;
+ u8_t vtc;
+ u8_t tcflow;
+ u16_t flow;
+ u8_t len[2];
+ u8_t nexthdr;
+ u8_t hop_limit;
struct in6_addr src;
struct in6_addr dst;
} __packed;
struct udp_hdr {
- uint16_t src_port;
- uint16_t dst_port;
- uint16_t len;
- uint16_t chksum;
+ u16_t src_port;
+ u16_t dst_port;
+ u16_t len;
+ u16_t chksum;
} __packed;
struct icmp_hdr {
- uint8_t type;
- uint8_t code;
- uint16_t chksum;
+ u8_t type;
+ u8_t code;
+ u16_t chksum;
} __packed;
static const char example_data[] =
@@ -286,7 +286,7 @@
'5', '6', '7' };
#if HEXDUMP
-static void hexdump(const char *str, const uint8_t *packet, size_t length)
+static void hexdump(const char *str, const u8_t *packet, size_t length)
{
int n = 0;
@@ -348,19 +348,19 @@
static int test_pkt_read_append(void)
{
int remaining = strlen(sample_data);
- uint8_t verify_rw_short[sizeof(test_rw_short)];
- uint8_t verify_rw_long[sizeof(test_rw_long)];
+ u8_t verify_rw_short[sizeof(test_rw_short)];
+ u8_t verify_rw_long[sizeof(test_rw_long)];
struct net_pkt *pkt;
struct net_buf *frag;
struct net_buf *tfrag;
struct ipv6_hdr *ipv6;
struct udp_hdr *udp;
- uint8_t data[10];
+ u8_t data[10];
int pos = 0;
int bytes;
- uint16_t off;
- uint16_t tpos;
- uint16_t fail_pos;
+ u16_t off;
+ u16_t tpos;
+ u16_t fail_pos;
/* Example of multi fragment read, append and skip APS's */
pkt = net_pkt_get_reserve_rx(0, K_FOREVER);
@@ -508,27 +508,27 @@
tfrag = net_buf_frag_last(pkt->frags);
off = tfrag->len;
- if (!net_pkt_append(pkt, (uint16_t)sizeof(test_rw_short),
+ if (!net_pkt_append(pkt, (u16_t)sizeof(test_rw_short),
test_rw_short, K_FOREVER)) {
printk("net_pkt_append failed\n");
return -EINVAL;
}
- if (!net_pkt_append(pkt, (uint16_t)sizeof(test_rw_short),
+ if (!net_pkt_append(pkt, (u16_t)sizeof(test_rw_short),
test_rw_short, K_FOREVER)) {
printk("net_pkt_append failed\n");
return -EINVAL;
}
tfrag = net_frag_skip(tfrag, off, &tpos,
- (uint16_t)sizeof(test_rw_short));
+ (u16_t)sizeof(test_rw_short));
if (!tfrag) {
printk("net_frag_skip failed\n");
return -EINVAL;
}
tfrag = net_frag_read(tfrag, tpos, &tpos,
- (uint16_t)sizeof(test_rw_short),
+ (u16_t)sizeof(test_rw_short),
verify_rw_short);
if (memcmp(test_rw_short, verify_rw_short, sizeof(test_rw_short))) {
printk("net_frag_read failed with mismatch data");
@@ -546,27 +546,27 @@
tfrag = net_buf_frag_last(pkt->frags);
off = tfrag->len;
- if (!net_pkt_append(pkt, (uint16_t)sizeof(test_rw_long), test_rw_long,
+ if (!net_pkt_append(pkt, (u16_t)sizeof(test_rw_long), test_rw_long,
K_FOREVER)) {
printk("net_pkt_append failed\n");
return -EINVAL;
}
- if (!net_pkt_append(pkt, (uint16_t)sizeof(test_rw_long), test_rw_long,
+ if (!net_pkt_append(pkt, (u16_t)sizeof(test_rw_long), test_rw_long,
K_FOREVER)) {
printk("net_pkt_append failed\n");
return -EINVAL;
}
tfrag = net_frag_skip(tfrag, off, &tpos,
- (uint16_t)sizeof(test_rw_long));
+ (u16_t)sizeof(test_rw_long));
if (!tfrag) {
printk("net_frag_skip failed\n");
return -EINVAL;
}
tfrag = net_frag_read(tfrag, tpos, &tpos,
- (uint16_t)sizeof(test_rw_long),
+ (u16_t)sizeof(test_rw_long),
verify_rw_long);
if (memcmp(test_rw_long, verify_rw_long, sizeof(test_rw_long))) {
printk("net_frag_read failed with mismatch data");
@@ -586,10 +586,10 @@
struct net_buf *temp_frag;
struct net_pkt *pkt;
struct net_buf *frag;
- uint8_t read_data[100];
- uint16_t read_pos;
- uint16_t len;
- uint16_t pos;
+ u8_t read_data[100];
+ u16_t read_pos;
+ u16_t len;
+ u16_t pos;
/* Example of multi fragment read, append and skip APS's */
pkt = net_pkt_get_reserve_rx(0, K_FOREVER);
@@ -605,7 +605,7 @@
* and write data).
*/
frag = net_pkt_write(pkt, frag, NET_IPV6UDPH_LEN, &pos, 10,
- (uint8_t *)sample_data, K_FOREVER);
+ (u8_t *)sample_data, K_FOREVER);
if (!frag || pos != 58) {
printk("Usecase 1: Write failed\n");
return -EINVAL;
@@ -628,7 +628,7 @@
* there shouldn't be any length change).
*/
frag = net_pkt_write(pkt, frag, 0, &pos, NET_IPV6UDPH_LEN,
- (uint8_t *)sample_data, K_FOREVER);
+ (u8_t *)sample_data, K_FOREVER);
if (!frag || pos != 48) {
printk("Usecase 2: Write failed\n");
return -EINVAL;
@@ -657,7 +657,7 @@
* create empty fragments(space) till offset and write data).
*/
frag = net_pkt_write(pkt, pkt->frags, 200, &pos, 10,
- (uint8_t *)sample_data + 10, K_FOREVER);
+ (u8_t *)sample_data + 10, K_FOREVER);
if (!frag) {
printk("Usecase 3: Write failed");
}
@@ -680,7 +680,7 @@
* the existing data.
*/
frag = net_pkt_write(pkt, pkt->frags, 190, &pos, 10,
- (uint8_t *)sample_data, K_FOREVER);
+ (u8_t *)sample_data, K_FOREVER);
if (!frag) {
printk("Usecase 4: Write failed\n");
return -EINVAL;
@@ -715,7 +715,7 @@
/* Create 10 bytes space. */
net_buf_add(frag, 10);
- frag = net_pkt_write(pkt, frag, 0, &pos, 20, (uint8_t *)sample_data,
+ frag = net_pkt_write(pkt, frag, 0, &pos, 20, (u8_t *)sample_data,
K_FOREVER);
if (!frag && pos != 20) {
printk("Usecase 5: Write failed\n");
@@ -773,7 +773,7 @@
net_buf_add(frag, 5);
temp_frag = net_pkt_write(pkt, temp_frag, temp_frag->len - 10, &pos,
- 30, (uint8_t *) sample_data, K_FOREVER);
+ 30, (u8_t *) sample_data, K_FOREVER);
if (!temp_frag) {
printk("Use case 6: Write failed\n");
return -EINVAL;
@@ -810,7 +810,7 @@
net_pkt_frag_add(pkt, frag);
frag = net_pkt_write(pkt, frag, NET_IPV6UDPH_LEN, &pos, 10,
- (uint8_t *)sample_data + 10, K_FOREVER);
+ (u8_t *)sample_data + 10, K_FOREVER);
if (!frag || pos != 58) {
printk("Usecase 7: Write failed\n");
return -EINVAL;
@@ -829,7 +829,7 @@
}
if (!net_pkt_insert(pkt, frag, NET_IPV6UDPH_LEN, 10,
- (uint8_t *)sample_data, K_FOREVER)) {
+ (u8_t *)sample_data, K_FOREVER)) {
printk("Usecase 7: Insert failed\n");
return -EINVAL;
}
@@ -847,7 +847,7 @@
}
/* Insert data outside input fragment length, error case. */
- if (net_pkt_insert(pkt, frag, 70, 10, (uint8_t *)sample_data,
+ if (net_pkt_insert(pkt, frag, 70, 10, (u8_t *)sample_data,
K_FOREVER)) {
printk("Usecase 7: False insert failed\n");
return -EINVAL;
@@ -872,7 +872,7 @@
net_pkt_frag_add(pkt, frag);
frag = net_pkt_write(pkt, frag, NET_IPV6UDPH_LEN, &pos, 10,
- (uint8_t *)sample_data + 60, K_FOREVER);
+ (u8_t *)sample_data + 60, K_FOREVER);
if (!frag || pos != 58) {
printk("Usecase 8: Write failed\n");
return -EINVAL;
@@ -891,7 +891,7 @@
}
if (!net_pkt_insert(pkt, frag, NET_IPV6UDPH_LEN, 60,
- (uint8_t *)sample_data, K_FOREVER)) {
+ (u8_t *)sample_data, K_FOREVER)) {
printk("Usecase 8: Insert failed\n");
return -EINVAL;
}
diff --git a/tests/net/route/src/main.c b/tests/net/route/src/main.c
index 2cb717e..d783263 100644
--- a/tests/net/route/src/main.c
+++ b/tests/net/route/src/main.c
@@ -83,7 +83,7 @@
#define WAIT_TIME 250
struct net_route_test {
- uint8_t mac_addr[sizeof(struct net_eth_addr)];
+ u8_t mac_addr[sizeof(struct net_eth_addr)];
struct net_linkaddr ll_addr;
};
@@ -92,7 +92,7 @@
return 0;
}
-static uint8_t *net_route_get_mac(struct device *dev)
+static u8_t *net_route_get_mac(struct device *dev)
{
struct net_route_test *route = dev->driver_data;
@@ -114,7 +114,7 @@
static void net_route_iface_init(struct net_if *iface)
{
- uint8_t *mac = net_route_get_mac(net_if_get_device(iface));
+ u8_t *mac = net_route_get_mac(net_if_get_device(iface));
net_if_set_link_addr(iface, mac, sizeof(struct net_eth_addr),
NET_LINK_ETHERNET);
diff --git a/tests/net/rpl/src/main.c b/tests/net/rpl/src/main.c
index 87564ae..bdf1bba 100644
--- a/tests/net/rpl/src/main.c
+++ b/tests/net/rpl/src/main.c
@@ -71,7 +71,7 @@
#define WAIT_TIME 250
struct net_rpl_test {
- uint8_t mac_addr[sizeof(struct net_eth_addr)];
+ u8_t mac_addr[sizeof(struct net_eth_addr)];
struct net_linkaddr ll_addr;
};
@@ -80,7 +80,7 @@
return 0;
}
-static uint8_t *net_rpl_get_mac(struct device *dev)
+static u8_t *net_rpl_get_mac(struct device *dev)
{
struct net_rpl_test *rpl = dev->driver_data;
@@ -99,7 +99,7 @@
static void net_rpl_iface_init(struct net_if *iface)
{
- uint8_t *mac = net_rpl_get_mac(net_if_get_device(iface));
+ u8_t *mac = net_rpl_get_mac(net_if_get_device(iface));
net_if_set_link_addr(iface, mac, sizeof(struct net_eth_addr),
NET_LINK_ETHERNET);
diff --git a/tests/net/tcp/src/main.c b/tests/net/tcp/src/main.c
index a7a9294..420c330 100644
--- a/tests/net/tcp/src/main.c
+++ b/tests/net/tcp/src/main.c
@@ -76,7 +76,7 @@
static bool syn_v6_sent;
struct net_tcp_context {
- uint8_t mac_addr[sizeof(struct net_eth_addr)];
+ u8_t mac_addr[sizeof(struct net_eth_addr)];
struct net_linkaddr ll_addr;
};
@@ -89,7 +89,7 @@
return 0;
}
-static uint8_t *net_tcp_get_mac(struct device *dev)
+static u8_t *net_tcp_get_mac(struct device *dev)
{
struct net_tcp_context *context = dev->driver_data;
@@ -108,7 +108,7 @@
static void net_tcp_iface_init(struct net_if *iface)
{
- uint8_t *mac = net_tcp_get_mac(net_if_get_device(iface));
+ u8_t *mac = net_tcp_get_mac(net_if_get_device(iface));
net_if_set_link_addr(iface, mac, 6, NET_LINK_ETHERNET);
}
@@ -209,8 +209,8 @@
struct ud {
const struct sockaddr *remote_addr;
const struct sockaddr *local_addr;
- uint16_t remote_port;
- uint16_t local_port;
+ u16_t remote_port;
+ u16_t local_port;
char *test;
struct net_conn_handle *handle;
};
@@ -257,8 +257,8 @@
static void setup_ipv6_tcp(struct net_pkt *pkt,
struct in6_addr *remote_addr,
struct in6_addr *local_addr,
- uint16_t remote_port,
- uint16_t local_port)
+ u16_t remote_port,
+ u16_t local_port)
{
NET_IPV6_HDR(pkt)->vtc = 0x60;
NET_IPV6_HDR(pkt)->tcflow = 0;
@@ -286,8 +286,8 @@
static void setup_ipv4_tcp(struct net_pkt *pkt,
struct in_addr *remote_addr,
struct in_addr *local_addr,
- uint16_t remote_port,
- uint16_t local_port)
+ u16_t remote_port,
+ u16_t local_port)
{
NET_IPV4_HDR(pkt)->vhl = 0x45;
NET_IPV4_HDR(pkt)->tos = 0;
@@ -316,8 +316,8 @@
static bool send_ipv6_tcp_msg(struct net_if *iface,
struct in6_addr *src,
struct in6_addr *dst,
- uint16_t src_port,
- uint16_t dst_port,
+ u16_t src_port,
+ u16_t dst_port,
struct ud *ud,
bool expect_failure)
{
@@ -367,8 +367,8 @@
static bool send_ipv4_tcp_msg(struct net_if *iface,
struct in_addr *src,
struct in_addr *dst,
- uint16_t src_port,
- uint16_t dst_port,
+ u16_t src_port,
+ u16_t dst_port,
struct ud *ud,
bool expect_failure)
{
@@ -416,8 +416,8 @@
}
static void set_port(sa_family_t family, struct sockaddr *raddr,
- struct sockaddr *laddr, uint16_t rport,
- uint16_t lport)
+ struct sockaddr *laddr, u16_t rport,
+ u16_t lport)
{
if (family == AF_INET6) {
if (raddr) {
@@ -679,7 +679,7 @@
static bool v6_check_port_and_address(char *test_str, struct net_pkt *pkt,
const struct in6_addr *expected_dst_addr,
- uint16_t expected_dst_port)
+ u16_t expected_dst_port)
{
if (!net_ipv6_addr_cmp(&NET_IPV6_HDR(pkt)->src,
&my_v6_addr.sin6_addr)) {
@@ -719,7 +719,7 @@
static bool v4_check_port_and_address(char *test_str, struct net_pkt *pkt,
const struct in_addr *expected_dst_addr,
- uint16_t expected_dst_port)
+ u16_t expected_dst_port)
{
if (!net_ipv4_addr_cmp(&NET_IPV4_HDR(pkt)->src,
&my_v4_addr.sin_addr)) {
@@ -760,7 +760,7 @@
static bool test_create_v6_reset_packet(void)
{
struct net_tcp *tcp = v6_ctx->tcp;
- uint8_t flags = NET_TCP_RST;
+ u8_t flags = NET_TCP_RST;
struct net_pkt *pkt = NULL;
int ret;
@@ -791,7 +791,7 @@
static bool test_create_v4_reset_packet(void)
{
struct net_tcp *tcp = v4_ctx->tcp;
- uint8_t flags = NET_TCP_RST;
+ u8_t flags = NET_TCP_RST;
struct net_pkt *pkt = NULL;
int ret;
@@ -822,7 +822,7 @@
static bool test_create_v6_syn_packet(void)
{
struct net_tcp *tcp = v6_ctx->tcp;
- uint8_t flags = NET_TCP_SYN;
+ u8_t flags = NET_TCP_SYN;
struct net_pkt *pkt = NULL;
int ret;
@@ -853,7 +853,7 @@
static bool test_create_v4_syn_packet(void)
{
struct net_tcp *tcp = v4_ctx->tcp;
- uint8_t flags = NET_TCP_SYN;
+ u8_t flags = NET_TCP_SYN;
struct net_pkt *pkt = NULL;
int ret;
@@ -884,7 +884,7 @@
static bool test_create_v6_synack_packet(void)
{
struct net_tcp *tcp = v6_ctx->tcp;
- uint8_t flags = NET_TCP_SYN | NET_TCP_ACK;
+ u8_t flags = NET_TCP_SYN | NET_TCP_ACK;
struct net_pkt *pkt = NULL;
int ret;
@@ -916,7 +916,7 @@
static bool test_create_v4_synack_packet(void)
{
struct net_tcp *tcp = v4_ctx->tcp;
- uint8_t flags = NET_TCP_SYN | NET_TCP_ACK;
+ u8_t flags = NET_TCP_SYN | NET_TCP_ACK;
struct net_pkt *pkt = NULL;
int ret;
@@ -948,7 +948,7 @@
static bool test_create_v6_fin_packet(void)
{
struct net_tcp *tcp = v6_ctx->tcp;
- uint8_t flags = NET_TCP_FIN;
+ u8_t flags = NET_TCP_FIN;
struct net_pkt *pkt = NULL;
int ret;
@@ -979,7 +979,7 @@
static bool test_create_v4_fin_packet(void)
{
struct net_tcp *tcp = v4_ctx->tcp;
- uint8_t flags = NET_TCP_FIN;
+ u8_t flags = NET_TCP_FIN;
struct net_pkt *pkt = NULL;
int ret;
@@ -1010,9 +1010,9 @@
static bool test_v6_seq_check(void)
{
struct net_tcp *tcp = v6_ctx->tcp;
- uint8_t flags = NET_TCP_SYN;
+ u8_t flags = NET_TCP_SYN;
struct net_pkt *pkt = NULL;
- uint32_t seq;
+ u32_t seq;
int ret;
ret = net_tcp_prepare_segment(tcp, flags, NULL, 0, NULL,
@@ -1042,9 +1042,9 @@
static bool test_v4_seq_check(void)
{
struct net_tcp *tcp = v4_ctx->tcp;
- uint8_t flags = NET_TCP_SYN;
+ u8_t flags = NET_TCP_SYN;
struct net_pkt *pkt = NULL;
- uint32_t seq;
+ u32_t seq;
int ret;
ret = net_tcp_prepare_segment(tcp, flags, NULL, 0, NULL,
diff --git a/tests/net/udp/src/main.c b/tests/net/udp/src/main.c
index 1e96b56..673b077 100644
--- a/tests/net/udp/src/main.c
+++ b/tests/net/udp/src/main.c
@@ -38,7 +38,7 @@
static struct k_sem recv_lock;
struct net_udp_context {
- uint8_t mac_addr[sizeof(struct net_eth_addr)];
+ u8_t mac_addr[sizeof(struct net_eth_addr)];
struct net_linkaddr ll_addr;
};
@@ -51,7 +51,7 @@
return 0;
}
-static uint8_t *net_udp_get_mac(struct device *dev)
+static u8_t *net_udp_get_mac(struct device *dev)
{
struct net_udp_context *context = dev->driver_data;
@@ -70,7 +70,7 @@
static void net_udp_iface_init(struct net_if *iface)
{
- uint8_t *mac = net_udp_get_mac(net_if_get_device(iface));
+ u8_t *mac = net_udp_get_mac(net_if_get_device(iface));
net_if_set_link_addr(iface, mac, 6, NET_LINK_ETHERNET);
}
@@ -126,8 +126,8 @@
struct ud {
const struct sockaddr *remote_addr;
const struct sockaddr *local_addr;
- uint16_t remote_port;
- uint16_t local_port;
+ u16_t remote_port;
+ u16_t local_port;
char *test;
void *handle;
};
@@ -174,8 +174,8 @@
static void setup_ipv6_udp(struct net_pkt *pkt,
struct in6_addr *remote_addr,
struct in6_addr *local_addr,
- uint16_t remote_port,
- uint16_t local_port)
+ u16_t remote_port,
+ u16_t local_port)
{
NET_IPV6_HDR(pkt)->vtc = 0x60;
NET_IPV6_HDR(pkt)->tcflow = 0;
@@ -203,8 +203,8 @@
static void setup_ipv4_udp(struct net_pkt *pkt,
struct in_addr *remote_addr,
struct in_addr *local_addr,
- uint16_t remote_port,
- uint16_t local_port)
+ u16_t remote_port,
+ u16_t local_port)
{
NET_IPV4_HDR(pkt)->vhl = 0x45;
NET_IPV4_HDR(pkt)->tos = 0;
@@ -233,8 +233,8 @@
static bool send_ipv6_udp_msg(struct net_if *iface,
struct in6_addr *src,
struct in6_addr *dst,
- uint16_t src_port,
- uint16_t dst_port,
+ u16_t src_port,
+ u16_t dst_port,
struct ud *ud,
bool expect_failure)
{
@@ -281,8 +281,8 @@
static bool send_ipv4_udp_msg(struct net_if *iface,
struct in_addr *src,
struct in_addr *dst,
- uint16_t src_port,
- uint16_t dst_port,
+ u16_t src_port,
+ u16_t dst_port,
struct ud *ud,
bool expect_failure)
{
@@ -327,8 +327,8 @@
}
static void set_port(sa_family_t family, struct sockaddr *raddr,
- struct sockaddr *laddr, uint16_t rport,
- uint16_t lport)
+ struct sockaddr *laddr, u16_t rport,
+ u16_t lport)
{
if (family == AF_INET6) {
if (raddr) {
diff --git a/tests/net/utils/src/main.c b/tests/net/utils/src/main.c
index e00c676..4ea1097 100644
--- a/tests/net/utils/src/main.c
+++ b/tests/net/utils/src/main.c
@@ -151,7 +151,7 @@
{
struct net_pkt *pkt;
struct net_buf *frag;
- uint16_t chksum, orig_chksum;
+ u16_t chksum, orig_chksum;
int hdr_len, i, chunk, datalen, total = 0;
/* Packet fits to one fragment */