Module stun

The stun module contains a STUN (rfc5389) implementation.

Summary

Members Descriptions
namespacescy::stun

namespace scy::stun

Summary

Members Descriptions
classscy::stun::AddressAttribute Implements a STUN/TURN attribute that contains a socket address.
classscy::stun::Attribute The virtual base class for all STUN/TURN attributes.
classscy::stun::ErrorCode Implements STUN/TURN attribute that reflects an error code.
classscy::stun::FlagAttribute Implements STUN/TURN attribute representing a 0 size flag.
classscy::stun::Message
classscy::stun::MessageIntegrity Implements STUN/TURN attributes that reflects an internet address.
classscy::stun::StringAttribute Implements STUN/TURN attribute that reflects an arbitrary byte string.
classscy::stun::Transaction
classscy::stun::UInt16ListAttribute Implements STUN/TURN attribute that reflects a list of attribute names.
classscy::stun::UInt32Attribute Implements STUN/TURN attribute that reflects a 32-bit integer.
classscy::stun::UInt64Attribute Implements STUN/TURN attribute that reflects a 64-bit integer.
classscy::stun::UInt8Attribute Implements STUN/TURN attribute that reflects a 32-bit integer.

class scy::stun::AddressAttribute

class scy::stun::AddressAttribute
  : public scy::stun::Attribute

Implements a STUN/TURN attribute that contains a socket address.

Summary

Members Descriptions
public AddressAttribute(std::uint16_t type,bool ipv4)
public AddressAttribute(constAddressAttribute& r)
public virtualstun::Attribute* clone()
public inlinestun::AddressFamilyfamily() const
public virtualnet::Addressaddress() const
public virtual void read(BitReader& reader)
public virtual void write(BitWriter& writer) const
public inline virtual void setAddress(constnet::Address& addr)

Members

public AddressAttribute(std::uint16_t type,bool ipv4)

public AddressAttribute(constAddressAttribute& r)

public virtualstun::Attribute* clone()

public inlinestun::AddressFamilyfamily() const

public virtualnet::Addressaddress() const

public virtual void read(BitReader& reader)

Reads the body (not the type or size) for this type of attribute from the given buffer. Return value is true if successful.

public virtual void write(BitWriter& writer) const

Writes the body (not the type or size) to the given buffer. Return value is true if successful.

public inline virtual void setAddress(constnet::Address& addr)

class scy::stun::Attribute

The virtual base class for all STUN/TURN attributes.

Summary

Members Descriptions
public inline virtual ~Attribute()
publicAttribute* clone()
public void read(BitReader& reader)
public void write(BitWriter& writer) const
public std::uint16_t type() const
public std::uint16_t size() const
public void consumePadding(BitReader& reader) const
public void writePadding(BitWriter& writer) const
public std::string typeString()
protected std::uint16_t _type
protected std::uint16_t _size
protected Attribute(std::uint16_t type,std::uint16_t size)
protected void setLength(std::uint16_t size)

Members

public inline virtual ~Attribute()

publicAttribute* clone()

public void read(BitReader& reader)

Reads the body (not the type or size) for this type of attribute from the given buffer. Return value is true if successful.

public void write(BitWriter& writer) const

Writes the body (not the type or size) to the given buffer. Return value is true if successful.

public std::uint16_t type() const

public std::uint16_t size() const

public void consumePadding(BitReader& reader) const

public void writePadding(BitWriter& writer) const

public std::string typeString()

protected std::uint16_t _type

protected std::uint16_t _size

protected Attribute(std::uint16_t type,std::uint16_t size)

protected void setLength(std::uint16_t size)

class scy::stun::ErrorCode

class scy::stun::ErrorCode
  : public scy::stun::Attribute

Implements STUN/TURN attribute that reflects an error code.

Summary

Members Descriptions
public ErrorCode(std::uint16_t size)
public ErrorCode(constErrorCode& r)
public virtual ~ErrorCode()
public virtualAttribute* clone()
public void setErrorCode(int code)
public void setReason(const std::string & reason)
public int errorCode() const
public inline std::uint8_t errorClass() const
public inline std::uint8_t errorNumber() const
public inline const std::string & reason() const
public virtual void read(BitReader& reader)
public virtual void write(BitWriter& writer) const

Members

public ErrorCode(std::uint16_t size)

public ErrorCode(constErrorCode& r)

public virtual ~ErrorCode()

public virtualAttribute* clone()

public void setErrorCode(int code)

public void setReason(const std::string & reason)

public int errorCode() const

public inline std::uint8_t errorClass() const

public inline std::uint8_t errorNumber() const

public inline const std::string & reason() const

public virtual void read(BitReader& reader)

Reads the body (not the type or size) for this type of attribute from the given buffer. Return value is true if successful.

public virtual void write(BitWriter& writer) const

Writes the body (not the type or size) to the given buffer. Return value is true if successful.

class scy::stun::FlagAttribute

class scy::stun::FlagAttribute
  : public scy::stun::Attribute

Implements STUN/TURN attribute representing a 0 size flag.

Summary

Members Descriptions
public FlagAttribute(std::uint16_t type)
public virtualAttribute* clone()
public inline virtual void read(BitReader& reader)
public inline virtual void write(BitWriter& writer) const

Members

public FlagAttribute(std::uint16_t type)

public virtualAttribute* clone()

public inline virtual void read(BitReader& reader)

Reads the body (not the type or size) for this type of attribute from the given buffer. Return value is true if successful.

public inline virtual void write(BitWriter& writer) const

Writes the body (not the type or size) to the given buffer. Return value is true if successful.

class scy::stun::Message

class scy::stun::Message
  : public scy::IPacket

Summary

Members Descriptions
public Message()
public Message(ClassType clss,MethodTypemeth)
public Message(constMessage& that)
publicMessage& operator=(constMessage& that)
public virtual ~Message()
public virtualIPacket* clone() const
public void setClass(ClassType type)
public void setMethod(MethodTypetype)
public void setTransactionID(const std::string & id)
public ClassType classType() const
publicMethodTypemethodType() const
public inline const TransactionID & transactionID() const
public inline const std::vector<Attribute* > attrs() const
public inline virtual std::size_t size() const
public std::string methodString() const
public std::string classString() const
public std::string errorString(std::uint16_t errorCode) const
public void add(Attribute* attr)
publicAttribute* get(Attribute::Typetype,int index) const
public template<typename T>
inline T * get(int index) const
public virtual std::size_t read(constConstBuffer& buf)
public virtual void write(Buffer & buf) const Writes this object into a STUN/TURN packet.
public std::string toString() const
public virtual void print(std::ostream & os) const
public inline virtual const char * className() const
protected std::uint16_t _class
protected std::uint16_t _method
protected std::uint16_t _size
protected TransactionID _transactionID
protected std::vector<Attribute* > _attrs

Members

public Message()

public Message(ClassType clss,MethodTypemeth)

public Message(constMessage& that)

publicMessage& operator=(constMessage& that)

public virtual ~Message()

public virtualIPacket* clone() const

public void setClass(ClassType type)

public void setMethod(MethodTypetype)

public void setTransactionID(const std::string & id)

public ClassType classType() const

publicMethodTypemethodType() const

public inline const TransactionID & transactionID() const

public inline const std::vector<Attribute* > attrs() const

public inline virtual std::size_t size() const

The size of the packet in bytes.

This is the nember of bytes that will be written on a call to write(), but may not be the number of bytes that will be consumed by read().

public std::string methodString() const

public std::string classString() const

public std::string errorString(std::uint16_t errorCode) const

public void add(Attribute* attr)

publicAttribute* get(Attribute::Typetype,int index) const

public template<typename T>
inline T * get(int index) const

public virtual std::size_t read(constConstBuffer& buf)

Parses the STUN/TURN packet from the given buffer. The return value indicates the number of bytes read.

public virtual void write(Buffer & buf) const

Writes this object into a STUN/TURN packet.

public std::string toString() const

public virtual void print(std::ostream & os) const

public inline virtual const char * className() const

protected std::uint16_t _class

protected std::uint16_t _method

protected std::uint16_t _size

protected TransactionID _transactionID

protected std::vector<Attribute* > _attrs

class scy::stun::MessageIntegrity

class scy::stun::MessageIntegrity
  : public scy::stun::Attribute

Implements STUN/TURN attributes that reflects an internet address.

Summary

Members Descriptions
public MessageIntegrity()
public MessageIntegrity(constMessageIntegrity& r)
public virtual ~MessageIntegrity()
public virtualAttribute* clone()
public bool verifyHmac(const std::string & key) const
public inline std::string input() const
public inline std::string hmac() const
public inline std::string key() const
public inline void setInput(const std::string & input)
public inline void setHmac(const std::string & hmac)
public inline void setKey(const std::string & key)
public virtual void read(BitReader& reader)
public virtual void write(BitWriter& writer) const

Members

public MessageIntegrity()

public MessageIntegrity(constMessageIntegrity& r)

public virtual ~MessageIntegrity()

public virtualAttribute* clone()

public bool verifyHmac(const std::string & key) const

public inline std::string input() const

public inline std::string hmac() const

public inline std::string key() const

public inline void setInput(const std::string & input)

public inline void setHmac(const std::string & hmac)

public inline void setKey(const std::string & key)

public virtual void read(BitReader& reader)

Reads the body (not the type or size) for this type of attribute from the given buffer. Return value is true if successful.

public virtual void write(BitWriter& writer) const

Writes the body (not the type or size) to the given buffer. Return value is true if successful.

class scy::stun::StringAttribute

class scy::stun::StringAttribute
  : public scy::stun::Attribute

Implements STUN/TURN attribute that reflects an arbitrary byte string.

Summary

Members Descriptions
public StringAttribute(std::uint16_t type,std::uint16_t size)
public StringAttribute(constStringAttribute& r)
public virtual ~StringAttribute()
public virtualAttribute* clone()
public inline const char * bytes() const
public void setBytes(char * bytes,unsigned size)
public std::string asString() const
public void copyBytes(const char * bytes)
public void copyBytes(const void * bytes,unsigned size)
public std::uint8_t getByte(int index) const
public void setByte(int index,std::uint8_t value)
public virtual void read(BitReader& reader)
public virtual void write(BitWriter& writer) const

Members

public StringAttribute(std::uint16_t type,std::uint16_t size)

public StringAttribute(constStringAttribute& r)

public virtual ~StringAttribute()

public virtualAttribute* clone()

public inline const char * bytes() const

public void setBytes(char * bytes,unsigned size)

public std::string asString() const

public void copyBytes(const char * bytes)

public void copyBytes(const void * bytes,unsigned size)

public std::uint8_t getByte(int index) const

public void setByte(int index,std::uint8_t value)

public virtual void read(BitReader& reader)

Reads the body (not the type or size) for this type of attribute from the given buffer. Return value is true if successful.

public virtual void write(BitWriter& writer) const

Writes the body (not the type or size) to the given buffer. Return value is true if successful.

class scy::stun::Transaction

class scy::stun::Transaction
  : public scy::net::Transaction< Message >

Summary

Members Descriptions
public Transaction(const net::Socket::Ptr & socket,constnet::Address& peerAddress,long timeout,int retries,uv::Loop * loop)
public virtual bool checkResponse(constMessage& message)
public virtual void onResponse() Called when a successful response match is received.
protected virtual ~Transaction()

Members

public Transaction(const net::Socket::Ptr & socket,constnet::Address& peerAddress,long timeout,int retries,uv::Loop * loop)

public virtual bool checkResponse(constMessage& message)

public virtual void onResponse()

Called when a successful response match is received.

protected virtual ~Transaction()

class scy::stun::UInt16ListAttribute

class scy::stun::UInt16ListAttribute
  : public scy::stun::Attribute

Implements STUN/TURN attribute that reflects a list of attribute names.

Summary

Members Descriptions
public UInt16ListAttribute(std::uint16_t type,std::uint16_t size)
public UInt16ListAttribute(constUInt16ListAttribute& r)
public virtual ~UInt16ListAttribute()
public virtualAttribute* clone()
public std::size_t size() const
public std::uint16_t getType(int index) const
public void setType(int index,std::uint16_t value)
public void addType(std::uint16_t value)
public virtual void read(BitReader& reader)
public virtual void write(BitWriter& writer) const

Members

public UInt16ListAttribute(std::uint16_t type,std::uint16_t size)

public UInt16ListAttribute(constUInt16ListAttribute& r)

public virtual ~UInt16ListAttribute()

public virtualAttribute* clone()

public std::size_t size() const

public std::uint16_t getType(int index) const

public void setType(int index,std::uint16_t value)

public void addType(std::uint16_t value)

public virtual void read(BitReader& reader)

Reads the body (not the type or size) for this type of attribute from the given buffer. Return value is true if successful.

public virtual void write(BitWriter& writer) const

Writes the body (not the type or size) to the given buffer. Return value is true if successful.

class scy::stun::UInt32Attribute

class scy::stun::UInt32Attribute
  : public scy::stun::Attribute

Implements STUN/TURN attribute that reflects a 32-bit integer.

Summary

Members Descriptions
public UInt32Attribute(std::uint16_t type)
public UInt32Attribute(constUInt32Attribute& r)
public virtualAttribute* clone()
public inline std::uint32_t value() const
public inline void setValue(std::uint32_t bits)
public bool getBit(int index) const
public void setBit(int index,bool value)
public virtual void read(BitReader& reader)
public virtual void write(BitWriter& writer) const

Members

public UInt32Attribute(std::uint16_t type)

public UInt32Attribute(constUInt32Attribute& r)

public virtualAttribute* clone()

public inline std::uint32_t value() const

public inline void setValue(std::uint32_t bits)

public bool getBit(int index) const

public void setBit(int index,bool value)

public virtual void read(BitReader& reader)

Reads the body (not the type or size) for this type of attribute from the given buffer. Return value is true if successful.

public virtual void write(BitWriter& writer) const

Writes the body (not the type or size) to the given buffer. Return value is true if successful.

class scy::stun::UInt64Attribute

class scy::stun::UInt64Attribute
  : public scy::stun::Attribute

Implements STUN/TURN attribute that reflects a 64-bit integer.

Summary

Members Descriptions
public UInt64Attribute(std::uint16_t type)
public UInt64Attribute(constUInt64Attribute& r)
public virtualAttribute* clone()
public inline std::uint64_t value() const
public inline void setValue(std::uint64_t bits)
public bool getBit(int index) const
public void setBit(int index,bool value)
public virtual void read(BitReader& reader)
public virtual void write(BitWriter& writer) const

Members

public UInt64Attribute(std::uint16_t type)

public UInt64Attribute(constUInt64Attribute& r)

public virtualAttribute* clone()

public inline std::uint64_t value() const

public inline void setValue(std::uint64_t bits)

public bool getBit(int index) const

public void setBit(int index,bool value)

public virtual void read(BitReader& reader)

Reads the body (not the type or size) for this type of attribute from the given buffer. Return value is true if successful.

public virtual void write(BitWriter& writer) const

Writes the body (not the type or size) to the given buffer. Return value is true if successful.

class scy::stun::UInt8Attribute

class scy::stun::UInt8Attribute
  : public scy::stun::Attribute

Implements STUN/TURN attribute that reflects a 32-bit integer.

Summary

Members Descriptions
public UInt8Attribute(std::uint16_t type)
public UInt8Attribute(constUInt8Attribute& r)
public virtualAttribute* clone()
public inline std::uint8_t value() const
public inline void setValue(std::uint8_t bits)
public bool getBit(int index) const
public void setBit(int index,bool value)
public virtual void read(BitReader& reader)
public virtual void write(BitWriter& writer) const

Members

public UInt8Attribute(std::uint16_t type)

public UInt8Attribute(constUInt8Attribute& r)

public virtualAttribute* clone()

public inline std::uint8_t value() const

public inline void setValue(std::uint8_t bits)

public bool getBit(int index) const

public void setBit(int index,bool value)

public virtual void read(BitReader& reader)

Reads the body (not the type or size) for this type of attribute from the given buffer. Return value is true if successful.

public virtual void write(BitWriter& writer) const

Writes the body (not the type or size) to the given buffer. Return value is true if successful.

results matching ""

    No results matching ""