#include <stddef.h>#include "common/container_of.h"#include "common/common_types.h"

Go to the source code of this file.
Data Structures | |
| struct | list_entity |
Defines | |
| #define | list_first_element(head, element, list_member) container_of((head)->next, typeof(*(element)), list_member) |
| #define | list_last_element(head, element, list_member) container_of((head)->prev, typeof(*(element)), list_member) |
| #define | list_next_element(element, list_member) container_of((&(element)->list_member)->next, typeof(*(element)), list_member) |
| #define | list_prev_element(element, list_member) container_of((&(element)->list_member)->prev, typeof(*(element)), list_member) |
| #define | list_for_element_range(first_element, last_element, element, list_member) |
| #define | list_for_element_range_reverse(first_element, last_element, element, list_member) |
| #define | list_for_each_element(head, element, list_member) |
| #define | list_for_each_element_reverse(head, element, list_member) |
| #define | list_for_element_to_last(head, first, element, list_member) list_for_element_range(first, list_last_element(head, element, list_member), element, list_member) |
| #define | list_for_element_to_last_reverse(head, first, element, list_member) list_for_element_range_reverse(first, list_last_element(head, element, list_member), element, list_member) |
| #define | list_for_first_to_element(head, last, element, list_member) list_for_element_range(list_first_element(head, element, list_member), last, element, list_member) |
| #define | list_for_first_to_element_reverse(head, last, element, list_member) list_for_element_range_reverse(list_first_element(head, element, list_member), last, element, list_member) |
| #define | list_for_element_range_safe(first_element, last_element, element, list_member, ptr) |
| #define | list_for_element_range_reverse_safe(first_element, last_element, element, list_member, ptr) |
| #define | list_for_each_element_safe(head, element, list_member, ptr) |
| #define | list_for_each_element_reverse_safe(head, element, list_member, ptr) |
Functions | |
| static INLINE void | list_init_head (struct list_entity *head) |
| static INLINE void | list_init_node (struct list_entity *entity) |
| static INLINE void | __list_add (struct list_entity *prev, struct list_entity *next, struct list_entity *new) |
| static INLINE void | list_add_head (struct list_entity *head, struct list_entity *new) |
| static INLINE void | list_add_tail (struct list_entity *head, struct list_entity *new) |
| static INLINE void | list_add_before (struct list_entity *before, struct list_entity *new) |
| static INLINE void | list_add_after (struct list_entity *after, struct list_entity *new) |
| static INLINE void | __list_remove (struct list_entity *prev, struct list_entity *next) |
| static INLINE void | list_remove (struct list_entity *entity) |
| static INLINE bool | list_is_empty (struct list_entity *head) |
| static INLINE bool | list_node_added (struct list_entity *node) |
| static INLINE bool | list_is_first (const struct list_entity *head, const struct list_entity *entity) |
| static INLINE bool | list_is_last (const struct list_entity *head, const struct list_entity *entity) |
| static INLINE void | list_merge (struct list_entity *add_to, struct list_entity *remove_from) |
| #define list_first_element | ( | head, | |||
| element, | |||||
| list_member | ) | container_of((head)->next, typeof(*(element)), list_member) |
| head | pointer to list-head | |
| element | pointer to a node element (don't need to be initialized) | |
| list_member | name of the list_entity element inside the larger struct |
Definition at line 233 of file list.h.
Referenced by olsr_calculate_routing_table(), olsr_memcookie_malloc(), olsr_timer_cleanup(), and olsr_timer_walk().
| #define list_for_each_element | ( | head, | |||
| element, | |||||
| list_member | ) |
list_for_element_range(list_first_element(head, element, list_member), \ list_last_element(head, element, list_member), \ element, list_member)
Loop over all elements of a list, used similar to a for() command. This loop should not be used if elements are removed from the list during the loop.
| head | pointer to list-head | |
| element | pointer to a node of the list, this element will contain the current node of the list during the loop | |
| list_member | name of the list_entity element inside the larger struct |
Definition at line 315 of file list.h.
Referenced by insert_new_name_in_list(), lookup_name_latlon(), lookup_position_latlon(), mapwrite_work(), write_hosts_file(), write_resolv_file(), and write_services_file().
| #define list_for_each_element_reverse | ( | head, | |||
| element, | |||||
| list_member | ) |
list_for_element_range_reverse(list_first_element(head, element, list_member), \ list_last_element(head, element, list_member), \ element, list_member)
Loop over all elements of a list backwards, used similar to a for() command. This loop should not be used if elements are removed from the list during the loop.
| head | pointer to list-head | |
| element | pointer to a node of the list, this element will contain the current node of the list during the loop | |
| list_member | name of the list_entity element inside the larger struct |
| #define list_for_each_element_reverse_safe | ( | head, | |||
| element, | |||||
| list_member, | |||||
| ptr | ) |
list_for_element_range_reverse_safe(list_first_element(head, element, list_member), \ list_last_element(head, element, list_member), \ element, list_member, ptr)
Loop over all elements of a list backwards, used similar to a for() command. This loop can be used if the current element might be removed from the list during the loop. Other elements should not be removed during the loop.
| head | pointer to list-head | |
| element | pointer to a node of the list, this element will contain the current node of the list during the loop | |
| list_member | name of the list_entity element inside the larger struct | |
| ptr | pointer to an list element struct which is used to store the next node during the loop |
| #define list_for_each_element_safe | ( | head, | |||
| element, | |||||
| list_member, | |||||
| ptr | ) |
list_for_element_range_safe(list_first_element(head, element, list_member), \ list_last_element(head, element, list_member), \ element, list_member, ptr)
Loop over all elements of a list, used similar to a for() command. This loop can be used if the current element might be removed from the list during the loop. Other elements should not be removed during the loop.
| head | pointer to list-head | |
| element | pointer to a node of the list, this element will contain the current node of the list during the loop | |
| list_member | name of the list_entity element inside the larger struct | |
| ptr | pointer to an list element struct which is used to store the next node during the loop |
Definition at line 452 of file list.h.
Referenced by arproaming_client_update(), arproaming_list_remove(), free_all_listold_entries(), and olsr_timer_remove().
| #define list_for_element_range | ( | first_element, | |||
| last_element, | |||||
| element, | |||||
| list_member | ) |
for (element = (first_element); \ element->list_member.prev != &(last_element)->list_member; \ element = list_next_element(element, list_member))
Loop over a block of elements of a list, used similar to a for() command. This loop should not be used if elements are removed from the list during the loop.
| first_element | first element of loop | |
| last_element | last element of loop | |
| element | iterator pointer to list element struct | |
| list_member | name of list_entity within list element struct |
| #define list_for_element_range_reverse | ( | first_element, | |||
| last_element, | |||||
| element, | |||||
| list_member | ) |
for (element = (last_element); \ element->list_member.next != &(first_element)->list_member; \ element = list_prev_element(element, list_member))
Loop over a block of elements of a list backwards, used similar to a for() command. This loop should not be used if elements are removed from the list during the loop.
| first_element | first element of range (will be last returned by the loop) | |
| last_element | last element of range (will be first returned by the loop) | |
| element | iterator pointer to list element struct | |
| list_member | name of list_entity within list element struct |
| #define list_for_element_range_reverse_safe | ( | first_element, | |||
| last_element, | |||||
| element, | |||||
| list_member, | |||||
| ptr | ) |
for (element = (last_element), ptr = list_prev_element(last_element, list_member); \ element->list_member.next != &(first_element)->list_member; \ element = ptr, ptr = list_prev_element(ptr, list_member))
Loop over a block of elements of a list backwards, used similar to a for() command. This loop can be used if the current element might be removed from the list during the loop. Other elements should not be removed during the loop.
| first_element | first element of range (will be last returned by the loop) | |
| last_element | last element of range (will be first returned by the loop) | |
| element | iterator pointer to list element struct | |
| list_member | name of list_entity within list element struct | |
| ptr | pointer to list element struct which is used to store the previous node during the loop |
| #define list_for_element_range_safe | ( | first_element, | |||
| last_element, | |||||
| element, | |||||
| list_member, | |||||
| ptr | ) |
for (element = (first_element), ptr = list_next_element(first_element, list_member); \ element->list_member.prev != &(last_element)->list_member; \ element = ptr, ptr = list_next_element(ptr, list_member))
Loop over a block of elements of a list, used similar to a for() command. This loop can be used if the current element might be removed from the list during the loop. Other elements should not be removed during the loop.
| first_element | first element of loop | |
| last_element | last element of loop | |
| element | iterator pointer to list element struct | |
| list_member | name of list_entity within list element struct | |
| ptr | pointer to list element struct which is used to store the next node during the loop |
| #define list_for_element_to_last | ( | head, | |||
| first, | |||||
| element, | |||||
| list_member | ) | list_for_element_range(first, list_last_element(head, element, list_member), element, list_member) |
Loop over a block of elements of a list, used similar to a for() command. This loop should not be used if elements are removed from the list during the loop. The loop runs from the element 'first' to the end of the list.
| head | pointer to head of list | |
| first | pointer to first element of loop | |
| element | pointer to a node of the list, this element will contain the current node of the list during the loop | |
| list_member | name of the list_entity element inside the larger struct |
| #define list_for_element_to_last_reverse | ( | head, | |||
| first, | |||||
| element, | |||||
| list_member | ) | list_for_element_range_reverse(first, list_last_element(head, element, list_member), element, list_member) |
Loop over a block of elements of a list backwards, used similar to a for() command. This loop should not be used if elements are removed from the list during the loop. The loop runs from the end of the list to the element 'first'.
| head | pointer to head of list | |
| first | pointer to first element of loop | |
| element | pointer to a node of the list, this element will contain the current node of the list during the loop | |
| list_member | name of the list_entity element inside the larger struct |
| #define list_for_first_to_element | ( | head, | |||
| last, | |||||
| element, | |||||
| list_member | ) | list_for_element_range(list_first_element(head, element, list_member), last, element, list_member) |
Loop over a block of elements of a list, used similar to a for() command. This loop should not be used if elements are removed from the list during the loop. The loop runs from the start of the list to the element 'last'.
| head | pointer to head of list | |
| last | pointer to last element of loop | |
| element | pointer to a node of the list, this element will contain the current node of the list during the loop | |
| list_member | name of the list_entity element inside the larger struct |
| #define list_for_first_to_element_reverse | ( | head, | |||
| last, | |||||
| element, | |||||
| list_member | ) | list_for_element_range_reverse(list_first_element(head, element, list_member), last, element, list_member) |
Loop over a block of elements of a list backwards, used similar to a for() command. This loop should not be used if elements are removed from the list during the loop. The loop runs from the element 'last' to the start of the list.
| head | pointer to head of list | |
| last | pointer to last element of loop | |
| element | pointer to a node of the list, this element will contain the current node of the list during the loop | |
| list_member | name of the list_entity element inside the larger struct | |
| loop_ptr | pointer to an list_entity which is used as the internal iterator |
| #define list_last_element | ( | head, | |||
| element, | |||||
| list_member | ) | container_of((head)->prev, typeof(*(element)), list_member) |
| head | pointer to list-head | |
| element | pointer to a node element (don't need to be initialized) | |
| list_member | name of the list_entity element inside the larger struct |
| #define list_next_element | ( | element, | |||
| list_member | ) | container_of((&(element)->list_member)->next, typeof(*(element)), list_member) |
This function must not be called for the last element of a list
| element | pointer to a node of the list | |
| list_member | name of the list_entity element inside the larger struct |
Definition at line 258 of file list.h.
Referenced by avl_insert(), and avl_remove().
| #define list_prev_element | ( | element, | |||
| list_member | ) | container_of((&(element)->list_member)->prev, typeof(*(element)), list_member) |
This function must not be called for the first element of a list
| element | pointer to a node of the list | |
| list_member | name of the list_entity element inside the larger struct |
| static INLINE void __list_add | ( | struct list_entity * | prev, | |
| struct list_entity * | next, | |||
| struct list_entity * | new | |||
| ) | [static] |
internal function to add a new node between two other nodes.
| prev | node before the insertion point | |
| next | node after the insertion point | |
| new | node which will be added to the list between 'prev' and 'next' |
Definition at line 93 of file list.h.
References list_entity::next, and list_entity::prev.
Referenced by list_add_after(), list_add_before(), list_add_head(), and list_add_tail().
| static INLINE void __list_remove | ( | struct list_entity * | prev, | |
| struct list_entity * | next | |||
| ) | [static] |
internal function that removes the nodes between two other nodes.
| prev | node before the removed part of the list | |
| next | node after the removed part of the list |
Definition at line 146 of file list.h.
References list_entity::next, and list_entity::prev.
Referenced by list_remove().
| static INLINE void list_add_after | ( | struct list_entity * | after, | |
| struct list_entity * | new | |||
| ) | [static] |
adds a node after another node
| before | reference node in the list | |
| new | node which will be added to the list |
Definition at line 136 of file list.h.
References __list_add(), and list_entity::next.
Referenced by _avl_insert_after(), olsr_com_parse_request(), olsr_enqueue_rt(), and olsr_timer_walk().

| static INLINE void list_add_before | ( | struct list_entity * | before, | |
| struct list_entity * | new | |||
| ) | [static] |
adds a node before another node
| before | reference node in the list | |
| new | node which will be added to the list |
Definition at line 126 of file list.h.
References __list_add(), and list_entity::prev.
Referenced by _avl_insert_before(), add_interface(), add_link_entry(), ip_prefix_list_add(), olsr_enqueue_rt(), olsr_socket_add(), olsr_spf_add_path_list(), olsr_timer_change(), and olsr_timer_start().

| static INLINE void list_add_head | ( | struct list_entity * | head, | |
| struct list_entity * | new | |||
| ) | [static] |
adds a node at the beginning of a list
| head | pointer to list head | |
| new | node which will be added to the list |
Definition at line 106 of file list.h.
References __list_add(), and list_entity::next.
Referenced by addObampNode4(), and avl_insert().

| static INLINE void list_add_tail | ( | struct list_entity * | head, | |
| struct list_entity * | new | |||
| ) | [static] |
adds a node at the end of a list
| head | pointer to list head | |
| new | node which will be added to the list |
Definition at line 116 of file list.h.
References __list_add(), and list_entity::prev.
Referenced by addObampNode4(), AddObampSniffingIf(), arproaming_list_add(), insert_new_name_in_list(), olsr_callback_cons_register(), olsr_log_addhandler(), olsr_memcookie_add_custom(), olsr_memcookie_free(), olsr_memcookie_malloc(), and olsr_timer_add().

| static INLINE void list_init_head | ( | struct list_entity * | head | ) | [static] |
initialize a list-head
| pointer | to list-head |
Definition at line 73 of file list.h.
References list_entity::next, and list_entity::prev.
Referenced by arproaming_init(), avl_init(), init_interfaces(), InitOBAMP(), ip_acl_init(), list_merge(), name_constructor(), olsr_calculate_routing_table(), olsr_callback_prv_create(), olsr_com_init(), olsr_get_default_cfg(), olsr_init_export_route(), olsr_init_link_set(), olsr_log_init(), olsr_memcookie_add(), olsr_socket_init(), olsr_timer_init(), olsr_timer_walk(), and PreInitOBAMP().
| static INLINE void list_init_node | ( | struct list_entity * | entity | ) | [static] |
initialize a list-node
| pointer | to list-node |
Definition at line 82 of file list.h.
References list_entity::next, and list_entity::prev.
| static INLINE bool list_is_empty | ( | struct list_entity * | head | ) | [static] |
checks if list is empty
| head | pointer to list head |
Definition at line 167 of file list.h.
References list_entity::next, and list_entity::prev.
Referenced by addObampNode4(), build_config_body(), CoreElection(), CreateObampSniffingInterfaces(), DoIHaveATreeLink(), init_interfaces(), list_merge(), lookup_link_status(), manage_hello(), manage_tree_create(), mesh_create(), olsr_calculate_routing_table(), olsr_chg_kernel_routes(), olsr_log(), olsr_memcookie_malloc(), olsr_socket_handle(), olsr_timer_cleanup(), olsr_timer_walk(), olsr_write_cnf_buf(), outer_tree_create(), printObampNodesList(), purge_nodes(), remove_interface(), replace_neighbor_link_set(), select_tree_anchor(), and tree_create().
| static INLINE bool list_is_first | ( | const struct list_entity * | head, | |
| const struct list_entity * | entity | |||
| ) | [static] |
checks if a node is the first element of a list
| head | pointer to list head | |
| entity | pointer to node |
Definition at line 189 of file list.h.
References list_entity::next.
Referenced by avl_find_greaterequal(), and avl_find_lessequal().
| static INLINE bool list_is_last | ( | const struct list_entity * | head, | |
| const struct list_entity * | entity | |||
| ) | [static] |
checks if node is the last element of a list
| head | pointer to list head | |
| entity | pointer to node |
Definition at line 200 of file list.h.
References list_entity::prev.
Referenced by avl_find_greaterequal(), avl_find_lessequal(), avl_insert(), and avl_remove().
| static INLINE void list_merge | ( | struct list_entity * | add_to, | |
| struct list_entity * | remove_from | |||
| ) | [static] |
Merge two lists and clear the second head
| add_to | head of the list which will contain all elements | |
| remove_from | head of the list which elements will be added after the elements of the first one |
Definition at line 211 of file list.h.
References list_init_head(), list_is_empty(), list_entity::next, and list_entity::prev.
Referenced by olsr_timer_walk().

| static INLINE bool list_node_added | ( | struct list_entity * | node | ) | [static] |
checks if node has been added to a list
| node | pointer to node |
Definition at line 178 of file list.h.
References list_entity::next, and list_entity::prev.
Referenced by olsr_enqueue_rt(), olsr_spf_relax(), and unlock_interface().
| static INLINE void list_remove | ( | struct list_entity * | entity | ) | [static] |
removes a node from a list and clears node pointers
| entity | node to remove from the list |
Definition at line 156 of file list.h.
References __list_remove(), list_entity::next, and list_entity::prev.
Referenced by _avl_remove(), arproaming_list_remove(), ip_prefix_list_flush(), ip_prefix_list_remove(), olsr_calculate_routing_table(), olsr_callback_cons_unregister(), olsr_chg_kernel_routes(), olsr_com_cleanup_session(), olsr_delete_link_entry(), olsr_log_removehandler(), olsr_memcookie_add_custom(), olsr_memcookie_free(), olsr_memcookie_malloc(), olsr_memcookie_remove_custom(), olsr_namesvc_delete_db_entry(), olsr_socket_intfree(), olsr_spf_relax(), olsr_timer_change(), olsr_timer_cleanup(), olsr_timer_remove(), olsr_timer_stop(), olsr_timer_walk(), purge_nodes(), and remove_interface().

1.6.3