/* ScianNetObjects.h John R. Murray */

#define NO_END_OF_PTRS 0
#define NO_PTR_TO_REALS 1
#define NO_PTR_TO_INTS 2
#define NO_PTR_TO_OBJPTRS 3

typedef struct PointerDescriberStruct {
    unsigned long ptrOffset;	/* location of pointer. */
    unsigned long number;	/* number of things pointed to */
    int type;			/* type of things pointed to */
} *PtrDescPtr;

typedef int NetFlagsTyp;
#define HTON_NETFLAGSTYP(x) htons(x)	/* to be consistent with FlagsTyp */
#define NTOH_NETFLAGSTYP(x) ntohs(x)

#define NO_NULL_CLASS 0x1L
#define NO_NULL_VARS 0x2L
#define NO_NULL_METHODS 0x4L
#define NO_NULL_DEPENDS 0x8L

#define NO_LAST_VAR 0L

/* different types of network packets (This is allowing for multiple ways
 * of shipping one type of object (e.g. reals) */

extern ObjPtr allPublishedObjects;

#ifdef PROTO
void InitNetObjects();
void KillNetObjects();
int PublishObject(ObjPtr);
void UnPublishObject(ObjPtr);
void TransmitObject(ObjPtr, ObjPtr, Bool);
unsigned long GetNetworkID();
ObjPtr FindPublishedObject(unsigned long);
ObjPtr ReceiveObject(ObjPtr, unsigned long);
ObjPtr TransmitExtraStuffRealArrayRaw(ObjPtr, ObjPtr);
ObjPtr ReceiveExtraStuffRealArrayRaw(ObjPtr, ObjPtr);
ObjPtr TransmitExtraStuffRealArrayAscii(ObjPtr, ObjPtr);
ObjPtr ReceiveExtraStuffRealArrayAscii(ObjPtr, ObjPtr);
ObjPtr TransmitExtraStuffObjectArray(ObjPtr, ObjPtr);
ObjPtr ReceiveExtraStuffObjectArray(ObjPtr, ObjPtr);
ObjPtr TransmitExtraStuffObjectArraySpecial(ObjPtr, ObjPtr);
ObjPtr ReceiveExtraStuffObjectArraySpecial(ObjPtr, ObjPtr);
#else
void InitNetObjects();
void KillNetObjects();
int PublishObject();
void UnPublishObject();
void TransmitObject();
unsigned long GetNetworkID();
ObjPtr FindPublishedObject();
ObjPtr ReceiveObject();
ObjPtr TransmitExtraStuffRealArrayRaw();
ObjPtr ReceiveExtraStuffRealArrayRaw();
ObjPtr TransmitExtraStuffRealArrayAscii();
ObjPtr ReceiveExtraStuffRealArrayAscii();
ObjPtr TransmitExtraStuffObjectArray();
ObjPtr ReceiveExtraStuffObjectArray();
ObjPtr TransmitExtraStuffObjectArraySpecial();
ObjPtr ReceiveExtraStuffObjectArraySpecial();
#endif

/* messages */				/* saying... */
#define	NO_MESG_OBJECT		"OBJ!"	/* <variable format>. Here's an object */
#define NO_MESG_SEND_OBJECT	"SNDO"	/* <objid>. Send me this object */
#define NO_MESG_DELETE_OBJECT	"JNKO"	/* I'm not interested in this object anymore, you can delete it */
#define NO_MESG_MAKEVAR		"MKVR"	/* <objid> <varnum>. (NIY) Make this var for me */
#define NO_MESG_DIDMAKEVAR	"YSVR"	/* <objid> <varnum>. (NIY) I made this var for you */
#define NO_MESG_DIDNTMAKEVAR	"NOVR"	/* <objid> <varnum>. (NIY) I didn't need to make this var */
#define NO_MESG_GETVAR		"GTVR"	/* <objid> <varnum>. I want the value of this var of this object */
#define NO_MESG_GETELEMENT	"GTEL"	/* <objid> <elnum> get element of object array */
#define NO_MESG_GOTVAR		"GOTV"	/* <objid> <varnum> <objid>. Here's the ID of this var of this object */
						/* objid == 0 ==> NULLOBJ */
#define NO_MESG_GOTELEMENT	"GOTE"	/* <objid> <elnum> <objid> here 'tis */
#define NO_MESG_UPDATEVAR	"UPVR"	/* <objid> <varnum>. value of var changed */
#define NO_MESG_UPDATEVAR_ID	"UPV2"	/* UPVR style 2 includes netid */
#define NO_MESG_UPDATEVAR_SEND	"UPV3"	/* UPVR style 3 includes object */
#define NO_MESG_MACHINE_IRIS4D	"SG4D"	/* I'm an SGI 4D */
#define NO_MESG_MACHINE_RS6000	"RS6K"	/* I'm an IBM RS6000 */
#define NO_MESG_MACHINE_UNKNOWN	"UNKN"	/* I don't know what I am */

#define NET_PLAINOBJECT		"OBJ1"	/* plain old object. no trailing data*/
#define NET_INTEGER		"INT1"	/* std integer */
#define NET_REAL		"REA1"	/* std. real, first cut format. */
#define NET_REALARRAYRAW	"RAR1"	/* obj in arrayClass class, raw fmt */
#define NET_REALARRAYASCII	"RAR2"	/* obj in arrayClass class, ascii fmt */
#define NET_OBJECTARRAY		"OAR1"	/* obj in objectArrayClass class */
#define NET_STRING		"STR1"	/* std string */
#define NET_ICONDATASET		"IDS1"	/* obj in iconDataset class */
#define NET_ICON1DVECTOR	"I1V1"	/* obj in icon1DVector class */
#define NET_ICON2DVECTOR	"I2V1"	/* obj in icon2DVector class */
#define NET_ICON3DVECTOR	"I3V1"	/* obj in icon3DVector class */
#define NET_ICON4DVECTOR	"I4V1"	/* obj in icon4DVector class */
#define NET_ICON1DSCALAR	"I1S1"	/* obj in icon1DScalar class */
#define NET_ICON2DSCALAR	"I2S1"	/* obj in icon2DScalar class */
#define NET_ICON3DSCALAR	"I3S1"	/* obj in icon3DScalar class */
#define NET_ICON4DSCALAR	"I4S1"	/* obj in icon4DScalar class */
#define NET_DATA1DVECTOR	"D1V1"	/* obj in data1DVector class */
#define NET_DATA2DSCALAR	"D2S1"	/* obj in data2DScalar class */
#define NET_DATA3DSCALAR	"D3S1"	/* obj in data3DScalar class */
#define NET_DATA3DUNSTRUCT	"D3U1"	/* obj in dat3DUnstructSurface class */
#define NET_DATASET		"DAT1"	/* obj in generic dataset class */
#define NET_DATAFORM		"DFM1"	/* obj in dataform class */
#define NET_TIMEDOBJECT		"TOB1"	/* obj in timedObjClass */
#define NET_PALETTE		"PLT1"	/* obj in paletteClass */
#define NET_VISICON		"VSI1"	/* obj in visIcon, whatever that is */
#define NET_UNIMPLEMENTED	"Huh?"	/* transmit/receive unimplemented for this class */

#ifndef FASTSOCKET
#define FASTSOCKET	997
#endif
