mirror of
https://github.com/mfontanini/libtins
synced 2026-01-23 02:35:57 +01:00
Added SNAP. Couldn't test it yet.
This commit is contained in:
76
include/snap.h
Normal file
76
include/snap.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* libtins is a net packet wrapper library for crafting and
|
||||
* interpreting sniffed packets.
|
||||
*
|
||||
* Copyright (C) 2011 Nasel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef __IEEE8022_H
|
||||
#define __IEEE8022_H
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include "pdu.h"
|
||||
|
||||
namespace Tins {
|
||||
|
||||
/**
|
||||
* \brief Class representing a SNAP frame.
|
||||
*
|
||||
* So far only unnumbered information structure is supported.
|
||||
*/
|
||||
class SNAP : public PDU {
|
||||
public:
|
||||
/**
|
||||
* \brief Creates an instance of SNAP
|
||||
* \param child The child PDU.(optional)
|
||||
*/
|
||||
SNAP(PDU *child = 0);
|
||||
|
||||
/**
|
||||
* \brief Returns the SNAP frame's header length.
|
||||
*
|
||||
* \return The header's size.
|
||||
* \sa PDU::header_size()
|
||||
*/
|
||||
uint32_t header_size() const;
|
||||
|
||||
/**
|
||||
* \brief Getter for the PDU's type.
|
||||
* \sa PDU::pdu_type
|
||||
*/
|
||||
PDUType pdu_type() const { return PDU::SNAP; }
|
||||
private:
|
||||
struct snaphdr {
|
||||
uint8_t dsap;
|
||||
uint8_t ssap;
|
||||
uint32_t id:2,
|
||||
reserved1:2,
|
||||
poll:2,
|
||||
reserved2:2,
|
||||
org_code:24;
|
||||
uint16_t eth_type;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
void write_serialization(uint8_t *buffer, uint32_t total_sz, const PDU *parent);
|
||||
|
||||
snaphdr _snap;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user