/* atm.h - Functions useful for ATM applications */
 
/* Written 1995-1997 by Werner Almesberger, EPFL-LRC */
 

#ifndef ATM_H
#define ATM_H

#include <sys/socket.h>
#include <linux/atm.h>


#define HOSTS_ATM "/etc/hosts.atm"

#define T2A_PVC		  1	/* address is PVC */
#define T2A_SVC		  2	/* address is SVC */
#define T2A_UNSPEC	  4	/* allow unspecified parts in PVC address */
#define T2A_WILDCARD	  8	/* allow wildcards in PVC or SVC address */
#define T2A_NNI		 16	/* allow NNI VPI range (PVC) */
#define T2A_NAME	 32	/* allow name resolution */
#define T2A_REMOTE	 64	/* OBSOLETE */
#define T2A_LOCAL	128	/* don't use ANS */

#define A2T_PRETTY	 1	/* add syntactic sugar */
#define A2T_NAME	 2	/* attempt name lookup */
#define A2T_REMOTE	 4	/* OBSOLETE */
#define A2T_LOCAL	 8	/* don't use ANS */

#define AXE_WILDCARD	 1	/* allow wildcard match */
#define AXE_PRVOPT	 2	/* private part is optional */

#define T2Q_DEFAULTS	 1	/* structure contains default values */

#define S2T_NAME	 1	/* attempt name lookup */
#define S2T_LOCAL	 2	/* we may support NIS or such in the future */

#define T2S_NAME	 1	/* attempt name lookup */
#define T2S_LOCAL	 2	/* we may support NIS or such in the future */


#define MAX_ATM_ADDR_LEN (2*ATM_ESA_LEN+ATM_E164_LEN+5)
				/* 4 dots, 1 plus */
#define MAX_ATM_NAME_LEN 256	/* wild guess */
#define MAX_ATM_QOS_LEN 116	/* 5+4+2*(3+3*(7+9)+2)+1 */
#define MAX_ATM_SAP_LEN	255	/* BHLI(27)+1+3*BLLI(L2=33,L3=41,+1)+2 */


int create_leaf(int session);

int text2atm(const char *text,struct sockaddr *addr,int length,int flags);
int atm2text(char *buffer,int length,const struct sockaddr *addr,int flags);
int atm_equal(const struct sockaddr_atmsvc *a,const struct sockaddr_atmsvc *b,
  int len,int flags);

int sdu2cell(int s,int sizes,const int *sdu_size,int *num_sdu);

int text2qos(const char *text,struct atm_qos *qos,int flags);
int qos2text(char *buffer,int length,const struct atm_qos *qos,int flags);
int qos_equal(const struct atm_qos *a,const struct atm_qos *b);

int sap2text(char *buffer,int length,const struct atm_sap *sap,int flags);
int text2sap(const char *text,struct atm_sap *sap,int flags);

int __atmlib_fetch(const char **pos,...); /* internal use only */

#endif
