1c39934eaSBrian Somers /*- 2c39934eaSBrian Somers * Copyright (c) 1997 Brian Somers <brian@Awfulhak.org> 3c39934eaSBrian Somers * All rights reserved. 4c39934eaSBrian Somers * 5c39934eaSBrian Somers * Redistribution and use in source and binary forms, with or without 6c39934eaSBrian Somers * modification, are permitted provided that the following conditions 7c39934eaSBrian Somers * are met: 8c39934eaSBrian Somers * 1. Redistributions of source code must retain the above copyright 9c39934eaSBrian Somers * notice, this list of conditions and the following disclaimer. 10c39934eaSBrian Somers * 2. Redistributions in binary form must reproduce the above copyright 11c39934eaSBrian Somers * notice, this list of conditions and the following disclaimer in the 12c39934eaSBrian Somers * documentation and/or other materials provided with the distribution. 13c39934eaSBrian Somers * 14c39934eaSBrian Somers * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15c39934eaSBrian Somers * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16c39934eaSBrian Somers * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17c39934eaSBrian Somers * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18c39934eaSBrian Somers * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19c39934eaSBrian Somers * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20c39934eaSBrian Somers * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21c39934eaSBrian Somers * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22c39934eaSBrian Somers * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23c39934eaSBrian Somers * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24c39934eaSBrian Somers * SUCH DAMAGE. 25c39934eaSBrian Somers * 2697d92980SPeter Wemm * $FreeBSD$ 2775240ed1SBrian Somers */ 2875240ed1SBrian Somers 292764b86aSBrian Somers struct bundle; 304ef16f24SBrian Somers 3177ff88adSBrian Somers struct server { 32f013f33eSBrian Somers struct fdescriptor desc; 3377ff88adSBrian Somers int fd; 3474457d3dSBrian Somers 3574457d3dSBrian Somers struct { 36b6217683SBrian Somers char passwd[50]; 37565e35e5SBrian Somers 3874457d3dSBrian Somers char sockname[MAXPATHLEN]; /* Points to local socket path */ 3974457d3dSBrian Somers mode_t mask; 40565e35e5SBrian Somers 41565e35e5SBrian Somers u_short port; /* tcp socket */ 4274457d3dSBrian Somers } cfg; 4374457d3dSBrian Somers }; 4474457d3dSBrian Somers 4574457d3dSBrian Somers enum server_stat { 4674457d3dSBrian Somers SERVER_OK, /* Diagnostic socket available */ 4774457d3dSBrian Somers SERVER_INVALID, /* Bad args, can't be set up */ 4874457d3dSBrian Somers SERVER_FAILED, /* Failed - lack of resources */ 4974457d3dSBrian Somers SERVER_UNSET /* Not already set up */ 5077ff88adSBrian Somers }; 5177ff88adSBrian Somers 5277ff88adSBrian Somers #define descriptor2server(d) \ 5377ff88adSBrian Somers ((d)->type == SERVER_DESCRIPTOR ? (struct server *)(d) : NULL) 5477ff88adSBrian Somers 5577ff88adSBrian Somers extern struct server server; 561ae349f5Scvs2svn 5774457d3dSBrian Somers extern enum server_stat server_LocalOpen(struct bundle *, const char *, mode_t); 5874457d3dSBrian Somers extern enum server_stat server_TcpOpen(struct bundle *, u_short); 5974457d3dSBrian Somers extern enum server_stat server_Reopen(struct bundle *); 60dd7e2610SBrian Somers extern int server_Close(struct bundle *); 6174457d3dSBrian Somers extern int server_Clear(struct bundle *); 62