net/task.h header reference
[Abstract network stack module]
The source code of this header can be browsed online.
Description [link]
this header contains all declarations about Network library tasks.
Members [link]
Types [link]
- typedef void (net_task_destroy_func_t)(void *task)
- typedef [...] * net_task_queue_item_t
- struct net_task_s
- enum net_task_type_e
Functions [link]
- 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 [link]
#define GCT_CONTAINER_ALGO_net_task_queue [link]
This macro is declared in net/task.h source file, line 47.
#define GCT_CONTAINER_LOCK_net_task_queue [link]
This macro is declared in net/task.h source file, line 48.
#define NET_TASK_H [link]
This macro is declared in net/task.h source file, line 21.
void net_task_destroy(struct net_task_s *task) [link]
This function is declared in net/task.h source file, line 104.
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) [link]
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) [link]
This function is declared in net/task.h source file, line 186.
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) [link]
This function is declared in net/task.h source file, line 234.
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) [link]
This function is declared in net/task.h source file, line 207.
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) [link]
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) [link]
This function is declared in net/task.h source file, line 216.
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]) [link]
This function is declared in net/task.h source file, line 280.
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) [link]
This function is declared in net/task.h source file, line 244.
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) [link]
This function is declared in net/task.h source file, line 251.
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 [link]
This typedef is declared in net/task.h source file, line 167.
typedef struct net_task_s * net_task_queue_item_t [link]
This typedef is declared in net/task.h source file, line 167.
void net_task_queue_reject_all(net_task_queue_root_t *root) [link]
This function is declared in net/task.h source file, line 173.
typedef void * net_task_queue_root_t [link]
This typedef is declared in net/task.h source file, line 167.
struct net_task_s [link]
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.
Field | Description |
---|---|
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) [link]
This function is declared in net/task.h source file, line 225.
this function pushes a timetout task to a layer. Source layer is same as target layer.
enum net_task_type_e [link]
This enum is declared in net/task.h source file, line 64.
this enum is a type for tasks.
Identifier | Description |
---|---|
NET_TASK_INVALID | An invalid task. This has to be set on a newly created task not initialized yet. |
NET_TASK_INBOUND | An inbound packet task. Task references a payload transitting from root towards leaves of the network stack tree. |
NET_TASK_OUTBOUND | An outbound packet task. Task references a payload transitting from leaves towards root of the network stack tree. |
NET_TASK_TIMEOUT | A timeout task. Contains an timeout after which the task will be scheduled for handling. |
NET_TASK_QUERY | A query task, should be responded to through net_task_query_respond_push. |
NET_TASK_RESPONSE | A query response task. |
NET_TASK_NOTIFICATION | A 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) [link]
This function is declared in net/task.h source file, line 98.
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.