File tree 3 files changed +13
-9
lines changed
3 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 1
- pub const DHCP_MAGIC_COOKIE_ARR : [ u8 ; 4 ] = [ 99 , 130 , 83 , 99 ] ;
2
- pub const DHCP_MINIMUM_LEGAL_MAX_MESSAGE_SIZE : u16 = 576 ;
3
- pub const DHCP_MAGIC_COOKIE : u32 = 1_669_485_411 ;
4
- pub const DHCP_MIN_MSG_SIZE : usize = 300 ;
5
- pub const DHCP_SERVER_PORT : u16 = 67 ;
6
- pub const DHCP_CLIENT_PORT : u16 = 68 ;
1
+ pub const MINIMUM_LEGAL_MAX_MESSAGE_SIZE : u16 = 576 ;
2
+ pub const MIN_MSG_SIZE : usize = 300 ;
3
+
4
+ pub const SERVER_PORT : u16 = 67 ;
5
+ pub const CLIENT_PORT : u16 = 68 ;
6
+
7
+ pub const MAGIC_COOKIE_ARR : [ u8 ; 4 ] = [ 99 , 130 , 83 , 99 ] ;
8
+ pub const MAGIC_COOKIE : u32 = 1_669_485_411 ;
9
+
10
+ pub const MINIMAL_RETRANS_DURATION_SECS : u32 = 60 ;
7
11
8
12
pub const HARDWARE_ADDR_TYPE_ETHERNET : u8 = 1 ;
9
13
pub const HARDWARE_ADDR_LEN_ETHERNET : u8 = 6 ;
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ impl Server {
50
50
// Wait until the socket is readable, this can produce a false positive
51
51
socket. readable ( ) . await ?;
52
52
53
- let mut buf = [ 0u8 ; constants:: DHCP_MINIMUM_LEGAL_MAX_MESSAGE_SIZE as usize ] ;
53
+ let mut buf = [ 0u8 ; constants:: MINIMUM_LEGAL_MAX_MESSAGE_SIZE as usize ] ;
54
54
let ( len, addr) = match socket. recv_from ( & mut buf) . await {
55
55
Ok ( result) => result,
56
56
Err ( err) if err. kind ( ) == std:: io:: ErrorKind :: WouldBlock => {
Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ impl Readable for Message {
141
141
let file = buf. read_vec ( 128 ) ?;
142
142
143
143
match buf. peekn :: < 4 > ( ) {
144
- Some ( m) if m == constants:: DHCP_MAGIC_COOKIE_ARR => buf. skipn ( 4 ) ?,
144
+ Some ( m) if m == constants:: MAGIC_COOKIE_ARR => buf. skipn ( 4 ) ?,
145
145
Some ( _) => return Err ( MessageError :: BufferError ( BufferError :: InvalidData ) ) ,
146
146
None => return Err ( MessageError :: BufferError ( BufferError :: BufTooShort ) ) ,
147
147
} ;
@@ -198,7 +198,7 @@ impl Writeable for Message {
198
198
n += self . file . write :: < E > ( buf) ?;
199
199
200
200
// Write magic cookie
201
- n += buf. write ( constants:: DHCP_MAGIC_COOKIE_ARR ) ;
201
+ n += buf. write ( constants:: MAGIC_COOKIE_ARR ) ;
202
202
203
203
n += self . options . write :: < E > ( buf) ?;
204
204
You can’t perform that action at this time.
0 commit comments