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
01002 #define NMXP_MAX_SIZE_USERNAME 12
01003
01005 typedef struct {
01006 char username[NMXP_MAX_SIZE_USERNAME];
01007 int32_t version;
01008 int32_t connection_time;
01009 int32_t crc32;
01010 } NMXP_CONNECT_REQUEST;
01011
01013 typedef struct {
01014 int32_t chan_key;
01015 int32_t start_time;
01016 int32_t end_time;
01017 } NMXP_DATA_REQUEST;
01018
01019 #define NMXP_MAX_FUNC_PD 10
01020 #define TIME_TOLLERANCE 0.001
01021
01022 typedef struct {
01023 int32_t last_seq_no_sent;
01024 double last_sample_time;
01025 double last_latency;
01026 int32_t max_pdlist_items;
01027 double max_tolerable_latency;
01028 int timeoutrecv;
01029 int32_t n_pdlist;
01030 NMXP_DATA_PROCESS **pdlist;
01031 } NMXP_RAW_STREAM_DATA;
01032
01033
01042 int nmxp_sendConnect(int isock);
01043
01044
01055 int nmxp_sendTerminateSubscription(int isock, NMXP_SHUTDOWN_REASON reason, char *message);
01056
01057
01067 int nmxp_receiveChannelList(int isock, NMXP_CHAN_LIST **pchannelList);
01068
01069
01088 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);
01089
01090
01103 NMXP_DATA_PROCESS *nmxp_receiveData(int isock, NMXP_CHAN_LIST_NET *channelList, const char *network_code, int timeoutsec, int *recv_errno );
01104
01105
01117 int nmxp_sendConnectRequest(int isock, char *naqs_username, char *naqs_password, int32_t connection_time);
01118
01119
01129 int nmxp_readConnectionTime(int isock, int32_t *connection_time);
01130
01131
01140 int nmxp_waitReady(int isock);
01141
01142
01154 int nmxp_sendDataRequest(int isock, int32_t key, int32_t start_time, int32_t end_time);
01155
01156
01169 NMXP_CHAN_LIST *nmxp_getAvailableChannelList(char * hostname, int portnum, NMXP_DATATYPE datatype, int (*func_cond)(void));
01170
01171
01188 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));
01189
01190
01196 int nmxp_raw_stream_seq_no_compare(const void *a, const void *b);
01197
01198
01206 void nmxp_raw_stream_init(NMXP_RAW_STREAM_DATA *raw_stream_buffer, int32_t max_tolerable_latency, int timeoutrecv);
01207
01208
01214 void nmxp_raw_stream_free(NMXP_RAW_STREAM_DATA *raw_stream_buffer);
01215
01216
01225 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);
01226
01234 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);
01235
01236 #endif
01237