
#pragma once

//========================================>
//			BOOTP
//========================================>
typedef struct sBOOTP_MESSAGE 
{
	unsigned char op;		//!<packet op code / message type.1 = BOOTREQUEST, 2 = BOOTREPLY
    unsigned char htype;	//!<hardware address type,see ARP section in "Assigned Numbers" RFC.'1' = 10mb ethernet
	unsigned char hlen;		//!<hardware address length (eg '6' for 10mb ethernet).
	unsigned char hops;		//!<client sets to zero, optionally used by gateways in cross-gateway booting.
	unsigned int  xid;		//!<transaction ID, a random number, used to match this boot request with the responses it generates.
	unsigned short secs;	//!<filled in by client, seconds elapsed since client started trying to boot.
	unsigned short unused;	//!<unused
    unsigned int ciaddr;	//!<client IP address, filled in by client in bootrequest if known.
	unsigned int yiaddr;	//!<'your' (client) IP address; filled by server if client doesn't know its own address (ciaddr was 0).
    unsigned int siaddr;	//!<server IP address; returned in bootreply by server.
	unsigned int giaddr;	//!<gateway IP address, used in optional cross-gateway booting.
	unsigned char chaddr[16];	//!<client hardware address, filled in by client.
	unsigned char sname[64];	//!<optional server host name,null terminated string.
	unsigned char file[128];	//!<boot file name, null terminated string;'generic' name or null in bootrequest,fully qualified directory-path name in bootreply.
	unsigned char vend[64];		//!<optional vendor-specific area, e.g. could be hardware type/serial on request, or 'capability' / remote file system handle on reply.  This info may be set aside for use by a third phase bootstrap or kernel.
}BOOTP_MESSAGE;

int CreateBOOTPReply(BOOTP_MESSAGE * pMsg,unsigned int transactionID, unsigned int OwnIPaddress, unsigned int ClientIPAddress, unsigned int ClientSubnetMask, unsigned char ClientMACAddress[6]);

//========================================>
//			SNMP
//========================================>
enum SNMP_UNIVERSAL_TYPE
{
	SNMP_EOC		=0,
	SNMP_BOOLEAN	=1,
	SNMP_INTEGER	=2,
	SNMP_BIT_STRING	=3,
	SNMP_OCTET_STRING	=4,
	SNMP_NULL			=5,
	SNMP_OBJECT_IDENTIFIER	=6,
	SNMP_Object_Descriptor	=7,
	SNMP_EXTERNAL		=8,
	SNMP_REAL			=9,
	SNMP_ENUMERATED		=10,
	SNMP_EMBEDDED_PDV	=11,
	SNMP_UTF8String		=12,
	SNMP_RELATIVE_OID	=13,
	SNMP_SEQUENCE		=16,
	SNMP_SET			=17,
	SNMP_NumericString	=18,
	SNMP_PrintableString=19,
	SNMP_T61String		=20,
	SNMP_VideotexString	=21,
	SNMP_IA5String		=22,
	SNMP_UTCTime		=23,
	SNMP_GeneralizedTime=24,
	SNMP_GraphicString	=25,
	SNMP_VisibleString	=26,
	SNMP_GeneralString	=27,
	SNMP_UniversalString=28,
	SNMP_CHARACTER		=29,
	SNMP_BMPString		=30
};

struct SNMP_UniversalPrimitiveItem
{
	SNMP_UNIVERSAL_TYPE Type;
	unsigned int Size;
	void * pValue;
	SNMP_UniversalPrimitiveItem *pNext;
};


int ParseSNMPPayload(unsigned char* pData, unsigned int Size, SNMP_UniversalPrimitiveItem ** ppResult);
