00001 #ifndef I_ASINTF_H
00002 #define I_ASINTF_H
00003
00004 #ifdef __cplusplus
00005 extern "C" {
00006 #endif
00007
00008 #include <string.h>
00009 #include "ix_tools.h"
00010 #include "rsintf.h"
00011 #include "asintf.h"
00012
00014 #define AS_FILTER_MAX 64
00015
00017 #define AS_PROXY_ID 1
00018
00019 typedef enum
00020 {
00021 AS_CONNECT,
00022 AS_DISCONNECT,
00023 AS_SETFILTER
00024 } as_request_e;
00025
00026 #define AS_REQUEST_MAX 8*1024
00027 typedef struct
00028 {
00029 union {
00030 char buffer[AS_REQUEST_MAX];
00031 } request_u;
00032 } as_request_t;
00033
00034
00035
00036 typedef struct
00037 {
00038 int init_f;
00039 ix_thread_t *pt;
00040 ix_cs_t *pmut;
00041 int connected;
00042 int server_connected;
00043 ix_event_t *pev;
00044 rs_reg_t reg;
00045 char *name;
00046 ix_list_t *filter_list;
00047 as_filter_t filter[AS_FILTER_MAX];
00048 int cap_count;
00049 int cap_offset;
00050 as_alarm_t *cap_alarm_buffer;
00051 int alarm_version;
00052 ix_net_t *cap_net_packet;
00053 ix_queue_t *cap_queue;
00054 AS_HOOK_FCT alarm_hook;
00055 ix_cs_t *cap_cs;
00056 } as_data_t;
00057
00058 #define AS_TRIGGER_TIMEOUT 60000 // in ms, timeout for trigger alarmserver
00059 #define AS_RECONNECT_TIMEOUT 5000 // in ms, timeout to re-connect after disconnect
00060
00061
00062 #define AS_MAX_CAPQUEUE 128
00063
00064
00065
00066
00067
00068 int as_request_id_encode( int request_id, unsigned char *buf, int buflen );
00069 int as_request_id_decode(unsigned char *buf, int buflen, int *prequest_id );
00070
00071 int as_request_setfilter_encode( as_filter_t *pfilter, int nfilter, unsigned char *buf, int buflen );
00072 int as_request_setfilter_decode( unsigned char *buf, int buflen, as_filter_t *preq, int *nfilter );
00073
00074 int as_reply_status_encode( int status, unsigned char *buf, int buflen );
00075 int as_reply_status_decode( unsigned char *buf, int buflen, int *pstatus );
00076
00077
00078
00079
00080 typedef int (*FILTER_FREE_FCT)(as_filter_t *pfilter);
00081 ix_list_t *as_filter_list_new( int len );
00082 void as_filter_list_free( ix_list_t *pfilter_list, FILTER_FREE_FCT fct );
00083 int as_filter_set_to_list( ix_list_t *pfilter_list, as_filter_t *pfilter, int nfilter );
00084 int as_filter_dump( ix_list_t *pfilter_list, as_filter_t *pfilter, int nfilter );
00085
00086 #ifdef __cplusplus
00087 }
00088 #endif
00089
00090 #endif
00091