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

The source code of this header can be browsed online.

Description  

this header contains all declarations about Network library tasks.

Members  

Types  

Functions  

  • void net_task_destroy(struct net_task_s *task)
  • void net_task_inbound_push(struct net_task_s *task, struct net_layer_s *target, struct net_layer_s *source, dev_timer_value_t timestamp, const struct net_addr_s *src_addr, const struct net_addr_s *dst_addr, struct buffer_s *buffer)
  • void net_task_notification_push(struct net_task_s *task, struct net_layer_s *target, struct net_layer_s *source, uint32_t opcode)
  • void net_task_outbound_push(struct net_task_s *task, struct net_layer_s *target, struct net_layer_s *source, dev_timer_value_t timestamp, const struct net_addr_s *src_addr, const struct net_addr_s *dst_addr, struct buffer_s *buffer)
  • struct buffer_s * net_task_packet_buffer_steal(struct net_task_s *task, size_t begin, size_t size)
  • void net_task_packet_forward(struct net_task_s *task, struct net_layer_s *target)
  • void net_task_packet_respond(struct net_task_s *task, struct net_layer_s *next_hop, dev_timer_value_t timestamp, const struct net_addr_s dst[static 1])
  • void net_task_query_push(struct net_task_s *task, struct net_layer_s *target, struct net_layer_s *requester, uint32_t opcode)
  • void net_task_query_respond_push(struct net_task_s *task, error_t err)
  • void net_task_queue_reject_all(net_task_queue_root_t *root)
  • void net_task_timeout_push(struct net_task_s *task, struct net_layer_s *target, dev_timer_value_t deadline, dev_timer_value_t precision)
  • void net_task_push(struct net_task_s *task, struct net_layer_s *target, struct net_layer_s *source, enum net_task_type_e type)

Members detail  

#define GCT_CONTAINER_ALGO_net_task_queue  

This macro is declared in net/task.h source file, line 47.

#define GCT_CONTAINER_LOCK_net_task_queue  

This macro is declared in net/task.h source file, line 48.

#define NET_TASK_H  

This macro is declared in net/task.h source file, line 21.

void net_task_destroy(struct net_task_s *task)  

this function destroys a task. This drops references to referenced data (layers, buffer if any) and calls its destroy function.

typedef void (net_task_destroy_func_t)(void *task)   

This typedef is declared in net/task.h source file, line 58.

this typedef is called when a task gets destroyed.

void net_task_inbound_push(struct net_task_s *task, struct net_layer_s *target, struct net_layer_s *source, dev_timer_value_t timestamp, const struct net_addr_s *src_addr, const struct net_addr_s *dst_addr, struct buffer_s *buffer)  

this function pushes an inbound packet task to a layer.

this function sets all structure fields and pushes the task.

void net_task_notification_push(struct net_task_s *task, struct net_layer_s *target, struct net_layer_s *source, uint32_t opcode)  

this function pushes a notification task to a layer. opcode meaning is source or destination-layer defined.

void net_task_outbound_push(struct net_task_s *task, struct net_layer_s *target, struct net_layer_s *source, dev_timer_value_t timestamp, const struct net_addr_s *src_addr, const struct net_addr_s *dst_addr, struct buffer_s *buffer)  

this function pushes an outbound packet task to a layer.

this function sets all structure fields and pushes the task.

  • task: Task to be pushed. Must be allocated and in INVALID state.
  • target: Target layer, mandatory
  • source: Source layer, mandatory
  • timestamp: Source timestamp, 0 implies now.
  • src_addr: Source address to set in packet, may be NULL.
  • dst_addr: Destionation address to set in packet, may be NULL.
  • buffer: Buffer to use as payload, mandatory.

struct buffer_s * net_task_packet_buffer_steal(struct net_task_s *task, size_t begin, size_t size)  

This function is declared in net/task.h source file, line 261.

this function steals a buffer from a packet task. Once stolen, task cannot be reused and should be destroyed.

void net_task_packet_forward(struct net_task_s *task, struct net_layer_s *target)  

Forward a packet task (inbound or outbound) to another layer without changing timestamp and buffer.

Task must not be cleaned up for before calling this function.

void net_task_packet_respond(struct net_task_s *task, struct net_layer_s *next_hop, dev_timer_value_t timestamp, const struct net_addr_s dst[static 1])  

this function pushes an OUTBOUND task as response of an INBOUND task. task's original destination address is reused as source.

void net_task_query_push(struct net_task_s *task, struct net_layer_s *target, struct net_layer_s *requester, uint32_t opcode)  

this function pushes a query to a layer. opcode is requester-layer defined. Responder should use net_task_query_respond_push with the same task for answering.

void net_task_query_respond_push(struct net_task_s *task, error_t err)  

Transform a query task into its response counterpart. Query target and requester fields are used as response responder and target fields.

typedef void * net_task_queue_entry_t  

This typedef is declared in net/task.h source file, line 167.

typedef struct net_task_s * net_task_queue_item_t  

This typedef is declared in net/task.h source file, line 167.

void net_task_queue_reject_all(net_task_queue_root_t *root)  

typedef void * net_task_queue_root_t  

This typedef is declared in net/task.h source file, line 167.

struct net_task_s  

This struct is declared in net/task.h source file, line 114.

this struct is a network task structure. Custom query and notification tasks may inherit this structure.

A destroy function must be set for each task. When a task is cleaned up, its destroy function will be called.

FieldDescription
net_task_destroy_func_t * destroy_func;Destroy function
struct net_layer_s * source;Must be filled, must retain a reference. This is implicitly done by standard functions.
struct net_layer_s * target;Must be filled, must retain a reference. This is implicitly done by standard functions.
enum net_task_type_e type;
union <anonymous> {
struct <anonymous> {Packet task must have a reference on packet, and a reference on source layer.
Packet task may be forwarded from layer to layer. If so, reference to source and owner layers must be updated accordingly.
dev_timer_value_t timestamp;
struct net_addr_s src_addr;
struct net_addr_s dst_addr;
struct buffer_s * buffer;
} packet;
struct <anonymous> {Deadline is relative to scheduler's timer device.
dev_timer_value_t deadline;
dev_timer_value_t precision;
} timeout;
struct <anonymous> {
uint32_t opcode;
} notification;
struct <anonymous> {
uint32_t opcode;
error_t err;
} query;
};

See also net_task_queue_item_t and net_timeout_queue_item_t.

void net_task_timeout_push(struct net_task_s *task, struct net_layer_s *target, dev_timer_value_t deadline, dev_timer_value_t precision)  

this function pushes a timetout task to a layer. Source layer is same as target layer.

enum net_task_type_e  

This enum is declared in net/task.h source file, line 64.

this enum is a type for tasks.

IdentifierDescription
NET_TASK_INVALIDAn invalid task. This has to be set on a newly created task not initialized yet.
NET_TASK_INBOUNDAn inbound packet task. Task references a payload transitting from root towards leaves of the network stack tree.
NET_TASK_OUTBOUNDAn outbound packet task. Task references a payload transitting from leaves towards root of the network stack tree.
NET_TASK_TIMEOUTA timeout task. Contains an timeout after which the task will be scheduled for handling.
NET_TASK_QUERYA query task, should be responded to through net_task_query_respond_push.
NET_TASK_RESPONSEA query response task.
NET_TASK_NOTIFICATIONA one-way notification.

void net_task_push(struct net_task_s *task, struct net_layer_s *target, struct net_layer_s *source, enum net_task_type_e type)  

this function pushes a task to a given target, for a given type.

Parameter list:

  • task: Task to push
  • target: Target layer, mandatory
  • source: Source layer, mandatory
  • type: Task type

This function is for internal use only.

Valid XHTML 1.0 StrictGenerated by diaxen on Wed Oct 17 21:18:39 2018 using MkDoc