server.h revision 71657
1219820Sjeff/*- 2219820Sjeff * Copyright (c) 1997 Brian Somers <brian@Awfulhak.org> 3219820Sjeff * All rights reserved. 4219820Sjeff * 5219820Sjeff * Redistribution and use in source and binary forms, with or without 6219820Sjeff * modification, are permitted provided that the following conditions 7219820Sjeff * are met: 8219820Sjeff * 1. Redistributions of source code must retain the above copyright 9219820Sjeff * notice, this list of conditions and the following disclaimer. 10219820Sjeff * 2. Redistributions in binary form must reproduce the above copyright 11219820Sjeff * notice, this list of conditions and the following disclaimer in the 12219820Sjeff * documentation and/or other materials provided with the distribution. 13219820Sjeff * 14219820Sjeff * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15219820Sjeff * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16219820Sjeff * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17219820Sjeff * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18219820Sjeff * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19219820Sjeff * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20219820Sjeff * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21219820Sjeff * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22219820Sjeff * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23219820Sjeff * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24219820Sjeff * SUCH DAMAGE. 25219820Sjeff * 26219820Sjeff * $FreeBSD: head/usr.sbin/ppp/server.h 71657 2001-01-26 01:41:34Z brian $ 27219820Sjeff */ 28219820Sjeff 29219820Sjeffstruct bundle; 30219820Sjeff 31219820Sjeffstruct server { 32219820Sjeff struct fdescriptor desc; 33219820Sjeff int fd; 34219820Sjeff 35331772Shselasky struct { 36331772Shselasky char passwd[50]; 37219820Sjeff 38219820Sjeff char sockname[MAXPATHLEN]; /* Points to local socket path */ 39219820Sjeff mode_t mask; 40219820Sjeff 41219820Sjeff u_short port; /* tcp socket */ 42219820Sjeff } cfg; 43219820Sjeff}; 44219820Sjeff 45219820Sjeffenum server_stat { 46278886Shselasky SERVER_OK, /* Diagnostic socket available */ 47331769Shselasky SERVER_INVALID, /* Bad args, can't be set up */ 48331769Shselasky SERVER_FAILED, /* Failed - lack of resources */ 49278886Shselasky SERVER_UNSET /* Not already set up */ 50219820Sjeff}; 51219820Sjeff 52219820Sjeff#define descriptor2server(d) \ 53219820Sjeff ((d)->type == SERVER_DESCRIPTOR ? (struct server *)(d) : NULL) 54219820Sjeff 55331769Shselaskyextern struct server server; 56331769Shselasky 57331769Shselaskyextern enum server_stat server_LocalOpen(struct bundle *, const char *, mode_t); 58331769Shselaskyextern enum server_stat server_TcpOpen(struct bundle *, u_short); 59331769Shselaskyextern enum server_stat server_Reopen(struct bundle *); 60331769Shselaskyextern int server_Close(struct bundle *); 61331769Shselaskyextern int server_Clear(struct bundle *); 62331769Shselasky