-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCEthernetLayer.h
More file actions
47 lines (36 loc) · 1.4 KB
/
CEthernetLayer.h
File metadata and controls
47 lines (36 loc) · 1.4 KB
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
// EthernetLayer.h: interface for the CEthernetLayer class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_ETHERNETLAYER_H__7857C9C2_B459_4DC8_B9B3_4E6C8B587B29__INCLUDED_)
#define AFX_ETHERNETLAYER_H__7857C9C2_B459_4DC8_B9B3_4E6C8B587B29__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "BaseLayer.h"
#include "pch.h"
class CEthernetLayer
: public CBaseLayer
{
private:
inline void ResetHeader();
public:
BOOL Receive(unsigned char* ppayload);
BOOL Send(unsigned char* ppayload, int nlength, unsigned short type);
void SetDestinAddress(unsigned char* pAddress);
void SetSourceAddress(unsigned char* pAddress);
unsigned char* GetDestinAddress();
unsigned char* GetSourceAddress();
CEthernetLayer(char* pName);
virtual ~CEthernetLayer();
typedef struct _ETHERNET_HEADER {
unsigned char enet_dstaddr[6]; // destination address of ethernet layer
unsigned char enet_srcaddr[6]; // source address of ethernet layer
unsigned short enet_type; // type of ethernet layer
unsigned char enet_data[ETHER_MAX_DATA_SIZE]; // frame data
} ETHERNET_HEADER, * PETHERNET_HEADER;
protected:
ETHERNET_HEADER m_sHeader;
static bool AddressEquals(unsigned char* addr1, unsigned char* addr2);
static bool IsBroadcast(unsigned char* address);
};
#endif // !defined(AFX_ETHERNETLAYER_H__7857C9C2_ B459_4DC8_B9B3_4E6C8B587B29__INCLUDED_)