net/layer.h header reference
[Abstract network stack module]

The source code of this header can be browsed online.

Description [link] 

this header contains all definitions around Network layer structure.

Members [link] 

Types [link] 

Functions [link] 

  • error_t net_layer_bind(struct net_layer_s *parent, void *addr, struct net_layer_s *child)
  • void net_layer_context_changed(struct net_layer_s *layer)
  • error_t net_layer_init(struct net_layer_s *layer, const struct net_layer_handler_s *handler, struct net_scheduler_s *scheduler, void *delegate, const struct net_layer_delegate_vtable_s *delegate_vtable)
  • void net_layer_unbind(struct net_layer_s *layer, struct net_layer_s *child)
  • void net_layer_unbind_all(struct net_layer_s *layer)
  • void net_layer_destroy(struct net_layer_s *layer)

Members detail [link] 

#define GCT_CONTAINER_ALGO_net_layer_list [link] 

This macro is declared in net/layer.h source file, line 130.

#define GCT_CONTAINER_ALGO_net_layer_sched_list [link] 

This macro is declared in net/layer.h source file, line 132.

#define GCT_CONTAINER_REFCOUNT_net_layer_list [link] 

This macro is declared in net/layer.h source file, line 131.

#define NET_LAYER_H [link] 

This macro is declared in net/layer.h source file, line 30.

error_t net_layer_bind(struct net_layer_s *parent, void *addr, struct net_layer_s *child) [link] 

This function is declared in net/layer.h source file, line 240.

this function binds a child layer to another layer. Caller should refdec child layer after this call, whatever the return value. If accepted, reference will be retained by new parent, if rejected, child layer should be destroyed anyway.

Parameter list:

  • parent: Parent layer
  • addr: Address data (parent context specific)
  • child: Child layer

The return value is error if parent refused layer as a child

void net_layer_context_changed(struct net_layer_s *layer) [link] 

This function is declared in net/layer.h source file, line 258.

this function must be called by layer when its context changes.

struct net_layer_context_s [link] 

This struct is declared in net/layer.h source file, line 58.

this struct defines context a layer can live in. Context contains parameters with respect to parent layers.

FieldDescription
struct net_addr_s addr;Upper-layer addresses
uint16_t prefix_size;Byte count layer should leave available for upper layers at the begining of a packet
uint16_t mtu;Maximum byte count this layer is allowed to use for its payloads, starting from prefix_size offset in buffers.

struct net_layer_delegate_vtable_s [link] 

This struct is declared in ble/net/generic.h source file, line 33.

this struct is the base vtable for a delegate. All delegate must implement functions contained herein.

Specific layer definitions may inherit this vtable as base.

FieldDescription
void (*release)(void *delegate, struct net_layer_s *layer) ;this variable notifies delegate the layer got destroyed, implying delegate is released from referencing layer.

struct net_layer_handler_s [link] 

This struct is declared in net/layer.h source file, line 74.

this struct is a vtable for a layer

FieldDescription
void (*destroyed)(struct net_layer_s *layer) ;this variable is called after a layer gets destroyed because its refcount dropped down to 0. This method is mandatory.
void (*task_handle)(struct net_layer_s *layer, struct net_task_s *task) ;this variable is called when a task requires handling from the layer. It is responsability from this call to destroy the task (or reuse it). This method is mandatory.
void (*child_context_adjust)(const struct net_layer_s *layer, struct net_layer_context_s *ctx) ;this variable is responsible for calculating children's context. This method is optional.
void (*context_changed)(struct net_layer_s *layer) ;this variable notifies a layer its own context changed. This method is optional.
void (*dandling)(struct net_layer_s *layer) ;this variable notifies a layer its got unbound and has no parent any more. This method is optional.
error_t (*bound)(struct net_layer_s *layer, void *addrstruct net_layer_s *child) ;this variable is called when another layer is bound using this one as parent. addr is address context passed to net_layer_bind, it is context-dependent.
If this function returns an error, layer binding is aborted. This method is optional. If not implemented, no layer may be bound as child of this one.
void (*unbound)(struct net_layer_s *layer, struct net_layer_s *child) ;this variable is called when a child layer gets unbound. This method is optional.

error_t net_layer_init(struct net_layer_s *layer, const struct net_layer_handler_s *handler, struct net_scheduler_s *scheduler, void *delegate, const struct net_layer_delegate_vtable_s *delegate_vtable) [link] 

This function is declared in net/layer.h source file, line 274.

this function initializes a network layer.

Parameter list:

  • layer: Layer to initialize
  • handler: Pointer to a vtable
  • scheduler: Context scheduler this layer runs in
  • delegate: Delegate private data pointer
  • delegate_vtable: Vtable for delegate, mandatory if delegate is set

typedef void * net_layer_list_entry_t [link] 

This typedef is declared in net/layer.h source file, line 182.

typedef struct net_layer_s * net_layer_list_item_t [link] 

This typedef is declared in net/layer.h source file, line 213.

typedef void * net_layer_list_root_t [link] 

This typedef is declared in net/layer.h source file, line 182.

struct net_layer_s [link] 

This struct is declared in ble/stack/raw_connection.h source file, line 29.

this struct is base structure for a layer. It should be inherited from by actual implementations.

FieldDescription
net_layer_list_root_t children;
const struct net_layer_handler_s * handler;
struct net_scheduler_s * scheduler;Layer's scheduler. May be dereferenced for using its timing and allocation functions.
struct net_layer_s * parent;Layer's parent in stack. Should be checked for NULL before using.
struct net_layer_context_s context;Layer's context, as set by parent. Layer is notified of changes in this structure through net_layer_handler_s::context_changed method.
void * delegate;Delegate pointer
const struct net_layer_delegate_vtable_s * delegate_vtable;Delegate vtable

See also net_layer_list_item_t and net_layer_sched_list_item_t.

typedef void * net_layer_sched_list_entry_t [link] 

This typedef is declared in net/layer.h source file, line 216.

typedef struct net_layer_s * net_layer_sched_list_item_t [link] 

This typedef is declared in net/layer.h source file, line 216.

typedef void * net_layer_sched_list_root_t [link] 

This typedef is declared in net/layer.h source file, line 216.

void net_layer_unbind(struct net_layer_s *layer, struct net_layer_s *child) [link] 

This function is declared in net/layer.h source file, line 247.

this function unbinds a child layer from another layer.

void net_layer_unbind_all(struct net_layer_s *layer) [link] 

This function is declared in net/layer.h source file, line 252.

this function unbinds all children layers from a layer.

void net_layer_destroy(struct net_layer_s *layer) [link] 

This function is declared in net/layer.h source file, line 223.

this function is refcount destroy function, called from refcount management.

This function is for internal use only.

Valid XHTML 1.0 StrictGenerated by diaxen on Thu Aug 4 15:44:06 2022 using MkDoc