Commit 8682f6c5 authored by Matteo Quintiliani's avatar Matteo Quintiliani
Browse files

Added network code for channel specification


git-svn-id: file:///home/quintiliani/svncopy/nmxptool/trunk@420 3cd66e75-5955-46cb-a940-c26e5fc5497d
parent 7891ee19
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -19,9 +19,10 @@ nmxpport 28000 # Port number of the NaqsServer server

MaxTolerableLatency 120

NetworkCode	XX
DefaultNetworkCode	IV

Channel		BOB.HH?
Channel		ES.BOB.HH?
Channel		MN.TIR.HH?
Channel		MDI.HH?
Channel		DOI.HH?
Channel		SALO.HH?
+3 −3
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
 * 	Istituto Nazionale di Geofisica e Vulcanologia - Italy
 *	quintiliani@ingv.it
 *
 * $Id: nmxp.h,v 1.38 2007-10-03 13:38:27 mtheo Exp $
 * $Id: nmxp.h,v 1.39 2007-10-07 14:11:23 mtheo Exp $
 *
 */

@@ -1123,7 +1123,7 @@ int nmxp_receiveChannelList(int isock, NMXP_CHAN_LIST **pchannelList);
 * \retval SOCKET_ERROR on error
 * 
 */
int nmxp_sendAddTimeSeriesChannel(int isock, NMXP_CHAN_LIST *channelList, int32_t shortTermCompletion, int32_t out_format, NMXP_BUFFER_FLAG buffer_flag);
int nmxp_sendAddTimeSeriesChannel(int isock, NMXP_CHAN_LIST_NET *channelList, int32_t shortTermCompletion, int32_t out_format, NMXP_BUFFER_FLAG buffer_flag);


/*! \brief Receive Compressed or Decompressed Data message from a socket and launch func_processData() on the extracted data
@@ -1136,7 +1136,7 @@ int nmxp_sendAddTimeSeriesChannel(int isock, NMXP_CHAN_LIST *channelList, int32_
 * \retval NULL on error
 * 
 */
NMXP_DATA_PROCESS *nmxp_receiveData(int isock, NMXP_CHAN_LIST *channelList, const char *network_code);
NMXP_DATA_PROCESS *nmxp_receiveData(int isock, NMXP_CHAN_LIST_NET *channelList, const char *network_code);


/*! \brief Sends the message "ConnectRequest" on a socket
+3 −3
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
 * 	Istituto Nazionale di Geofisica e Vulcanologia - Italy
 *	quintiliani@ingv.it
 *
 * $Id: nmxp_base.h,v 1.22 2007-09-11 14:06:12 mtheo Exp $
 * $Id: nmxp_base.h,v 1.23 2007-10-07 14:11:23 mtheo Exp $
 *
 */

@@ -145,7 +145,7 @@ int nmxp_receiveMessage(int isock, NMXP_MSG_SERVER *type, void **buffer, int32_t
 * \return Return a pointer to static struct NMXP_DATA_PROCESS.
 *
 */
NMXP_DATA_PROCESS *nmxp_processCompressedData(char* buffer_data, int length_data, NMXP_CHAN_LIST *channelList, const char *network_code);
NMXP_DATA_PROCESS *nmxp_processCompressedData(char* buffer_data, int length_data, NMXP_CHAN_LIST_NET *channelList, const char *network_code);


/*! \brief Process decompressed Data message by function func_processData().
@@ -158,7 +158,7 @@ NMXP_DATA_PROCESS *nmxp_processCompressedData(char* buffer_data, int length_data
 * \return Return a pointer to static struct NMXP_DATA_PROCESS.
 *
 */
NMXP_DATA_PROCESS *nmxp_processDecompressedData(char* buffer_data, int length_data, NMXP_CHAN_LIST *channelList, const char *network_code);
NMXP_DATA_PROCESS *nmxp_processDecompressedData(char* buffer_data, int length_data, NMXP_CHAN_LIST_NET *channelList, const char *network_code);

#endif
+28 −14
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
 * 	Istituto Nazionale di Geofisica e Vulcanologia - Italy
 *	quintiliani@ingv.it
 *
 * $Id: nmxp_chan.h,v 1.20 2007-09-07 07:08:30 mtheo Exp $
 * $Id: nmxp_chan.h,v 1.21 2007-10-07 14:11:23 mtheo Exp $
 *
 */

@@ -34,15 +34,27 @@ typedef enum {
} NMXP_META_CHAN_LIST_SORT_TYPE;


/*! \brief Max number of channels */
#define MAX_N_CHAN 2000

/*! \brief The key/name info for one channel */
typedef struct {
    int32_t key;
    char name[24];
} NMXP_CHAN_KEY_NET;

/*! \brief Channel list */
typedef struct {
    int32_t number;
    NMXP_CHAN_KEY_NET channel[MAX_N_CHAN];
} NMXP_CHAN_LIST_NET;

/*! \brief The key/name info for one channel */
typedef struct {
    int32_t key;
    char name[12];
} NMXP_CHAN_KEY;

/*! \brief Max number of channels */
#define MAX_N_CHAN 1000

/*! \brief Channel list */
typedef struct {
    int32_t number;
@@ -105,9 +117,10 @@ typedef struct {

/*! \brief Copy station code and channel code from name
 *
 * \param station_dot_channel string containing STA.CHAN
 * \param net_dot_station_dot_channel string containing NET.STA.CHAN where NET. is optional
 * \param[out] station_code Pointer to string for station code
 * \param[out] channel_code Pointer to string for char code
 * \param[out] channel_code Pointer to string for channel code
 * \param[out] network_code Pointer to string for station code
 *
 * \warning Parametes can not be NULL!
 *
@@ -115,13 +128,13 @@ typedef struct {
 * \retval 0 on error
 *
 */
int nmxp_chan_cpy_sta_chan(const char *station_dot_channel, char *station_code, char *channel_code);
int nmxp_chan_cpy_sta_chan(const char *net_dot_station_dot_channel, char *station_code, char *channel_code, char *network_code);


/*! \brief Match station_dot_channel against pattern, treating errors as no match.
 *
 * \param station_dot_channel STA.CHAN format
 * \param pattern STA.?HZ or STA.H?Z or STA.HH? or STA.?H? or ....
 * \param net_dot_station_dot_channel NET.STA.CHAN format (NET. is optional)
 * \param pattern N1.STA.?HZ or N2.STA.H?Z or STA.HH? or STA.?H? or ....
 *
 * \retval 1 for match
 * \retval 0 for no match
@@ -129,7 +142,7 @@ int nmxp_chan_cpy_sta_chan(const char *station_dot_channel, char *station_code,
 * \retval -2 on error for invalid station_dot_channel
 *
 */
int nmxp_chan_match(const char *station_dot_channel, char *pattern);
int nmxp_chan_match(const char *net_dot_station_dot_channel, char *pattern);



@@ -152,7 +165,7 @@ int nmxp_chan_lookupKey(char* name, NMXP_CHAN_LIST *channelList);
 * \return Index of channel with key. -1 on error.
 *
 */
int nmxp_chan_lookupKeyIndex(int32_t key, NMXP_CHAN_LIST *channelList);
int nmxp_chan_lookupKeyIndex(int32_t key, NMXP_CHAN_LIST_NET *channelList);


/*! \brief Looks up a channel name in the list using a key
@@ -163,7 +176,7 @@ int nmxp_chan_lookupKeyIndex(int32_t key, NMXP_CHAN_LIST *channelList);
 * \return Name of channel with key. NULL on error.
 *
 */
char *nmxp_chan_lookupName(int32_t key, NMXP_CHAN_LIST *channelList);
char *nmxp_chan_lookupName(int32_t key, NMXP_CHAN_LIST_NET *channelList);


/*! \brief Looks up a channel with specified data type.
@@ -184,13 +197,14 @@ NMXP_CHAN_LIST *nmxp_chan_getType(NMXP_CHAN_LIST *channelList, NMXP_DATATYPE dat
 * \param channelList Channel list.
 * \param dataType Type of channel.
 * \param sta_chan_list String list of item STA.CHAN, separeted by comma.
 * \param network_code_default Default Network code
 *
 * \return Channel list with specified dataType. It will need to be freed!
 *
 * \warning Returned value will need to be freed!
 *
 */
NMXP_CHAN_LIST *nmxp_chan_subset(NMXP_CHAN_LIST *channelList, NMXP_DATATYPE dataType, char *sta_chan_list);
NMXP_CHAN_LIST_NET *nmxp_chan_subset(NMXP_CHAN_LIST *channelList, NMXP_DATATYPE dataType, char *sta_chan_list, const char *network_code_default);


/*! Sort list by channel key
@@ -214,7 +228,7 @@ void nmxp_chan_sortByName(NMXP_CHAN_LIST *channelList);
 * \param channelList Channel List
 *
 */
void nmxp_chan_print_channelList(NMXP_CHAN_LIST *channelList);
void nmxp_chan_print_channelList(NMXP_CHAN_LIST_NET *channelList);


void nmxp_meta_chan_free(NMXP_META_CHAN_LIST **chan_list);
+3 −3
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
 * 	Istituto Nazionale di Geofisica e Vulcanologia - Italy
 *	quintiliani@ingv.it
 *
 * $Id: nmxp.c,v 1.48 2007-10-04 20:34:30 mtheo Exp $
 * $Id: nmxp.c,v 1.49 2007-10-07 14:11:23 mtheo Exp $
 *
 */

@@ -61,7 +61,7 @@ int nmxp_receiveChannelList(int isock, NMXP_CHAN_LIST **pchannelList) {
}


int nmxp_sendAddTimeSeriesChannel(int isock, NMXP_CHAN_LIST *channelList, int32_t shortTermCompletion, int32_t out_format, NMXP_BUFFER_FLAG buffer_flag) {
int nmxp_sendAddTimeSeriesChannel(int isock, NMXP_CHAN_LIST_NET *channelList, int32_t shortTermCompletion, int32_t out_format, NMXP_BUFFER_FLAG buffer_flag) {
    int ret;
    int32_t buffer_length = 16 + (4 * channelList->number); 
    char *buffer = malloc(buffer_length);
@@ -100,7 +100,7 @@ int nmxp_sendAddTimeSeriesChannel(int isock, NMXP_CHAN_LIST *channelList, int32_
}


NMXP_DATA_PROCESS *nmxp_receiveData(int isock, NMXP_CHAN_LIST *channelList, const char *network_code) {
NMXP_DATA_PROCESS *nmxp_receiveData(int isock, NMXP_CHAN_LIST_NET *channelList, const char *network_code) {
    NMXP_MSG_SERVER type;
    void *buffer = NULL;
    int32_t length;
Loading