#ifndef  CLIB_NIPC_PROTOS_H
#define  CLIB_NIPC_PROTOS_H

/*
**	$Id: nipc_protos.h 1.22 1998/09/13 10:44:39 heinz Exp $
**
**	C prototypes. For use with 32 bit integers only.
**
**	(C) Copyright 1995-98 by Heinz Wrobel
**	    All Rights Reserved
*/

#ifndef  EXEC_TYPES_H
#include <exec/types.h>
#endif
#ifndef  UTILITY_TAGITEM_H
#include <utility/tagitem.h>
#endif
#ifndef  ENVOY_NIPC_H
#include <envoy/nipc.h>
#endif
/*--- functions in V39 or higher (Release 3) ---*/
BOOL AddRoute( ULONG network, ULONG gateway, UWORD hops, WORD ttl );
APTR DeleteRoute( ULONG network );
/*--- (5 function slots reserved here) ---*/
struct Transaction *AllocTransactionA( struct TagItem *tags );
struct Transaction *AllocTransaction( Tag tag1, ... );
APTR FreeTransaction( struct Transaction *transaction );
/*---------------- Entities ---------------------------------------------------*/
struct Entity *CreateEntityA( struct TagItem *tags );
struct Entity *CreateEntity( Tag tag1, ... );
VOID DeleteEntity( struct Entity *entity );
struct Entity *FindEntity( STRPTR hostname, STRPTR entityname,
	struct Entity *src_entity, ULONG *detailerror );
VOID LoseEntity( struct Entity *entity );
/*---------------- NIPC I/O ---------------------------------------------------*/
ULONG DoTransaction( struct Entity *dest_entity, struct Entity *src_entity,
	struct Transaction *transaction );
BOOL BeginTransaction( struct Entity *dest_entity, struct Entity *src_entity,
	struct Transaction *transaction );
struct Transaction *GetTransaction( struct Entity *entity );
VOID ReplyTransaction( struct Transaction *transaction );
BOOL CheckTransaction( struct Transaction *transaction );
VOID AbortTransaction( struct Transaction *transaction );
ULONG WaitTransaction( struct Transaction *transaction );
VOID WaitEntity( struct Entity *entity );
/*---------------- Network Information ----------------------------------------*/
BOOL GetEntityName( struct Entity *entity, STRPTR string, ULONG maxlen );
BOOL GetHostName( struct Entity *entity, STRPTR string, ULONG maxlen );
BOOL NIPCInquiryA( struct Hook *hook, ULONG maxTime, ULONG maxResponses,
	struct TagItem *tagList );
BOOL NIPCInquiry( struct Hook *hook, ULONG maxTime, ULONG maxResponses,
	Tag tag1, ... );
ULONG PingEntity( struct Entity *pingtarget, ULONG maxTime );
ULONG GetEntityAttrsA( struct Entity *entity, struct TagItem *tagList );
ULONG GetEntityAttrs( struct Entity *entity, Tag tag1, ... );
VOID SetEntityAttrsA( struct Entity *entity, struct TagItem *tagList );
VOID SetEntityAttrs( struct Entity *entity, Tag tag1, ... );
/*---------------- NIPC Buffer Management Routines ----------------------------*/
/*--- functions in V40 or higher (Release 3.1) ---*/
struct NIPCBuff *AllocNIPCBuff( ULONG entries );
struct NIPCBuffEntry *AllocNIPCBuffEntry( void );
ULONG CopyNIPCBuff( struct NIPCBuff *src_buff, struct NIPCBuff *dest_buff,
	ULONG srcoffset, ULONG dstoffset, ULONG length );
ULONG CopyToNIPCBuff( UBYTE *src_data, struct NIPCBuff *dest_buff,
	ULONG dstoffset, ULONG length );
ULONG CopyFromNIPCBuff( struct NIPCBuff *src_buff, UBYTE *dest_data,
	ULONG srcoffset, ULONG length );
VOID FreeNIPCBuff( struct NIPCBuff *buff );
VOID FreeNIPCBuffEntry( struct NIPCBuffEntry *entry );
ULONG NIPCBuffLength( struct NIPCBuff *buff );
VOID AppendNIPCBuff( struct NIPCBuff *first, struct NIPCBuff *second );
UBYTE *NIPCBuffPointer( struct NIPCBuff *buff, struct NIPCBuffEntry **beptr,
	ULONG offset );
/* version 40.77 (Yes this number is strange considering the numbers below!) */
VOID LockNIPCBuff( struct NIPCBuff *buff );
/* buffer management routines available starting with nipc 43.13 */
struct NIPCBuffEntry *AllocNIPCBuffEntryWithMem( ULONG size );
UWORD CalcNIPCChecksum( APTR data, ULONG length, UWORD startsum );
/*--- (3 function slots reserved here) ---*/
/*---------------- General IP support -----------------------------------------*/
/* version 40.74 */
BOOL SetDeviceIPAddressA( STRPTR devicename, ULONG unit, ULONG ipaddress,
	ULONG mask, struct TagItem *tags );
BOOL SetDeviceIPAddress( STRPTR devicename, ULONG unit, ULONG ipaddress,
	ULONG mask, Tag tag1, ... );
APTR AllocateIPProtocolA( UWORD protonr, APTR input, APTR cleanup,
	struct TagItem *tags );
APTR AllocateIPProtocol( UWORD protonr, APTR input, APTR cleanup, Tag tag1,
	... );
BOOL RegisterIPProtocol( APTR handle );
void FreeIPProtocol( APTR handle );
void SendIPPacketA( struct NIPCBuff *data, ULONG srcip, ULONG destip,
	UBYTE protocol, struct TagItem *iptags );
void SendIPPacket( struct NIPCBuff *data, ULONG srcip, ULONG destip,
	UBYTE protocol, Tag tag1, ... );
ULONG SendICMPMessageA( UWORD typeandcode, ULONG magicid, APTR iphdr,
	ULONG sourceip, ULONG destip, APTR data, ULONG datalen,
	struct TagItem *iptags );
ULONG SendICMPMessage( UWORD typeandcode, ULONG magicid, APTR iphdr,
	ULONG sourceip, ULONG destip, APTR data, ULONG datalen, ... );
/*---------------- General UDP support ----------------------------------------*/
/* version 40.77 */
APTR AllocateUDPPortA( LONG localport, APTR datain, struct TagItem *tags );
APTR AllocateUDPPort( LONG localport, APTR datain, Tag tag1, ... );
BOOL RegisterUDPPort( APTR handle );
void FreeUDPPort( APTR handle );
void SendUDPPacketA( APTR dataptr, UWORD length, ULONG destip, UWORD srcport,
	UWORD dstport, struct TagItem *iptags );
void SendUDPPacket( APTR dataptr, UWORD length, ULONG destip, UWORD srcport,
	UWORD dstport, Tag tag1, ... );
/*--- (2 function slots reserved here) ---*/
/*---------------- General Event support --------------------------------------*/
/* version 40.78 */
struct MsgPort *AllocNIPCEventPort( void );
struct NIPCEvent *AllocNIPCEvent( ULONG eventcode, APTR eventdata,
	struct MsgPort *eventport );
void ScheduleNIPCEvent( struct NIPCEvent *event, ULONG seconds, ULONG micros );
ULONG CheckNIPCEvent( struct NIPCEvent *event );
struct NIPCEvent *GetNIPCEvent( struct MsgPort *eventport );
ULONG GetNIPCEventCode( struct NIPCEvent *event );
APTR GetNIPCEventData( struct NIPCEvent *event );
void AbortNIPCEvent( struct NIPCEvent *event );
void FreeNIPCEvent( struct NIPCEvent *event );
void FreeNIPCEventPort( struct MsgPort *eventport );
/*--- functions in V43 or higher ---*/
/*--- (2 function slots reserved here) ---*/
void NIPCControlA( struct TagItem *taglist );
void NIPCControl( Tag tag1, ... );
/*--- (10 function slots reserved here) ---*/
#endif   /* CLIB_NIPC_PROTOS_H */
