1 #ifdef USE_XXX 2 3 /* -*-C-*- 4 * 5 * Project : TRACE 6 * 7 * File : socklib.h 8 * 9 * Description 10 * 11 * Copyright (C) 1991 by Arne Helme, The TRACE project 12 * 13 * Rights to use this source is granted for all non-commercial and research 14 * uses. Creation of derivate forms of this software may be subject to 15 * restriction. Please obtain written permission from the author. 16 * 17 * This software is provided "as is" without any express or implied warranty. 18 * 19 * RCS: $Id$ 20 * 21 * Revision 1.1.1.1 1992/05/11 12:32:34 bjoerns 22 * XPilot v1.0 23 * 24 * Revision 1.2 91/10/02 08:38:20 08:38:20 arne (Arne Helme) 25 * "ANSI C prototypes added." 26 * 27 * Revision 1.1 91/10/02 08:34:53 08:34:53 arne (Arne Helme) 28 * Initial revision 29 * 30 */ 31 32 #ifndef _SOCKLIB_INCLUDED 33 #define _SOCKLIB_INCLUDED 34 35 /* Error values and their meanings */ 36 #define SL_ESOCKET 0 /* socket system call error */ 37 #define SL_EBIND 1 /* bind system call error */ 38 #define SL_ELISTEN 2 /* listen system call error */ 39 #define SL_EHOSTNAME 3 /* Invalid host name format */ 40 #define SL_ECONNECT 5 /* connect system call error */ 41 #define SL_ESHUTD 6 /* shutdown system call error */ 42 #define SL_ECLOSE 7 /* close system call error */ 43 #define SL_EWRONGHOST 8 /* message arrived from unspec. host */ 44 #define SL_ENORESP 9 /* No response */ 45 #define SL_ERECEIVE 10 /* Receive error */ 46 47 extern void SetTimeout(int, int); 48 extern int GetPortNum(int); 49 extern int SetSocketReceiveBufferSize(int, int); 50 extern int SetSocketSendBufferSize(int, int); 51 extern int SetSocketNonBlocking(int, int); 52 extern int GetSocketError(int); 53 extern int SocketReadable(int); 54 extern int CreateDgramSocket(int); 55 extern int DgramConnect(int, char *, int); 56 extern int DgramSend(int, char *, int, char *, int); 57 extern int DgramReceiveAny(int, char *, int); 58 extern int DgramReceive(int, char *, char *, int); 59 extern int DgramReply(int, char *, int); 60 extern int DgramRead(int fd, char *rbuf, int size); 61 extern int DgramWrite(int fd, char *wbuf, int size); 62 extern char *DgramLastaddr(void); 63 extern char *DgramLastname(void); 64 extern int DgramLastport(void); 65 extern void DgramClose(int); 66 extern void GetLocalHostName(char *, unsigned); 67 68 #if !defined(select) && defined(__linux__) 69 #define select(N, R, W, E, T) select((N), \ 70 (fd_set*)(R), (fd_set*)(W), (fd_set*)(E), (T)) 71 #endif 72 73 #endif /* _SOCKLIB_INCLUDED */ 74 75 76 #endif /* USE_XXX */ 77