Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
/*
2
 *	Cf. /lib/rfc/rfc1014, /lib/rfc/rfc1050
3
 */
4
 
5
enum Bool
6
{
7
	FALSE	= 0,
8
	TRUE	= 1
9
};
10
 
11
enum Auth_flavor
12
{
13
	AUTH_NULL	= 0,
14
	AUTH_UNIX	= 1,
15
	AUTH_SHORT	= 2,
16
	AUTH_DES	= 3
17
};
18
 
19
enum Msg_type
20
{
21
	CALL	= 0,
22
	REPLY	= 1
23
};
24
 
25
/*
26
 * A reply to a call message can take on two forms:
27
 * The message was either accepted or rejected.
28
 */
29
 
30
enum Reply_stat
31
{
32
	MSG_ACCEPTED	= 0,
33
	MSG_DENIED	= 1
34
};
35
 
36
/*
37
 * Given that a call message was accepted, the following is the
38
 * status of an attempt to call a remote procedure.
39
 */
40
enum Accept_stat
41
{
42
	SUCCESS		= 0,	/* RPC executed successfully       */
43
	PROG_UNAVAIL	= 1,	/* remote hasn't exported program  */
44
	PROG_MISMATCH	= 2,	/* remote can't support version #  */
45
	PROC_UNAVAIL	= 3,	/* program can't support procedure */
46
	GARBAGE_ARGS	= 4	/* procedure can't decode params   */
47
};
48
 
49
/*
50
 * Reasons why a call message was rejected:
51
 */
52
enum Reject_stat
53
{
54
	RPC_MISMATCH	= 0,	/* RPC version number != 2          */
55
	AUTH_ERROR	= 1	/* remote can't authenticate caller */
56
};
57
 
58
/*
59
 * Why authentication failed:
60
 */
61
enum Auth_stat
62
{
63
	AUTH_BADCRED		= 1,	/* bad credentials (seal broken) */
64
	AUTH_REJECTEDCRED	= 2,	/* client must begin new session */
65
	AUTH_BADVERF		= 3,	/* bad verifier (seal broken)    */
66
	AUTH_REJECTEDVERF	= 4,	/* verifier expired or replayed  */
67
	AUTH_TOOWEAK		= 5	/* rejected for security reasons */
68
};
69
 
70
enum
71
{
72
	IPPROTO_TCP	= 6,	/* protocol number for TCP/IP */
73
	IPPROTO_UDP	= 17	/* protocol number for UDP/IP */
74
};
75
 
76
#define	ROUNDUP(n)	((n) + ((-(n))&3))	
77
 
78
#define	PLONG(x)	(dataptr[3] = ((ulong)(x)), dataptr[2] = ((ulong)(x))>>8, dataptr[1] = ((ulong)(x))>>16, dataptr[0] = ((ulong)(x))>>24, dataptr += 4)
79
#define	PPTR(x, n)	(memmove(dataptr, (x), n), dataptr += ROUNDUP(n))
80
#define	PBYTE(x)	(*dataptr++ = (x))
81
 
82
#define	GLONG()		(argptr += 4, (((uchar*)argptr)[-1] | (((uchar*)argptr)[-2]<<8) | (((uchar*)argptr)[-3]<<16) | (((uchar*)argptr)[-4]<<24)))
83
#define	GPTR(n)		(void *)(argptr); argptr += ROUNDUP(n)
84
#define	GBYTE()	(argptr++, ((uchar*)argptr)[-1])