File: rpl.h

package info (click to toggle)
rpld 1.8beta1-6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 832 kB
  • ctags: 621
  • sloc: ansic: 2,230; asm: 434; yacc: 225; makefile: 169; sh: 40
file content (137 lines) | stat: -rw-r--r-- 2,941 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*************************************************
*     rpld - an IBM style RIPL server            *
*************************************************/

/* Copyright (c) 1999,2000, James McKenzie.
 *                      All rights reserved
 * Copyright (c) 1998,2000, Christopher Lightfoot.
 *                      All rights reserved
 *
 * By using this file, you agree to the terms and conditions set
 * forth in the LICENCE file which can be found at the top level of
 * the rpld distribution.
 *
 * IBM is a trademark of IBM corp.
 *
 */



/*
 * $Id: rpl.h,v 1.12 2000/07/29 23:25:25 root Exp $
 *
 * $Log: rpl.h,v $
 * Revision 1.12  2000/07/29 23:25:25  root
 * #
 *
 * Revision 1.11  2000/07/17 10:43:34  root
 * #
 *
 * Revision 1.10  2000/07/16 14:05:28  root
 * #
 *
 * Revision 1.9  2000/07/16 13:18:10  root
 * #
 *
 * Revision 1.1  2000/07/16 13:16:33  root
 * #
 *
 * Revision 1.8  1999/09/13 11:17:35  root
 * \#
 *
 * Revision 1.7  1999/09/13 11:05:27  root
 * \#
 *
 * Revision 1.6  1999/09/13 11:04:13  root
 * \#
 *
 * Revision 1.5  1999/09/13 11:04:13  root
 * \#
 *  
 */


typedef unsigned int u32;
typedef unsigned short int u16;
typedef unsigned char u8;


#define LLC_RPL_OVERHEAD 0x30

#define RPL_SAP		0xfc

#define RPL_PK_FIND	0x0001
#define RPL_PK_FOUND	0x0002
#define RPL_PK_SENDFILE	0x0010
#define RPL_PK_FILEDATA	0x0020

#define RPL_IS_TOKEN(a) (a & 0xc000)

#define RPL_TK_TMZ	0x4003
#define RPL_TK_MYMAC	0x4006
#define RPL_TK_SAP	0x4007
#define RPL_TK_FRAMELEN 0x4009
#define RPL_TK_WHOAMI	0x400a
#define RPL_TK_TSZ	0x400b
#define RPL_TK_YOUMAC	0x400c
#define RPL_TK_BLOCK	0x4011
#define RPL_TK_DATA	0x4018
#define RPL_TK_IDENT   	0xc005
#define RPL_TK_ADDR	0xc014

#define RPL_FL_TMZ  	(1L << 0)
#define RPL_FL_MYMAC 	(1L << 1)
#define RPL_FL_SAP 	(1L << 2)
#define RPL_FL_FRAMELEN (1L << 3)
#define RPL_FL_WHOAMI 	(1L << 4)
#define RPL_FL_TSZ 	(1L << 5)
#define RPL_FL_YOUMAC 	(1L << 6)
#define RPL_FL_BLOCK 	(1L << 7)
#define RPL_FL_DATA 	(1L << 8)
#define RPL_FL_IDENT 	(1L << 9)
#define RPL_FL_ADDR 	(1L << 10)

#define RPL_AD_FLAGS_ASK_MORE	0x10
#define RPL_AD_FLAGS_MORE	0x20
#define RPL_AD_FLAGS_DONE	0xc0

#define RPL_FIND_FLAGS (RPL_FL_FRAMELEN|RPL_FL_MYMAC|RPL_FL_IDENT|RPL_FL_TMZ)

#define RPL_FOUND_FLAGS (RPL_FL_TMZ | RPL_FL_TSZ | RPL_FL_YOUMAC | RPL_FL_MYMAC | RPL_FL_FRAMELEN | RPL_FL_WHOAMI | RPL_FL_SAP)

#define RPL_SEND_FILE_FLAGS (RPL_FL_BLOCK | RPL_FL_FRAMELEN | RPL_FL_MYMAC)

#define RPL_FILE_DATA_FLAGS (RPL_FL_BLOCK | RPL_FL_ADDR | RPL_FL_DATA)

struct addr_block
{
  u32 load;
  u32 run;
  u32 flags;
};

#define MAX_DATA_LEN MAX_FRAME_LEN
#define MAX_IDENT_LEN MAX_FRAME_LEN

struct rpl_packet
{
  int flags;

  int type;

  u32 themightyzero;
  u8 mymac[ETH_ALEN];
  u8 sap;
  u16 framelen;
  u16 whoami;
  u16 thesmallzero;
  u8 youmac[ETH_ALEN];
  u32 block;
  u8 data[MAX_DATA_LEN];
  int datalen;

  u8 ident[MAX_IDENT_LEN];
  int identlen;

  struct addr_block addr;
};