Rev | Line | |
---|
[22] | 1 | #include "EthernetDissector.h" |
---|
| 2 | #include "Logger/Logger.h" |
---|
| 3 | |
---|
| 4 | EthernetDissector::EthernetDissector() |
---|
| 5 | { |
---|
| 6 | } |
---|
| 7 | |
---|
| 8 | EthernetDissector::~EthernetDissector() { |
---|
| 9 | delete m_ethHdr; |
---|
| 10 | } |
---|
| 11 | |
---|
| 12 | EthernetDissector * EthernetDissector::Clone() const { |
---|
| 13 | return new EthernetDissector(); |
---|
| 14 | } |
---|
| 15 | |
---|
| 16 | bool EthernetDissector::Dissect(const unsigned char * pData, const ssize_t nLen) { |
---|
| 17 | |
---|
| 18 | m_ethHdr = new EthernetHeader; |
---|
| 19 | memcpy(m_ethHdr, pData, sizeof(EthernetHeader)); |
---|
| 20 | pData += sizeof(EthernetHeader); |
---|
| 21 | |
---|
| 22 | SavePayload(pData, nLen - sizeof(EthernetHeader)); |
---|
| 23 | return true; |
---|
| 24 | } |
---|
| 25 | |
---|
| 26 | bool EthernetDissector::NeedReassembly() const { |
---|
| 27 | return false; |
---|
| 28 | } |
---|
| 29 | |
---|
| 30 | const EProtocolType EthernetDissector::GetUpperLayerType() const |
---|
| 31 | { |
---|
| 32 | EProtocolType res = EProtocolType_Unknown; |
---|
| 33 | switch(m_ethHdr->type) |
---|
| 34 | { |
---|
| 35 | case 8: |
---|
| 36 | res = EProtocolType_IPv4; |
---|
| 37 | break; |
---|
| 38 | } |
---|
| 39 | return res; |
---|
| 40 | } |
---|
| 41 | |
---|
| 42 | |
---|
| 43 | ProtocolInfoElement * EthernetDissector::CreateLayerInfo() |
---|
| 44 | { |
---|
| 45 | return 0; |
---|
| 46 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.