⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 haqmsg.h

📁 extremeDB s sample code,useful for you
💻 H
字号:
/******************************************************************* *                                                                 * *  This file is a part of the eXtremeDB-HA Application Framework  * *  Copyright (c) 2001-2006 McObject LLC                           * *  All Rights Reserved                                            * *                                                                 * *******************************************************************//* * ++ * * PROJECT:   eXtremeDB(tm) (c) 2003 McObject LLC * * SUBSYSTEM: HA support * * MODULE:    haQMSG.h * * ABSTRACT:  definitions of channel-over-QNX-messaging * * * VERSION:   1.0 * * HISTORY: *            1.0- 1 SS     5-Sep-2003 Created it was * * -- */#ifndef	_QNXM_H_#define	_QNXM_H_#ifdef CFG_QNXMSG_CHANNEL#ifdef _QNX#ifdef __cplusplus  extern "C" {#endif#include "platform.h"#include "mco.h"#include "mcoHA.h"/* change this as you please *//**********************************************************************        definitions of HA endpoints **********************************************************************//* * ATTENTION! In this version of haframework the last 2 symbols of master's * logical name (port number for TCP and UDP or pipename for pipes) MUST ALWAYS BE * "00". These symbols indicate the HA instance of master and are to be replaced * by the index of current HA instance. *//* * Connection parameters for QNX messaging */#define CHANNEL_NAME "QNX messaging"#define nw_MasterName       "/dev/name/HaTest00"            // for MASTER HA instance//#define nw_ConnectionString "/dev/name/HaTest00"           // for REPLICA//#define nw_ConnectionString "/net/sem1/dev/name/HaTest00"//#define nw_ConnectionString "/net/semanin/dev/name/HaTest00"/**********************************************************************        definitions of HA timeouts **********************************************************************//*  Master/replica timeouts. These parameters *  are passed to the mco_HA_attach_replica() & mco_HA_attach_master() */#define TM_ATTACH_REPLICA     1000*5  // time to establish initial connection and the initial                                      // databases synchronization#define TM_DETACH_REPLICA     1000*5  // time to disconnect a replica from the master#define TM_MASTER_COMMIT      1000*5  // total commit time (master)#define TM_REPLICA_COMMIT     1000*5  // total database update time at the replica side                                      // "replica commit"#define TM_WAIT_FOR_DATA      1000*5  // amount of time a replica waits for the next transaction#define TM_SYNCH	      1000*10 /**< amount of time a replica waits for the synchronization					 of the 2-nd phase of commit *///#define RECONNECTION_DELAY    3000#define TM_CONNECTION_TIMEOUT 1000*10#define TM_ACCEPT_TIMEOUT     1000*10#define TM_INFINITE       -1 /**< also used if the parameter is irrelevant *//* local TCP address:port for the cancel point */#define	CANCELPOINT_ADDR	"127.0.0.1:9990" // for replica#define	CANCELPOINT_PORT	"9990"           // for master/*************************************************************************** *                Definitions of channel-over-QNX-messaging                *  ***************************************************************************/#include <sys/iofunc.h>#include <sys/dispatch.h>#define NW_MAX_NAMELENGTH 64            // max length of base pipe name#define NW_FULL_NAMELENGTH NW_MAX_NAMELENGTH+16 // length of full pipe name#define TM_CONN_MASTER    1000*1000#define MAX_DATALENGTH 	     32767#pragma pack(1)#define MAGIC  	             'HA'#define REPEAT_COUNT         3#define MSG_BUFFER_SIZE      2048#define MAX_CHANNELS         8#define TIME_SLICE           100#define TIME_INFINITE        0x7fffffffenum MsgFrameTypes {  FT_CONNECT    = 0x2000,  FT_ACCEPT,  FT_SEND,  FT_RECV,};enum MsgStatusFlags  {  NWST_RECV_PENDED = 0x2,  NWST_SEND_PENDED = 0x4,  NWST_RECV        = 0x8,  NWST_SEND        = 0x10,};typedef struct _master_ {  mco_db_h    db;  PSTR        devname;  mco_connection_param_t * params;  PSTR        replica_name;  DWORD       timeout;}master_t, *master_h;typedef struct _msg_header_ {  WORD          type;             // message type;  WORD          subtype;          // message subtype(reserved for pulses);  WORD          magic;            // data for checking integrity of a header  WORD          id;               // channel id;  WORD			    length;  // length of data field of a frame}msg_header_t, *msg_header_h;typedef struct _msg_buf_ {  msg_header_t   hd;                       // frame header  BYTE           buffer[MSG_BUFFER_SIZE];  // data buffer}msg_buf_t, *msg_buf_h;/* * internal channel-over-QNX-msg messages * connect message */typedef struct _conn_msg_ {  msg_header_t   hd;                       // frame header}conn_msg_t, *conn_msg_h;typedef struct nw_channel_  {    mco_channel_t   mco_channel;    uint2            status;             // channel status    PVOID           db;                 // database handle    uint2            index;              // channel index    BYTE            name[NW_MAX_NAMELENGTH];    long            snd_id;             // sender identifier    long            rcv_id;             // receiver identifier    long            fd;                 // named channel handle    long            timeout;		// send-receive timeout    PVOID           send_buf;           // pointer to pended data-to-receive    msg_buf_h       pMsg;               // pointer to a message buffer    PBYTE           pBuffer;            // current pointer to data buffer    uint2            currlen;            // current buffer length} nw_channel_t, *nw_channel_h;#pragma pack()#ifdef __cplusplus}#endif#endif /* _QNX */#endif  //CFG_QNXMSG_CHANNEL#endif	//_QNXM_H_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -