Description | Hierarchy | Fields | Methods | Properties |
type unaSTUNclient = class(unaSTUNagent)
STUN client
constructor create(const host: string; proto: int = C_STUN_PROTO_UDP; useDNSSRV: bool = true; const port: string = ''; const bind2ip: string = '0.0.0.0'); |
|
destructor Destroy(); override; |
|
function req(method: int = C_STUN_MSGTYPE_BINDING; attrs: pointer = nil; attrsLen: int = 0; socket: unaSocket = nil; event: tHandle = 0): int; |
|
function doYourJob(addr: PSockAddrIn; buf: pointer; dataLen: int): bool; override; |
|
function readData(buf: pointer; maxSize: int; out addr: sockaddr_in): int; override; |
|
procedure doOpen(); override; |
|
procedure onDNSAnswer(query: unaDNSQuery); virtual; |
|
procedure onResponse4(r: unaSTUNClient_req; error: int; const ip4H: TIPv4H; port, boundPort: uint16); virtual; |
|
procedure onResponse6(r: unaSTUNClient_req; error: int; const ip6H: TIPV6H; port, boundPort: uint16); virtual; |
|
procedure startIn(); override; |
|
procedure startOut(); override; |
property bind2port: string read f_bind2port write f_bind2port; |
|
property host: string read f_host; |
constructor create(const host: string; proto: int = C_STUN_PROTO_UDP; useDNSSRV: bool = true; const port: string = ''; const bind2ip: string = '0.0.0.0'); |
|
Creates STUN client
Parameters
|
destructor Destroy(); override; |
|
Destroys STUN Client object |
function req(method: int = C_STUN_MSGTYPE_BINDING; attrs: pointer = nil; attrsLen: int = 0; socket: unaSocket = nil; event: tHandle = 0): int; |
|
Sends a request to remote server.
Parameters
Returnsinternal index of request ( > 0), or -1 in case of some error |
function doYourJob(addr: PSockAddrIn; buf: pointer; dataLen: int): bool; override; |
|
Send pending requests |
function readData(buf: pointer; maxSize: int; out addr: sockaddr_in): int; override; |
|
Reads data from socket(s) |
procedure doOpen(); override; |
|
Issue DNSSRV lookup if needed. |
procedure onDNSAnswer(query: unaDNSQuery); virtual; |
|
Got DNS reply |
procedure onResponse4(r: unaSTUNClient_req; error: int; const ip4H: TIPv4H; port, boundPort: uint16); virtual; |
|
Got STUN response, IPv4 address |
procedure onResponse6(r: unaSTUNClient_req; error: int; const ip6H: TIPV6H; port, boundPort: uint16); virtual; |
|
Got STUN response, IPv6 address |
procedure startIn(); override; |
|
Handle DNS responses if using SRV records |
procedure startOut(); override; |
|
Cleans up |
property bind2port: string read f_bind2port write f_bind2port; |
|
Bind client to this port. |
property host: string read f_host; |
|
Remote STUN server host. |
(c) 2012 Lake of Soft