1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-30 21:44:26 +01:00

Fixed some bugs.

This commit is contained in:
Matias Fontanini
2011-09-18 11:42:21 -03:00
parent a1f2334d52
commit 1f2967c8fb
6 changed files with 138 additions and 28 deletions

View File

@@ -52,7 +52,7 @@ namespace Tins {
/**
* \brief Creates an instance of ICMP.
*
* If no flag is specified, then ECHO_REPLY will be used.
* If no flag is specified, then ECHO_REQUEST will be used.
* \param flag The type flag which will be set.
*/
ICMP(Flags flag = ECHO_REQUEST);
@@ -112,6 +112,13 @@ namespace Tins {
* \param new_mtu uint16_t with the new sequence.
*/
void mtu(uint16_t new_mtu);
/**
* \brief Setter for the pointer field.
*
* \param new_pointer uint8_t with the new pointer.
*/
void pointer(uint8_t new_pointer);
/**
* \brief Sets echo request flag for this PDU.
@@ -242,6 +249,13 @@ namespace Tins {
uint32_t gateway() const { return Utils::net_to_host_l(this->_icmp.un.gateway); }
/**
* \brief Getter for the pointer field.
*
* \return Returns the pointer value.
*/
uint8_t pointer() const { return this->_icmp.un.pointer; }
/**
* \brief Getter for the mtu field.
*
* \return Returns the mtu value in an uint16_t.
@@ -306,6 +320,7 @@ namespace Tins {
uint16_t __unused;
uint16_t mtu;
} frag;
uint8_t pointer;
} un;
} __attribute__((__packed__));

View File

@@ -25,18 +25,22 @@
#include <stdint.h>
#include "pdu.h"
#include "utils.h"
namespace Tins {
/**
* \brief Class representing a SNAP frame.
*
* Note that this PDU contains the 802.3 LLC structure + SNAP frame.
* So far only unnumbered information structure is supported.
*/
class SNAP : public PDU {
public:
/**
* \brief Creates an instance of SNAP
* This constructor sets the dsap and ssap fields to 0xaa, and
* the id field to 3.
* \param child The child PDU.(optional)
*/
SNAP(PDU *child = 0);
@@ -59,6 +63,70 @@ namespace Tins {
*/
SNAP &operator= (const SNAP &other);
/* Setters */
/**
* \brief Setter for the id field.
* \param new_id The new id to be set.
*/
void id(uint8_t new_id);
/**
* \brief Setter for the poll field.
* \param new_poll The new poll to be set.
*/
void poll(uint8_t new_poll);
/**
* \brief Setter for the org code field.
* \param new_org The new org code to be set.
*/
void org_code(uint32_t new_org);
/**
* \brief Setter for the eth type field.
* \param new_eth The new eth type to be set.
*/
void eth_type(uint32_t new_eth);
/* Getters */
/**
* \brief Getter for the dsap field.
* \return The dsap field.
*/
inline uint8_t dsap() const { return _snap.dsap; }
/**
* \brief Getter for the ssap field.
* \return The ssap field.
*/
inline uint8_t ssap() const { return _snap.ssap; }
/**
* \brief Getter for the id field.
* \return The id field.
*/
inline uint8_t id() const { return _snap.id; }
/**
* \brief Getter for the poll field.
* \return The poll field.
*/
inline uint8_t poll() const { return _snap.poll; }
/**
* \brief Getter for the org code field.
* \return The org code field.
*/
inline uint32_t org_code() const { return _snap.org_code; }
/**
* \brief Getter for the eth type field.
* \return The eth field.
*/
inline uint16_t eth_type() const { return Utils::net_to_host_s(_snap.eth_type); }
/**
* \brief Returns the SNAP frame's header length.
*