home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / gcc / ixemulsrc.lha / ixemul / ixnet / ixnet.h < prev    next >
C/C++ Source or Header  |  1996-12-11  |  4KB  |  163 lines

  1. /*
  2.  *  This file is part of ixnet.library for the Amiga.
  3.  *  Copyright (C) 1996 Jeff Shepherd
  4.  *
  5.  *  This library is free software; you can redistribute it and/or
  6.  *  modify it under the terms of the GNU Library General Public
  7.  *  License as published by the Free Software Foundation; either
  8.  *  version 2 of the License, or (at your option) any later version.
  9.  *
  10.  *  This library is distributed in the hope that it will be useful,
  11.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.  *  Library General Public License for more details.
  14.  *
  15.  *  You should have received a copy of the GNU Library General Public
  16.  *  License along with this library; if not, write to the Free
  17.  *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  *
  19.  *  $Id:$
  20.  *
  21.  *  $Log:$
  22.  */
  23.  
  24. #ifndef _IXNET_H_
  25. #define _IXNET_H_
  26.  
  27. #ifdef START
  28.  
  29. /* definitions for the assembler startup file */
  30.  
  31. /* when I've REALLY lots of free time, I'll rewrite header files, but now... */
  32.  
  33. /* amazingly works, contains only defines ;-)) */
  34. #include <exec/alerts.h>
  35.  
  36. #define _LVOOpenLibrary     -0x228
  37. #define _LVOCloseLibrary    -0x19e
  38. #define _LVOAlert        -0x6c
  39. #define _LVOFreeMem        -0xd2
  40. #define _LVORemove        -0xfc
  41.  
  42. #define RTC_MATCHWORD    0x4afc
  43. #define RTF_AUTOINIT    (1<<7)
  44.  
  45. #define LIBF_CHANGED    (1<<1)
  46. #define LIBF_SUMUSED    (1<<2)
  47. /* seems there is an assembler bug in expression evaluation here.. */
  48. #define LIBF_CHANGED_SUMUSED 0x6
  49. #define LIBF_DELEXP    (1<<3)
  50. #define LIBB_DELEXP    3
  51.  
  52. #define LN_TYPE     8
  53. #define LN_NAME     10
  54. #define NT_LIBRARY    9
  55. #define MP_FLAGS    14
  56. #define PA_IGNORE    2
  57.  
  58. #define INITBYTE(field,val)     .word 0xe000; .word (field); .byte (val); .byte 0
  59. #define INITWORD(field,val)     .word 0xd000; .word (field); .word (val)
  60. #define INITLONG(field,val)     .word 0xc000; .word (field); .long (val)
  61.  
  62. /*
  63.  * our library base..
  64.  */
  65.  
  66. /* struct library */
  67. #define IXNETBASE_NODE       0
  68. #define IXNETBASE_FLAGS    14
  69. #define IXNETBASE_NEGSIZE  16
  70. #define IXNETBASE_POSSIZE  18
  71. #define IXNETBASE_VERSION  20
  72. #define IXNETBASE_REVISION 22
  73. #define IXNETBASE_IDSTRING 24
  74. #define IXNETBASE_SUM       28
  75. #define IXNETBASE_OPENCNT  32
  76. #define IXNETBASE_LIBRARY  34  /* size of library */
  77.  
  78. /* custom part */
  79. #define IXNETBASE_MYFLAGS       (IXNETBASE_LIBRARY + 0)
  80. #define IXNETBASE_SEGLIST       (IXNETBASE_MYFLAGS + 2)
  81. #define IXNETBASE_C_PRIVATE       (IXNETBASE_SEGLIST + 4)
  82.  
  83.  
  84. #else  /* C-part */
  85.  
  86. #include <exec/types.h>
  87. #include <exec/libraries.h>
  88. #include <exec/execbase.h>
  89. #include <exec/ports.h>
  90. #include <libraries/dosextens.h>
  91.  
  92. #include <sys/types.h>
  93.  
  94. #ifdef _KERNEL
  95. #define _INTERNAL_FILE
  96. #endif
  97.  
  98. #include <sys/file.h>
  99. #include <sys/param.h>
  100. #include <packets.h>
  101. #include <signal.h>
  102.  
  103. #ifdef _KERNEL
  104. #include <user.h>
  105. #endif
  106.  
  107. #include <errno.h>
  108.  
  109. struct ixnet_base {
  110.     struct Library     ixnet_lib;
  111. #ifdef _KERNEL
  112.     unsigned char      ix_myflags;     /* used by start.s */
  113.     unsigned char      ix_pad;
  114.     BPTR           ix_seg_list;    /* used by start.s */
  115.  
  116.     LONG           dummy;
  117. #endif
  118. };
  119.  
  120. /*
  121.  * ixnet.library stuff -  don't peek into this structure yourself
  122.  */
  123. struct ixnet {
  124.     void            *u_InetBase;
  125.     void            *u_SockBase;
  126.     void            *u_TCPBase;
  127.     void            *u_UserGroupBase;
  128.     int            u_sigurg;
  129.     int            u_sigio;
  130.     int            u_networkprotocol;
  131.     int            sock_id;     /* used for AS225 to reply to inetd message */
  132.     short            u_daemon;    /* 1 if started from inetd */
  133.     char            *u_progname; /* useful pointer */
  134. };
  135.  
  136. extern struct ixnet_base *ixnetbase;
  137.  
  138. #include "ixemul.h"
  139. #include <stdio.h>
  140.  
  141. #define h_errno (* u.u_h_errno)
  142.  
  143. /* need to do this so I don't get unresolved symbols */
  144. #undef stdin
  145. #undef stdout
  146. #undef stderr
  147. #define stdin    (u.u_sF[0])
  148. #define stdout    (u.u_sF[1])
  149. #define stderr    (u.u_sF[2])
  150.  
  151. #include "usergroup.h"
  152. #include "amitcp.h"
  153. #include "as225.h"
  154.  
  155. /* I need these prototypes but <sys/file.h> includes <fcntl.h>
  156.  * with _KERNEL defined hence not including these
  157.  */
  158. int    open __P((const char *, int, ...));
  159. int    fcntl __P((int, int, ...));
  160.  
  161. #endif /* START */
  162. #endif /* IXNET_H */
  163.