1 #ifndef _CLIB_NETLIB_PROTOS_H_
    2 #define _CLIB_NETLIB_PROTOS_H_
    3 /*
    4  * netlib.lib C prototypes
    5  *
    6  * Copyright © 2002 The MorphOS Development Team, All Rights Reserved.
    7  *
    8  * $Id: netlib_protos.h,v 1.2 2025/09/27 22:11:23 piru Exp $
    9  */
   10 
   11 #ifndef EXEC_TYPES_H
   12 #include <exec/types.h>
   13 #endif
   14 #ifndef _SYS_TYPES_H_
   15 #include <sys/types.h>
   16 #endif
   17 #ifndef _SYS_CDEFS_H_
   18 #include <sys/cdefs.h>
   19 #endif
   20 #ifndef EXEC_LIBRARIES_H
   21 struct Library;
   22 #endif
   23 #ifndef _SYS__TIMEVAL_H_
   24 #include <sys/_timeval.h>
   25 #endif
   26 #ifndef _SYS_SOCKET_H_
   27 #include <sys/socket.h>
   28 #endif
   29 #ifndef _NETDB_H_
   30 struct hostent;
   31 struct netent;
   32 struct servent;
   33 struct protoent;
   34 #endif
   35 #ifndef _NETINET_IN_H_
   36 #include <netinet/in.h>
   37 #endif
   38 #ifndef DOS_DOS_H
   39 #include <dos/dos.h>
   40 #endif
   41 #ifndef DOS_RDARGS_H
   42 #include <dos/rdargs.h>
   43 #endif
   44 #ifndef _SYS_STAT_H
   45 #include <sys/stat.h>
   46 #endif
   47 
   48 #ifndef _STDARG_H
   49 #include <stdarg.h>
   50 #endif
   51 
   52 
   53 #if 1
   54 
   55 #ifdef __cplusplus
   56 extern "C" {
   57 #endif /* __cplusplus */
   58 
   59 /* ioctl.c */
   60 int ioctl(int fd, unsigned int request, char *argp);
   61 
   62 ULONG VCSPrintf(struct CSource *, const char *, va_list);
   63 ULONG CSPrintf(struct CSource *, const char *, ...);
   64 
   65 /* printfault.c */
   66 void  PrintNetFault(LONG code, const UBYTE *banner);
   67 
   68 /* printuserfault.c */
   69 void  PrintUserFault(LONG code, const UBYTE *banner);
   70 
   71 /* herror.c */
   72 void  herror(const char *banner);
   73 
   74 /* perror.c */
   75 void  perror(const char *banner);
   76 
   77 /* strerror.c */
   78 char *strerror(int code);
   79 
   80 #else
   81 /* access.c */
   82 int __access(const char *name, int mode);
   83 
   84 /* autoinit.c */
   85 extern int h_errno;
   86 extern struct Library *SocketBase;
   87 LONG  _STI_200_openSockets(void);
   88 void  _STD_200_closeSockets(void);
   89 
   90 /* chmod.c */
   91 int chmod(const char *path, int mode);
   92 
   93 /* dosio_init.c */
   94 extern BPTR __dosio_files[3];
   95 long  _STI_500_dosio_init(void);
   96 
   97 /* dosio_sprintf.c */
   98 ULONG VCSPrintf(struct CSource *, const char *, va_list);
   99 ULONG CSPrintf(struct CSource *, const char *, ...);
  100 ULONG VSPrintf(STRPTR, const char *, va_list);
  101 ULONG SPrintf(STRPTR, const char *, ...);
  102 
  103 /* dummy.c */
  104 struct hostent  *gethostent(void);
  105 struct netent  *getnetent(void);
  106 struct servent  *getservent(void);
  107 struct protoent *getprotoent(void);
  108 
  109 /* fhopen.c */
  110 int fhopen(long file, int mode);
  111 
  112 /* getopt.c */
  113 extern int opterr;
  114 extern int optind;
  115 extern int optopt;
  116 extern char *optarg;
  117 int   getopt(int argc, char * const argv[], char const *opts);
  118 
  119 /* getpid.c */
  120 pid_t getpid(void);
  121 
  122 /* gettimeofday.c */
  123 int   gettimeofday(struct timeval *tp, struct timezone *tzp);
  124 
  125 /* herror.c */
  126 void  herror(const char *banner);
  127 
  128 /* init_inet_daemon.c */
  129 int init_inet_daemon(void);
  130 
  131 /* init_usergroup.c */
  132 extern struct Library *UserGroupBase;
  133 LONG  _STI_200_openUserGroup(void);
  134 void  _STD_200_closeUserGroup(void);
  135 
  136 /* ioctl.c */
  137 int ioctl(int fd, unsigned int request, char *argp);
  138 
  139 /* iomode.c */
  140 int iomode(int fd, int mode);
  141 
  142 /* isatty.c */
  143 int isatty(int fd);
  144 
  145 /* lineread.c */
  146 int   lineRead(struct LineRead * rl);
  147 
  148 /* perror.c */
  149 void  perror(const char *banner);
  150 
  151 /* popen.c */
  152 #ifndef _STDIO_H
  153 struct __iobuf; /* typedef struct __iobuf FILE */
  154 #endif
  155 struct __iobuf *popen(const char *cmd, const char *mode);
  156 struct __iobuf *popenl(const char *arg0, ...);
  157 int pclose(struct __iobuf *fptr);
  158 void  _STD_4000_popen(void);
  159 char *mktemp(char * template);
  160 
  161 /* printfault.c */
  162 void  PrintNetFault(LONG code, const UBYTE *banner);
  163 
  164 /* printuserfault.c */
  165 void  PrintUserFault(LONG code, const UBYTE *banner);
  166 
  167 /* rcmd.c */
  168 int   rcmd(char **, int, const char *, const char *, const char *, int *);
  169 int   rresvport(int *alport);
  170 
  171 /* serveraccept.c */
  172 long serveraccept(char *pname, struct sockaddr_in *ha);
  173 
  174 /* set_socket_stdio.c */
  175 int set_socket_stdio(int sock);
  176 
  177 /* setegid.c */
  178 int setegid(gid_t g);
  179 
  180 /* seteuid.c */
  181 int seteuid(uid_t u);
  182 
  183 /* sleep.c */
  184 void sleep(unsigned int secs);
  185 
  186 /* stat.c */
  187 int stat(const char *name, struct stat *st);
  188 
  189 /* strerror.c */
  190 char *strerror(int code);
  191 
  192 /* stubs.c */
  193 #if !defined(__SASC) || !defined(_OPTINLINE) /* these are inlined for SAS/C */
  194 char * inet_ntoa(struct in_addr addr);
  195 struct in_addr inet_makeaddr(int net, int host);
  196 unsigned long inet_lnaof(struct in_addr addr);
  197 unsigned long inet_netof(struct in_addr addr);
  198 int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exeptfds,
  199 	   struct timeval *timeout);
  200 #endif
  201 
  202 /* syslog.c */
  203 void  openlog(const char *ident, int logstat, int logfac);
  204 void  closelog(void);
  205 int   setlogmask(int pmask);
  206 
  207 /* timerinit.c */
  208 extern long __local_to_GMT;
  209 extern struct Library *TimerBase; /* actually struct Device * */
  210 LONG  _STI_200_openTimer(void);
  211 void  _STD_200_closeTimer(void);
  212 
  213 /* usleep.c */
  214 void usleep(unsigned int usecs);
  215 
  216 /* utime.c */
  217 #ifndef UTIME_H
  218 struct utimbuf;
  219 #endif
  220 int utime(const char *name, const struct utimbuf *times);
  221 
  222 #ifndef _IOS1_H
  223 struct UFB;
  224 #endif
  225 
  226 /* _allocufb.c */
  227 struct UFB * __allocufb(int *fdp);
  228 
  229 /* _chkufb.c */
  230 long  _STI_1000_install_AmiTCP_callback(void);
  231 long ASM SAVEDS fdCallback(__reg(d0, int fd), __reg(d1, int action));
  232 struct UFB * __chkufb(int fd);
  233 
  234 /* _close.c */
  235 int __close(int fd);
  236 
  237 /* _dup.c */
  238 /* _dup2.c */
  239 
  240 /* _fstat.c */
  241 int fstat(int fd, struct stat *st);
  242 
  243 /* _lseek.c */
  244 long __lseek(int fd, long rpos, int mode);
  245 
  246 /* _open.c */
  247  int __open(const char *name, int mode, ...);
  248 
  249 /* _read.c */
  250 int __read(int fd, void *buffer, unsigned int length);
  251 
  252 /* _write.c */
  253 int __write(int fd, const void *buffer, unsigned int length);
  254 
  255 #ifdef __cplusplus
  256 }
  257 #endif /* __cplusplus */
  258 
  259 #endif
  260 
  261 #endif /* !_CLIB_NETLIB_PROTOS_H_ */