xref: /freebsd/usr.sbin/ppp/descriptor.h (revision f013f33ee27e881a82929e677fab7303de58d27b)
142d4d396SBrian Somers /*-
242d4d396SBrian Somers  * Copyright (c) 1998 Brian Somers <brian@Awfulhak.org>
342d4d396SBrian Somers  * All rights reserved.
442d4d396SBrian Somers  *
542d4d396SBrian Somers  * Redistribution and use in source and binary forms, with or without
642d4d396SBrian Somers  * modification, are permitted provided that the following conditions
742d4d396SBrian Somers  * are met:
842d4d396SBrian Somers  * 1. Redistributions of source code must retain the above copyright
942d4d396SBrian Somers  *    notice, this list of conditions and the following disclaimer.
1042d4d396SBrian Somers  * 2. Redistributions in binary form must reproduce the above copyright
1142d4d396SBrian Somers  *    notice, this list of conditions and the following disclaimer in the
1242d4d396SBrian Somers  *    documentation and/or other materials provided with the distribution.
1342d4d396SBrian Somers  *
1442d4d396SBrian Somers  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1542d4d396SBrian Somers  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1642d4d396SBrian Somers  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1742d4d396SBrian Somers  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1842d4d396SBrian Somers  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1942d4d396SBrian Somers  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2042d4d396SBrian Somers  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2142d4d396SBrian Somers  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2242d4d396SBrian Somers  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2342d4d396SBrian Somers  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2442d4d396SBrian Somers  * SUCH DAMAGE.
2542d4d396SBrian Somers  *
2697d92980SPeter Wemm  * $FreeBSD$
2742d4d396SBrian Somers  */
2842d4d396SBrian Somers 
2942d4d396SBrian Somers #define PHYSICAL_DESCRIPTOR (1)
3085b542cfSBrian Somers #define SERVER_DESCRIPTOR (2)
3185b542cfSBrian Somers #define PROMPT_DESCRIPTOR (3)
32b6dec9f0SBrian Somers #define CHAT_DESCRIPTOR (4)
333006ec67SBrian Somers #define DATALINK_DESCRIPTOR (5)
342f786681SBrian Somers #define BUNDLE_DESCRIPTOR (6)
351fa665f5SBrian Somers #define MPSERVER_DESCRIPTOR (7)
36f0cdd9c0SBrian Somers #define RADIUS_DESCRIPTOR (8)
3758330d7bSBrian Somers #define CHAP_DESCRIPTOR (9)
3842d4d396SBrian Somers 
392764b86aSBrian Somers struct bundle;
402764b86aSBrian Somers 
41f013f33eSBrian Somers struct fdescriptor {
4242d4d396SBrian Somers   int type;
4342d4d396SBrian Somers 
44f013f33eSBrian Somers   int (*UpdateSet)(struct fdescriptor *, fd_set *, fd_set *, fd_set *, int *);
45f013f33eSBrian Somers   int (*IsSet)(struct fdescriptor *, const fd_set *);
46f013f33eSBrian Somers   void (*Read)(struct fdescriptor *, struct bundle *, const fd_set *);
47f013f33eSBrian Somers   int (*Write)(struct fdescriptor *, struct bundle *, const fd_set *);
4842d4d396SBrian Somers };
4942d4d396SBrian Somers 
5042d4d396SBrian Somers #define descriptor_UpdateSet(d, r, w, e, n) ((*(d)->UpdateSet)(d, r, w, e, n))
5142d4d396SBrian Somers #define descriptor_IsSet(d, s) ((*(d)->IsSet)(d, s))
52b77776a7SBrian Somers #define descriptor_Read(d, b, f) ((*(d)->Read)(d, b, f))
53f4768038SBrian Somers #define descriptor_Write(d, b, f) ((*(d)->Write)(d, b, f))
54