Home Units Hierarchy Routines All identifiers

Unit unaSocks_STUN

DescriptionUsesClasses, Interfaces, Objects and RecordsFunctions and ProceduresTypesConstantsVariables

Description

- STUN (RFC 5389)

Version 2.5.2012.01 First release (UDP mostly)

Uses

Overview

Classes, Interfaces, Objects and Records

Name Description
Class unaSTUNagent STUN base agent
Class unaSTUNclient STUN client
Class unaSTUNClient_req STUN Client request
Class unaSTUNClient_server STUN Client server
Class unaSTUNserver STUN server
packed record unaSTUN_ALTERNATE_SERVER_attr  
packed record unaSTUN_attrHdr  
packed record unaSTUN_ERROR_CODE_attr  
packed record unaSTUN_FINGERPRINT_attr  
packed record unaSTUN_hdr  
packed record unaSTUN_MAPPED_ADDRESS_attr  
packed record unaSTUN_MESSAGE_INTEGRITY_attr  
packed record unaSTUN_NONCE_attr  
packed record unaSTUN_REALM_attr  
packed record unaSTUN_SOFTWARE_attr  
packed record unaSTUN_UNKNOWN_ATTRIBUTES_attr  
packed record unaSTUN_USERNAME_attr  
packed record unaSTUN_XOR_MAPPED_ADDRESS_attr  

Functions and Procedures

function getMappedIPPort4(const host: string; out mipH: TIPv4H; out mport, boundPort: uint16; const port: string = ''; proto: int = C_STUN_PROTO_UDP; timeout: tTimeout = 20000; useDNSSRV: bool = true; socket: unaSocket = nil; const bind2ip: string = '0.0.0.0'; const _bind2port: string = '0'): bool;

Types

punaSTUN_hdr = ˆunaSTUN_hdr;
punaSTUN_attrHdr = ˆunaSTUN_attrHdr;
punaSTUN_MAPPED_ADDRESS_attr = ˆunaSTUN_MAPPED_ADDRESS_attr;
punaSTUN_XOR_MAPPED_ADDRESS_attr = ˆunaSTUN_XOR_MAPPED_ADDRESS_attr;
punaSTUN_USERNAME_attr = ˆunaSTUN_USERNAME_attr;
punaSTUN_MESSAGE_INTEGRITY_attr = ˆunaSTUN_MESSAGE_INTEGRITY_attr;
punaSTUN_FINGERPRINT_attr = ˆunaSTUN_FINGERPRINT_attr;
punaSTUN_ERROR_CODE_attr = ˆunaSTUN_ERROR_CODE_attr;
punaSTUN_REALM_attr = ˆunaSTUN_REALM_attr;
punaSTUN_NONCE_attr = ˆunaSTUN_NONCE_attr;
punaSTUN_UNKNOWN_ATTRIBUTES_attr = ˆunaSTUN_UNKNOWN_ATTRIBUTES_attr;
punaSTUN_SOFTWARE_attr = ˆunaSTUN_SOFTWARE_attr;
punaSTUN_ALTERNATE_SERVER_attr = ˆunaSTUN_ALTERNATE_SERVER_attr;
unaSTUNServerOnResponse = procedure(sender: tObject; addr: PSockAddrIn; req: punaSTUN_hdr) of object;

Constants

C_FINGERPRINT_XOR = $5354554e;
C_INITIAL_RTO = 1000;
C_MAGIC_COOKIE = $2112A442;
C_STUN_ATTR_ALTERNATE_SERVER = $8023;
C_STUN_ATTR_ERROR_CODE = $0009;
C_STUN_ATTR_FINGERPRINT = $8028;
C_STUN_ATTR_MAPPED_ADDRESS = $0001;
C_STUN_ATTR_MESSAGE_INTEGRITY = $0008;
C_STUN_ATTR_NONCE = $0015;
C_STUN_ATTR_REALM = $0014;
C_STUN_ATTR_Reserved = $0000;
C_STUN_ATTR_Reserved_was_CHANGED_ADDRESS = $0005;
C_STUN_ATTR_Reserved_was_CHANGE_ADDRESS = $0003;
C_STUN_ATTR_Reserved_was_PASSWORD = $0007;
C_STUN_ATTR_Reserved_was_REFLECTED_FROM = $000B;
C_STUN_ATTR_Reserved_was_RESPONSE_ADDRESS = $0002;
C_STUN_ATTR_Reserved_was_SOURCE_ADDRESS = $0004;
C_STUN_ATTR_SOFTWARE = $8022;
C_STUN_ATTR_UNKNOWN_ATTRIBUTES = $000A;
C_STUN_ATTR_USERNAME = $0006;
C_STUN_ATTR_XOR_MAPPED_ADDRESS = $0020;
C_STUN_CLASS_INDICATION = 01;
C_STUN_CLASS_REQ = 00;
C_STUN_CLASS_RESP_ERROR = 03;
C_STUN_CLASS_RESP_SUCCESS = 02;
C_STUN_DEF_PORT = 3478;
C_STUN_DEF_PORT_TLS = 5349;
C_STUN_ERR_ALTERNATE = 300;
C_STUN_ERR_BAD_REQUEST = 400;
C_STUN_ERR_SERVER_ERROR = 500;
C_STUN_ERR_STALE_NONCE = 438;
C_STUN_ERR_UNAUTHORIZED = 401;
C_STUN_ERR_UNKNOWN_ATTR = 420;
C_STUN_MSGTYPE_BINDING = 01;
C_STUN_PROTO_TCP = 2;
C_STUN_PROTO_TLS = 3;
C_STUN_PROTO_UDP = 1;
C_TOTAL_Rc = 5;

Description

Functions and Procedures

function getMappedIPPort4(const host: string; out mipH: TIPv4H; out mport, boundPort: uint16; const port: string = ''; proto: int = C_STUN_PROTO_UDP; timeout: tTimeout = 20000; useDNSSRV: bool = true; socket: unaSocket = nil; const bind2ip: string = '0.0.0.0'; const _bind2port: string = '0'): bool;

Performs synchronous mapping.

Parameters
host
STUN server host name/IP address
port
STUN server port. Default is '', whihc is same as C_STUN_DEF_PORT
mip
OUT: mapped IPv4
mport
OUT: mapped port
boundPort
OUT: port the STUN client was bound to when performing mapping
proto
Transport to use, default is C_STUN_PROTO_UDP
timeout
Wait this amount of ms before reporting failure
useDNSSRV
use DNS SRV lookup to find STUN server
socket
use this socket instead of internal one, default is nil, which means use internal socket
bind2ip
Bind internal socket to this IP (not used if external socket is specified)
_bind2port
Bind internal socket to this port (not used if external socket is specified)
Returns

True if mapping was successfull

Types

punaSTUN_hdr = ˆunaSTUN_hdr;

STUN message header

punaSTUN_attrHdr = ˆunaSTUN_attrHdr;

STUN attribute header

punaSTUN_MAPPED_ADDRESS_attr = ˆunaSTUN_MAPPED_ADDRESS_attr;

MAPPED-ADDRESS attr

punaSTUN_XOR_MAPPED_ADDRESS_attr = ˆunaSTUN_XOR_MAPPED_ADDRESS_attr;

XOR-MAPPED-ADDRESS attr

punaSTUN_USERNAME_attr = ˆunaSTUN_USERNAME_attr;

USERNAME attr

punaSTUN_MESSAGE_INTEGRITY_attr = ˆunaSTUN_MESSAGE_INTEGRITY_attr;

MESSAGE-INTEGRITY attr

punaSTUN_FINGERPRINT_attr = ˆunaSTUN_FINGERPRINT_attr;

FINGERPRINT attr

punaSTUN_ERROR_CODE_attr = ˆunaSTUN_ERROR_CODE_attr;

ERROR-CODE attr

punaSTUN_REALM_attr = ˆunaSTUN_REALM_attr;

REALM attr

punaSTUN_NONCE_attr = ˆunaSTUN_NONCE_attr;

NONCE attr

punaSTUN_UNKNOWN_ATTRIBUTES_attr = ˆunaSTUN_UNKNOWN_ATTRIBUTES_attr;

UNKNOWN-ATTRIBUTES attr

punaSTUN_SOFTWARE_attr = ˆunaSTUN_SOFTWARE_attr;

SOFTWARE attr

punaSTUN_ALTERNATE_SERVER_attr = ˆunaSTUN_ALTERNATE_SERVER_attr;

ALTERNATE-SERVER attr

unaSTUNServerOnResponse = procedure(sender: tObject; addr: PSockAddrIn; req: punaSTUN_hdr) of object;

Response event.

Constants

C_FINGERPRINT_XOR = $5354554e;
 
C_INITIAL_RTO = 1000;

Server Error

C_MAGIC_COOKIE = $2112A442;
 
C_STUN_ATTR_ALTERNATE_SERVER = $8023;
 
C_STUN_ATTR_ERROR_CODE = $0009;
 
C_STUN_ATTR_FINGERPRINT = $8028;
 
C_STUN_ATTR_MAPPED_ADDRESS = $0001;
 
C_STUN_ATTR_MESSAGE_INTEGRITY = $0008;
 
C_STUN_ATTR_NONCE = $0015;
 
C_STUN_ATTR_REALM = $0014;
 
C_STUN_ATTR_Reserved = $0000;

attributes Comprehension-required range (0x0000-0x7FFF):

C_STUN_ATTR_Reserved_was_CHANGED_ADDRESS = $0005;
 
C_STUN_ATTR_Reserved_was_CHANGE_ADDRESS = $0003;
 
C_STUN_ATTR_Reserved_was_PASSWORD = $0007;
 
C_STUN_ATTR_Reserved_was_REFLECTED_FROM = $000B;
 
C_STUN_ATTR_Reserved_was_RESPONSE_ADDRESS = $0002;
 
C_STUN_ATTR_Reserved_was_SOURCE_ADDRESS = $0004;
 
C_STUN_ATTR_SOFTWARE = $8022;

Comprehension-optional range (0x8000-0xFFFF)

C_STUN_ATTR_UNKNOWN_ATTRIBUTES = $000A;
 
C_STUN_ATTR_USERNAME = $0006;
 
C_STUN_ATTR_XOR_MAPPED_ADDRESS = $0020;
 
C_STUN_CLASS_INDICATION = 01;
 
C_STUN_CLASS_REQ = 00;

TODO: yep classes

C_STUN_CLASS_RESP_ERROR = 03;
 
C_STUN_CLASS_RESP_SUCCESS = 02;
 
C_STUN_DEF_PORT = 3478;

default port

C_STUN_DEF_PORT_TLS = 5349;
 
C_STUN_ERR_ALTERNATE = 300;

error codes

C_STUN_ERR_BAD_REQUEST = 400;

Try Alternate

C_STUN_ERR_SERVER_ERROR = 500;

Stale Nonce

C_STUN_ERR_STALE_NONCE = 438;

Unknown Attribute

C_STUN_ERR_UNAUTHORIZED = 401;

Bad Request

C_STUN_ERR_UNKNOWN_ATTR = 420;

Unauthorized

C_STUN_MSGTYPE_BINDING = 01;

methods

C_STUN_PROTO_TCP = 2;
 
C_STUN_PROTO_TLS = 3;
 
C_STUN_PROTO_UDP = 1;

transport

C_TOTAL_Rc = 5;

1 second

Author

(c) 2012 Lake of Soft


Generated by PasDoc 0.12.1 on 2012-10-09