00001 /* 00002 ** async_action.h for lseos in /home/anoman/work/lse/lseos/lseos-srv/net/inet 00003 ** 00004 ** Copyright (c)2004 Arthur Kopatsy 00005 ** Login <kopats_a@epita.fr> 00006 ** 00007 ** Started on Mon Nov 29 09:54:51 2004 Arthur Kopatsy 00008 ** Last update Mon Dec 13 11:02:34 2004 Arthur Kopatsy 00009 */ 00010 00011 #ifndef ASYNC_ACTION_H_ 00012 #define ASYNC_ACTION_H_ 00013 00014 typedef void (*t_ar_fn)(struct s_async_report *ar); 00015 00016 struct s_async_report 00017 { 00018 TAILQ_ENTRY(s_async_report) ar_next; 00019 int64_t ar_id; 00020 int ar_success; /* Value returned on success */ 00021 void *ar_data; /* Data for report function */ 00022 int ar_code; 00023 t_ar_fn ar_report; 00024 }; 00025 00026 TAILQ_HEAD(s_ar_tailq, s_async_report); 00027 00028 /* 00029 ** Add here async action type 00030 */ 00031 00032 #define AA_ETHERNET_INPUT 0 00033 #define AA_ETHERNET_OUTPUT 1 00034 #define AA_IP_INPUT 2 00035 #define AA_IP_OUTPUT 3 00036 #define AA_UDP_SEND 4 00037 #define AA_UDP_CLOSE 5 00038 #define AA_ICMP_SEND 6 00039 #define AA_TCP_SEND 7 00040 #define AA_TCP_CONNECT 8 00041 #define AA_TCP_CLOSE 9 00042 #define AA_TCP_ACK 10 00043 #define AA_TCP_ACCEPT 11 00044 00045 typedef int (*t_aa_fn)(void **aa_data); 00046 00047 struct s_aa_type 00048 { 00049 int aa_type; 00050 t_aa_fn aa_fn; 00051 }; 00052 00053 struct s_async_action 00054 { 00055 TAILQ_ENTRY(s_async_action) aa_next; 00056 int64_t aa_ar; /* Id of the corresponding async report */ 00057 int aa_type; 00058 void *aa_data; 00059 }; 00060 00061 TAILQ_HEAD(s_aa_tailq, s_async_action); 00062 00063 /* PROTO async_action.c */ 00064 #ifdef __INET__ 00065 /* async_action.c */ 00066 int64_t async_report_add(int ar_success, t_ar_fn ar_report, void *ar_data); 00067 struct s_async_report *async_report_find(int64_t ar_id); 00068 void async_report_remove(int64_t ar_id); 00069 void async_report(int64_t ar_id, int ar_code); 00070 #endif /* __INET__ */ 00071 #endif