source: trunk/ETSI-Testsuites/ETSI_auto_IOT/adapter/src/Dispatcher/EthernetDissector.cpp

Last change on this file was 22, checked in by rings, 14 years ago
  • Property svn:executable set to *
File size: 885 bytes
Line 
1#include "EthernetDissector.h"
2#include "Logger/Logger.h"
3
4EthernetDissector::EthernetDissector()
5{
6}
7
8EthernetDissector::~EthernetDissector() {
9  delete m_ethHdr;
10}
11
12EthernetDissector * EthernetDissector::Clone() const {
13  return new EthernetDissector();
14}
15
16bool 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
26bool EthernetDissector::NeedReassembly() const {
27  return false;
28}
29
30const 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
43ProtocolInfoElement * EthernetDissector::CreateLayerInfo()
44{
45        return 0;
46}
Note: See TracBrowser for help on using the repository browser.