00001
00986 #ifndef NMXP_H
00987 #define NMXP_H 1
00988
00989 #include "nmxp_base.h"
00990 #include "nmxp_crc32.h"
00991 #include "nmxp_memory.h"
00992
00993 #define NMXP_MAX_MSCHAN_MSEC 15000
00994
00996 typedef enum {
00997 NMXP_BUFFER_NO = 0,
00998 NMXP_BUFFER_YES = 1
00999 } NMXP_BUFFER_FLAG;
01000
01001
01003 typedef struct {
01004 char username[12];
01005 int32_t version;
01006 int32_t connection_time;
01007 int32_t crc32;
01008 } NMXP_CONNECT_REQUEST;
01009
01011 typedef struct {
01012 int32_t chan_key;
01013 int32_t start_time;
01014 int32_t end_time;
01015 } NMXP_DATA_REQUEST;
01016
01017 #define NMXP_MAX_FUNC_PD 10
01018 #define TIME_TOLLERANCE 0.001
01019
01020 typedef struct {
01021 int32_t last_seq_no_sent;
01022 double last_sample_time;
01023 double last_latency;
01024 int32_t max_pdlist_items;
01025 double max_tolerable_latency;
01026 int timeoutrecv;
01027 int32_t n_pdlist;
01028 NMXP_DATA_PROCESS **pdlist;
01029 } NMXP_RAW_STREAM_DATA;
01030
01031
01040 int nmxp_sendConnect(int isock);
01041
01042
01053 int nmxp_sendTerminateSubscription(int isock, NMXP_SHUTDOWN_REASON reason, char *message);
01054
01055
01065 int nmxp_receiveChannelList(int isock, NMXP_CHAN_LIST **pchannelList);
01066
01067
01086 int nmxp_sendAddTimeSeriesChannel(int isock, NMXP_CHAN_LIST_NET *channelList, int32_t shortTermCompletion, int32_t out_format, NMXP_BUFFER_FLAG buffer_flag, int n_channel, int n_usec, int flag_restart);
01087
01088
01101 NMXP_DATA_PROCESS *nmxp_receiveData(int isock, NMXP_CHAN_LIST_NET *channelList, const char *network_code, int timeoutsec, int *recv_errno );
01102
01103
01115 int nmxp_sendConnectRequest(int isock, char *naqs_username, char *naqs_password, int32_t connection_time);
01116
01117
01127 int nmxp_readConnectionTime(int isock, int32_t *connection_time);
01128
01129
01138 int nmxp_waitReady(int isock);
01139
01140
01152 int nmxp_sendDataRequest(int isock, int32_t key, int32_t start_time, int32_t end_time);
01153
01154
01166 NMXP_CHAN_LIST *nmxp_getAvailableChannelList(char * hostname, int portnum, NMXP_DATATYPE datatype, int (*func_cond)(void));
01167
01168
01184 NMXP_META_CHAN_LIST *nmxp_getMetaChannelList(char * hostname, int portnum, NMXP_DATATYPE datatype, int flag_request_channelinfo, char *datas_username, char *datas_password, NMXP_CHAN_LIST **pchannelList, int (*func_cond)(void));
01185
01186
01192 int nmxp_raw_stream_seq_no_compare(const void *a, const void *b);
01193
01194
01202 void nmxp_raw_stream_init(NMXP_RAW_STREAM_DATA *raw_stream_buffer, int32_t max_tolerable_latency, int timeoutrecv);
01203
01204
01210 void nmxp_raw_stream_free(NMXP_RAW_STREAM_DATA *raw_stream_buffer);
01211
01212
01221 int nmxp_raw_stream_manage(NMXP_RAW_STREAM_DATA *p, NMXP_DATA_PROCESS *a_pd, int (*p_func_pd[NMXP_MAX_FUNC_PD]) (NMXP_DATA_PROCESS *), int n_func_pd);
01222
01230 int nmxp_raw_stream_manage_flush(NMXP_RAW_STREAM_DATA *p, int (*p_func_pd[NMXP_MAX_FUNC_PD]) (NMXP_DATA_PROCESS *), int n_func_pd);
01231
01232 #endif
01233