📄 interface.h
字号:
*\return Returns MSO_S_OK if successful or error code (see above). */MCO_RET mco_nw_attach_replica( mco_db_h db, const char* devname, const mco_connection_param_t * params, const char* replica_name, timer_unit timeout, void * arg);/**\fn MCO_RET mco_nw_attach_master( mco_db_h* db, const char* conn_string, const mco_connection_param_t* params, MCO_E_HA_REPLICA_STOP_REASON* stop_reason, const char* db_name, mco_dictionary_h dict, void* mem_ptr, uint4 total_size, timer_unit timeout, void * arg); * * Description:\n * This function includes connection algotrithm dependent on the type of a communication * channel. It attaches the replica to the connected master. * *\param IN OUT mco_db_h* db - database descriptor pointer. *\param IN const char*conn_string - interconnect dependent connection-string. *\param IN const mco_connection_param_t* params - connection & transaction timeouts. *\param OUT MCO_E_HA_REPLICA_STOP_REASON* stop_reason - the reason why the replica is stopped. *\param IN const char* db_name - database name. *\param IN mco_dictionary_h dict - pointer to database dictionary *\param IN void* mem_ptr - pointer to the memory allocated for database copy *\param IN uint4 total_size - size of allocated memory *\param IN unsigned long timeout - wait-for-connection timeout *\param IN OUT void * arg - user defined argument. In C++ applications it may be * implemented as pointer to the instance of user defined class. * In C application it may be implemented in any way. * *\return * Returns MSO_S_OK if successful or error code (see above). */MCO_RET mco_nw_attach_master( /* IN OUT */ mco_db_h* db, const char* conn_string, const mco_connection_param_t* params, MCO_E_HA_REPLICA_STOP_REASON* stop_reason, const char* db_name, mco_dictionary_h dict, void* mem_ptr, uint4 total_size, timer_unit timeout, void * arg);/**\fn MCO_RET mco_nw_close (void * arg); * * Description:\n * If called by the replica the function closes the communication channel. * if called by the master then disconnects all replicas * connected to the master and closes all master/replica communication channels * *\param IN OUT void * arg - user defined argument. In C++ applications it may be * implemented as pointer to the instance of user defined class. * In C application it may be implemented in any way. * *\return * Returns MSO_S_OK if successful or error code (see above). */MCO_RET mco_nw_close (void * arg);/** **********************************************************************\n * Transport layer. Used by an application for providing of communication \n * channels, guaranteed data transfer. Can be used by an application for \n * the implementation of it's own communications channels. \n * Some details of a communication channel are accessible to application \n *************************************************************************\n * *\fn MCO_RET nw_init( nw_channel_h chan); * * Description:\n * Initializes the network protocol & base channel descriptor. * The base channel is the main channel descriptor used by server for accepting * client's connections requests. The descriptor of base channel MAY contain * extention including common properties of the transport layer. * *\param IN nw_channel_h chan - pointer to the base channel descriptor. * *\return * Returns MSO_S_OK if successful or error code (see above). */MCO_RET nw_init( nw_channel_h chan);/** **********************************************************************\n *\fn MCO_RET nw_listen( nw_channel_h chan, const char * nw_dev); * * Description:\n * Sets the IO channel to the listener state. * *\param IN nw_channel_h chan - pointer to a channel descriptor. *\param IN const char * nw_dev - listener channel name * *\return * Returns MSO_S_OK if successful or error code (see above). */MCO_RET nw_listen( nw_channel_h chan, const char * nw_dev);/** **********************************************************************\n *\fn MCO_RET nw_accept( nw_channel_h chan, nw_channel_h ioch, timer_unit timeout); * * Description:\n * Waits for the connection of a remote host to the IO channel. * *\param IN nw_channel_h chan - pointer to the listener channel. *\param IN OUT nw_channel_h ioch - pointer to the IO channel waiting for connection. *\param IN timeout - wait-for-connect timeout. * *\return * Returns MSO_S_OK if successful or error code (see above). */MCO_RET nw_accept( nw_channel_h chan, nw_channel_h ioch, timer_unit timeout);/** ***********************************************************************\n *\fn MCO_RET nw_connect( nw_channel_h chan, const char* connect_string, timer_unit timeout); * * Description:\n * Connects IO channel to the remote host by it's name. * *\param IN nw_channel_h chan - pointer to a channel descriptor *\param IN const char connect_string - interconnect dependent connection-string *\param IN timer_unit timeout - connection timeout * *\return * Returns MSO_S_OK if successful or error code (see above). */MCO_RET nw_connect( nw_channel_h chan, const char* connect_string, timer_unit timeout);/** ***********************************************************************\n *\fn MCO_RET nw_send ( nw_channel_h chan, char* buffer, int2 buflen, timer_unit timeout); * * Description:\n * Low level data transfer. * Sends a block of data to the communication channel * *\param IN nw_channel_h chan - pointer to a channel descriptor. *\param IN char* buffer - buffer to send. *\param IN int2 buflen - buffer length,is cut to 32767 bytes. *\param IN timer_unit timeout - send timeout in milliseconds. It is media dependent * & application dependent. Application MUST set this * parameter considering the media rate & it's own needs. * *\return * Returns MSO_S_OK if successful or error code (see above). */MCO_RET nw_send( nw_channel_h chan, char* buffer, int2 buflen, timer_unit timeout);/** **********************************************************************\n *\fn MCO_RET nw_recv ( nw_channel_h chan, char* buffer, int2 buflen, int2* recvlen, timer_unit timeout); * * Description: * Low level data transfer. * Receives block of data from the communication channel * *\param IN nw_channel_h chan - pointer to a channel descriptor. *\param OUT char* buffer - buffer to receive. *\param IN int2 buflen - buffer length limit, is cut to 32767 bytes. *\param OUT int2* recvlen, - actual received length, is cut to 32767 bytes. *\param IN timer_unit timeout - receive timeout in milliseconds. It is media dependent * & application dependet. Application MUST set this parameter * considering the media rate & it's own needs *\return * Returns MSO_S_OK if successful or error code (see above). */MCO_RET nw_recv ( nw_channel_h chan, char* buffer, int2 buflen, int2* recvlen, timer_unit timeout);/** **********************************************************************\n *\fn MCO_RET nw_close (nw_channel_h ch); * * Description:\n * Closes the communication channel * *\param IN nw_channel_h ch - pointer to a channel descriptor. * *\return * Returns MSO_S_OK if successful or error code (see above). */MCO_RET nw_close (nw_channel_h ch);/** **********************************************************************\n *\fn void nw_cancel(nw_channel_h chan); * * Cancels the communication channel * *\param IN nw_channel_h ch - pointer to a channel descriptor. * */void nw_cancel(nw_channel_h chan);/************************************************************************** * * Set "listen for cancel point connection" state * * IN nw_channel_h ch - pointer to a channel descriptor. * IN const char * nw_dev - Listener channel name * * Description: * Sets the IO channel to the listener state. * * Returns MSO_S_OK if successful or error code (see above). */MCO_RET nw_listen_cancel_point( nw_channel_h ch );/*************************************************************************** * * Accept the cancel point connection * * IN nw_channel_h chan - pointer to the listener channel. * IN char * port - pointer to "port number" string * IN timer_unit timeout - timeout in milliseconds (reserved). * * Description: * Waits for the connection of a remote host to the IO channel. * * Returns MSO_S_OK if successful or error code (see above). */MCO_RET nw_accept_cancel_point( nw_channel_h chan, char * port, timer_unit timeout );/*************************************************************************** * * Connect to cancel point * * IN nw_channel_h chan - pointer to a channel descriptor * IN const char connect_string - interconnect dependent connection-string * IN timer_unit timeout - timeout in milliseconds (reserved). * * Description: * Connects IO channel to the remote host by it's name. * * Returns MSO_S_OK if successful or error code (see above). */MCO_RET nw_connect_cancel_point( nw_channel_h chan, const char * connect_string, timer_unit timeout );#ifdef __cplusplus }#endif#endif //_APPNW_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -