Main Page | Class List | File List | Class Members | File Members

misc.h File Reference

Go to the source code of this file.

Defines

#define _MISC_H   1
#define UNREACHABLE   0
#define DPRINT   if(DEBUG) printf
#define IPRINT   printf
#define EPRINT   eprintf

Functions

void eprintf (const char *template,...)
void * xmalloc (size_t size)
void xfree (void *x)
void mutex_lock (char *caller, pthread_mutex_t *mut)
void mutex_unlock (char *caller, pthread_mutex_t *mut)
long get_uclock ()
long get_mclock ()
void safe_exit (int val)
unsigned ceil_div (unsigned a, unsigned b)


Define Documentation

#define _MISC_H   1
 

Definition at line 6 of file misc.h.

#define DPRINT   if(DEBUG) printf
 

Definition at line 10 of file misc.h.

Referenced by alloc_tcp_cb(), alloc_tcp_queue(), check_dealloc_tcp_queue(), cleanup_timer(), clear_tcp_queue(), close_tcp_queue(), dealloc_tcp_cb(), handle_packet(), handle_tcp(), left_timer(), main(), mh_ack_rcvd(), packet_timeout(), queue_hipri(), queue_lowpri(), queue_packet(), queue_tcp(), scheduler(), send_packet(), send_tcp_rst(), signal_handler(), tcp_timeout(), tcp_timer(), tcps_close_wait(), tcps_closing(), tcps_established(), tcps_fin_wait1(), tcps_fin_wait2(), tcps_last_ack(), tcps_new(), tcps_syn_recv(), tcps_syn_sent(), and tcps_time_wait().

#define EPRINT   eprintf
 

Definition at line 12 of file misc.h.

Referenced by cleanup(), handle_packet(), init_sched(), main(), mutex_lock(), mutex_unlock(), scheduler(), send_packet(), signal_handler(), tcp_timeout(), tcp_timer(), tcps_closed(), tcps_err(), xfree(), and xmalloc().

#define IPRINT   printf
 

Definition at line 11 of file misc.h.

Referenced by cleanup(), and handle_packet().

#define UNREACHABLE   0
 

Definition at line 8 of file misc.h.

Referenced by queue_hipri(), queue_lowpri(), queue_tcp(), tcps_closed(), and tcps_err().


Function Documentation

unsigned ceil_div unsigned  a,
unsigned  b
[inline]
 

Definition at line 137 of file misc.c.

void eprintf const char *  template,
  ...
[inline]
 

Definition at line 19 of file misc.c.

long get_mclock  )  [inline]
 

Definition at line 105 of file misc.c.

Referenced by add_tcp_sent(), add_timer(), clear_timer(), and tcp_timer().

long get_uclock  )  [inline]
 

Definition at line 93 of file misc.c.

void mutex_lock char *  caller,
pthread_mutex_t *  mut
[inline]
 

Definition at line 65 of file misc.c.

References EPRINT, EXIT_ERR_MUTEX, and safe_exit().

Referenced by add_timer(), alloc_tcp_queue(), clear_timer(), close_tcp_queue(), handle_tcp(), left_timer(), mh_ack_rcvd(), packet_timeout(), queue_packet(), reset_tcp_queue(), scheduler(), tcp_timeout(), and tcp_timer().

void mutex_unlock char *  caller,
pthread_mutex_t *  mut
[inline]
 

Definition at line 79 of file misc.c.

References EPRINT, EXIT_ERR_MUTEX, and safe_exit().

Referenced by add_timer(), alloc_tcp_queue(), clear_timer(), close_tcp_queue(), handle_tcp(), left_timer(), mh_ack_rcvd(), packet_timeout(), queue_packet(), reset_tcp_queue(), scheduler(), tcp_timeout(), and tcp_timer().

void safe_exit int  val  ) 
 

Definition at line 119 of file misc.c.

References main_thread, and request_exit.

Referenced by init_sched(), mutex_lock(), mutex_unlock(), xfree(), and xmalloc().

void xfree void *  x  )  [inline]
 

Definition at line 49 of file misc.c.

References EPRINT, EXIT_ERR_MEM_FREE, and safe_exit().

Referenced by cleanup_sched(), cleanup_timer(), clear_tcp_queue(), clear_timer(), dealloc_packet_data(), mh_ack_rcvd(), packet_timeout(), send_tcp_rst(), and tcp_timer().

void* xmalloc size_t  size  )  [inline]
 

Definition at line 32 of file misc.c.

References EPRINT, EXIT_ERR_MEM_ALLOC, and safe_exit().

Referenced by add_tcp_sent(), add_timer(), alloc_packet_data(), init_sched(), and send_tcp_rst().


Generated on Sun May 14 13:36:52 2006 by  doxygen 1.4.2