SASC-NG
DVBSoftCAM

list.h File Reference

Go to the source code of this file.

Classes

struct  list_head

Defines

#define LIST_POISON1   ((void *) 0x00100100)
#define LIST_POISON2   ((void *) 0x00200200)
#define LIST_HEAD_INIT(name)   { &(name), &(name), (unsigned int)-1 }
#define LIST_HEAD(name)   struct list_head name = LIST_HEAD_INIT(name)
#define INIT_LIST_HEAD(ptr)
#define list_entry(ptr, type)   ((type *)ptr)
#define list_for_each(pos, head)   for (pos = (head)->next; pos != (head); pos = pos->next)
#define list_for_each_safe(pos, n, head)
#define list_add_l(_var, _ll, _lock)
#define pop_entry_from_queue_l(_var, _ll, _type, _lock)
#define pop_entry_from_queue(_var, _ll, _type)
#define ll_find_elem(elem, lhead, item, value, type)

Functions

static void __list_add (struct list_head *_new, struct list_head *_prev, struct list_head *_next)
static void list_add (struct list_head *_new, struct list_head *_head)
static void list_add_tail (struct list_head *_new, struct list_head *_head)
static void list_add_priority (struct list_head *_new, struct list_head *_head, int priority)
static void __list_del (struct list_head *prev, struct list_head *next)
static void list_del (struct list_head *entry)
static int list_empty (const struct list_head *head)

Define Documentation

#define INIT_LIST_HEAD (   ptr)
Value:
do { \
        (ptr)->next = (ptr); (ptr)->prev = (ptr); (ptr)->priority = (unsigned int)-1;\
} while (0)

Definition at line 22 of file list.h.

Referenced by connect_ffd(), connect_sid(), forward_data(), init_device(), msg_loop_init(), read_pat(), read_pmt(), and start().

#define list_add_l (   _var,
  _ll,
  _lock 
)
Value:
{\
  pthread_mutex_lock(_lock);            \
  list_add(_var, _ll);                  \
  pthread_mutex_unlock(_lock);          \
}

Definition at line 138 of file list.h.

Referenced by close_demux(), free_pat(), free_sidmsg(), read_pat(), and set_demux().

#define list_entry (   ptr,
  type 
)    ((type *)ptr)
#define list_for_each (   pos,
  head 
)    for (pos = (head)->next; pos != (head); pos = pos->next)
#define list_for_each_safe (   pos,
  n,
  head 
)
Value:
for (pos = (head)->next, n = pos->next; pos != (head); \
                pos = n, n = pos->next)

Definition at line 134 of file list.h.

#define LIST_HEAD (   name)    struct list_head name = LIST_HEAD_INIT(name)

Definition at line 19 of file list.h.

#define LIST_HEAD_INIT (   name)    { &(name), &(name), (unsigned int)-1 }

Definition at line 17 of file list.h.

#define LIST_POISON1   ((void *) 0x00100100)

Definition at line 9 of file list.h.

Referenced by list_del().

#define LIST_POISON2   ((void *) 0x00200200)

Definition at line 10 of file list.h.

Referenced by list_del().

#define ll_find_elem (   elem,
  lhead,
  item,
  value,
  type 
)
Value:
{       \
  struct list_head *lptr;                               \
  type *ptr;                                            \
  elem = NULL;                                          \
  list_for_each(lptr, &lhead) {                         \
    ptr = list_entry(lptr, type);                       \
    if(ptr->item == value)                              \
      elem = ptr;                                       \
  }                                                     \
}

Definition at line 164 of file list.h.

#define pop_entry_from_queue (   _var,
  _ll,
  _type 
)
Value:
{\
  if(list_empty(_ll))  {                        \
    _var = (_type *)calloc(1, sizeof(_type));   \
  } else {                                      \
    _var = list_entry((_ll)->next, _type);      \
    list_del(&_var->list);                      \
  }                                             \
}

Definition at line 155 of file list.h.

Referenced by dmxioctl_call(), and process_cam().

#define pop_entry_from_queue_l (   _var,
  _ll,
  _type,
  _lock 
)
Value:
{\
  pthread_mutex_lock(_lock);            \
  if(list_empty(_ll))  {                        \
    _var = (_type *)calloc(1, sizeof(_type));   \
  } else {                                      \
    _var = list_entry((_ll)->next, _type);      \
    list_del(&_var->list);                      \
  }                                             \
  pthread_mutex_unlock(_lock);          \
}

Definition at line 144 of file list.h.

Referenced by read_pat(), read_pmt(), read_sid(), set_demux(), shutdown_sid(), and update_keys().


Function Documentation

static void __list_add ( struct list_head *  _new,
struct list_head *  _prev,
struct list_head *  _next 
) [inline, static]

Definition at line 32 of file list.h.

References list_head::next, and list_head::prev.

Referenced by list_add(), list_add_priority(), and list_add_tail().

{
        _next->prev = _new;
        _new->next = _next;
        _new->prev = _prev;
        _prev->next = _new;
}
static void __list_del ( struct list_head *  prev,
struct list_head *  next 
) [inline, static]

Definition at line 90 of file list.h.

References list_head::next, and list_head::prev.

Referenced by list_del().

{
        next->prev = prev;
        prev->next = next;
}
static void list_add ( struct list_head *  _new,
struct list_head *  _head 
) [inline, static]

list_add - add a new entry : new entry to be added : list head to add it after

Insert a new entry after the specified head. This is good for implementing stacks.

Definition at line 50 of file list.h.

References __list_add(), and list_head::next.

Referenced by __attribute__(), cam_del_pid(), connect_cam(), connect_ffd(), dmxclose_call(), dmxioctl_call(), forward_data(), free_sid(), msg_loop(), msg_remove_type_from_list(), msg_terminate(), process_cam(), read_pat(), read_pmt(), shutdown_sid(), and update_keys().

{
        __list_add(_new, _head, _head->next);
}
static void list_add_priority ( struct list_head *  _new,
struct list_head *  _head,
int  priority 
) [inline, static]

Definition at line 69 of file list.h.

References __list_add(), list_head::next, list_head::prev, and list_head::priority.

Referenced by _attach_callback().

{
        struct list_head *pos = _head;
        _new->priority = priority;
        for (pos = _head->next; pos != _head; pos = pos->next)
          if((unsigned int)priority <= pos->priority) {
            __list_add(_new, pos->prev, pos);
            return;
          }
        __list_add(_new, _head, _head->next);
}
static void list_add_tail ( struct list_head *  _new,
struct list_head *  _head 
) [inline, static]

list_add_tail - add a new entry : new entry to be added : list head to add it before

Insert a new entry before the specified head. This is useful for implementing queues.

Definition at line 63 of file list.h.

References __list_add(), and list_head::prev.

Referenced by __attribute__(), connect_ffd(), connect_rb(), connect_scan(), connect_sid(), msg_add_type_to_list(), msg_loop(), read_pmt(), and set_demux().

{
        __list_add(_new, _head->prev, _head);
}
static void list_del ( struct list_head *  entry) [inline, static]

list_del - deletes entry from list. : the element to delete from the list. Note: list_empty on entry does not return true after this, the entry is in an undefined state.

Definition at line 102 of file list.h.

References __list_del(), LIST_POISON1, LIST_POISON2, list_head::next, and list_head::prev.

Referenced by cam_del_pid(), clear_sid_data(), close_demux(), dmxclose_call(), forward_data(), free_pat(), free_sid(), main(), msg_add_type_to_list(), msg_loop(), msg_remove_type_from_list(), msg_terminate(), read_pat(), read_sid(), set_demux(), and update_keys().

{
        __list_del(entry->prev, entry->next);
        entry->next = (struct list_head *)LIST_POISON1;
        entry->prev = (struct list_head *)LIST_POISON2;
}
static int list_empty ( const struct list_head *  head) [inline, static]

list_empty - tests whether a list is empty : the list to test.

Definition at line 113 of file list.h.

References list_head::next.

Referenced by check_state(), clear_sid_data(), free_pat(), free_sid(), msg_add_type_to_list(), msg_terminate(), process_cam(), read_pat(), read_sid(), start(), and update_keys().

{
        return head->next == head;
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines