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

📄 ipc_glue.h

📁 界面程序
💻 H
字号:
/*************************************************************************

NAME
	ipc_glue.h  -  Rabbit IPC "glue" interface header file

DESCRIPTION
	Contains data structures and #defines needed by applications
	using the ipcPublish() and ipcLearn() calls. 

NOTES
	For unused fields, appropriate initializers should be used.

	See "rabbit_ids.h" for class, type, and instance initializers
	as well as routines to manipulate the RABBIT_ID structure.
	
	See "rabbit.h" for process ID and signal initializers.

	See "semaphore.h" for the semaphore ID initializer.


Copyright 1992 by Rabbit Software Corporation

*************************************************************************/

#ifndef _IPC_GLUE_H_
#define _IPC_GLUE_H_

#ifdef HEADERVERSIONS
static char *_ipc_glue_h = "@(#)ipc_glue.h	1.5 !R2";
#endif /* HEADERVERSIONS */

#include "rabbit_ids.h"
#include "semaphore.h" 
#include "fifo_event.h" 

#define NO_IPCID	-1		/* "no IPC ID" initializer	*/
#define NO_MSG_TYPE	0L		/* "no message type" 		*/

typedef struct				/* IPC message structure	*/
{
    int  	msg_mqid;		/* message queue identifier	*/
    long 	msg_mtype;		/* message queue message type	*/
    DevPath	msg_file;		/* message file name		*/
} IPC_MESSAGE;

typedef struct				/* IPC message data structure	*/
{
    int  	dat_shmid;		/* data shared memory identifier*/
    long 	dat_smoffset;		/* data shared memory offet	*/ 
    int	        dat_segsize;		/* shared memory segment size	*/
    int		dat_mqid;		/* data message queue ID	*/
} IPC_MSGDATA;

typedef struct				/* IPC event structure		*/
{
    int  	evt_signal;		/* signal to be sent		*/ 
    PID		evt_pidsig;		/* process to be signalled	*/
    semaphore 	evt_semid;		/* semaphore to kick		*/ 
    FIFO_EVENT  evt_fifo;		/* FIFO (named pipe) to write to*/
} IPC_EVENT;

typedef struct				/* IPC glue structure		*/
{
    RABBIT_ID	*ipc_publisher;		/* IPC publisher		*/
    RABBIT_ID	*ipc_learner;		/* IPC learner			*/
    IPC_MESSAGE	*ipc_message;		/* IPC message information	*/
    IPC_MSGDATA	*ipc_msgdata;		/* IPC message data information	*/
    IPC_EVENT	*ipc_event;		/* IPC event information	*/
} IPC_GLUE;

/* 
   WARNING: The following data structure is provided for efficiency. It
    	    should never be looked at or dealt with as is. Since its size
   	    is often needed, a #define is provided for this purpose.
*/ 
  
/* The glue structure above is ideal for most situations, except for those 
   where the structure must be treated as one piece (e.g., when writing it and 
   when sending it as part of a message via IPC). The structure below is the 
   "packed" version of the one above which allows it to be treated as one 
   entity. Ideally, this should all be done internally into some opaque byte 
   stream, but data structures which contain glue information need to know 
   what the packed form is so space can be statically allocated for it. With 
   this in mind, the data structure should never actually be looked at. Its 
   size can be taken, or a data structure of this type can be used as an 
   argument to the ipcPackGlue() or ipcUnpackGlue() call.
*/
typedef struct				/* "packed" IPC glue structure	*/ 
{
    RABBIT_ID	pack_publisher;		/* IPC publisher		*/
    RABBIT_ID	pack_learner;		/* IPC learner			*/
    IPC_MESSAGE	pack_message;		/* IPC message information	*/
    IPC_MSGDATA	pack_msgdata;		/* IPC message data information	*/
    IPC_EVENT	pack_event;		/* IPC event information	*/
} IPC_PACK_GLUE;

#define IG_PACK_SIZE	sizeof(IPC_PACK_GLUE)

/* Error values found in "ipc_glue_errno" when functions fail. Also check 
   "errno" for system errors.
*/
#define IGE_NOERROR	0		/* no error (initializer)	*/
#define IGE_MAPFILE	1		/* error accessing map file	*/
#define IGE_MKFILEN	2		/* error making file name	*/
#define IGE_FMKOPEN	3		/* error making/opening file	*/
#define IGE_FWRITE	4		/* error writing to file	*/
#define IGE_NOTPUB	5		/* IPC info. not published	*/
#define IGE_FOPEN	6		/* error opening IPC file	*/
#define IGE_FREAD	7		/* error reading IPC file	*/
#define IGE_RMPATH	8		/* error removing file/path	*/
#define IGE_BUFOFLOW	9		/* internal buffer overflow	*/
#define IGE_KILLPID	10		/* cannot signal process	*/ 
#define IGE_SEMPOST	11		/* cannot post semaphore	*/
#define IGE_NOMEMORY	12		/* no memory (alloc failed)	*/
#define IGE_QREMOVE	13		/* error removing message queue */
#define IGE_SHMREMOVE	14		/* error removing memory seg.	*/
#define IGE_SEMREMOVE	15		/* error removing semaphore	*/
#define IGE_FIFOPOST	16		/* error posting event to FIFO	*/

extern int ipc_glue_errno;

extern void ipcInitMessage	( /* IPC_MESSAGE	*p_Message */ );
extern void ipcInitMsgData	( /* IPC_MSGDATA	*p_Msgdata */ );
extern void ipcInitEvent	( /* IPC_EVENT		*p_Event */ );
extern void ipcInitGlueDS	( /* IPC_GLUE		*p_Glue */ );
extern int ipcPublish		( /* IPC_GLUE		*p_Glue */ );
extern int ipcUnpublish		( /* IPC_GLUE		*p_Glue */ );
extern int ipcLearn		( /* IPC_GLUE		*p_Glue */ );
extern int ipcDoEvent		( /* IPC_EVENT		*p_Event */ );
extern char *ipcStrErrno	( /* int		 ipc_glue_errno */ );
extern void ipcPackGlue		( /* IPC_GLUE		*p_glue,
				     IPC_PACK_GLUE	*p_packed */ );
extern void ipcUnpackGlue	( /* IPC_GLUE		*p_glue,
				     IPC_PACK_GLUE	*p_packed */ ); 
extern IPC_GLUE *ipcAllocGlue	( /* void */ );
extern void ipcFreeGlue		( /* IPC_GLUE		*p_Glue */ );
extern void ipcLogGlue		( /* int		 message_num,
				     IPC_GLUE		*p_Glue,
				     bool		 fTimeStamp */ );
extern int ipcCleanGlue		( /* IPC_GLUE		*p_Glue */ );
extern int ipcGlueFileClean	( /* char		*glue_file */ );
extern void ipcGluePtrsInit	( /* IPC_GLUE		*p_Glue */ );
extern int ipcGlueAllocPtrs 	( /* IPC_GLUE		*p_glue */ );
extern void ipcGlueFreePtrs 	( /* IPC_GLUE		*p_glue */ );
extern int ipcGlueFileClean	( /* char		*glue_file */ );
extern int ipcGlueFileDump	( /* FILE		*fp,
				     char		*glue_file */ );
#endif /* _IPC_GLUE_H_ */

⌨️ 快捷键说明

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