Annotation of embedaddon/mpd/src/phys.h, revision 1.1.1.1
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) */
67: };
68: typedef struct phystype *PhysType;
69:
70: /*
71: * VARIABLES
72: */
73:
74: extern const PhysType gPhysTypes[];
75: extern const char *gPhysStateNames[];
76:
77: /*
78: * FUNCTIONS
79: */
80:
81: extern int PhysOpenCmd(Context ctx);
82: extern void PhysOpen(Link l);
83: extern int PhysCloseCmd(Context ctx);
84: extern void PhysClose(Link l);
85: extern void PhysUp(Link l);
86: extern void PhysDown(Link l, const char *reason, const char *details);
87: extern void PhysIncoming(Link l);
88: extern int PhysGetUpperHook(Link l, char *path, char *hook);
89:
90: extern int PhysSetAccm(Link l, uint32_t xmit, u_int32_t recv);
91: extern int PhysSetCallingNum(Link l, char *buf);
92: extern int PhysSetCalledNum(Link l, char *buf);
93: extern int PhysGetSelfName(Link l, char *buf, size_t buf_len);
94: extern int PhysGetPeerName(Link l, char *buf, size_t buf_len);
95: extern int PhysGetSelfAddr(Link l, char *buf, size_t buf_len);
96: extern int PhysGetPeerAddr(Link l, char *buf, size_t buf_len);
97: extern int PhysGetPeerPort(Link l, char *buf, size_t buf_len);
98: extern int PhysGetPeerMacAddr(Link l, char *buf, size_t buf_len);
99: extern int PhysGetPeerIface(Link l, char *buf, size_t buf_len);
100: extern int PhysGetCallingNum(Link l, char *buf, size_t buf_len);
101: extern int PhysGetCalledNum(Link l, char *buf, size_t buf_len);
102: extern int PhysIsBusy(Link l);
103:
104: extern int PhysInit(Link l);
105: extern int PhysInst(Link l, Link lt);
106: extern int PhysGet(Link l);
107: extern void PhysShutdown(Link l);
108: extern void PhysSetDeviceType(Link l, char *typename);
109: extern int PhysGetOriginate(Link l);
110: extern int PhysIsSync(Link l);
111: extern int PhysStat(Context ctx, int ac, char *av[], void *arg);
112:
113: #endif
114:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>