net: Renaming net nbuf API to net pkt API
There have been long lasting confusion between net_buf and net_nbuf. While the first is actually a buffer, the second one is not. It's a network buffer descriptor. More precisely it provides meta data about a network packet, and holds the chain of buffer fragments made of net_buf. Thus renaming net_nbuf to net_pkt and all names around it as well (function, Kconfig option, ..). Though net_pkt if the new name, it still inherit its logic from net_buf. ' This patch is the first of a serie that will separate completely net_pkt from net_buf. Change-Id: Iecb32d2a0d8f4647692e5328e54b5c35454194cd Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
9bf3ea071a
commit
bf964cdd4c
216 changed files with 3109 additions and 3124 deletions
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <net/http.h>
|
||||
|
||||
#include <net/nbuf.h>
|
||||
#include <net/net_pkt.h>
|
||||
#include <misc/printk.h>
|
||||
|
||||
/* HTTP client defines */
|
||||
|
@ -22,42 +22,42 @@ int http_request(struct net_context *net_ctx, int32_t timeout,
|
|||
struct net_buf *tx;
|
||||
int rc = -ENOMEM;
|
||||
|
||||
tx = net_nbuf_get_tx(net_ctx, timeout);
|
||||
tx = net_pkt_get_tx(net_ctx, timeout);
|
||||
if (!tx) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (!net_nbuf_append(tx, strlen(req->method), (uint8_t *)req->method,
|
||||
timeout)) {
|
||||
if (!net_pkt_append(tx, strlen(req->method), (uint8_t *)req->method,
|
||||
timeout)) {
|
||||
goto lb_exit;
|
||||
}
|
||||
|
||||
if (!net_nbuf_append(tx, strlen(req->url), (uint8_t *)req->url,
|
||||
timeout)) {
|
||||
if (!net_pkt_append(tx, strlen(req->url), (uint8_t *)req->url,
|
||||
timeout)) {
|
||||
goto lb_exit;
|
||||
}
|
||||
|
||||
if (!net_nbuf_append(tx, strlen(req->protocol),
|
||||
(uint8_t *)req->protocol, timeout)) {
|
||||
if (!net_pkt_append(tx, strlen(req->protocol),
|
||||
(uint8_t *)req->protocol, timeout)) {
|
||||
goto lb_exit;
|
||||
}
|
||||
|
||||
if (!net_nbuf_append(tx, strlen(req->header_fields),
|
||||
(uint8_t *)req->header_fields,
|
||||
timeout)) {
|
||||
if (!net_pkt_append(tx, strlen(req->header_fields),
|
||||
(uint8_t *)req->header_fields,
|
||||
timeout)) {
|
||||
goto lb_exit;
|
||||
}
|
||||
|
||||
if (req->content_type_value) {
|
||||
if (!net_nbuf_append(tx, strlen(HTTP_CONTENT_TYPE),
|
||||
(uint8_t *)HTTP_CONTENT_TYPE,
|
||||
timeout)) {
|
||||
if (!net_pkt_append(tx, strlen(HTTP_CONTENT_TYPE),
|
||||
(uint8_t *)HTTP_CONTENT_TYPE,
|
||||
timeout)) {
|
||||
goto lb_exit;
|
||||
}
|
||||
|
||||
if (!net_nbuf_append(tx, strlen(req->content_type_value),
|
||||
(uint8_t *)req->content_type_value,
|
||||
timeout)) {
|
||||
if (!net_pkt_append(tx, strlen(req->content_type_value),
|
||||
(uint8_t *)req->content_type_value,
|
||||
timeout)) {
|
||||
goto lb_exit;
|
||||
}
|
||||
}
|
||||
|
@ -73,23 +73,23 @@ int http_request(struct net_context *net_ctx, int32_t timeout,
|
|||
goto lb_exit;
|
||||
}
|
||||
|
||||
if (!net_nbuf_append(tx, rc, (uint8_t *)content_len_str,
|
||||
timeout)) {
|
||||
if (!net_pkt_append(tx, rc, (uint8_t *)content_len_str,
|
||||
timeout)) {
|
||||
rc = -ENOMEM;
|
||||
goto lb_exit;
|
||||
}
|
||||
|
||||
if (!net_nbuf_append(tx, req->payload_size,
|
||||
(uint8_t *)req->payload,
|
||||
timeout)) {
|
||||
if (!net_pkt_append(tx, req->payload_size,
|
||||
(uint8_t *)req->payload,
|
||||
timeout)) {
|
||||
rc = -ENOMEM;
|
||||
goto lb_exit;
|
||||
}
|
||||
|
||||
} else {
|
||||
if (!net_nbuf_append(tx, strlen(HTTP_EOF),
|
||||
(uint8_t *)HTTP_EOF,
|
||||
timeout)) {
|
||||
if (!net_pkt_append(tx, strlen(HTTP_EOF),
|
||||
(uint8_t *)HTTP_EOF,
|
||||
timeout)) {
|
||||
goto lb_exit;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue