1 #ifndef CLIB_SOCKET_PROTOS_H
    2 #define CLIB_SOCKET_PROTOS_H
    3 /*
    4  * Prototypes of AmiTCP/IP bsdsocket.library
    5  * 
    6  * Copyright © 1994-2013 AmiTCP/IP Group & The MorphOS Team,
    7  * Network Solutions Development, Inc.
    8  * All rights reserved.
    9  *
   10  * $Id: socket_protos.h,v 1.6 2025/09/27 22:11:23 piru Exp $
   11  */
   12 
   13 #ifndef EXEC_TYPES_H
   14 #include <exec/types.h>
   15 #endif
   16 
   17 #ifndef UTILITY_TAGITEM_H
   18 #include <utility/tagitem.h>
   19 #endif
   20 
   21 #ifndef _SYS_TYPES_H_
   22 #include <sys/types.h>
   23 #endif
   24 
   25 #ifndef _SYS__TIMEVAL_H_
   26 #include <sys/_timeval.h>
   27 #endif
   28 
   29 #ifndef _SYS_SOCKET_H_
   30 #include <sys/socket.h>
   31 #endif
   32 
   33 #ifndef _NETINET_IN_H_
   34 #include <netinet/in.h>
   35 #endif
   36 
   37 #ifdef __cplusplus
   38 extern "C" {
   39 #endif /* __cplusplus */
   40 
   41 LONG socket(LONG domain, LONG type, LONG protocol);
   42 LONG bind(LONG s, const struct sockaddr *name, LONG namelen);
   43 LONG listen(LONG s, LONG backlog);
   44 LONG accept(LONG s, struct sockaddr *addr, LONG *addrlen);
   45 LONG connect(LONG s, const struct sockaddr *name, LONG namelen);
   46 LONG send(LONG s, const UBYTE *msg, LONG len, LONG flags);
   47 LONG sendto(LONG s, const UBYTE *msg, LONG len, LONG flags, 
   48 		  const struct sockaddr *to, LONG tolen);
   49 LONG sendmsg(LONG s, struct msghdr * msg, LONG flags);
   50 LONG recv(LONG s, UBYTE *buf, LONG len, LONG flags);
   51 LONG recvfrom(LONG s, UBYTE *buf, LONG len, LONG flags, 
   52 		    struct sockaddr *from, LONG *fromlen);
   53 LONG recvmsg(LONG s, struct msghdr * msg, LONG flags);
   54 LONG shutdown(LONG s, LONG how);
   55 LONG setsockopt(LONG s, LONG level, LONG optname, 
   56 		     const void *optval, LONG optlen);
   57 LONG getsockopt(LONG s, LONG level, LONG optname, 
   58 		     void *optval, LONG *optlen);
   59 LONG getsockname(LONG s, struct sockaddr *name, LONG *namelen);
   60 LONG getpeername(LONG s, struct sockaddr *name, LONG *namelen);
   61 
   62 LONG IoctlSocket(LONG d, ULONG request, char *argp);
   63 LONG CloseSocket(LONG d);
   64 LONG WaitSelect(LONG nfds, fd_set *readfds, fd_set *writefds, fd_set *exeptfds,
   65 		struct timeval *timeout, ULONG *maskp);
   66 
   67 LONG Dup2Socket(LONG fd1, LONG fd2);
   68 
   69 LONG getdtablesize(void);
   70 void SetSocketSignals(ULONG _SIGINTR, ULONG _SIGIO, ULONG _SIGURG);
   71 LONG SetErrnoPtr(void *errno_p, LONG size);
   72 LONG SocketBaseTagList(struct TagItem *tagList);
   73 #if !defined(USE_INLINE_STDARG)
   74 LONG SocketBaseTags(LONG tag, ...);
   75 #endif
   76 
   77 LONG GetSocketEvents(ULONG *eventmaskp);
   78 
   79 LONG Errno(void);
   80 
   81 LONG gethostname(STRPTR hostname, LONG size);
   82 ULONG gethostid(void);
   83 
   84 LONG ObtainSocket(LONG id, LONG domain, LONG type, LONG protocol);
   85 LONG ReleaseSocket(LONG fd, LONG id);
   86 LONG ReleaseCopyOfSocket(LONG fd, LONG id);
   87 
   88 /* Arpa/inet functions */
   89 ULONG inet_addr(const UBYTE *);
   90 ULONG inet_network(const UBYTE *);
   91 char *Inet_NtoA(ULONG s_addr);
   92 ULONG Inet_MakeAddr(ULONG net, ULONG lna);
   93 ULONG Inet_LnaOf(LONG s_addr);
   94 ULONG Inet_NetOf(LONG s_addr);
   95 
   96 /* NetDB functions */
   97 struct hostent  *gethostbyname(const UBYTE *name);
   98 struct hostent  *gethostbyaddr(const UBYTE *addr, LONG len, LONG type);
   99 struct netent   *getnetbyname(const UBYTE *name);
  100 struct netent   *getnetbyaddr(LONG net, LONG type);
  101 struct servent  *getservbyname(const UBYTE *name, const UBYTE *proto);
  102 struct servent  *getservbyport(LONG port, const UBYTE *proto);
  103 struct protoent *getprotobyname(const UBYTE *name);
  104 struct protoent *getprotobynumber(LONG proto);
  105 
  106 /* Syslog functions */
  107 void vsyslog(ULONG pri, const char *fmt, LONG *);
  108 #if !defined(USE_INLINE_STDARG)
  109 void syslog(ULONG pri, const char *fmt, ...);
  110 #endif
  111 
  112 
  113 #ifdef __cplusplus
  114 }
  115 #endif /* __cplusplus */
  116 
  117 #endif /* !CLIB_SOCKET_PROTOS_H */