Home Units Hierarchy Routines All identifiers

Class unaSTUNagent

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type unaSTUNagent = class(unaThread)

Description

STUN base agent

Hierarchy

Overview

Methods

Public constructor create(proto: int = C_STUN_PROTO_UDP; port: string = ''; const bind2ip: string = '0.0.0.0');
Public destructor Destroy(); override;
Public function open(): bool;
Protected function doYourJob(addr: PSockAddrIn; buf: pointer; dataLen: int): bool; virtual; abstract;
Protected function execute(threadID: unsigned): int; override;
Protected function readData(buf: pointer; maxSize: int; out addr: sockaddr_in): int; virtual; abstract;
Public procedure close();
Protected procedure doOpen(); virtual;
Protected procedure startIn(); override;

Properties

Public property active: bool read f_active;
Public property port: string read f_port;
Public property proto: int read f_proto;
Public property socketError: int read f_socketError;

Description

Methods

Public constructor create(proto: int = C_STUN_PROTO_UDP; port: string = ''; const bind2ip: string = '0.0.0.0');
 
Public destructor Destroy(); override;
 
Public function open(): bool;

Opens client or server.

Protected function doYourJob(addr: PSockAddrIn; buf: pointer; dataLen: int): bool; virtual; abstract;

Processes any pending job.

Parameters
buf
ponter to data buffer
dataLen
size of data in buffer. Could be 0, which means no data was read in last cycle
Returns

True if some job was done, or False if there was nothing to do

Protected function execute(threadID: unsigned): int; override;
 
Protected function readData(buf: pointer; maxSize: int; out addr: sockaddr_in): int; virtual; abstract;

Reads data from internal or exteranal socket(s) Client and server will do it differently.

Parameters
buf
buffer to read data into
maxSize
size of buffer
addr
OUT UDP ONLY: remote address
Returns

Size of data actually read

Public procedure close();

Closes client or server.

Protected procedure doOpen(); virtual;

Prepare for open.

Protected procedure startIn(); override;

Prepares socket

Properties

Public property active: bool read f_active;

True if server or client is active.

Public property port: string read f_port;

Local server port for STUN Server Remote server port for STUN Client

Public property proto: int read f_proto;

Internal socket proto

Public property socketError: int read f_socketError;

Fatal socket error or 0 if no error.

(c) 2012 Lake of Soft


Generated by PasDoc 0.12.1 on 2012-10-09