further implemented bootp protocol

This commit is contained in:
Markus Fröschle
2013-12-24 10:41:43 +00:00
parent 7addadeb70
commit c1ff9a7181
8 changed files with 427 additions and 524 deletions

View File

@@ -8,12 +8,28 @@
#ifndef _BOOTP_H_
#define _BOOTP_H_
/********************************************************************/
#define BOOTP_SERVER_PORT 67
#define BOOTP_CLIENT_PORT 68
/* protocol header information */
#define BOOTP_HDR_OFFSET (ETH_HDR_LEN + IP_HDR_SIZE + UDP_HDR_SIZE)
/* timeout in seconds */
#define BOOTP_TIMEOUT 2
/* BOOTP connection status */
struct bootp_connection
{
bool open; /* connection established flag */
NIF *nif; /* pointer to network interface */
IP_ADDR server_ip; /* server IP address */
};
/*
* This data definition is defined for Ethernet only!
*/
typedef struct
struct bootp_packet
{
uint8_t type; /* bootp operation type */
uint8_t htype; /* hardware type */
@@ -29,9 +45,9 @@ typedef struct
uint8_t sname[64]; /* server name */
uint8_t file[128]; /* name of bootfile */
uint8_t vend[64]; /* vendor specific (see below) */
} bootp_frame_hdr;
};
#define BOOTP_HDR_LEN sizeof(bootp_frame_hdr)
#define BOOTP_PACKET_LEN (BOOTP_HDR_OFFSET + sizeof(struct bootp_packet))
/* possible values for type field */
#define BOOTP_TYPE_BOOTREQUEST 1
@@ -46,11 +62,6 @@ typedef struct
/* values for flags - only broadcast flag in use */
#define BOOTP_FLAGS_BROADCAST 1
#define BOOTP_TIMEOUT (1) /* Timeout in seconds */
/* Protocol Header information */
#define BOOTP_HDR_OFFSET ETH_HDR_LEN
extern void bootp_request(NIF *, uint8_t *);
extern void bootp_handler(NIF *, NBUF *);
//extern void bootp_init(BOOTP_INFO *);