00001 00056 #ifndef __WORKER_H 00057 #define __WORKER_H 00058 00059 #include "peer.h" 00060 #include "diameter.h" 00061 #include "utils.h" 00062 00064 typedef int (*worker_init_function)(int rank); 00065 00067 typedef struct _task_t { 00068 peer *p; 00069 AAAMessage *msg; 00070 } task_t; 00071 00073 typedef struct { 00074 gen_lock_t *lock; 00075 int start; 00076 int end; 00077 int max; 00078 task_t *queue; 00079 int empty; 00080 int full; 00081 } task_queue_t; 00082 00084 typedef int (*cdp_cb_f)(peer *p,AAAMessage *msg,void* ptr); 00085 00087 typedef struct _cdp_cb_t{ 00088 cdp_cb_f cb; 00089 void **ptr; 00090 struct _cdp_cb_t *next; 00091 struct _cdp_cb_t *prev; 00092 } cdp_cb_t; 00093 00095 typedef struct { 00096 cdp_cb_t *head; 00097 cdp_cb_t *tail; 00098 } cdp_cb_list_t; 00099 00100 void worker_init(); 00101 void worker_destroy(); 00102 00103 int cb_add(cdp_cb_f cb,void *ptr); 00104 void cb_remove(cdp_cb_t *cb); 00105 00106 int put_task(peer *p,AAAMessage *msg); 00107 task_t take_task(); 00108 00109 00110 void worker_poison_queue(); 00111 00112 void worker_process(int id); 00113 00114 00115 00116 #endif 00117
1.5.2