EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index

S3C24xxPkg/vivi/include/net/bootp.h

Go to the documentation of this file.
00001 /*
00002  *      Copied from LiMon - BOOTP.
00003  *
00004  *      Copyright 1994, 1995, 2000 Neil Russell.
00005  *      (See License)
00006  *      Copyright 2000 Paolo Scaffardi
00007  */
00008 
00009 #ifndef __BOOTP_H__
00010 #define __BOOTP_H__
00011 
00012 #ifndef __NET_H__
00013 #include        "net.h"
00014 #endif /* __NET_H__ */
00015 
00016 /**********************************************************************/
00017 
00018 /*
00019  *      BOOTP header.
00020  */
00021 #if (CONFIG_COMMANDS & CFG_CMD_DHCP)
00022 #define OPT_SIZE 312    /* Minimum DHCP Options size per RFC2131 - results in 576 byte pkt */
00023 #else
00024 #define OPT_SIZE 64
00025 #endif
00026 
00027 typedef struct
00028 {
00029         uchar           bp_op;          /* Operation                            */
00030 # define OP_BOOTREQUEST 1
00031 # define OP_BOOTREPLY   2
00032         uchar           bp_htype;       /* Hardware type                        */
00033 # define HWT_ETHER      1
00034         uchar           bp_hlen;        /* Hardware address length              */
00035 # define HWL_ETHER      6
00036         uchar           bp_hops;        /* Hop count (gateway thing)            */
00037         ulong           bp_id;          /* Transaction ID                       */
00038         ushort          bp_secs;        /* Seconds since boot                   */
00039         ushort          bp_spare1;      /* Alignment                            */
00040         IPaddr_t        bp_ciaddr;      /* Client IP address                    */
00041         IPaddr_t        bp_yiaddr;      /* Your (client) IP address             */
00042         IPaddr_t        bp_siaddr;      /* Server IP address                    */
00043         IPaddr_t        bp_giaddr;      /* Gateway IP address                   */
00044         uchar           bp_chaddr[16];  /* Client hardware address              */
00045         char            bp_sname[64];   /* Server host name                     */
00046         char            bp_file[128];   /* Boot file name                       */
00047         char            bp_vend[OPT_SIZE];      /* Vendor information                   */
00048 }       Bootp_t;
00049 
00050 #define BOOTP_HDR_SIZE  sizeof (Bootp_t)
00051 #define BOOTP_SIZE      (ETHER_HDR_SIZE + IP_HDR_SIZE + BOOTP_HDR_SIZE)
00052 
00053 /**********************************************************************/
00054 /*
00055  *      Global functions and variables.
00056  */
00057 
00058 /* bootp.c */
00059 extern ulong    BootpID;                /* ID of cur BOOTP request              */
00060 extern char     BootFile[128];          /* Boot file name                       */
00061 extern int      BootpTry;
00062 #ifdef CONFIG_BOOTP_RANDOM_DELAY
00063 ulong           seed1, seed2;           /* seed for random BOOTP delay          */
00064 #endif
00065 
00066 
00067 /* Send a BOOTP request */
00068 extern void     BootpRequest (void);
00069 
00070 /****************** DHCP Support *********************/
00071 extern void DhcpRequest(void);
00072 
00073 /* DHCP States */
00074 typedef enum { INIT, 
00075                INIT_REBOOT, 
00076                REBOOTING, 
00077                SELECTING, 
00078                REQUESTING, 
00079                REBINDING, 
00080                BOUND, 
00081                RENEWING } dhcp_state_t;
00082 
00083 #define DHCP_DISCOVER 1
00084 #define DHCP_OFFER    2
00085 #define DHCP_REQUEST  3
00086 #define DHCP_DECLINE  4
00087 #define DHCP_ACK      5
00088 #define DHCP_NAK      6
00089 #define DHCP_RELEASE  7
00090 
00091 #define SELECT_TIMEOUT 3        /* Seconds to wait for offers */
00092 
00093 /**********************************************************************/
00094 
00095 #endif /* __BOOTP_H__ */
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines