/*
 *	Copyright (c) 1995, 1996, Sun Microsystems, Inc.
 *
 * This software is provided by Sun ``AS IS'' and any express or implied
 * warranties, including, but not limited to, the implied warranties of
 * merchantability and fitness for a particular purpose are disclaimed.
 * In no event shall Sun Microsystems be liable for any direct, indirect,
 * incidental, special, exemplary, or consequential damages.
 *
 * This software is not a product, and is provided for evaluation purposes
 * only.
 *
 * This software may not be resold without the express permission of
 * Sun Microsystems.
 *
 * Feedback on this tool may be sent to packet-shell-owner@sunroof.eng.sun.com.
 *
 * Packet Shell
 */

#pragma ident	"@(#)proto.h	1.12	99/05/28 SMI"

/*
 * General initialization--called just after link time.  The init()
 * routine needs the protocol's newly created proto_tbl in order to
 * set the size of the protocol specific endpoint in the proto_epsize
 * field.
 */
int init(proto_tbl_t *, Tcl_Interp *);

/*
 * Creates an end-point for communication.  As a side effect it
 * registers the new tcl commands which represent the operations
 * that can be done to that end-point.  Returns TCL_OK on success.
 */
int propen(ClientData, Tcl_Interp *, int, char **);

/*
 * Close a communication end-point.  Unregisters the commands
 * associated with this end-point.
 */
int prclose(ClientData, Tcl_Interp *, int, char **);


/*
 * Create a "default" packet.
 */
int pinit(ClientData, Tcl_Interp *, struct packet *, int, char **);

/*
 * Free a packet.
 */
int pfree(ClientData, Tcl_Interp *, struct packet *, int, char **);

/*
 * Identify the next protocol encapsulated, if possible.  'Element'
 * identifies the ptbl element which corresponds to *this* protocol layer.
 * It returns the name and size which should be the next entry in the ptbl.
 */
int decode(struct packet *, int, char **, int *);

/*
 * Fetch a protocol element from a packet, and return its string
 * representation.  While this could have been implemented bundled in
 * with an end-point, it wasn't to reduce the size of the command
 * name-space.  (Larger command name spaces slow down TCL interpretation.)
 */
int get(int, ClientData, Tcl_Interp *, struct packet *, int, char **);

/*
 * Set a protocol element in a packet as indicated by the arguments.
 */
int set(int, ClientData, Tcl_Interp *, struct packet *, int, char **);

/*
 * List one or more protocol layers in a packet in a (hopefully) human
 * readable format.
 */
int list(int, ClientData, Tcl_Interp *, struct packet *, int, char **);

/*
 * Symbol names we use dlsym() to get at.  Note that some platforms require
 * '_name' here.
 */
#define	PSH_INIT_SYM	"init"
#define	PSH_OPEN_SYM	"propen"
#define	PSH_CLOSE_SYM	"prclose"
#define	PSH_PINIT_SYM	"pinit"
#define	PSH_PFREE_SYM	"pfree"
#define	PSH_DECODE_SYM	"decode"
#define	PSH_GET_SYM	"get"
#define	PSH_SET_SYM	"set"
#define	PSH_LIST_SYM	"list"
#define	PSH_WACTION_SYM	"pwait_action"
