home *** CD-ROM | disk | FTP | other *** search
- /* Headers for the handling of RPC
-
- ©1999 Joseph Walton
-
- This software is distributed under the terms of the GNU General Public
- License; either version 2 of the License, or (at your option) any
- later version.
- */
-
- #ifndef NFSD_RPC_H
- #define NFSD_RPC_H
-
- #include <exec/types.h>
- #include <sys/types.h>
-
- #include <netinet/in.h>
-
- /* The type that XDR takes on the wire */
- typedef LONG int32;
-
- #define SINT32 (sizeof(int32))
-
- #define INT32S(bytes) (((bytes) + 3) / SINT32)
-
- #define G_INT(x) (int)ntohl(x)
- #define G_UINT(x) (unsigned int)ntohl(x)
-
- #define G_ENUM(x) G_INT(x)
-
- #define P_INT(x) (int32)htonl(x)
- #define P_UINT(x) (int32)htonl(x)
-
- #define P_ENUM(x) G_INT(x)
- #define P_ENUM_FALSE P_ENUM(0)
- #define P_ENUM_TRUE P_ENUM(1)
-
- /* What kind of RPC are we concerned with? */
- #define RPC_VERSION 2
-
- // Kinds of message
- #define CALL 0
- #define REPLY 1
-
- // Status of a reply
- #define MSG_ACCEPTED 0
- #define MSG_DENIED 1
-
- // Reasons for rejecting message
- #define RPC_MISMATCH 0
- #define AUTH_ERROR 1
-
- // Reasons for AUTH_ERROR
- #define AUTH_TOOWEAK 5
- #define AUTH_FAILED 7
-
- // Status of an accepted message
- #define SUCCESS 0
- #define PROG_UNAVAIL 1
- #define PROG_MISMATCH 2
- #define PROC_UNAVAIL 3
- #define GARBAGE_ARGS 4
- #define SYSTEM_ERR 5
-
- // Kinds of authorisation
- #define AUTH_NONE 0
- #define AUTH_SYS 1
- #define AUTH_SHORT 2
- // One day, perhaps...
- #define AUTH_DES 3
- #define AUTH_KERB 4
-
- #define AUTH_SYS_MACHINENAMELEN 256
-
- struct authunix {
- BOOL isUnix;
- char machineName[AUTH_SYS_MACHINENAMELEN];
- u_int uid;
- u_int gid;
- u_int numGids;
- u_int gids[16];
- };
-
- struct Call {
- int c_program;
- int c_version;
- int c_procedure;
- struct authunix c_auth;
- struct sockaddr_in c_from;
- BOOL c_hasBeenPrinted; /* Has the source been identified on the console? */
- };
-
- /* Prototypes */
- u_int getUnsignedInt(int32);
- int getInt(int32);
- int32 *getString(int32 *ptr, int32 *limit, char *buf, int bufchars);
- int32 *readAuth(int32 *ptr, int32 *limit, struct authunix *auth);
- int32 *PrepareAcceptedHeader(int32 id, int32 *ptr);
-
- #endif
-
-