net/pkt: Remove _new suffix to net_pkt_read functions
Suffix is now useless, as these functions are now the only ones. Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
f8a091104e
commit
a25f054cbd
27 changed files with 77 additions and 77 deletions
|
|
@ -356,7 +356,7 @@ static inline void telnet_handle_input(struct net_pkt *pkt)
|
|||
}
|
||||
|
||||
len = MIN(len, CONSOLE_MAX_LINE_LEN);
|
||||
if (net_pkt_read_new(pkt, (u8_t *)input->line, len)) {
|
||||
if (net_pkt_read(pkt, (u8_t *)input->line, len)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ static int e1000_send(struct device *device, struct net_pkt *pkt)
|
|||
struct e1000_dev *dev = device->driver_data;
|
||||
size_t len = net_pkt_get_len(pkt);
|
||||
|
||||
if (net_pkt_read_new(pkt, dev->txb, len)) {
|
||||
if (net_pkt_read(pkt, dev->txb, len)) {
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -502,7 +502,7 @@ static int eth_tx(struct device *dev, struct net_pkt *pkt)
|
|||
*/
|
||||
imask = irq_lock();
|
||||
|
||||
if (net_pkt_read_new(pkt, context->frame_buf, total_len)) {
|
||||
if (net_pkt_read(pkt, context->frame_buf, total_len)) {
|
||||
irq_unlock(imask);
|
||||
return -EIO;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ static int eth_send(struct device *dev, struct net_pkt *pkt)
|
|||
int count = net_pkt_get_len(pkt);
|
||||
int ret;
|
||||
|
||||
ret = net_pkt_read_new(pkt, ctx->send, count);
|
||||
ret = net_pkt_read(pkt, ctx->send, count);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ static int eth_tx(struct device *dev, struct net_pkt *pkt)
|
|||
|
||||
dma_buffer = (u8_t *)(dma_tx_desc->Buffer1Addr);
|
||||
|
||||
if (net_pkt_read_new(pkt, dma_buffer, total_len)) {
|
||||
if (net_pkt_read(pkt, dma_buffer, total_len)) {
|
||||
res = -EIO;
|
||||
goto error;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -465,7 +465,7 @@ static int winc1500_send(struct net_pkt *pkt,
|
|||
w1500_data.socket_data[socket].send_cb = cb;
|
||||
w1500_data.socket_data[socket].send_user_data = user_data;
|
||||
|
||||
if (net_pkt_read_new(pkt, buf->data, net_pkt_get_len(pkt))) {
|
||||
if (net_pkt_read(pkt, buf->data, net_pkt_get_len(pkt))) {
|
||||
ret = -ENOBUFS;
|
||||
goto out;
|
||||
}
|
||||
|
|
@ -509,7 +509,7 @@ static int winc1500_sendto(struct net_pkt *pkt,
|
|||
w1500_data.socket_data[socket].send_cb = cb;
|
||||
w1500_data.socket_data[socket].send_user_data = user_data;
|
||||
|
||||
if (net_pkt_read_new(pkt, buf->data, net_pkt_get_len(pkt))) {
|
||||
if (net_pkt_read(pkt, buf->data, net_pkt_get_len(pkt))) {
|
||||
ret = -ENOBUFS;
|
||||
goto out;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2304,12 +2304,12 @@ struct net_pkt *net_pkt_clone(struct net_pkt *pkt, s32_t timeout);
|
|||
*
|
||||
* @return 0 on success, negative errno code otherwise.
|
||||
*/
|
||||
int net_pkt_read_new(struct net_pkt *pkt, void *data, size_t length);
|
||||
int net_pkt_read(struct net_pkt *pkt, void *data, size_t length);
|
||||
|
||||
/* Read u8_t data data a net_pkt */
|
||||
static inline int net_pkt_read_u8_new(struct net_pkt *pkt, u8_t *data)
|
||||
static inline int net_pkt_read_u8(struct net_pkt *pkt, u8_t *data)
|
||||
{
|
||||
return net_pkt_read_new(pkt, data, 1);
|
||||
return net_pkt_read(pkt, data, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -2324,7 +2324,7 @@ static inline int net_pkt_read_u8_new(struct net_pkt *pkt, u8_t *data)
|
|||
*
|
||||
* @return 0 on success, negative errno code otherwise.
|
||||
*/
|
||||
int net_pkt_read_be16_new(struct net_pkt *pkt, u16_t *data);
|
||||
int net_pkt_read_be16(struct net_pkt *pkt, u16_t *data);
|
||||
|
||||
/**
|
||||
* @brief Read u32_t big endian data from a net_pkt
|
||||
|
|
@ -2338,7 +2338,7 @@ int net_pkt_read_be16_new(struct net_pkt *pkt, u16_t *data);
|
|||
*
|
||||
* @return 0 on success, negative errno code otherwise.
|
||||
*/
|
||||
int net_pkt_read_be32_new(struct net_pkt *pkt, u32_t *data);
|
||||
int net_pkt_read_be32(struct net_pkt *pkt, u32_t *data);
|
||||
|
||||
/**
|
||||
* @brief Write data into a net_pkt
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ static int build_reply(const char *name,
|
|||
|
||||
LOG_DBG("%s received %d bytes", name, reply_len);
|
||||
|
||||
net_pkt_read_new(pkt, buf, reply_len);
|
||||
net_pkt_read(pkt, buf, reply_len);
|
||||
|
||||
LOG_DBG("Received %d bytes, sending %d bytes", reply_len, reply_len);
|
||||
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ static enum net_verdict parse_lldp(struct net_if *iface, struct net_pkt *pkt)
|
|||
u16_t length;
|
||||
u8_t type;
|
||||
|
||||
if (net_pkt_read_be16_new(pkt, &type_length)) {
|
||||
if (net_pkt_read_be16(pkt, &type_length)) {
|
||||
LOG_DBG("End LLDP DU TLV");
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -566,7 +566,7 @@ static void receive_cb(struct net_context *ctx,
|
|||
break;
|
||||
}
|
||||
|
||||
if (net_pkt_read_new(pkt, (u8_t *)(cmd_buf + cmd_len), len)) {
|
||||
if (net_pkt_read(pkt, (u8_t *)(cmd_buf + cmd_len), len)) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -576,7 +576,7 @@ static void receive_cb(struct net_context *ctx,
|
|||
u8_t dummy;
|
||||
int ret;
|
||||
|
||||
if (net_pkt_read_u8_new(pkt, &dummy)) {
|
||||
if (net_pkt_read_u8(pkt, &dummy)) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -583,19 +583,19 @@ static bool dhcpv4_parse_options(struct net_pkt *pkt,
|
|||
u8_t length;
|
||||
u8_t type;
|
||||
|
||||
if (net_pkt_read_new(pkt, cookie, sizeof(cookie)) ||
|
||||
if (net_pkt_read(pkt, cookie, sizeof(cookie)) ||
|
||||
memcmp(magic_cookie, cookie, sizeof(magic_cookie))) {
|
||||
NET_DBG("Incorrect magic cookie");
|
||||
return false;
|
||||
}
|
||||
|
||||
while (!net_pkt_read_u8_new(pkt, &type)) {
|
||||
while (!net_pkt_read_u8(pkt, &type)) {
|
||||
if (type == DHCPV4_OPTIONS_END) {
|
||||
NET_DBG("options_end");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (net_pkt_read_u8_new(pkt, &length)) {
|
||||
if (net_pkt_read_u8(pkt, &length)) {
|
||||
NET_ERR("option parsing, bad length");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -609,7 +609,7 @@ static bool dhcpv4_parse_options(struct net_pkt *pkt,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (net_pkt_read_new(pkt, netmask.s4_addr, length)) {
|
||||
if (net_pkt_read(pkt, netmask.s4_addr, length)) {
|
||||
NET_ERR("options_subnet_mask, short packet");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -633,7 +633,7 @@ static bool dhcpv4_parse_options(struct net_pkt *pkt,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (net_pkt_read_new(pkt, router.s4_addr, 4) ||
|
||||
if (net_pkt_read(pkt, router.s4_addr, 4) ||
|
||||
net_pkt_skip(pkt, length - 4)) {
|
||||
NET_ERR("options_router, short packet");
|
||||
return false;
|
||||
|
|
@ -665,7 +665,7 @@ static bool dhcpv4_parse_options(struct net_pkt *pkt,
|
|||
|
||||
(void)memset(&dns, 0, sizeof(dns));
|
||||
|
||||
if (net_pkt_read_new(pkt, dns.sin_addr.s4_addr, 4) ||
|
||||
if (net_pkt_read(pkt, dns.sin_addr.s4_addr, 4) ||
|
||||
net_pkt_skip(pkt, length - 4)) {
|
||||
NET_ERR("options_dns, short packet");
|
||||
return false;
|
||||
|
|
@ -691,7 +691,7 @@ static bool dhcpv4_parse_options(struct net_pkt *pkt,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (net_pkt_read_be32_new(
|
||||
if (net_pkt_read_be32(
|
||||
pkt, &iface->config.dhcpv4.lease_time) ||
|
||||
!iface->config.dhcpv4.lease_time) {
|
||||
NET_ERR("options_lease_time, wrong value");
|
||||
|
|
@ -708,7 +708,7 @@ static bool dhcpv4_parse_options(struct net_pkt *pkt,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (net_pkt_read_be32_new(
|
||||
if (net_pkt_read_be32(
|
||||
pkt, &iface->config.dhcpv4.renewal_time) ||
|
||||
!iface->config.dhcpv4.renewal_time) {
|
||||
NET_DBG("options_renewal, wrong value");
|
||||
|
|
@ -725,7 +725,7 @@ static bool dhcpv4_parse_options(struct net_pkt *pkt,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (net_pkt_read_be32_new(
|
||||
if (net_pkt_read_be32(
|
||||
pkt,
|
||||
&iface->config.dhcpv4.rebinding_time) ||
|
||||
!iface->config.dhcpv4.rebinding_time) {
|
||||
|
|
@ -743,7 +743,7 @@ static bool dhcpv4_parse_options(struct net_pkt *pkt,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (net_pkt_read_new(
|
||||
if (net_pkt_read(
|
||||
pkt,
|
||||
iface->config.dhcpv4.server_id.s4_addr,
|
||||
length)) {
|
||||
|
|
@ -761,7 +761,7 @@ static bool dhcpv4_parse_options(struct net_pkt *pkt,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (net_pkt_read_u8_new(pkt, (u8_t *)msg_type)) {
|
||||
if (net_pkt_read_u8(pkt, (u8_t *)msg_type)) {
|
||||
NET_DBG("options_msg_type, read err");
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ static inline int ipv6_handle_ext_hdr_options(struct net_pkt *pkt,
|
|||
u16_t exthdr_len = 0U;
|
||||
u16_t length = 0U;
|
||||
|
||||
if (net_pkt_read_u8_new(pkt, (u8_t *)&exthdr_len)) {
|
||||
if (net_pkt_read_u8(pkt, (u8_t *)&exthdr_len)) {
|
||||
return -ENOBUFS;
|
||||
}
|
||||
|
||||
|
|
@ -201,12 +201,12 @@ static inline int ipv6_handle_ext_hdr_options(struct net_pkt *pkt,
|
|||
u8_t opt_type, opt_len;
|
||||
|
||||
/* Each extension option has type and length */
|
||||
if (net_pkt_read_u8_new(pkt, &opt_type)) {
|
||||
if (net_pkt_read_u8(pkt, &opt_type)) {
|
||||
return -ENOBUFS;
|
||||
}
|
||||
|
||||
if (opt_type != NET_IPV6_EXT_HDR_OPT_PAD1) {
|
||||
if (net_pkt_read_u8_new(pkt, &opt_len)) {
|
||||
if (net_pkt_read_u8(pkt, &opt_len)) {
|
||||
return -ENOBUFS;
|
||||
}
|
||||
}
|
||||
|
|
@ -446,7 +446,7 @@ enum net_verdict net_ipv6_input(struct net_pkt *pkt, bool is_loopback)
|
|||
|
||||
NET_DBG("IPv6 next header %d", nexthdr);
|
||||
|
||||
if (net_pkt_read_u8_new(pkt, &next_nexthdr)) {
|
||||
if (net_pkt_read_u8(pkt, &next_nexthdr)) {
|
||||
goto drop;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ int net_ipv6_find_last_ext_hdr(struct net_pkt *pkt, u16_t *next_hdr_off,
|
|||
|
||||
nexthdr = hdr->nexthdr;
|
||||
while (!net_ipv6_is_nexthdr_upper_layer(nexthdr)) {
|
||||
if (net_pkt_read_u8_new(pkt, &next_nexthdr)) {
|
||||
if (net_pkt_read_u8(pkt, &next_nexthdr)) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ int net_ipv6_find_last_ext_hdr(struct net_pkt *pkt, u16_t *next_hdr_off,
|
|||
case NET_IPV6_NEXTHDR_DESTO:
|
||||
length = 0U;
|
||||
|
||||
if (net_pkt_read_u8_new(pkt, (u8_t *)&length)) {
|
||||
if (net_pkt_read_u8(pkt, (u8_t *)&length)) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -460,8 +460,8 @@ enum net_verdict net_ipv6_handle_fragment_hdr(struct net_pkt *pkt,
|
|||
* being 1 byte too far, let's just read the next relevant pieces.
|
||||
*/
|
||||
if (net_pkt_skip(pkt, 1) || /* reserved */
|
||||
net_pkt_read_be16_new(pkt, &flag) ||
|
||||
net_pkt_read_be32_new(pkt, &id)) {
|
||||
net_pkt_read_be16(pkt, &flag) ||
|
||||
net_pkt_read_be32(pkt, &id)) {
|
||||
goto drop;
|
||||
}
|
||||
|
||||
|
|
@ -678,9 +678,9 @@ int net_ipv6_send_fragmented_pkt(struct net_if *iface, struct net_pkt *pkt,
|
|||
net_pkt_cursor_init(pkt);
|
||||
|
||||
if (net_pkt_skip(pkt, next_hdr_off) ||
|
||||
net_pkt_read_u8_new(pkt, &next_hdr) ||
|
||||
net_pkt_read_u8(pkt, &next_hdr) ||
|
||||
net_pkt_skip(pkt, last_hdr_off) ||
|
||||
net_pkt_read_u8_new(pkt, &last_hdr)) {
|
||||
net_pkt_read_u8(pkt, &last_hdr)) {
|
||||
return -ENOBUFS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -899,7 +899,7 @@ static inline struct net_nbr *handle_ns_neighbor(struct net_pkt *pkt,
|
|||
|
||||
lladdr.len = 8 * ll_len - 2;
|
||||
|
||||
if (net_pkt_read_new(pkt, lladdr.addr, lladdr.len)) {
|
||||
if (net_pkt_read(pkt, lladdr.addr, lladdr.len)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -1437,7 +1437,7 @@ static inline bool handle_na_neighbor(struct net_pkt *pkt,
|
|||
net_pkt_cursor_init(pkt);
|
||||
|
||||
if (net_pkt_skip(pkt, tllao_offset) ||
|
||||
net_pkt_read_new(pkt, lladdr.addr, lladdr.len)) {
|
||||
net_pkt_read(pkt, lladdr.addr, lladdr.len)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1918,7 +1918,7 @@ static inline struct net_nbr *handle_ra_neighbor(struct net_pkt *pkt, u8_t len)
|
|||
lladdr.len = net_pkt_lladdr_src(pkt)->len;
|
||||
}
|
||||
|
||||
if (net_pkt_read_new(pkt, lladdr.addr, lladdr.len)) {
|
||||
if (net_pkt_read(pkt, lladdr.addr, lladdr.len)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -2235,7 +2235,7 @@ static enum net_verdict handle_ra_input(struct net_pkt *pkt,
|
|||
case NET_ICMPV6_ND_OPT_MTU:
|
||||
/* MTU has reserved 2 bytes, so skip it. */
|
||||
if (net_pkt_skip(pkt, 2) ||
|
||||
net_pkt_read_be32_new(pkt, &mtu)) {
|
||||
net_pkt_read_be32(pkt, &mtu)) {
|
||||
goto drop;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2270,31 +2270,31 @@ int net_pkt_memset(struct net_pkt *pkt, int byte, size_t amount)
|
|||
return net_pkt_cursor_operate(pkt, &byte, amount, false, true);
|
||||
}
|
||||
|
||||
int net_pkt_read_new(struct net_pkt *pkt, void *data, size_t length)
|
||||
int net_pkt_read(struct net_pkt *pkt, void *data, size_t length)
|
||||
{
|
||||
NET_DBG("pkt %p data %p length %zu", pkt, data, length);
|
||||
|
||||
return net_pkt_cursor_operate(pkt, data, length, true, false);
|
||||
}
|
||||
|
||||
int net_pkt_read_be16_new(struct net_pkt *pkt, u16_t *data)
|
||||
int net_pkt_read_be16(struct net_pkt *pkt, u16_t *data)
|
||||
{
|
||||
u8_t d16[2];
|
||||
int ret;
|
||||
|
||||
ret = net_pkt_read_new(pkt, d16, sizeof(u16_t));
|
||||
ret = net_pkt_read(pkt, d16, sizeof(u16_t));
|
||||
|
||||
*data = d16[0] << 8 | d16[1];
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int net_pkt_read_be32_new(struct net_pkt *pkt, u32_t *data)
|
||||
int net_pkt_read_be32(struct net_pkt *pkt, u32_t *data)
|
||||
{
|
||||
u8_t d32[4];
|
||||
int ret;
|
||||
|
||||
ret = net_pkt_read_new(pkt, d32, sizeof(u32_t));
|
||||
ret = net_pkt_read(pkt, d32, sizeof(u32_t));
|
||||
|
||||
*data = d32[0] << 24 | d32[1] << 16 | d32[2] << 8 | d32[3];
|
||||
|
||||
|
|
@ -2570,7 +2570,7 @@ void *net_pkt_get_data(struct net_pkt *pkt,
|
|||
|
||||
net_pkt_cursor_backup(pkt, &backup);
|
||||
|
||||
if (net_pkt_read_new(pkt, access->data, access->size)) {
|
||||
if (net_pkt_read(pkt, access->data, access->size)) {
|
||||
net_pkt_cursor_restore(pkt, &backup);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1286,7 +1286,7 @@ int net_tcp_parse_opts(struct net_pkt *pkt, int opt_totlen,
|
|||
u8_t opt, optlen;
|
||||
|
||||
while (opt_totlen) {
|
||||
if (net_pkt_read_u8_new(pkt, &opt)) {
|
||||
if (net_pkt_read_u8(pkt, &opt)) {
|
||||
optlen = 0U;
|
||||
goto error;
|
||||
}
|
||||
|
|
@ -1310,7 +1310,7 @@ int net_tcp_parse_opts(struct net_pkt *pkt, int opt_totlen,
|
|||
goto error;
|
||||
}
|
||||
|
||||
if (net_pkt_read_u8_new(pkt, &optlen) || optlen < 2) {
|
||||
if (net_pkt_read_u8(pkt, &optlen) || optlen < 2) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
|
@ -1330,7 +1330,7 @@ int net_tcp_parse_opts(struct net_pkt *pkt, int opt_totlen,
|
|||
goto error;
|
||||
}
|
||||
|
||||
if (net_pkt_read_be16_new(pkt, &opts->mss)) {
|
||||
if (net_pkt_read_be16(pkt, &opts->mss)) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -444,7 +444,7 @@ static int dns_read(struct net_context *ctx,
|
|||
|
||||
/* TODO: Instead of this temporary copy, just use the net_pkt directly.
|
||||
*/
|
||||
ret = net_pkt_read_new(pkt, dns_data->data, data_len);
|
||||
ret = net_pkt_read(pkt, dns_data->data, data_len);
|
||||
if (ret < 0) {
|
||||
goto quit;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ static int dns_read(struct net_context *ctx,
|
|||
|
||||
/* TODO: Instead of this temporary copy, just use the net_pkt directly.
|
||||
*/
|
||||
ret = net_pkt_read_new(pkt, dns_data->data, data_len);
|
||||
ret = net_pkt_read(pkt, dns_data->data, data_len);
|
||||
if (ret < 0) {
|
||||
goto quit;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -343,7 +343,7 @@ static int dns_read(struct dns_resolve_context *ctx,
|
|||
|
||||
/* TODO: Instead of this temporary copy, just use the net_pkt directly.
|
||||
*/
|
||||
ret = net_pkt_read_new(pkt, dns_data->data, data_len);
|
||||
ret = net_pkt_read(pkt, dns_data->data, data_len);
|
||||
if (ret < 0) {
|
||||
ret = DNS_EAI_MEMORY;
|
||||
goto quit;
|
||||
|
|
|
|||
|
|
@ -678,7 +678,7 @@ static inline ssize_t zsock_recv_dgram(struct net_context *ctx,
|
|||
recv_len = max_len;
|
||||
}
|
||||
|
||||
if (net_pkt_read_new(pkt, buf, recv_len)) {
|
||||
if (net_pkt_read(pkt, buf, recv_len)) {
|
||||
errno = ENOBUFS;
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -749,7 +749,7 @@ static inline ssize_t zsock_recv_stream(struct net_context *ctx,
|
|||
}
|
||||
|
||||
/* Actually copy data to application buffer */
|
||||
if (net_pkt_read_new(pkt, buf, recv_len)) {
|
||||
if (net_pkt_read(pkt, buf, recv_len)) {
|
||||
errno = ENOBUFS;
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ static ssize_t zcan_recvfrom_ctx(struct net_context *ctx, void *buf,
|
|||
recv_len = max_len;
|
||||
}
|
||||
|
||||
if (net_pkt_read_new(pkt, (void *)&zframe, sizeof(zframe))) {
|
||||
if (net_pkt_read(pkt, (void *)&zframe, sizeof(zframe))) {
|
||||
errno = EIO;
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ ssize_t zpacket_recvfrom_ctx(struct net_context *ctx, void *buf, size_t max_len,
|
|||
recv_len = max_len;
|
||||
}
|
||||
|
||||
if (net_pkt_read_new(pkt, buf, recv_len)) {
|
||||
if (net_pkt_read(pkt, buf, recv_len)) {
|
||||
errno = ENOBUFS;
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@ static int ecm_send(struct net_pkt *pkt)
|
|||
|
||||
net_pkt_hexdump(pkt, "<");
|
||||
|
||||
if (net_pkt_read_new(pkt, tx_buf, len)) {
|
||||
if (net_pkt_read(pkt, tx_buf, len)) {
|
||||
return -ENOBUFS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ static int eem_send(struct net_pkt *pkt)
|
|||
*hdr = sys_cpu_to_le16(0x3FFF & len);
|
||||
b_idx += sizeof(u16_t);
|
||||
|
||||
if (net_pkt_read_new(pkt, &tx_buf[b_idx], net_pkt_get_len(pkt))) {
|
||||
if (net_pkt_read(pkt, &tx_buf[b_idx], net_pkt_get_len(pkt))) {
|
||||
return -ENOBUFS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1034,9 +1034,9 @@ static int rndis_send(struct net_pkt *pkt)
|
|||
|
||||
rndis_hdr_add(tx_buf, len);
|
||||
|
||||
ret = net_pkt_read_new(pkt,
|
||||
tx_buf + sizeof(struct rndis_payload_packet),
|
||||
len);
|
||||
ret = net_pkt_read(pkt,
|
||||
tx_buf + sizeof(struct rndis_payload_packet),
|
||||
len);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -290,7 +290,7 @@ static int parse_dhcp_message(struct net_pkt *pkt, struct dhcp_msg *msg)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (net_pkt_read_be32_new(pkt, &msg->xid)) {
|
||||
if (net_pkt_read_be32(pkt, &msg->xid)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -303,7 +303,7 @@ static int parse_dhcp_message(struct net_pkt *pkt, struct dhcp_msg *msg)
|
|||
u8_t length = 0U;
|
||||
u8_t type;
|
||||
|
||||
if (net_pkt_read_u8_new(pkt, &type)) {
|
||||
if (net_pkt_read_u8(pkt, &type)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -312,14 +312,14 @@ static int parse_dhcp_message(struct net_pkt *pkt, struct dhcp_msg *msg)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (net_pkt_read_u8_new(pkt, &msg->type)) {
|
||||
if (net_pkt_read_u8(pkt, &msg->type)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (net_pkt_read_u8_new(pkt, &length)) {
|
||||
if (net_pkt_read_u8(pkt, &length)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -949,7 +949,7 @@ large:
|
|||
}
|
||||
|
||||
if (net_pkt_skip(pkt, 40 + 1032 + 2) ||
|
||||
net_pkt_read_be16_new(pkt, &frag_offset)) {
|
||||
net_pkt_read_be16(pkt, &frag_offset)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -989,7 +989,7 @@ large:
|
|||
}
|
||||
|
||||
if (net_pkt_skip(pkt, 40 + 1032 + 2) ||
|
||||
net_pkt_read_be16_new(pkt, &frag_offset)) {
|
||||
net_pkt_read_be16(pkt, &frag_offset)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -1029,7 +1029,7 @@ large:
|
|||
}
|
||||
|
||||
if (net_pkt_skip(pkt, 40 + 1032 + 2) ||
|
||||
net_pkt_read_be16_new(pkt, &frag_offset)) {
|
||||
net_pkt_read_be16(pkt, &frag_offset)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -1312,13 +1312,13 @@ static void test_find_last_ipv6_fragment_hbho_1(void)
|
|||
|
||||
net_pkt_cursor_init(pkt);
|
||||
net_pkt_skip(pkt, next_hdr_pos);
|
||||
net_pkt_read_u8_new(pkt, &next_hdr);
|
||||
net_pkt_read_u8(pkt, &next_hdr);
|
||||
|
||||
zassert_equal(next_hdr, 0x11, "Invalid next header");
|
||||
|
||||
net_pkt_cursor_init(pkt);
|
||||
net_pkt_skip(pkt, last_hdr_pos);
|
||||
net_pkt_read_u8_new(pkt, &last_hdr);
|
||||
net_pkt_read_u8(pkt, &last_hdr);
|
||||
|
||||
zassert_equal(last_hdr, 0x4e, "Invalid last header");
|
||||
|
||||
|
|
@ -1355,13 +1355,13 @@ static void test_find_last_ipv6_fragment_hbho_2(void)
|
|||
|
||||
net_pkt_cursor_init(pkt);
|
||||
net_pkt_skip(pkt, next_hdr_pos);
|
||||
net_pkt_read_u8_new(pkt, &next_hdr);
|
||||
net_pkt_read_u8(pkt, &next_hdr);
|
||||
|
||||
zassert_equal(next_hdr, 0x11, "Invalid next header");
|
||||
|
||||
net_pkt_cursor_init(pkt);
|
||||
net_pkt_skip(pkt, last_hdr_pos);
|
||||
net_pkt_read_u8_new(pkt, &last_hdr);
|
||||
net_pkt_read_u8(pkt, &last_hdr);
|
||||
|
||||
zassert_equal(last_hdr, 0x4e, "Invalid last header");
|
||||
|
||||
|
|
@ -1398,13 +1398,13 @@ static void test_find_last_ipv6_fragment_hbho_3(void)
|
|||
|
||||
net_pkt_cursor_init(pkt);
|
||||
net_pkt_skip(pkt, next_hdr_pos);
|
||||
net_pkt_read_u8_new(pkt, &next_hdr);
|
||||
net_pkt_read_u8(pkt, &next_hdr);
|
||||
|
||||
zassert_equal(next_hdr, 0x11, "Invalid next header");
|
||||
|
||||
net_pkt_cursor_init(pkt);
|
||||
net_pkt_skip(pkt, last_hdr_pos);
|
||||
net_pkt_read_u8_new(pkt, &last_hdr);
|
||||
net_pkt_read_u8(pkt, &last_hdr);
|
||||
|
||||
zassert_equal(last_hdr, 0x4e, "Invalid last header");
|
||||
|
||||
|
|
@ -1477,13 +1477,13 @@ static void test_find_last_ipv6_fragment_hbho_frag_1(void)
|
|||
|
||||
net_pkt_cursor_init(pkt);
|
||||
net_pkt_skip(pkt, next_hdr_pos);
|
||||
net_pkt_read_u8_new(pkt, &next_hdr);
|
||||
net_pkt_read_u8(pkt, &next_hdr);
|
||||
|
||||
zassert_equal(next_hdr, 0x3a, "Invalid next header");
|
||||
|
||||
net_pkt_cursor_init(pkt);
|
||||
net_pkt_skip(pkt, last_hdr_pos);
|
||||
net_pkt_read_u8_new(pkt, &last_hdr);
|
||||
net_pkt_read_u8(pkt, &last_hdr);
|
||||
|
||||
zassert_equal(last_hdr, 0x80, "Invalid next header");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue