seqnet_h

/*
**	Copyright 1999, Universities Research Association.  All rights reserved.
*/
/******************************************************************************/
/* seqnet.h
**  
**  FACILITY:
**
**	SEQNET
**
**  MODULE DESCRIPTION:
**
**	describe structures for client communication with the Sequencer
**
**  MODIFICATION HISTORY:
**
**	20 Dec 99	R. Joshel
**	Created.
**
*/
/******************************************************************************/

#ifndef SEQNET_H_DEFINED			/* do this only once */
#define	SEQNET_H_DEFINED

/******************************************************************************/
/* 
**	defined constants for argument values and structure definitions
*/
/******************************************************************************/

/* client program definitions */

#define	SEQNET_EXECUTE	1	/* command code: execute a new request */
#define	SEQNET_ABORT	2 	/* command code: abort a previous request */
#define	SEQNET_UPDATE	3 	/* command code: return status reply */

#define	SEQNET_MAX_MESS	1024	/* maximum message length, in bytes */

typedef void (*seqnet_request_cb_t)(int request_id, int request_command,
				    int request_synch,
				    unsigned short request_length,
				    void *request_message);

/* server program definitions */

#define	LEN_REQTAG	12	/* request tagname length */

#define WACR50  RAD50L("SEQRMC")  /* multicast (wacnet) taskname id */ 
#define SEQ_NET_WACNET  (-1)    /* typecode: wacnet header typecode */
#define SEQ_NET_SEQNET	1	/* typecode: seqnet message */
#define SEQ_NET_PING	2	/* typecode: ping request */
#define SEQ_NET_DUMP	3	/* typecode: dump request */
#define SEQ_NET_STATS	4	/* typecode: return statistics request */
#define SEQ_NET_0STATS	5	/* typecode: reset statistics request */
#define SEQ_NET_ALERT  	6       /* typecode: seq alert message via acnet */

typedef struct	/* header for ACNET requests */
    {
    short	tc;		/* typecode */
    short	stc;		/* sub-typecode */
    char	name[8];	/* request ASCII-string ACNET taskname */
    int		node;		/* request node */
    int		cns;		/* request console */
    int		slt;		/* request slot */
    int		req_id;		/* special requestor id */
    int		rpy_id;		/* special replier id */
    } __attribute__((packed)) seqnet_hdr_t;

typedef struct  /* stats: reply to SEQ_NET_STATS for SEQERx handles */
    {
    clib_time_t time_report;	/* time report returned */
    clib_time_t time_connect;	/* time ACNET connected or last statistics reset */
    int		reqout;		/* # of ACNET requests sent */
    int		reqin;		/* # of ACNET requests received */
    int		error;		/* # of ACNET network errors */
    int		usm;		/* # of USMs received */
    int		wacout;		/* # of wacnet requests sent */
    int		wacin;		/* # of wacnet requests received */
    int		reply;		/* # of ACNET replies */
    } __attribute__((packed)) seq_netstat_t;

typedef struct SEQNET_REQUESTER_INFO
    {
    int		node;		/* requester's node */
    int		console;	/* requester's console */
    int		slot;		/* requester's slot */
    char	process_name[PROCESS_NAME_LEN+2];	/* requester's process name */
    } __attribute__((packed)) SEQNET_REQUESTER_INFO;

typedef void (*seqnet_reply_cb_t)(int *req_id, char * req_tag,
  				  int *rpy_status, char *rpy_mess);

/******************************************************************************/
/*
**	function prototypes
*/
/******************************************************************************/

#ifdef __cplusplus
extern "C" {
#endif

/* client program function prototypes */

int seqnet_client_ready(char *tag_name);
int seqnet_connection(seqnet_request_cb_t cb_request_fuc);
int seqnet_disconnect(void);
int seqnet_reply_message(int request_id, char *reply_message);
int seqnet_reply_update(int request_id, int reply_status);
int seqnet_request_check(int *request_id, int *request_command,
			 int *request_synch, unsigned short *request_length,
			 void *request_message);
int seqnet_started(void);

/* server program function prototypes */

int seqnet_client_start(char *tagname, int cns, int slt,
  			char *pgmname);
void seqnet_empty_work(void);
int seqnet_reply_callback(seqnet_reply_cb_t u_rpy_callback);
int seqnet_reply_check(char *req_tag, int *rpy_status, char *rpy_mess);
int seqnet_request_command(char *tagname, int command);
int seqnet_request_send(int *reqid, char *reqtag, int command,
			int synch, int termit, unsigned short reqlen,
			void *reqmess, char *to_name, int to_cns, int to_slt);
int seqnet_requester_info_c(int request_id,
			    SEQNET_REQUESTER_INFO *requester_info);
int seqnet_send_status_message(int request_id, int color, unsigned int options,
			       char *format_string, ...);
			
#ifdef __cplusplus
}
#endif

#endif