/*
 * $RCSfile: prottbl_i.h,v $
 *
 * x-kernel v3.3
 *
 * Copyright (c) 1993,1991,1990,1996  Arizona Board of Regents
 *
 * $Log: prottbl_i.h,v $
 * Revision 1.2  1996/01/29 19:58:56  slm
 * Updated copyright and version.
 *
 * Revision 1.1  1995/07/28  21:42:22  slm
 * Initial revision
 *
 * Revision 1.10.1.1.1.1  1994/10/27  20:52:09  hkaram
 * New branch
 *
 * Revision 1.10.1.1  1994/04/19  00:24:24  menze
 * prottbl functions now use 32-bit ProtId
 *
 * Revision 1.10  1993/12/11  00:23:45  menze
 * fixed #endif comments
 *
 * Revision 1.9  1993/12/10  20:40:15  menze
 * Removed protTblInitMaps
 */

/* 
 * Declarations internal to the protocol id table utility
 */

#ifndef prottbl_i_h
#define prottbl_i_h

#include "idmap.h"

typedef enum {
    NO_ERROR = 0,
    ERR_FILE,
    ERR_NAME,
    ERR_ID,
    ERR_NAME_TOO_LARGE
} ErrorCode;


extern	Map	ptblNameMap;

typedef struct {
    char	*name;
    ProtId	id;
    Map		idMap;		/* ProtId's to relative protocol nums */
    Map		tmpMap;		/* strings to relative protocol numbers */
    Map		revMap;		/* relative protocol numbers -> 0 */
} PtblEntry;




#ifdef __STDC__

/* 
 * protTblAddProt -- Create an entry in the protocol map binding 'name'
 * to the given protocol id
 */
extern void	protTblAddProt( char *name, ProtId id );

/* 
 * protTblAddBinding -- Indicate in the map that 'hlp' uses 'relNum' as a
 * protocol number relative to 'llp'.
 */
extern void	protTblAddBinding( char *llp, char *hlp, ProtId relNum );

/* 
 * protTblBuild -- add the entries in the specified file to the table
 * returns non-zero if there were problems
 */
extern int	protTblBuild( char *filename );

/* 
 * protTblParse -- read in 'filename' and add the appropriate entries
 * to the protocol map via protTblAddProt and protTblAddBinding.
 * Returns 0 on a successful parse, non-zero if not.
 */
extern ErrorCode	protTblParse( char *filename );


/* 
 * This is used by the ptblDump utility program.  Not for general
 * consumption. 
 */
char *	protIdToStr( ProtId );


#endif /* __STDC__ */


#endif /* !prottbl_i_h */
