net/pkt: Remove _new suffix to net_pkt_get_data_new function

Now that legacy - and unrelated - function named net_pkt_get_data has
been removed, we can rename net_pkt_get_data_new relevantly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2019-02-20 09:28:18 +01:00 committed by Kumar Gala
commit f8a091104e
22 changed files with 78 additions and 99 deletions

View file

@ -312,8 +312,8 @@ static inline bool telnet_handle_command(struct net_pkt *pkt)
struct telnet_simple_command);
struct telnet_simple_command *cmd;
cmd = (struct telnet_simple_command *)net_pkt_get_data_new(pkt,
&cmd_access);
cmd = (struct telnet_simple_command *)net_pkt_get_data(pkt,
&cmd_access);
if (!cmd || cmd->iac != NVT_CMD_IAC) {
return false;
}

View file

@ -504,8 +504,7 @@ static int pkt_setup_ip_data(struct net_pkt *pkt,
NET_PKT_DATA_ACCESS_DEFINE(tcp_access, struct net_tcp_hdr);
struct net_tcp_hdr *tcp;
tcp = (struct net_tcp_hdr *)net_pkt_get_data_new(pkt,
&tcp_access);
tcp = (struct net_tcp_hdr *)net_pkt_get_data(pkt, &tcp_access);
if (!tcp) {
return -1;
}

View file

@ -2489,8 +2489,8 @@ struct net_pkt_data_access {
*
* @return a pointer to the requested contiguous data, NULL otherwise.
*/
void *net_pkt_get_data_new(struct net_pkt *pkt,
struct net_pkt_data_access *access);
void *net_pkt_get_data(struct net_pkt *pkt,
struct net_pkt_data_access *access);
/**
* @brief Set contiguous data into a network packet

View file

@ -132,7 +132,7 @@ static void udp_received(struct net_context *context,
return;
}
hdr = (struct zperf_udp_datagram *)net_pkt_get_data_new(pkt, &zperf);
hdr = (struct zperf_udp_datagram *)net_pkt_get_data(pkt, &zperf);
if (!hdr) {
shell_fprintf(shell, SHELL_WARNING,
"Short iperf packet!\n");

View file

@ -30,7 +30,7 @@ static inline void zperf_upload_decode_stat(const struct shell *shell,
struct zperf_server_hdr *stat;
hdr = (struct zperf_udp_datagram *)
net_pkt_get_data_new(pkt, &zperf_udp);
net_pkt_get_data(pkt, &zperf_udp);
if (!hdr) {
shell_fprintf(shell, SHELL_WARNING,
"Network packet too short\n");
@ -40,7 +40,7 @@ static inline void zperf_upload_decode_stat(const struct shell *shell,
net_pkt_acknowledge_data(pkt, &zperf_udp);
stat = (struct zperf_server_hdr *)
net_pkt_get_data_new(pkt, &zperf_stat);
net_pkt_get_data(pkt, &zperf_stat);
if (!stat) {
shell_fprintf(shell, SHELL_WARNING,
"Network packet too short\n");

View file

@ -182,7 +182,7 @@ static struct net_pkt *dhcpv4_create_message(struct net_if *iface, u8_t type,
goto fail;
}
msg = (struct dhcp_msg *)net_pkt_get_data_new(pkt, &dhcp_access);
msg = (struct dhcp_msg *)net_pkt_get_data(pkt, &dhcp_access);
(void)memset(msg, 0, sizeof(struct dhcp_msg));
@ -916,7 +916,7 @@ static enum net_verdict net_dhcpv4_input(struct net_conn *conn,
return NET_DROP;
}
msg = (struct dhcp_msg *)net_pkt_get_data_new(pkt, &dhcp_access);
msg = (struct dhcp_msg *)net_pkt_get_data(pkt, &dhcp_access);
if (!msg) {
return NET_DROP;
}

View file

@ -31,8 +31,7 @@ static int icmpv4_create(struct net_pkt *pkt, u8_t icmp_type, u8_t icmp_code)
struct net_icmp_hdr);
struct net_icmp_hdr *icmp_hdr;
icmp_hdr = (struct net_icmp_hdr *)net_pkt_get_data_new(pkt,
&icmpv4_access);
icmp_hdr = (struct net_icmp_hdr *)net_pkt_get_data(pkt, &icmpv4_access);
if (!icmp_hdr) {
return -ENOBUFS;
}
@ -50,8 +49,7 @@ int net_icmpv4_finalize(struct net_pkt *pkt)
struct net_icmp_hdr);
struct net_icmp_hdr *icmp_hdr;
icmp_hdr = (struct net_icmp_hdr *)net_pkt_get_data_new(pkt,
&icmpv4_access);
icmp_hdr = (struct net_icmp_hdr *)net_pkt_get_data(pkt, &icmpv4_access);
if (!icmp_hdr) {
return -ENOBUFS;
}
@ -159,7 +157,7 @@ int net_icmpv4_send_echo_request(struct net_if *iface,
goto drop;
}
echo_req = (struct net_icmpv4_echo_req *)net_pkt_get_data_new(
echo_req = (struct net_icmpv4_echo_req *)net_pkt_get_data(
pkt, &icmpv4_access);
if (!echo_req) {
goto drop;
@ -204,8 +202,7 @@ int net_icmpv4_send_error(struct net_pkt *orig, u8_t type, u8_t code)
net_pkt_cursor_init(orig);
ip_hdr = (struct net_ipv4_hdr *)net_pkt_get_data_new(orig,
&ipv4_access);
ip_hdr = (struct net_ipv4_hdr *)net_pkt_get_data(orig, &ipv4_access);
if (!ip_hdr) {
goto drop_no_pkt;
}
@ -215,7 +212,7 @@ int net_icmpv4_send_error(struct net_pkt *orig, u8_t type, u8_t code)
struct net_icmp_hdr);
struct net_icmp_hdr *icmp_hdr;
icmp_hdr = (struct net_icmp_hdr *)net_pkt_get_data_new(
icmp_hdr = (struct net_icmp_hdr *)net_pkt_get_data(
orig, &icmpv4_access);
if (!icmp_hdr || icmp_hdr->code < 8) {
/* We must not send ICMP errors back */
@ -294,8 +291,7 @@ enum net_verdict net_icmpv4_input(struct net_pkt *pkt,
struct net_icmp_hdr *icmp_hdr;
struct net_icmpv4_handler *cb;
icmp_hdr = (struct net_icmp_hdr *)net_pkt_get_data_new(pkt,
&icmp_access);
icmp_hdr = (struct net_icmp_hdr *)net_pkt_get_data(pkt, &icmp_access);
if (!icmp_hdr) {
NET_DBG("DROP: NULL ICMPv4 header");
return NET_DROP;

View file

@ -74,8 +74,7 @@ int net_icmpv6_finalize(struct net_pkt *pkt)
struct net_icmp_hdr);
struct net_icmp_hdr *icmp_hdr;
icmp_hdr = (struct net_icmp_hdr *)net_pkt_get_data_new(pkt,
&icmp_access);
icmp_hdr = (struct net_icmp_hdr *)net_pkt_get_data(pkt, &icmp_access);
if (!icmp_hdr) {
return -ENOBUFS;
}
@ -91,8 +90,7 @@ int net_icmpv6_create(struct net_pkt *pkt, u8_t icmp_type, u8_t icmp_code)
struct net_icmp_hdr);
struct net_icmp_hdr *icmp_hdr;
icmp_hdr = (struct net_icmp_hdr *)net_pkt_get_data_new(pkt,
&icmp_access);
icmp_hdr = (struct net_icmp_hdr *)net_pkt_get_data(pkt, &icmp_access);
if (!icmp_hdr) {
return -ENOBUFS;
}
@ -198,8 +196,7 @@ int net_icmpv6_send_error(struct net_pkt *orig, u8_t type, u8_t code,
net_pkt_cursor_init(orig);
ip_hdr = (struct net_ipv6_hdr *)net_pkt_get_data_new(orig,
&ipv6_access);
ip_hdr = (struct net_ipv6_hdr *)net_pkt_get_data(orig, &ipv6_access);
if (!ip_hdr) {
goto drop_no_pkt;
}
@ -211,7 +208,7 @@ int net_icmpv6_send_error(struct net_pkt *orig, u8_t type, u8_t code,
net_pkt_acknowledge_data(orig, &ipv6_access);
icmp_hdr = (struct net_icmp_hdr *)net_pkt_get_data_new(
icmp_hdr = (struct net_icmp_hdr *)net_pkt_get_data(
orig, &icmpv6_access);
if (!icmp_hdr || icmp_hdr->code < 128) {
/* We must not send ICMP errors back */
@ -324,7 +321,7 @@ int net_icmpv6_send_echo_request(struct net_if *iface,
goto drop;
}
echo_req = (struct net_icmpv6_echo_req *)net_pkt_get_data_new(
echo_req = (struct net_icmpv6_echo_req *)net_pkt_get_data(
pkt, &icmpv6_access);
if (!echo_req) {
goto drop;
@ -366,8 +363,7 @@ enum net_verdict net_icmpv6_input(struct net_pkt *pkt,
struct net_icmp_hdr *icmp_hdr;
struct net_icmpv6_handler *cb;
icmp_hdr = (struct net_icmp_hdr *)net_pkt_get_data_new(pkt,
&icmp_access);
icmp_hdr = (struct net_icmp_hdr *)net_pkt_get_data(pkt, &icmp_access);
if (!icmp_hdr) {
NET_DBG("DROP: NULL ICMPv6 header");
return NET_DROP;

View file

@ -34,8 +34,7 @@ int net_ipv4_create(struct net_pkt *pkt,
NET_PKT_DATA_ACCESS_CONTIGUOUS_DEFINE(ipv4_access, struct net_ipv4_hdr);
struct net_ipv4_hdr *ipv4_hdr;
ipv4_hdr = (struct net_ipv4_hdr *)net_pkt_get_data_new(pkt,
&ipv4_access);
ipv4_hdr = (struct net_ipv4_hdr *)net_pkt_get_data(pkt, &ipv4_access);
if (!ipv4_hdr) {
return -ENOBUFS;
}
@ -71,8 +70,7 @@ int net_ipv4_finalize(struct net_pkt *pkt, u8_t next_header_proto)
net_pkt_set_overwrite(pkt, true);
ipv4_hdr = (struct net_ipv4_hdr *)net_pkt_get_data_new(pkt,
&ipv4_access);
ipv4_hdr = (struct net_ipv4_hdr *)net_pkt_get_data(pkt, &ipv4_access);
if (!ipv4_hdr) {
return -ENOBUFS;
}
@ -129,7 +127,7 @@ enum net_verdict net_ipv4_input(struct net_pkt *pkt)
net_stats_update_ipv4_recv(net_pkt_iface(pkt));
hdr = (struct net_ipv4_hdr *)net_pkt_get_data_new(pkt, &ipv4_access);
hdr = (struct net_ipv4_hdr *)net_pkt_get_data(pkt, &ipv4_access);
if (!hdr) {
NET_DBG("DROP: no buffer");
goto drop;

View file

@ -63,8 +63,7 @@ int net_ipv6_create(struct net_pkt *pkt,
NET_PKT_DATA_ACCESS_CONTIGUOUS_DEFINE(ipv6_access, struct net_ipv6_hdr);
struct net_ipv6_hdr *ipv6_hdr;
ipv6_hdr = (struct net_ipv6_hdr *)net_pkt_get_data_new(pkt,
&ipv6_access);
ipv6_hdr = (struct net_ipv6_hdr *)net_pkt_get_data(pkt, &ipv6_access);
if (!ipv6_hdr) {
return -ENOBUFS;
}
@ -98,8 +97,7 @@ int net_ipv6_finalize(struct net_pkt *pkt, u8_t next_header_proto)
net_pkt_set_overwrite(pkt, true);
ipv6_hdr = (struct net_ipv6_hdr *)net_pkt_get_data_new(pkt,
&ipv6_access);
ipv6_hdr = (struct net_ipv6_hdr *)net_pkt_get_data(pkt, &ipv6_access);
if (!ipv6_hdr) {
return -ENOBUFS;
}
@ -369,7 +367,7 @@ enum net_verdict net_ipv6_input(struct net_pkt *pkt, bool is_loopback)
net_stats_update_ipv6_recv(net_pkt_iface(pkt));
hdr = (struct net_ipv6_hdr *)net_pkt_get_data_new(pkt, &ipv6_access);
hdr = (struct net_ipv6_hdr *)net_pkt_get_data(pkt, &ipv6_access);
if (!hdr) {
NET_DBG("DROP: no buffer");
goto drop;

View file

@ -60,7 +60,7 @@ int net_ipv6_find_last_ext_hdr(struct net_pkt *pkt, u16_t *next_hdr_off,
net_pkt_cursor_init(pkt);
hdr = (struct net_ipv6_hdr *)net_pkt_get_data_new(pkt, &ipv6_access);
hdr = (struct net_ipv6_hdr *)net_pkt_get_data(pkt, &ipv6_access);
if (!hdr) {
return -ENOBUFS;
}
@ -296,7 +296,7 @@ static void reassemble_packet(struct net_ipv6_reassembly *reass)
goto error;
}
ipv6.frag_hdr = (struct net_ipv6_frag_hdr *)net_pkt_get_data_new(
ipv6.frag_hdr = (struct net_ipv6_frag_hdr *)net_pkt_get_data(
pkt, &frag_access);
if (!ipv6.frag_hdr) {
NET_ERR("Failed to get fragment header");
@ -320,8 +320,7 @@ static void reassemble_packet(struct net_ipv6_reassembly *reass)
net_pkt_cursor_init(pkt);
ipv6.hdr = (struct net_ipv6_hdr *)net_pkt_get_data_new(pkt,
&ipv6_access);
ipv6.hdr = (struct net_ipv6_hdr *)net_pkt_get_data(pkt, &ipv6_access);
if (!ipv6.hdr) {
goto error;
}
@ -457,7 +456,7 @@ enum net_verdict net_ipv6_handle_fragment_hdr(struct net_pkt *pkt,
/* Each fragment has a fragment header, however since we already
* read the nexthdr part of it, we are not going to use
* net_pkt_get_data_new() and access the header directly: the cursor
* net_pkt_get_data() and access the header directly: the cursor
* being 1 byte too far, let's just read the next relevant pieces.
*/
if (net_pkt_skip(pkt, 1) || /* reserved */
@ -604,8 +603,8 @@ static int send_ipv6_fragment(struct net_pkt *pkt,
}
/* And we append the fragmentation header */
frag_hdr = (struct net_ipv6_frag_hdr *)net_pkt_get_data_new(
frag_pkt, &frag_access);
frag_hdr = (struct net_ipv6_frag_hdr *)net_pkt_get_data(frag_pkt,
&frag_access);
if (!frag_hdr) {
goto fail;
}

View file

@ -46,7 +46,7 @@ static int mld_create(struct net_pkt *pkt,
struct net_icmpv6_mld_mcast_record *mld;
mld = (struct net_icmpv6_mld_mcast_record *)
net_pkt_get_data_new(pkt, &mld_access);
net_pkt_get_data(pkt, &mld_access);
if (!mld) {
return -ENOBUFS;
}
@ -297,7 +297,7 @@ static enum net_verdict handle_mld_query(struct net_pkt *pkt,
u16_t pkt_len;
mld_query = (struct net_icmpv6_mld_query *)
net_pkt_get_data_new(pkt, &mld_access);
net_pkt_get_data(pkt, &mld_access);
if (!mld_query) {
NET_DBG("DROP: NULL MLD query");
goto drop;

View file

@ -653,7 +653,7 @@ enum net_verdict net_ipv6_prepare_for_send(struct net_pkt *pkt)
NET_ASSERT(pkt && pkt->buffer);
ip_hdr = (struct net_ipv6_hdr *)net_pkt_get_data_new(pkt, &ipv6_access);
ip_hdr = (struct net_ipv6_hdr *)net_pkt_get_data(pkt, &ipv6_access);
if (!ip_hdr) {
return NET_DROP;
}
@ -947,8 +947,7 @@ int net_ipv6_send_na(struct net_if *iface, const struct in6_addr *src,
goto drop;
}
na_hdr = (struct net_icmpv6_na_hdr *)net_pkt_get_data_new(pkt,
&na_access);
na_hdr = (struct net_icmpv6_na_hdr *)net_pkt_get_data(pkt, &na_access);
if (!na_hdr) {
goto drop;
}
@ -1029,8 +1028,7 @@ static enum net_verdict handle_ns_input(struct net_pkt *pkt,
const struct in6_addr *src;
struct in6_addr *tgt;
ns_hdr = (struct net_icmpv6_ns_hdr *)net_pkt_get_data_new(pkt,
&ns_access);
ns_hdr = (struct net_icmpv6_ns_hdr *)net_pkt_get_data(pkt, &ns_access);
if (!ns_hdr) {
NET_ERR("DROP: NULL NS header");
goto drop;
@ -1055,7 +1053,7 @@ static enum net_verdict handle_ns_input(struct net_pkt *pkt,
length -= (sizeof(struct net_ipv6_hdr) + sizeof(struct net_icmp_hdr));
nd_opt_hdr = (struct net_icmpv6_nd_opt_hdr *)
net_pkt_get_data_new(pkt, &nd_access);
net_pkt_get_data(pkt, &nd_access);
while (nd_opt_hdr && nd_opt_hdr->len > 0 &&
net_pkt_ipv6_ext_opt_len(pkt) < length) {
@ -1097,7 +1095,7 @@ static enum net_verdict handle_ns_input(struct net_pkt *pkt,
}
nd_opt_hdr = (struct net_icmpv6_nd_opt_hdr *)
net_pkt_get_data_new(pkt, &nd_access);
net_pkt_get_data(pkt, &nd_access);
}
if (IS_ENABLED(CONFIG_NET_ROUTING)) {
@ -1599,8 +1597,7 @@ static enum net_verdict handle_na_input(struct net_pkt *pkt,
struct net_icmpv6_na_hdr *na_hdr;
struct net_if_addr *ifaddr;
na_hdr = (struct net_icmpv6_na_hdr *)net_pkt_get_data_new(pkt,
&na_access);
na_hdr = (struct net_icmpv6_na_hdr *)net_pkt_get_data(pkt, &na_access);
if (!na_hdr) {
NET_ERR("DROP: NULL NA header");
goto drop;
@ -1629,7 +1626,7 @@ static enum net_verdict handle_na_input(struct net_pkt *pkt,
length -= (sizeof(struct net_ipv6_hdr) + sizeof(struct net_icmp_hdr));
nd_opt_hdr = (struct net_icmpv6_nd_opt_hdr *)
net_pkt_get_data_new(pkt, &nd_access);
net_pkt_get_data(pkt, &nd_access);
while (nd_opt_hdr && nd_opt_hdr->len &&
net_pkt_ipv6_ext_opt_len(pkt) < length) {
@ -1661,7 +1658,7 @@ static enum net_verdict handle_na_input(struct net_pkt *pkt,
net_pkt_acknowledge_data(pkt, &nd_access);
nd_opt_hdr = (struct net_icmpv6_nd_opt_hdr *)
net_pkt_get_data_new(pkt, &nd_access);
net_pkt_get_data(pkt, &nd_access);
}
ifaddr = net_if_ipv6_addr_lookup_by_iface(net_pkt_iface(pkt),
@ -1752,8 +1749,7 @@ int net_ipv6_send_ns(struct net_if *iface,
goto drop;
}
ns_hdr = (struct net_icmpv6_ns_hdr *)net_pkt_get_data_new(pkt,
&ns_access);
ns_hdr = (struct net_icmpv6_ns_hdr *)net_pkt_get_data(pkt, &ns_access);
if (!ns_hdr) {
goto drop;
}
@ -2092,7 +2088,7 @@ static inline bool handle_ra_prefix(struct net_pkt *pkt)
struct net_icmpv6_nd_opt_prefix_info *pfx_info;
pfx_info = (struct net_icmpv6_nd_opt_prefix_info *)
net_pkt_get_data_new(pkt, &rapfx_access);
net_pkt_get_data(pkt, &rapfx_access);
if (!pfx_info) {
return false;
}
@ -2126,7 +2122,7 @@ static inline bool handle_ra_6co(struct net_pkt *pkt, u8_t len)
struct net_icmpv6_nd_opt_6co *context;
context = (struct net_icmpv6_nd_opt_6co *)
net_pkt_get_data_new(pkt, &ctx_access);
net_pkt_get_data(pkt, &ctx_access);
if (!context) {
return false;
}
@ -2173,8 +2169,7 @@ static enum net_verdict handle_ra_input(struct net_pkt *pkt,
struct net_if_router *router;
u32_t mtu;
ra_hdr = (struct net_icmpv6_ra_hdr *)net_pkt_get_data_new(pkt,
&ra_access);
ra_hdr = (struct net_icmpv6_ra_hdr *)net_pkt_get_data(pkt, &ra_access);
if (!ra_hdr) {
NET_ERR("DROP: NULL RA header");
goto drop;
@ -2225,8 +2220,7 @@ static enum net_verdict handle_ra_input(struct net_pkt *pkt,
length -= (sizeof(struct net_ipv6_hdr) + sizeof(struct net_icmp_hdr));
nd_opt_hdr = (struct net_icmpv6_nd_opt_hdr *)
net_pkt_get_data_new(pkt, &nd_access);
net_pkt_get_data(pkt, &nd_access);
while (nd_opt_hdr) {
net_pkt_acknowledge_data(pkt, &nd_access);
@ -2301,7 +2295,7 @@ static enum net_verdict handle_ra_input(struct net_pkt *pkt,
}
nd_opt_hdr = (struct net_icmpv6_nd_opt_hdr *)
net_pkt_get_data_new(pkt, &nd_access);
net_pkt_get_data(pkt, &nd_access);
}
router = net_if_ipv6_router_lookup(net_pkt_iface(pkt), &ip_hdr->src);

View file

@ -2547,8 +2547,8 @@ bool net_pkt_is_contiguous(struct net_pkt *pkt, size_t size)
return false;
}
void *net_pkt_get_data_new(struct net_pkt *pkt,
struct net_pkt_data_access *access)
void *net_pkt_get_data(struct net_pkt *pkt,
struct net_pkt_data_access *access)
{
if (IS_ENABLED(CONFIG_NET_HEADERS_ALWAYS_CONTIGUOUS)) {
if (!net_pkt_is_contiguous(pkt, access->size)) {

View file

@ -439,7 +439,7 @@ static int prepare_segment(struct net_tcp *tcp,
goto fail;
}
tcp_hdr = (struct net_tcp_hdr *)net_pkt_get_data_new(pkt, &tcp_access);
tcp_hdr = (struct net_tcp_hdr *)net_pkt_get_data(pkt, &tcp_access);
if (!tcp_hdr) {
status = -ENOBUFS;
goto fail;
@ -874,7 +874,7 @@ int net_tcp_send_pkt(struct net_pkt *pkt)
return -EMSGSIZE;
}
tcp_hdr = (struct net_tcp_hdr *)net_pkt_get_data_new(pkt, &tcp_access);
tcp_hdr = (struct net_tcp_hdr *)net_pkt_get_data(pkt, &tcp_access);
if (!tcp_hdr) {
NET_ERR("Packet %p does not contain TCP header", pkt);
return -EMSGSIZE;
@ -1074,8 +1074,8 @@ bool net_tcp_ack_received(struct net_context *ctx, u32_t ack)
continue;
}
tcp_hdr = (struct net_tcp_hdr *)net_pkt_get_data_new(
pkt, &tcp_access);
tcp_hdr = (struct net_tcp_hdr *)net_pkt_get_data(pkt,
&tcp_access);
if (!tcp_hdr) {
/* The pkt does not contain TCP header, this should
* not happen.
@ -1269,7 +1269,7 @@ int net_tcp_finalize(struct net_pkt *pkt)
NET_PKT_DATA_ACCESS_DEFINE(tcp_access, struct net_tcp_hdr);
struct net_tcp_hdr *tcp_hdr;
tcp_hdr = (struct net_tcp_hdr *)net_pkt_get_data_new(pkt, &tcp_access);
tcp_hdr = (struct net_tcp_hdr *)net_pkt_get_data(pkt, &tcp_access);
if (!tcp_hdr) {
return -ENOBUFS;
}
@ -2574,7 +2574,7 @@ struct net_tcp_hdr *net_tcp_input(struct net_pkt *pkt,
goto drop;
}
tcp_hdr = (struct net_tcp_hdr *)net_pkt_get_data_new(pkt, tcp_access);
tcp_hdr = (struct net_tcp_hdr *)net_pkt_get_data(pkt, tcp_access);
if (tcp_hdr && !net_pkt_set_data(pkt, tcp_access)) {
return tcp_hdr;
}

View file

@ -22,7 +22,7 @@ int net_udp_create(struct net_pkt *pkt, u16_t src_port, u16_t dst_port)
NET_PKT_DATA_ACCESS_DEFINE(udp_access, struct net_udp_hdr);
struct net_udp_hdr *udp_hdr;
udp_hdr = (struct net_udp_hdr *)net_pkt_get_data_new(pkt, &udp_access);
udp_hdr = (struct net_udp_hdr *)net_pkt_get_data(pkt, &udp_access);
if (!udp_hdr) {
return -ENOBUFS;
}
@ -41,7 +41,7 @@ int net_udp_finalize(struct net_pkt *pkt)
struct net_udp_hdr *udp_hdr;
u16_t length;
udp_hdr = (struct net_udp_hdr *)net_pkt_get_data_new(pkt, &udp_access);
udp_hdr = (struct net_udp_hdr *)net_pkt_get_data(pkt, &udp_access);
if (!udp_hdr) {
return -ENOBUFS;
}
@ -78,7 +78,7 @@ struct net_udp_hdr *net_udp_get_hdr(struct net_pkt *pkt,
goto out;
}
udp_hdr = (struct net_udp_hdr *)net_pkt_get_data_new(pkt, &udp_access);
udp_hdr = (struct net_udp_hdr *)net_pkt_get_data(pkt, &udp_access);
out:
net_pkt_cursor_restore(pkt, &backup);
@ -107,7 +107,7 @@ struct net_udp_hdr *net_udp_set_hdr(struct net_pkt *pkt,
goto out;
}
udp_hdr = (struct net_udp_hdr *)net_pkt_get_data_new(pkt, &udp_access);
udp_hdr = (struct net_udp_hdr *)net_pkt_get_data(pkt, &udp_access);
if (!udp_hdr) {
goto out;
}
@ -153,7 +153,7 @@ struct net_udp_hdr *net_udp_input(struct net_pkt *pkt,
goto drop;
}
udp_hdr = (struct net_udp_hdr *)net_pkt_get_data_new(pkt, udp_access);
udp_hdr = (struct net_udp_hdr *)net_pkt_get_data(pkt, udp_access);
if (!udp_hdr || net_pkt_set_data(pkt, udp_access)) {
NET_DBG("DROP: corrupted header");
goto drop;

View file

@ -230,7 +230,7 @@ static void update_protocol_header_lengths(struct net_pkt *pkt, u16_t size)
NET_PKT_DATA_ACCESS_DEFINE(ipv6_access, struct net_ipv6_hdr);
struct net_ipv6_hdr *ipv6;
ipv6 = (struct net_ipv6_hdr *)net_pkt_get_data_new(pkt, &ipv6_access);
ipv6 = (struct net_ipv6_hdr *)net_pkt_get_data(pkt, &ipv6_access);
if (!ipv6) {
NET_ERR("could not get IPv6 header");
return;
@ -245,8 +245,7 @@ static void update_protocol_header_lengths(struct net_pkt *pkt, u16_t size)
NET_PKT_DATA_ACCESS_DEFINE(udp_access, struct net_udp_hdr);
struct net_udp_hdr *udp;
udp = (struct net_udp_hdr *)net_pkt_get_data_new(pkt,
&udp_access);
udp = (struct net_udp_hdr *)net_pkt_get_data(pkt, &udp_access);
if (udp) {
udp->len = htons(size - NET_IPV6H_LEN);
net_pkt_set_data(pkt, &udp_access);

View file

@ -541,8 +541,8 @@ static int sock_get_pkt_src_addr(struct net_pkt *pkt,
goto error;
}
ipv4_hdr = (struct net_ipv4_hdr *)net_pkt_get_data_new(pkt,
&ipv4_access);
ipv4_hdr = (struct net_ipv4_hdr *)net_pkt_get_data(
pkt, &ipv4_access);
if (!ipv4_hdr || net_pkt_acknowledge_data(pkt, &ipv4_access)) {
ret = -ENOBUFS;
goto error;
@ -562,8 +562,8 @@ static int sock_get_pkt_src_addr(struct net_pkt *pkt,
goto error;
}
ipv6_hdr = (struct net_ipv6_hdr *)net_pkt_get_data_new(pkt,
&ipv6_access);
ipv6_hdr = (struct net_ipv6_hdr *)net_pkt_get_data(
pkt, &ipv6_access);
if (!ipv6_hdr ||
net_pkt_acknowledge_data(pkt, &ipv6_access) ||
net_pkt_skip(pkt, net_pkt_ipv6_ext_len(pkt))) {
@ -582,8 +582,8 @@ static int sock_get_pkt_src_addr(struct net_pkt *pkt,
NET_PKT_DATA_ACCESS_DEFINE(udp_access, struct net_udp_hdr);
struct net_udp_hdr *udp_hdr;
udp_hdr = (struct net_udp_hdr *)net_pkt_get_data_new(pkt,
&udp_access);
udp_hdr = (struct net_udp_hdr *)net_pkt_get_data(pkt,
&udp_access);
if (!udp_hdr) {
ret = -ENOBUFS;
goto error;
@ -594,8 +594,8 @@ static int sock_get_pkt_src_addr(struct net_pkt *pkt,
NET_PKT_DATA_ACCESS_DEFINE(tcp_access, struct net_tcp_hdr);
struct net_tcp_hdr *tcp_hdr;
tcp_hdr = (struct net_tcp_hdr *)net_pkt_get_data_new(pkt,
&tcp_access);
tcp_hdr = (struct net_tcp_hdr *)net_pkt_get_data(pkt,
&tcp_access);
if (!tcp_hdr) {
ret = -ENOBUFS;
goto error;

View file

@ -125,7 +125,7 @@ static u16_t get_udp_chksum(struct net_pkt *pkt)
return 0;
}
udp_hdr = (struct net_udp_hdr *)net_pkt_get_data_new(pkt, &udp_access);
udp_hdr = (struct net_udp_hdr *)net_pkt_get_data(pkt, &udp_access);
if (!udp_hdr) {
return 0;
}

View file

@ -212,7 +212,7 @@ static struct net_icmp_hdr *get_icmp_hdr(struct net_pkt *pkt)
goto out;
}
hdr = (struct net_icmp_hdr *)net_pkt_get_data_new(pkt, &icmp_access);
hdr = (struct net_icmp_hdr *)net_pkt_get_data(pkt, &icmp_access);
out:
pkt->buffer = bak;

View file

@ -483,7 +483,7 @@ void test_net_pkt_easier_rw_usage(void)
struct net_ipv4_hdr *ip_hdr;
ip_hdr = (struct net_ipv4_hdr *)
net_pkt_get_data_new(pkt, &ip_access);
net_pkt_get_data(pkt, &ip_access);
zassert_not_null(ip_hdr, "Accessor failed");
ip_hdr->tos = 0x00;

View file

@ -145,7 +145,7 @@ struct net_tcp_hdr *net_tcp_get_hdr(struct net_pkt *pkt,
goto out;
}
tcp_hdr = (struct net_tcp_hdr *)net_pkt_get_data_new(pkt, &tcp_access);
tcp_hdr = (struct net_tcp_hdr *)net_pkt_get_data(pkt, &tcp_access);
out:
net_pkt_cursor_restore(pkt, &backup);
@ -174,7 +174,7 @@ struct net_tcp_hdr *net_tcp_set_hdr(struct net_pkt *pkt,
goto out;
}
tcp_hdr = (struct net_tcp_hdr *)net_pkt_get_data_new(pkt, &tcp_access);
tcp_hdr = (struct net_tcp_hdr *)net_pkt_get_data(pkt, &tcp_access);
if (!tcp_hdr) {
goto out;
}