/home/aaron/olsrd-current/olsrd/src/core/olsr_socket.c File Reference

#include <unistd.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "common/avl.h"
#include "common/avl_comp.h"
#include "olsr_clock.h"
#include "olsr_logging.h"
#include "olsr_memcookie.h"
#include "os_net.h"
#include "olsr_socket.h"
Include dependency graph for olsr_socket.c:

Go to the source code of this file.

Functions

static INLINE void olsr_socket_intfree (struct olsr_socket_entry *sock)
void olsr_socket_init (void)
void olsr_socket_cleanup (void)
struct olsr_socket_entryolsr_socket_add (int fd, socket_handler_func pf_imm, void *data, unsigned int flags)
void olsr_socket_remove (struct olsr_socket_entry *entry)
void olsr_socket_handle (uint32_t until_time)

Variables

struct list_entity socket_head
static struct olsr_memcookie_infosocket_memcookie

Function Documentation

struct olsr_socket_entry* olsr_socket_add ( int  fd,
socket_handler_func  pf_imm,
void *  data,
unsigned int  flags 
) [read]

Add a socket and handler to the socketset beeing used in the main select(2) loop

Parameters:
fd file descriptor for socket
pf_imm processing callback
data custom data
flags OLSR_SOCKET_READ/OLSR_SOCKET_WRITE (or both)
Returns:
pointer to socket_entry

Definition at line 110 of file olsr_socket.c.

References olsr_socket_entry::data, olsr_socket_entry::fd, olsr_socket_entry::flags, list_add_before(), LOG_SCHEDULER, olsr_socket_entry::node, OLSR_DEBUG, olsr_memcookie_malloc(), OLSR_WARN, olsr_socket_entry::process, and socket_head.

Referenced by add_interface(), CreateCaptureSocket(), dotdraw_enable(), olsr_com_init(), olsr_com_parse_request(), olsrd_plugin_init(), rtnetlink_register_socket(), and UdpServer().

Here is the call graph for this function:

void olsr_socket_cleanup ( void   ) 

Cleanup olsr socket scheduler. This will close and free all sockets.

Definition at line 83 of file olsr_socket.c.

References olsr_socket_entry::fd, list_entity::next, OLSR_FOR_ALL_SOCKETS, olsr_memcookie_remove(), olsr_socket_intfree(), os_close(), list_entity::prev, and socket_head.

Referenced by olsr_shutdown().

Here is the call graph for this function:

void olsr_socket_handle ( uint32_t  until_time  ) 

Handle all incoming socket events until a certain time

Parameters:
next_interval 

Definition at line 151 of file olsr_socket.c.

References olsr_socket_entry::data, olsr_socket_entry::fd, flags, olsr_socket_entry::flags, list_is_empty(), LOG_SCHEDULER, MSEC_PER_SEC, olsr_clock_getRelative(), olsr_clock_update(), OLSR_FOR_ALL_SOCKETS, olsr_socket_intfree(), OLSR_SOCKET_READ, OLSR_SOCKET_WRITE, OLSR_WARN, os_select(), olsr_socket_entry::process, socket_head, and USEC_PER_MSEC.

Referenced by main().

Here is the call graph for this function:

void olsr_socket_init ( void   ) 

Initialize olsr socket scheduler

Definition at line 72 of file olsr_socket.c.

References list_init_head(), olsr_memcookie_add(), and socket_head.

Referenced by main().

Here is the call graph for this function:

static INLINE void olsr_socket_intfree ( struct olsr_socket_entry sock  )  [static]

Definition at line 63 of file olsr_socket.c.

References list_remove(), olsr_socket_entry::node, and olsr_memcookie_free().

Referenced by olsr_socket_cleanup(), and olsr_socket_handle().

Here is the call graph for this function:

void olsr_socket_remove ( struct olsr_socket_entry entry  ) 

Remove a socket and handler from the socket scheduler

Parameters:
sock pointer to socket entry

Definition at line 138 of file olsr_socket.c.

References olsr_socket_entry::fd, olsr_socket_entry::flags, LOG_SCHEDULER, OLSR_DEBUG, and olsr_socket_entry::process.

Referenced by olsr_com_cleanup_session(), and remove_interface().


Variable Documentation

Definition at line 59 of file olsr_socket.c.

Generated on Fri May 24 06:00:04 2013 for olsrd by  doxygen 1.6.3