home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 56 / af056sub.adf / parnfs.lha / netfs.h < prev    next >
C/C++ Source or Header  |  1993-12-02  |  2KB  |  102 lines

  1. /*
  2.  * $Id: netfs.h,v 1.1 1993/12/02 20:45:46 Rhialto Exp $
  3.  * $Log: netfs.h,v $
  4.  * Revision 1.1  1993/12/02  20:45:46  Rhialto
  5.  * Initial revision
  6.  *
  7.  *
  8.  * Network file system data structures
  9.  */
  10.  
  11. #include <stddef.h>
  12.  
  13. #ifndef CLIB_EXEC_PROTOS_H
  14. #include <clib/exec_protos.h>
  15. #endif
  16. #ifndef CLIB_ALIB_PROTOS_H
  17. #include <clib/alib_protos.h>
  18. #endif
  19.  
  20. #ifndef DOS_H
  21. #include "dos.h"
  22. #endif
  23.  
  24. typedef struct {
  25.     ULONG        nfl_FileLock;   /* Remote identifier */
  26.     ULONG        nfl_Validation;
  27. } NetFileLock;
  28.  
  29. typedef struct {
  30.     ULONG        nfh_FileHandle; /* Remote identifier */
  31.     ULONG        nfh_Validation;
  32. } NetFileHandle;
  33.  
  34. typedef enum {
  35.     pt_Retry = -1,
  36.     pt_Request, pt_Reply, pt_AsyncReply,
  37.     pt_Reset, pt_ResetReply
  38. } Type;
  39.  
  40. typedef struct Packet {
  41.     BYTE        p_Type;
  42.     BYTE        p_Origin;
  43.     BYTE        p_Seq;        /* Sequence number for reliable transnission */
  44.     BYTE        p_Ack;        /* Acknowledgement */
  45. #define COMMONSIZE  4
  46.     union {
  47.     /* Format for pt_Request */
  48.     struct pu1 {
  49.         ULONG        p1_Action;
  50.         ULONG        p1_Arg[6];
  51.     } p_Request;
  52.     /* Format for pt_(Async)Reply */
  53.     struct pu2 {
  54.         ULONG        p2_Res1;
  55.         ULONG        p2_Res2;
  56.         ULONG        p2_Data[0];
  57.     } p_Reply;
  58.     /* Format for pt_Reset(Reply) */
  59.     struct {
  60.         ULONG        p3_Validation;
  61.     } p_Reset;
  62.     char        p_Pad[3*4+256+256];
  63.     } p_Misc;
  64. } Packet;
  65.  
  66. #define p_Action    p_Misc.p_Request.p1_Action
  67. #define p_Arg        p_Misc.p_Request.p1_Arg
  68.  
  69. #define p_Res1        p_Misc.p_Reply.p2_Res1
  70. #define p_Res2        p_Misc.p_Reply.p2_Res2
  71. #define p_Data        p_Misc.p_Reply.p2_Data
  72.  
  73. #define p_Validation p_Misc.p_Reset.p3_Validation
  74.  
  75. #define REQSIZE(nargs)  (offsetof(Packet, p_Arg[0])+4*(nargs))
  76.  
  77. /* Standard reply size */
  78. /*#define STDREPLY    offsetof(Packet, p_Data[0])*/
  79. #define STDREPLY    (COMMONSIZE+sizeof(struct pu2))
  80.  
  81. #define MAXPKT        (COMMONSIZE+sizeof(struct pu1))
  82. #define MAXDATA     4096
  83. #define PKTSIZE     (MAXPKT + MAXDATA)
  84.  
  85. #define min(a,b)        ((a) < (b)? (a) : (b))
  86.  
  87. #define SRV_ADDR    1
  88. #define CLI_ADDR    2
  89. #define NETFS_PORT    0x25C        /* randomly chosen */
  90.  
  91. #define PENDREADS    8
  92.  
  93. #ifndef Prototype
  94. #define Prototype   extern
  95. #endif
  96. #ifndef Local
  97. #define Local        static
  98. #endif
  99.  
  100. #include "proto.h"
  101.  
  102.