Difference between revisions of "Unit IGMP"
From Ultibo.org
Line 120: | Line 120: | ||
---- | ---- | ||
− | '' | + | |
+ | '''IGMP protocol transport''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <code>TIGMPProtocolTransport = class(TProtocolTransport)</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>constructor Create;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>Socket:TIGMPSocket;</code> | ||
+ | | Socket for sending replies | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''IGMP protocol''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <code>TIGMPProtocol = class(TNetworkProtocol)</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>constructor Create(AManager:TProtocolManager; const AName:String);</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FGroups:TNetworkList;</code> | ||
+ | | List of TIGMPGroup objects | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function PacketHandler(AHandle:THandle; ASource,ADest,APacket:Pointer; ASize:Integer; ABroadcast:Boolean):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ControlHandler(AHandle:THandle; ASource,ADest:Pointer; AProtocol,ACommand,ACode:Word; AAddress,AData:Pointer; ASize:Integer):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function SendIGMP1Report(ASocket:TIGMPSocket; ASource,ADest,AAddress:Pointer):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function SendIGMP2Report(ASocket:TIGMPSocket; ASource,ADest,AAddress:Pointer):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function SendIGMP2Leave(ASocket:TIGMPSocket; ASource,ADest,AAddress:Pointer):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function SendIGMP1Query(ASocket:TIGMPSocket; ASource,ADest,AAddress:Pointer):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function SendIGMP2Query(ASocket:TIGMPSocket; ASource,ADest,AAddress:Pointer):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetGroup(ATransport:TIGMPProtocolTransport; const AAddress:TInAddr; ALock:Boolean):TIGMPGroup;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetGroupByNext(APrevious:TIGMPGroup; ALock,AUnlock:Boolean):TIGMPGroup;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function AddGroup(ATransport:TIGMPProtocolTransport; const AAddress:TInAddr; const AHardware:THardwareAddress; ALock:Boolean):TIGMPGroup;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function RemoveGroup(ATransport:TIGMPProtocolTransport; const AAddress:TInAddr):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure FlushGroups(All:Boolean);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ProcessGroups:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div> | ||
+ | |- | ||
+ | | <code>function AddTransport(ATransport:TNetworkTransport):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function RemoveTransport(ATransport:TNetworkTransport):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function FindSocket(AFamily,AStruct,AProtocol:Word; ALocalAddress,ARemoteAddress:Pointer; ALocalPort,ARemotePort:Word; ABroadcast,AListen,ALock:Boolean; AState:LongWord):TProtocolSocket; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure FlushSockets(All:Boolean); override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function SelectCheck(ASource,ADest:PFDSet; ACode:Integer):Integer; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function SendPacket(ASocket:TProtocolSocket; ASource,ADest:Pointer; ASourcePort,ADestPort:Word; APacket:PPacketFragment; ASize,AFlags:Integer):Integer; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>function Accept(ASocket:TProtocolSocket; ASockAddr:PSockAddr; AAddrLength:PInteger):TProtocolSocket; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function Bind(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; AAddrLength:Integer):Integer; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function CloseSocket(ASocket:TProtocolSocket):Integer; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function Connect(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; AAddrLength:Integer):Integer; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function IoctlSocket(ASocket:TProtocolSocket; ACmd:DWORD; var AArg:u_long):Integer; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetPeerName(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; var AAddrLength:Integer):Integer; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetSockName(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; var AAddrLength:Integer):Integer; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetSockOpt(ASocket:TProtocolSocket; ALevel,AOptName:Integer; AOptValue:PChar; var AOptLength:Integer):Integer; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function Listen(ASocket:TProtocolSocket; ABacklog:Integer):Integer; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function Recv(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer):Integer; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function RecvFrom(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer; var AFromAddr:TSockAddr; var AFromLength:Integer):Integer; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function Select(ANfds:Integer; AReadfds,AWritefds,AExceptfds:PFDSet; ATimeout:PTimeVal):LongInt; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function Send(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer):Integer; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function SendTo(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer; var AToAddr:TSockAddr; AToLength:Integer):Integer; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function SetSockOpt(ASocket:TProtocolSocket; ALevel,AOptName:Integer; AOptValue:PChar; AOptLength:Integer):Integer; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function Shutdown(ASocket:TProtocolSocket; AHow:Integer):Integer; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function Socket(AFamily,AStruct,AProtocol:Integer):TProtocolSocket; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function StartProtocol:Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function StopProtocol:Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ProcessProtocol:Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''IGMP group''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <code>TIGMPGroup = class(TListObject)</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>constructor Create;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FLock:TCriticalSectionHandle;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FCount:Word;</code> | ||
+ | | Number of memberships | ||
+ | |- | ||
+ | | <code>FQueryTime:Int64;</code> | ||
+ | | IGMP query reply timer | ||
+ | |- | ||
+ | | <code>FReportTime:Int64;</code> | ||
+ | | IGMP report reply/transmit timer | ||
+ | |- | ||
+ | | <code>FTransmitCount:Word;</code> | ||
+ | | IGMP report transmit counter | ||
+ | |- | ||
+ | | <code>FAddress:TInAddr;</code> | ||
+ | | IP address of group | ||
+ | |- | ||
+ | | <code>FHardware:THardwareAddress;</code> | ||
+ | | Hardware address of group | ||
+ | |- | ||
+ | | <code>FTransport:TNetworkTransport;</code> | ||
+ | | Transport provider for group | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>procedure SetCount(ACount:Word);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetActive:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetQueryTime(const AQueryTime:Int64);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetReportTime(const AReportTime:Int64);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetTransmitCount(ATransmitCount:Word);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetAddress(const AAddress:TInAddr);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetHardware(const AHardware:THardwareAddress);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetTransport(ATransport:TNetworkTransport);</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>property Count:Word read FCount write SetCount;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property Active:Boolean read GetActive;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property QueryTime:Int64 read FQueryTime write SetQueryTime;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property ReportTime:Int64 read FReportTime write SetReportTime;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property TransmitCount:Word read FTransmitCount write SetTransmitCount;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property Address:TInAddr read FAddress write SetAddress;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property Hardware:THardwareAddress read FHardware write SetHardware;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property Transport:TNetworkTransport read FTransport write SetTransport;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function AcquireLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ReleaseLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>procedure IncrementCount;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure DecrementCount;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure IncrementTransmitCount;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure DecrementTransmitCount;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''ICMP socket''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <code>TIGMPSocket = class(TProtocolSocket)</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Note: SOCK_RAW | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>constructor Create(AProtocol:TNetworkProtocol; ATransport:TNetworkTransport);</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FRecvData:TIGMPBuffer;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>property RecvData:TIGMPBuffer read FRecvData;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function IoCtl(ACommand:DWORD; var AArgument:u_long):Integer; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function IsConnected(ALocalAddress,ARemoteAddress:Pointer; ALocalPort,ARemotePort:Word; ABroadcast:Boolean):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function IsListening(ALocalAddress,ARemoteAddress:Pointer; ALocalPort,ARemotePort:Word; ABroadcast:Boolean):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''IGMP buffer''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <code>TIGMPBuffer = class(TSocketBuffer)</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>constructor Create(ASocket:TTransportSocket);</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FOffset:Word;</code> | ||
+ | | Offset to RemoteAddress | ||
+ | |- | ||
+ | | <code>FLength:Word;</code> | ||
+ | | Length of RemoteAddress | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FRead:Pointer;</code> | ||
+ | | Pointer to Next Read from Buffer | ||
+ | |- | ||
+ | | <code>FWrite:Pointer;</code> | ||
+ | | Pointer to Next Write to Buffer | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FCount:LongWord;</code> | ||
+ | | Number of Packets in Buffer | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FFirst:PIGMPPacket;</code> | ||
+ | | Pointer to First Packet | ||
+ | |- | ||
+ | | <code>FLast:PIGMPPacket;</code> | ||
+ | | Pointer to Last Packet | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function AddPacket(ASize:Integer):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function RemovePacket:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure FlushPackets;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div> | ||
+ | |- | ||
+ | | <code>procedure SetSize(ASize:LongWord); override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>function GetNext:Integer;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetCount:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function ReadBuffer(var ABuffer; var ASize:Integer; ARemoteAddress:Pointer; AFlags:Integer):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function WriteBuffer(var ABuffer; ASize:Integer; ARemoteAddress:Pointer):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
=== Public variables === | === Public variables === |
Revision as of 03:38, 15 March 2017
Return to Unit Reference
Contents
Description
Ultibo IGMP (Internet Group Management Protocol) unit
To be documented
Constants
IGMP specific constants
IGMP_PROTOCOL_*
Note: Some IGMP definitions are in the Protocol or IP modules | |
IGMP_PROTOCOL_NAME = 'IGMP';
|
IGMP constants
IGMP_*
IGMP_TIMEOUT = 0;
|
Wait forever on a IGMP Read |
IGMP_BUFFER_SIZE = 65536;
|
IGMP Receive Buffer Size |
IGMP_HEADER_SIZE = 8;
|
SizeOf(TIGMPHeader); |
IGMP_PACKET_SIZE = 8;
|
SizeOf(TIGMPPacket) |
IGMP_QUERY_TIMEOUT = 5000;
|
|
IGMP_REPORT_TIMEOUT = 5000;
|
|
IGMP_TRANSMIT_COUNT = 3;
|
Type definitions
IGMP header
PIGMPHeader = ^TIGMPHeader;
TIGMPHeader = packed record
IGMPType:Byte;
|
type of IGMP message |
RespTime:Byte;
|
Query only otherwise 0 (Always zero in Version 1 (Assume 100)) |
Checksum:Word;
|
1s Compliment IP-style checksum |
Address:TInAddr;
|
group address being reported or queried (zero for "General" queries) |
IGMP packet
PIGMPPacket = ^TIGMPPacket;
TIGMPPacket = record
Note: 8 Bytes (Used by IGMPBuffer) | |
Size:LongWord;
|
LongWord to keep size even |
Next:PIGMPPacket;
|
Followed by RemoteAddress (4 or 16 Bytes) |
Class definitions
IGMP protocol transport
TIGMPProtocolTransport = class(TProtocolTransport)
constructor Create;
|
|
destructor Destroy; override;
|
|
public
| |
Socket:TIGMPSocket;
|
Socket for sending replies |
IGMP protocol
TIGMPProtocol = class(TNetworkProtocol)
constructor Create(AManager:TProtocolManager; const AName:String);
|
|
destructor Destroy; override;
|
|
private
| |
FGroups:TNetworkList;
|
List of TIGMPGroup objects |
function PacketHandler(AHandle:THandle; ASource,ADest,APacket:Pointer; ASize:Integer; ABroadcast:Boolean):Boolean;
|
|
function ControlHandler(AHandle:THandle; ASource,ADest:Pointer; AProtocol,ACommand,ACode:Word; AAddress,AData:Pointer; ASize:Integer):Boolean;
|
|
function SendIGMP1Report(ASocket:TIGMPSocket; ASource,ADest,AAddress:Pointer):Boolean;
|
|
function SendIGMP2Report(ASocket:TIGMPSocket; ASource,ADest,AAddress:Pointer):Boolean;
|
|
function SendIGMP2Leave(ASocket:TIGMPSocket; ASource,ADest,AAddress:Pointer):Boolean;
|
|
function SendIGMP1Query(ASocket:TIGMPSocket; ASource,ADest,AAddress:Pointer):Boolean;
|
|
function SendIGMP2Query(ASocket:TIGMPSocket; ASource,ADest,AAddress:Pointer):Boolean;
|
|
function GetGroup(ATransport:TIGMPProtocolTransport; const AAddress:TInAddr; ALock:Boolean):TIGMPGroup;
|
|
function GetGroupByNext(APrevious:TIGMPGroup; ALock,AUnlock:Boolean):TIGMPGroup;
|
|
function AddGroup(ATransport:TIGMPProtocolTransport; const AAddress:TInAddr; const AHardware:THardwareAddress; ALock:Boolean):TIGMPGroup;
|
|
function RemoveGroup(ATransport:TIGMPProtocolTransport; const AAddress:TInAddr):Boolean;
|
|
procedure FlushGroups(All:Boolean);
|
|
function ProcessGroups:Boolean;
|
|
protected
| |
function AddTransport(ATransport:TNetworkTransport):Boolean; override;
|
|
function RemoveTransport(ATransport:TNetworkTransport):Boolean; override;
|
|
function FindSocket(AFamily,AStruct,AProtocol:Word; ALocalAddress,ARemoteAddress:Pointer; ALocalPort,ARemotePort:Word; ABroadcast,AListen,ALock:Boolean; AState:LongWord):TProtocolSocket; override;
|
|
procedure FlushSockets(All:Boolean); override;
|
|
function SelectCheck(ASource,ADest:PFDSet; ACode:Integer):Integer; override;
|
|
function SendPacket(ASocket:TProtocolSocket; ASource,ADest:Pointer; ASourcePort,ADestPort:Word; APacket:PPacketFragment; ASize,AFlags:Integer):Integer; override;
|
|
public
| |
function Accept(ASocket:TProtocolSocket; ASockAddr:PSockAddr; AAddrLength:PInteger):TProtocolSocket; override;
|
|
function Bind(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; AAddrLength:Integer):Integer; override;
|
|
function CloseSocket(ASocket:TProtocolSocket):Integer; override;
|
|
function Connect(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; AAddrLength:Integer):Integer; override;
|
|
function IoctlSocket(ASocket:TProtocolSocket; ACmd:DWORD; var AArg:u_long):Integer; override;
|
|
function GetPeerName(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; var AAddrLength:Integer):Integer; override;
|
|
function GetSockName(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; var AAddrLength:Integer):Integer; override;
|
|
function GetSockOpt(ASocket:TProtocolSocket; ALevel,AOptName:Integer; AOptValue:PChar; var AOptLength:Integer):Integer; override;
|
|
function Listen(ASocket:TProtocolSocket; ABacklog:Integer):Integer; override;
|
|
function Recv(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer):Integer; override;
|
|
function RecvFrom(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer; var AFromAddr:TSockAddr; var AFromLength:Integer):Integer; override;
|
|
function Select(ANfds:Integer; AReadfds,AWritefds,AExceptfds:PFDSet; ATimeout:PTimeVal):LongInt; override;
|
|
function Send(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer):Integer; override;
|
|
function SendTo(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer; var AToAddr:TSockAddr; AToLength:Integer):Integer; override;
|
|
function SetSockOpt(ASocket:TProtocolSocket; ALevel,AOptName:Integer; AOptValue:PChar; AOptLength:Integer):Integer; override;
|
|
function Shutdown(ASocket:TProtocolSocket; AHow:Integer):Integer; override;
|
|
function Socket(AFamily,AStruct,AProtocol:Integer):TProtocolSocket; override;
|
|
function StartProtocol:Boolean; override;
|
|
function StopProtocol:Boolean; override;
|
|
function ProcessProtocol:Boolean; override;
|
IGMP group
TIGMPGroup = class(TListObject)
constructor Create;
|
|
destructor Destroy; override;
|
|
private
| |
FLock:TCriticalSectionHandle;
|
|
FCount:Word;
|
Number of memberships |
FQueryTime:Int64;
|
IGMP query reply timer |
FReportTime:Int64;
|
IGMP report reply/transmit timer |
FTransmitCount:Word;
|
IGMP report transmit counter |
FAddress:TInAddr;
|
IP address of group |
FHardware:THardwareAddress;
|
Hardware address of group |
FTransport:TNetworkTransport;
|
Transport provider for group |
procedure SetCount(ACount:Word);
|
|
function GetActive:Boolean;
|
|
procedure SetQueryTime(const AQueryTime:Int64);
|
|
procedure SetReportTime(const AReportTime:Int64);
|
|
procedure SetTransmitCount(ATransmitCount:Word);
|
|
procedure SetAddress(const AAddress:TInAddr);
|
|
procedure SetHardware(const AHardware:THardwareAddress);
|
|
procedure SetTransport(ATransport:TNetworkTransport);
|
|
public
| |
property Count:Word read FCount write SetCount;
|
|
property Active:Boolean read GetActive;
|
|
property QueryTime:Int64 read FQueryTime write SetQueryTime;
|
|
property ReportTime:Int64 read FReportTime write SetReportTime;
|
|
property TransmitCount:Word read FTransmitCount write SetTransmitCount;
|
|
property Address:TInAddr read FAddress write SetAddress;
|
|
property Hardware:THardwareAddress read FHardware write SetHardware;
|
|
property Transport:TNetworkTransport read FTransport write SetTransport;
|
|
function AcquireLock:Boolean;
|
|
function ReleaseLock:Boolean;
|
|
procedure IncrementCount;
|
|
procedure DecrementCount;
|
|
procedure IncrementTransmitCount;
|
|
procedure DecrementTransmitCount;
|
ICMP socket
TIGMPSocket = class(TProtocolSocket)
Note: SOCK_RAW | |
constructor Create(AProtocol:TNetworkProtocol; ATransport:TNetworkTransport);
|
|
destructor Destroy; override;
|
|
private
| |
FRecvData:TIGMPBuffer;
|
|
public
| |
property RecvData:TIGMPBuffer read FRecvData;
|
|
function IoCtl(ACommand:DWORD; var AArgument:u_long):Integer; override;
|
|
function IsConnected(ALocalAddress,ARemoteAddress:Pointer; ALocalPort,ARemotePort:Word; ABroadcast:Boolean):Boolean; override;
|
|
function IsListening(ALocalAddress,ARemoteAddress:Pointer; ALocalPort,ARemotePort:Word; ABroadcast:Boolean):Boolean; override;
|
IGMP buffer
TIGMPBuffer = class(TSocketBuffer)
constructor Create(ASocket:TTransportSocket);
|
|
destructor Destroy; override;
|
|
private
| |
FOffset:Word;
|
Offset to RemoteAddress |
FLength:Word;
|
Length of RemoteAddress |
FRead:Pointer;
|
Pointer to Next Read from Buffer |
FWrite:Pointer;
|
Pointer to Next Write to Buffer |
FCount:LongWord;
|
Number of Packets in Buffer |
FFirst:PIGMPPacket;
|
Pointer to First Packet |
FLast:PIGMPPacket;
|
Pointer to Last Packet |
function AddPacket(ASize:Integer):Boolean;
|
|
function RemovePacket:Boolean;
|
|
procedure FlushPackets;
|
|
protected
| |
procedure SetSize(ASize:LongWord); override;
|
|
public
| |
function GetNext:Integer;
|
|
function GetCount:LongWord;
|
|
function ReadBuffer(var ABuffer; var ASize:Integer; ARemoteAddress:Pointer; AFlags:Integer):Boolean;
|
|
function WriteBuffer(var ABuffer; ASize:Integer; ARemoteAddress:Pointer):Boolean;
|
Public variables
None defined
Function declarations
Initialization functions
procedure IGMPInit;
Description: To be documented
Note | None documented |
---|
IGMP functions
function CheckIGMP(AFamily:Word; ABuffer:Pointer):Boolean;
Description: Verify that the packet is a valid IGMP packet
Buffer | The complete packet including Transport header |
---|
function GetIGMPHeaderOffset(AFamily:Word; ABuffer:Pointer):Word;
Description: To be documented
Buffer | The complete packet including Transport header |
---|
function GetIGMPHeaderLength(AFamily:Word; ABuffer:Pointer):Word;
Description: To be documented
Buffer | The complete packet including Transport header |
---|
function GetIGMPDataOffset(AFamily:Word; ABuffer:Pointer):Word;
Description: To be documented
Buffer | The complete packet including Transport header |
---|
function GetIGMPDataLength(AFamily:Word; ABuffer:Pointer):Word;
Description: To be documented
Buffer | The complete packet including Transport header |
---|
function ChecksumIGMP(AFamily:Word; ABuffer:Pointer; AOffset,ALength:Word):Word;
Description: Checksum the IGMP Header on Send / Validate the Checksum on Receive
Note | Checksum is calculated on the whole packet (Header and Data) |
---|
Return to Unit Reference