Skip to content

Commit

Permalink
Merge "Merge net branch into master"
Browse files Browse the repository at this point in the history
  • Loading branch information
Anas Nashif committed Jan 3, 2017
2 parents 52e3eac + 7028b43 commit 98f9b10
Show file tree
Hide file tree
Showing 157 changed files with 1,429 additions and 765 deletions.
3 changes: 2 additions & 1 deletion doc/doxygen.config
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ INPUT = \
include/arch/nios2/ \
lib/libc/minimal/include/ \
ext/lib/crypto/tinycrypt/include/ \
lib/iot/zoap/zoap.h \
include/net/zoap.h \
include/net/dns_client.h \
tests/ztest/include/
INPUT_ENCODING = UTF-8
FILE_PATTERNS = "*.c" "*.h" "*.S"
Expand Down
6 changes: 3 additions & 3 deletions include/net/buf.h
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ struct net_buf_pool {
*
* @return New buffer or NULL if out of buffers.
*/
#if defined(CONFIG_NET_BUF_DEBUG)
#if defined(CONFIG_NET_BUF_LOG)
struct net_buf *net_buf_alloc_debug(struct net_buf_pool *pool, int32_t timeout,
const char *func, int line);
#define net_buf_alloc(_pool, _timeout) \
Expand All @@ -548,7 +548,7 @@ struct net_buf *net_buf_alloc(struct net_buf_pool *pool, int32_t timeout);
*
* @return New buffer or NULL if the FIFO is empty.
*/
#if defined(CONFIG_NET_BUF_DEBUG)
#if defined(CONFIG_NET_BUF_LOG)
struct net_buf *net_buf_get_debug(struct k_fifo *fifo, int32_t timeout,
const char *func, int line);
#define net_buf_get(_fifo, _timeout) \
Expand Down Expand Up @@ -602,7 +602,7 @@ void net_buf_put(struct k_fifo *fifo, struct net_buf *buf);
*
* @param buf A valid pointer on a buffer
*/
#if defined(CONFIG_NET_BUF_DEBUG)
#if defined(CONFIG_NET_BUF_LOG)
void net_buf_unref_debug(struct net_buf *buf, const char *func, int line);
#define net_buf_unref(_buf) \
net_buf_unref_debug(_buf, __func__, __LINE__)
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion include/iot/mqtt.h → include/net/mqtt.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#ifndef _MQTT_H_
#define _MQTT_H_

#include <iot/mqtt_types.h>
#include <net/mqtt_types.h>
#include <net/net_context.h>

/**
Expand Down
File renamed without changes.
20 changes: 0 additions & 20 deletions include/net/nbuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,6 @@ extern "C" {

struct net_context;

/** @cond ignore */
enum net_nbuf_type {
NET_NBUF_RX = 0,
NET_NBUF_TX = 1,
NET_NBUF_DATA = 2,
};
/** @endcond */

struct net_nbuf {
/** Network connection context */
struct net_context *context;
Expand All @@ -71,8 +63,6 @@ struct net_nbuf {
struct net_linkaddr lladdr_src;
struct net_linkaddr lladdr_dst;

enum net_nbuf_type type;

uint16_t appdatalen;
uint16_t reserve; /* length of the protocol headers */
uint8_t ll_reserve; /* link layer header length */
Expand Down Expand Up @@ -132,16 +122,6 @@ static inline void net_nbuf_set_iface(struct net_buf *buf, struct net_if *iface)
((struct net_nbuf *)net_buf_user_data(buf))->iface = iface;
}

static inline enum net_nbuf_type net_nbuf_type(struct net_buf *buf)
{
return ((struct net_nbuf *)net_buf_user_data(buf))->type;
}

static inline void net_nbuf_set_type(struct net_buf *buf, uint8_t type)
{
((struct net_nbuf *)net_buf_user_data(buf))->type = type;
}

static inline uint8_t net_nbuf_family(struct net_buf *buf)
{
return ((struct net_nbuf *)net_buf_user_data(buf))->family;
Expand Down
21 changes: 0 additions & 21 deletions include/net/net_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -631,27 +631,6 @@ int net_context_recv(struct net_context *context,
int32_t timeout,
void *user_data);

/**
* @brief Internal function that is called when network packet is sent
* successfully.
*
* @param context The network context to use.
* @param token User supplied token tied to the net_buf that was sent.
* @param err_code Error code
*/
static inline void net_context_send_cb(struct net_context *context,
void *token,
int err_code)
{
if (context->send_cb) {
context->send_cb(context, err_code, token, context->user_data);
}

if (net_context_get_ip_proto(context) == IPPROTO_UDP) {
NET_STATS_UDP(++net_stats.udp.sent);
}
}

typedef void (*net_context_cb_t)(struct net_context *context, void *user_data);

/**
Expand Down
14 changes: 8 additions & 6 deletions include/net/net_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,17 @@ extern "C" {

/* Network subsystem logging helpers */

#if defined(CONFIG_NET_LOG)
#if NET_DEBUG > 0
#if defined(NET_LOG_ENABLED)
#if !defined(SYS_LOG_DOMAIN)
#define SYS_LOG_DOMAIN "net"
#endif /* !SYS_LOG_DOMAIN */

#undef SYS_LOG_LEVEL
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_DEBUG
#endif /* NET_DEBUG */
#ifndef NET_SYS_LOG_LEVEL
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_NET_LEVEL
#else
#define SYS_LOG_LEVEL NET_SYS_LOG_LEVEL
#endif /* !NET_SYS_LOG_LEVEL */

#define NET_DBG(fmt, ...) SYS_LOG_DBG("(%p): " fmt, k_current_get(), \
##__VA_ARGS__)
Expand All @@ -53,14 +55,14 @@ extern "C" {
NET_ERR("{assert: '" #cond "' failed} " fmt, \
##__VA_ARGS__); \
} } while (0)
#else /* CONFIG_NET_LOG */
#else /* NET_LOG_ENABLED */
#define NET_DBG(...)
#define NET_ERR(...)
#define NET_INFO(...)
#define NET_WARN(...)
#define NET_ASSERT(...)
#define NET_ASSERT_INFO(...)
#endif /* CONFIG_NET_LOG */
#endif /* NET_LOG_ENABLED */

#include <kernel.h>

Expand Down
6 changes: 3 additions & 3 deletions include/net/net_ip.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ enum net_addr_type {
NET_ADDR_MANUAL,
};

#if NET_DEBUG > 0
#if NET_LOG_ENABLED > 0
static inline char *net_addr_type2str(enum net_addr_type type)
{
switch (type) {
Expand All @@ -219,14 +219,14 @@ static inline char *net_addr_type2str(enum net_addr_type type)

return "<unknown>";
}
#else
#else /* NET_LOG_ENABLED */
static inline char *net_addr_type2str(enum net_addr_type type)
{
ARG_UNUSED(type);

return NULL;
}
#endif
#endif /* NET_LOG_ENABLED */

/** What is the current state of the network address */
enum net_addr_state {
Expand Down
Loading

0 comments on commit 98f9b10

Please sign in to comment.