1/* atm.h - Functions useful for ATM applications */
2
3/* Written 1995-2000 by Werner Almesberger, EPFL-LRC/ICA */
4
5
6#ifndef _ATM_H
7#define _ATM_H
8
9#include <stdint.h>
10#include <sys/socket.h>
11#include <linux/atm.h>
12
13
14/*
15 * For versions of glibc < 2.1
16 */
17
18#ifndef AF_ATMPVC
19#define AF_ATMPVC	8
20#endif
21
22#ifndef AF_ATMSVC
23#define AF_ATMSVC	20
24#endif
25
26#ifndef PF_ATMPVC
27#define PF_ATMPVC	AF_ATMPVC
28#endif
29
30#ifndef PF_ATMSVC
31#define PF_ATMSVC	AF_ATMSVC
32#endif
33
34#ifndef SOL_ATM
35#define SOL_ATM		264
36#endif
37
38#ifndef SOL_AAL
39#define SOL_AAL		265
40#endif
41
42
43#define HOSTS_ATM "/etc/hosts.atm"
44
45/* text2atm flags */
46#define T2A_PVC		  1	/* address is PVC */
47#define T2A_SVC		  2	/* address is SVC */
48#define T2A_UNSPEC	  4	/* allow unspecified parts in PVC address */
49#define T2A_WILDCARD	  8	/* allow wildcards in PVC or SVC address */
50#define T2A_NNI		 16	/* allow NNI VPI range (PVC) */
51#define T2A_NAME	 32	/* allow name resolution */
52#define T2A_REMOTE	 64	/* OBSOLETE */
53#define T2A_LOCAL	128	/* don't use ANS */
54
55/* atm2text flags */
56#define A2T_PRETTY	 1	/* add syntactic sugar */
57#define A2T_NAME	 2	/* attempt name lookup */
58#define A2T_REMOTE	 4	/* OBSOLETE */
59#define A2T_LOCAL	 8	/* don't use ANS */
60
61/* atm_equal flags */
62#define AXE_WILDCARD	 1	/* allow wildcard match */
63#define AXE_PRVOPT	 2	/* private part of SVC address is optional */
64
65/* text2qos flags */
66#define T2Q_DEFAULTS	 1	/* structure contains default values */
67
68/* text2sap flags */
69#define T2S_NAME	 1	/* attempt name lookup */
70#define T2S_LOCAL	 2	/* we may support NIS or such in the future */
71
72/* sap2text flags */
73#define S2T_NAME	 1	/* attempt name lookup */
74#define S2T_LOCAL	 2	/* we may support NIS or such in the future */
75
76/* sap_equal flags */
77#define SXE_COMPATIBLE	 1	/* check for compatibility instead of identity*/
78#define SXE_NEGOTIATION	 2	/* allow negotiation; requires SXE_COMPATIBLE;
79				   assumes "a" defines the available
80				   capabilities */
81#define SXE_RESULT	 4	/* return selected SAP */
82
83#define MAX_ATM_ADDR_LEN (2*ATM_ESA_LEN+ATM_E164_LEN+5)
84				/* 4 dots, 1 plus */
85#define MAX_ATM_NAME_LEN 256	/* wild guess */
86#define MAX_ATM_QOS_LEN 116	/* 5+4+2*(3+3*(7+9)+2)+1 */
87#define MAX_ATM_SAP_LEN	255	/* BHLI(27)+1+3*BLLI(L2=33,L3=41,+1)+2 */
88
89
90int text2atm(const char *text,struct sockaddr *addr,int length,int flags);
91int atm2text(char *buffer,int length,const struct sockaddr *addr,int flags);
92int atm_equal(const struct sockaddr *a,const struct sockaddr *b,int len,
93  int flags);
94
95int sdu2cell(int s,int sizes,const int *sdu_size,int *num_sdu);
96
97int text2qos(const char *text,struct atm_qos *qos,int flags);
98int qos2text(char *buffer,int length,const struct atm_qos *qos,int flags);
99int qos_equal(const struct atm_qos *a,const struct atm_qos *b);
100
101int text2sap(const char *text,struct atm_sap *sap,int flags);
102int sap2text(char *buffer,int length,const struct atm_sap *sap,int flags);
103int sap_equal(const struct atm_sap *a,const struct atm_sap *b,int flags,...);
104
105int __t2q_get_rate(const char **text,int up);
106int __atmlib_fetch(const char **pos,...); /* internal use only */
107
108#endif
109