|
|
(One intermediate revision by the same user not shown) |
Line 6: |
Line 6: |
| | | |
| '''Ultibo IGMP (Internet Group Management Protocol) unit''' | | '''Ultibo IGMP (Internet Group Management Protocol) unit''' |
− |
| |
− | ''To be documented''
| |
| | | |
| === Constants === | | === Constants === |
Line 121: |
Line 119: |
| | | |
| | | |
− | '''IGMP protocol transport''' | + | '''IGMP specific classes''' |
| | | |
− | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
| + | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" |
− | | + | |
− | <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> | + | | [[TIGMPProtocolTransport|<code>TIGMPProtocolTransport = class(TProtocolTransport)</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>
| + | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" |
− | | + | |
− | '''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> | + | | [[TIGMPProtocol|<code>TIGMPProtocol = class(TNetworkProtocol)</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 SelectCheck(ASource,ADest:PFDSet; ACode:Integer):Integer; override;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function SelectWait(ASocket:TProtocolSocket;ACode:Integer;ATimeout:LongWord):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 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 StartProtocol:Boolean; override;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function StopProtocol:Boolean; override;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function ProcessProtocol:Boolean; override;</code>
| + | |
− | |
| + | |
| |- | | |- |
| |} | | |} |
− | </div></div>
| + | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" |
− | | + | |
− | '''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> | + | | [[TIGMPGroup|<code>TIGMPGroup = class(TListObject)</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>
| + | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" |
− | | + | |
− | '''IGMP 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 | + | | [[TIGMPSocket|<code>TIGMPSocket = class(TProtocolSocket)</code>]] |
− | |-
| + | |
− | |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>
| + | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" |
− | | + | |
− | '''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> | + | | [[TIGMPBuffer|<code>TIGMPBuffer = class(TSocketBuffer)</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 /> | | <br /> |
| | | |