Annotation of embedaddon/mpd/src/phys.h, revision 1.1.1.3
1.1 misho 1:
2: /*
3: * phys.h
4: *
5: * Written by Archie Cobbs <archie@freebsd.org>
6: * Copyright (c) 1995-1999 Whistle Communications, Inc. All rights reserved.
7: * See ``COPYRIGHT.whistle''
8: */
9:
10: #ifndef _PHYS_H_
11: #define _PHYS_H_
12:
13: #include "mbuf.h"
14: #include "msg.h"
15:
16: /*
17: * DEFINITIONS
18: */
19:
20: enum {
21: PHYS_STATE_DOWN = 0,
22: PHYS_STATE_CONNECTING,
23: PHYS_STATE_READY,
24: PHYS_STATE_UP
25: };
26:
27: /* Descriptor for a given type of physical layer */
28: struct phystype {
29: const char *name; /* Name of device type */
30: const char *descr; /* Description of device type */
31: u_short mtu, mru; /* Not incl. addr/ctrl/fcs */
32: int tmpl; /* This type is template, not an instance */
33: int (*tinit)(void); /* Initialize device type info */
34: void (*tshutdown)(void); /* Destroy device type info */
35: int (*init)(Link l); /* Initialize device info */
36: int (*inst)(Link l, Link lt); /* Instantiate device */
37: void (*open)(Link l); /* Initiate connection */
38: void (*close)(Link l); /* Disconnect */
39: void (*update)(Link l); /* Update config */
40: void (*shutdown)(Link l); /* Destroy all nodes */
41: void (*showstat)(Context ctx); /* Shows type specific stats */
42: int (*originate)(Link l); /* We originated connection? */
43: int (*issync)(Link l); /* Link is synchronous */
44: int (*setaccm)(Link l, u_int32_t xmit, u_int32_t recv); /* Set async accm */
45: int (*setcallingnum)(Link l, void *buf);
46: /* sets the calling number */
47: int (*setcallednum)(Link l, void *buf);
48: /* sets the called number */
49: int (*selfname)(Link l, void *buf, size_t buf_len);
50: /* returns the self-name */
51: int (*peername)(Link l, void *buf, size_t buf_len);
52: /* returns the peer-name */
53: int (*selfaddr)(Link l, void *buf, size_t buf_len);
54: /* returns the self-address (IP, MAC, whatever) */
55: int (*peeraddr)(Link l, void *buf, size_t buf_len);
56: /* returns the peer-address (IP, MAC, whatever) */
57: int (*peerport)(Link l, void *buf, size_t buf_len);
58: /* returns the peer-port */
59: int (*peermacaddr)(Link l, void *buf, size_t buf_len);
60: /* returns the peer MAC address */
61: int (*peeriface)(Link l, void *buf, size_t buf_len);
62: /* returns the peer interface */
63: int (*callingnum)(Link l, void *buf, size_t buf_len);
64: /* returns the calling number (IP, MAC, whatever) */
65: int (*callednum)(Link l, void *buf, size_t buf_len);
66: /* returns the called number (IP, MAC, whatever) */
1.1.1.2 misho 67: u_short (*getmtu)(Link l, int conf); /* returns actual MTU */
68: u_short (*getmru)(Link l, int conf); /* returns actual MRU */
1.1 misho 69: };
70: typedef struct phystype *PhysType;
71:
72: /*
73: * VARIABLES
74: */
75:
1.1.1.3 ! misho 76: extern const struct phystype *gPhysTypes[];
1.1 misho 77: extern const char *gPhysStateNames[];
78:
79: /*
80: * FUNCTIONS
81: */
82:
83: extern int PhysOpenCmd(Context ctx);
84: extern void PhysOpen(Link l);
85: extern int PhysCloseCmd(Context ctx);
86: extern void PhysClose(Link l);
87: extern void PhysUp(Link l);
88: extern void PhysDown(Link l, const char *reason, const char *details);
89: extern void PhysIncoming(Link l);
90: extern int PhysGetUpperHook(Link l, char *path, char *hook);
91:
92: extern int PhysSetAccm(Link l, uint32_t xmit, u_int32_t recv);
93: extern int PhysSetCallingNum(Link l, char *buf);
94: extern int PhysSetCalledNum(Link l, char *buf);
95: extern int PhysGetSelfName(Link l, char *buf, size_t buf_len);
96: extern int PhysGetPeerName(Link l, char *buf, size_t buf_len);
97: extern int PhysGetSelfAddr(Link l, char *buf, size_t buf_len);
98: extern int PhysGetPeerAddr(Link l, char *buf, size_t buf_len);
99: extern int PhysGetPeerPort(Link l, char *buf, size_t buf_len);
100: extern int PhysGetPeerMacAddr(Link l, char *buf, size_t buf_len);
101: extern int PhysGetPeerIface(Link l, char *buf, size_t buf_len);
102: extern int PhysGetCallingNum(Link l, char *buf, size_t buf_len);
103: extern int PhysGetCalledNum(Link l, char *buf, size_t buf_len);
1.1.1.2 misho 104: extern u_short PhysGetMtu(Link l, int conf);
105: extern u_short PhysGetMru(Link l, int conf);
1.1 misho 106: extern int PhysIsBusy(Link l);
107:
108: extern int PhysInit(Link l);
109: extern int PhysInst(Link l, Link lt);
110: extern int PhysGet(Link l);
111: extern void PhysShutdown(Link l);
112: extern void PhysSetDeviceType(Link l, char *typename);
113: extern int PhysGetOriginate(Link l);
114: extern int PhysIsSync(Link l);
1.1.1.3 ! misho 115: extern int PhysStat(Context ctx, int ac, const char *const av[], const void *arg);
1.1 misho 116:
117: #endif
118:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>