19#define STUN_VERSION "0.97"
21#define STUN_MAX_STRING 256
22#define STUN_MAX_UNKNOWN_ATTRIBUTES 8
23#define STUN_MAX_MESSAGE_SIZE 2048
27#ifndef RESIP_COMPAT_HXX
43 typedef struct {
unsigned char octet[16]; }
UInt128;
58#define MAX_REALM_BYTES 763
59#define MAX_NONCE_BYTES 763
322#define MAX_MEDIA_RELAYS 500
323#define MAX_RTP_MSG_SIZE 1500
324#define MEDIA_RELAY_TIMEOUT 3*60
355 bool changePort,
bool changeIp,
unsigned int id = 0);
427 bool* preservePort = 0,
462 bool verbose =
false);
468 bool verbose =
false);
473 void computeHmac(
char* hmac,
const char* input,
int length,
const char* key,
int sizeKey);
Handles cross-platform sockets compatibility.
#define STUN_MAX_UNKNOWN_ATTRIBUTES
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
dcm! – add UnusedChecking(_enum) below;
const uint16_t TurnSendResponse
bool stunParseServerName(char *name, StunAddress4 &addr)
find the IP address of a the specified stun server - return false is fails parse
void stunCreateUserName(const StunAddress4 &source, StunAtrString *username)
const uint16_t TurnSetActiveDestinationRequest
bool stunInitServer(StunServerInfo &info, const StunAddress4 &myAddr, const StunAddress4 &altAddr, int startMediaPort, bool verbose)
return true if all is OK Create a media relay and do the STERN thing if startMediaPort is non-zero
void computeHmac(char *hmac, const char *input, int length, const char *key, int sizeKey)
const uint16_t TurnLifetime
static const uint16_t Username
static const uint16_t AlternateServer
const uint16_t SharedSecretErrorResponseMsg
NatType stunNatType(StunAddress4 &dest, bool verbose, bool *preservePort, bool *hairpin, int port, StunAddress4 *sAddr)
const uint16_t TurnSendErrorResponse
const uint16_t TurnMagicCookie
void stunCreatePassword(const StunAtrString &username, StunAtrString *password)
static const uint16_t XorMappedAddress
const uint8_t IPv4Family
define a structure to hold a stun address
const uint16_t TurnDestinationAddress
static const uint16_t ChangedAddress
int stunFindLocalInterfaces(uint32_t *addresses, int maxRet)
returns number of address found - take array or addres
bool stunServerProcessMsg(char *buf, unsigned int bufLen, StunAddress4 &from, StunAddress4 &secondary, StunAddress4 &myAddr, StunAddress4 &altAddr, StunMessage *resp, StunAddress4 *destination, StunAtrString *hmacPassword, bool *changePort, bool *changeIp, bool verbose)
static const uint16_t Software
const uint16_t BindResponseMsg
static const uint16_t Realm
const uint16_t TurnRemoteAddress
const uint16_t TurnSetActiveDestinationErrorResponse
@ StunTypeIndependentFilter
@ StunTypeDependentMapping
@ StunTypePortDependedFilter
@ StunTypeDependentFilter
static const uint16_t SourceAddress
static const uint16_t XorMappedAddress_old
const uint16_t TurnSetActiveDestinationResponse
static const uint16_t ResponseAddress
static const uint16_t Fingerprint
const uint32_t ChangePortFlag
int stunOpenSocket(StunAddress4 &dest, StunAddress4 *mapAddr, int port, StunAddress4 *srcAddr, bool verbose)
unsigned long long uint64_t
static const uint16_t Nonce
bool stunVerifyMessageIntegrity(const char *buf, unsigned int bufLen, const StunMessage &message, const StunAtrString &password)
Verify the MESSAGE-INTEGRITY attribute of a parsed message against the supplied short-term credential...
const uint16_t TurnAllocateRequest
void stunBuildReqSimple(StunMessage *msg, const StunAtrString &username, bool changePort, bool changeIp, unsigned int id)
bool operator<(const Data &lhs, const Data &rhs)
const uint16_t TurnSendRequest
bool stunParseHostName(char *peerName, uint32_t &ip, uint16_t &portVal, uint16_t defaultPort)
const uint32_t ChangeIpFlag
static const uint16_t ErrorCode
static const uint16_t SecondaryAddress
static const uint16_t MappedAddress
const uint16_t BindErrorResponseMsg
void stunStopServer(StunServerInfo &info)
const uint16_t TurnAllocateErrorResponse
const uint16_t SharedSecretResponseMsg
static const uint16_t XorOnly
static const uint16_t ReflectedFrom
void stunGetUserNameAndPassword(const StunAddress4 &dest, StunAtrString *username, StunAtrString *password)
static const uint32_t StunMagicCookie
bool stunParseMessage(char *buf, unsigned int bufLen, StunMessage &msg, bool verbose)
static const uint16_t Password
const uint16_t TurnAlternateServer
static const uint16_t MessageIntegrity
static const uint16_t UnknownAttribute
bool stunServerProcess(StunServerInfo &info, bool verbose)
return true if all is OK
const uint16_t BindRequestMsg
uint64_t stunGetSystemTimeSecs()
int stunRandomPort()
return a random number to use as a port
const uint16_t TurnAllocateResponse
const uint16_t TurnBandwidth
const uint16_t SharedSecretRequestMsg
EncodeStream & operator<<(EncodeStream &strm, const BaseException &e)
bool stunTest(StunAddress4 &dest, int testNum, bool verbose, StunAddress4 *sAddr, unsigned long timeoutMs)
bool operator==(const char *lhs, const Data &rhs)
static const uint16_t ChangeRequest
bool stunOpenSocketPair(StunAddress4 &dest, StunAddress4 *mapAddr, int *fd1, int *fd2, int port, StunAddress4 *srcAddr, bool verbose)
unsigned int stunEncodeMessage(const StunMessage &msg, char *buf, unsigned int bufLen, const StunAtrString &password, bool verbose)
const uint16_t TurnDataIndication
bool hasUnknownAttributes
StunAtrAddress4 reflectedFrom
StunAtrAddress4 secondaryAddress
bool hasTurnAlternateServer
StunAtrAddress4 turnRemoteAddress
unsigned int messageIntegrityOffset
StunAtrAddress4 changedAddress
StunAtrChangeRequest changeRequest
StunAtrAddress4 sourceAddress
StunAtrAddress4 alternateServer
StunAtrAddress4 turnDestinationAddress
StunAtrUnknown unknownAttributes
StunAtrAddress4 xorMappedAddress
bool hasTurnDestinationAddress
StunAtrAddress4 turnAlternateServer
bool hasTurnRemoteAddress
StunAtrAddress4 mappedAddress
StunAtrAddress4 responseAddress
StunAtrIntegrity messageIntegrity
resip::Socket altIpPortFd