server.h revision 74001
16059Samurai/*- 26059Samurai * Copyright (c) 1997 Brian Somers <brian@Awfulhak.org> 36059Samurai * All rights reserved. 46059Samurai * 56059Samurai * Redistribution and use in source and binary forms, with or without 66059Samurai * modification, are permitted provided that the following conditions 76059Samurai * are met: 86059Samurai * 1. Redistributions of source code must retain the above copyright 96059Samurai * notice, this list of conditions and the following disclaimer. 106059Samurai * 2. Redistributions in binary form must reproduce the above copyright 116059Samurai * notice, this list of conditions and the following disclaimer in the 126059Samurai * documentation and/or other materials provided with the distribution. 136059Samurai * 146059Samurai * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 156059Samurai * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 166059Samurai * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 176059Samurai * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 186059Samurai * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 196059Samurai * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 206059Samurai * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 216059Samurai * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 226059Samurai * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 236059Samurai * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 246059Samurai * SUCH DAMAGE. 256059Samurai * 266059Samurai * $FreeBSD: head/usr.sbin/ppp/server.h 74001 2001-03-08 23:51:50Z brian $ 276059Samurai */ 286059Samurai 296059Samuraistruct bundle; 306059Samurai 316059Samuraistruct server { 326059Samurai struct fdescriptor desc; 336059Samurai int fd; 346059Samurai 356059Samurai struct { 366059Samurai char passwd[50]; 376059Samurai 386059Samurai char sockname[PATH_MAX]; /* Points to local socket path */ 396059Samurai mode_t mask; 406059Samurai 416059Samurai u_short port; /* tcp socket */ 426059Samurai } cfg; 436059Samurai}; 446059Samurai 456059Samuraienum server_stat { 466059Samurai SERVER_OK, /* Diagnostic socket available */ 476059Samurai SERVER_INVALID, /* Bad args, can't be set up */ 486059Samurai SERVER_FAILED, /* Failed - lack of resources */ 496059Samurai SERVER_UNSET /* Not already set up */ 506059Samurai}; 516059Samurai 526059Samurai#define descriptor2server(d) \ 536059Samurai ((d)->type == SERVER_DESCRIPTOR ? (struct server *)(d) : NULL) 546059Samurai 556059Samuraiextern struct server server; 566059Samurai 576059Samuraiextern enum server_stat server_LocalOpen(struct bundle *, const char *, mode_t); 586059Samuraiextern enum server_stat server_TcpOpen(struct bundle *, u_short); 596059Samuraiextern enum server_stat server_Reopen(struct bundle *); 606059Samuraiextern int server_Close(struct bundle *); 616059Samuraiextern int server_Clear(struct bundle *); 626059Samurai