2007-09-30 05:08:02 +02:00
|
|
|
/** @file
|
|
|
|
|
2009-01-16 01:09:52 +01:00
|
|
|
Copyright (c) 2005 - 2006, Intel Corporation.<BR>
|
2007-09-30 05:08:02 +02:00
|
|
|
All rights reserved. This program and the accompanying materials
|
|
|
|
are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
which accompanies this distribution. The full text of the license may be found at
|
|
|
|
http://opensource.org/licenses/bsd-license.php
|
|
|
|
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifndef __EFI_IP4_IGMP_H__
|
|
|
|
#define __EFI_IP4_IGMP_H__
|
|
|
|
|
|
|
|
#pragma pack(1)
|
|
|
|
typedef struct {
|
|
|
|
UINT8 Type;
|
|
|
|
UINT8 MaxRespTime;
|
|
|
|
UINT16 Checksum;
|
|
|
|
IP4_ADDR Group;
|
|
|
|
} IGMP_HEAD;
|
|
|
|
#pragma pack()
|
|
|
|
|
2008-11-11 10:23:25 +01:00
|
|
|
///
|
|
|
|
/// The status of multicast group. It isn't necessary to maintain
|
|
|
|
/// explicit state of host state diagram. A group with non-zero
|
|
|
|
/// DelayTime is in "delaying member" state. otherwise, it is in
|
|
|
|
/// "idle member" state.
|
|
|
|
///
|
2007-09-30 05:08:02 +02:00
|
|
|
typedef struct {
|
2008-02-14 10:40:22 +01:00
|
|
|
LIST_ENTRY Link;
|
2007-09-30 05:08:02 +02:00
|
|
|
INTN RefCnt;
|
|
|
|
IP4_ADDR Address;
|
|
|
|
INTN DelayTime;
|
|
|
|
BOOLEAN ReportByUs;
|
|
|
|
EFI_MAC_ADDRESS Mac;
|
|
|
|
} IGMP_GROUP;
|
|
|
|
|
2008-11-11 10:23:25 +01:00
|
|
|
///
|
|
|
|
/// The IGMP status. Each IP4 service instance has a IGMP_SERVICE_DATA
|
|
|
|
/// attached. The Igmpv1QuerySeen remember whether the server on this
|
|
|
|
/// connected network is v1 or v2.
|
|
|
|
///
|
2007-09-30 05:08:02 +02:00
|
|
|
typedef struct {
|
|
|
|
INTN Igmpv1QuerySeen;
|
2008-02-14 10:40:22 +01:00
|
|
|
LIST_ENTRY Groups;
|
2007-09-30 05:08:02 +02:00
|
|
|
} IGMP_SERVICE_DATA;
|
|
|
|
|
2008-11-11 03:44:30 +01:00
|
|
|
typedef enum {
|
2007-09-30 05:08:02 +02:00
|
|
|
//
|
|
|
|
// IGMP message type
|
|
|
|
//
|
|
|
|
IGMP_MEMBERSHIP_QUERY = 0x11,
|
|
|
|
IGMP_V1_MEMBERSHIP_REPORT = 0x12,
|
|
|
|
IGMP_V2_MEMBERSHIP_REPORT = 0x16,
|
|
|
|
IGMP_LEAVE_GROUP = 0x17,
|
|
|
|
|
|
|
|
IGMP_V1ROUTER_PRESENT = 400,
|
|
|
|
IGMP_UNSOLICIATED_REPORT = 10
|
2008-11-11 03:44:30 +01:00
|
|
|
} IGMP_ENUM_TYPES;
|
2007-09-30 05:08:02 +02:00
|
|
|
|
2008-11-18 10:29:44 +01:00
|
|
|
/**
|
|
|
|
Init the IGMP control data of the IP4 service instance, configure
|
|
|
|
MNP to receive ALL SYSTEM multicast.
|
|
|
|
|
2009-01-16 01:09:52 +01:00
|
|
|
@param[in, out] IpSb The IP4 service whose IGMP is to be initialized.
|
2008-11-18 10:29:44 +01:00
|
|
|
|
|
|
|
@retval EFI_SUCCESS IGMP of the IpSb is successfully initialized.
|
|
|
|
@retval EFI_OUT_OF_RESOURCES Failed to allocate resource to initialize IGMP.
|
|
|
|
@retval Others Failed to initialize the IGMP of IpSb.
|
|
|
|
|
|
|
|
**/
|
2007-09-30 05:08:02 +02:00
|
|
|
EFI_STATUS
|
|
|
|
Ip4InitIgmp (
|
2008-11-18 10:29:44 +01:00
|
|
|
IN OUT IP4_SERVICE *IpSb
|
2007-09-30 05:08:02 +02:00
|
|
|
);
|
|
|
|
|
2008-11-18 10:29:44 +01:00
|
|
|
/**
|
|
|
|
Join the multicast group on behalf of this IP4 child
|
|
|
|
|
2009-01-16 01:09:52 +01:00
|
|
|
@param[in] IpInstance The IP4 child that wants to join the group
|
|
|
|
@param[in] Address The group to join
|
2008-11-18 10:29:44 +01:00
|
|
|
|
|
|
|
@retval EFI_SUCCESS Successfully join the multicast group
|
|
|
|
@retval EFI_OUT_OF_RESOURCES Failed to allocate resources
|
|
|
|
@retval Others Failed to join the multicast group.
|
|
|
|
|
|
|
|
**/
|
2007-09-30 05:08:02 +02:00
|
|
|
EFI_STATUS
|
|
|
|
Ip4JoinGroup (
|
2008-11-18 10:29:44 +01:00
|
|
|
IN IP4_PROTOCOL *IpInstance,
|
|
|
|
IN IP4_ADDR Address
|
2007-09-30 05:08:02 +02:00
|
|
|
);
|
|
|
|
|
2008-11-18 10:29:44 +01:00
|
|
|
/**
|
|
|
|
Leave the IP4 multicast group on behalf of IpInstance.
|
|
|
|
|
2009-01-16 01:09:52 +01:00
|
|
|
@param[in] IpInstance The IP4 child that wants to leave the group
|
2008-11-18 10:29:44 +01:00
|
|
|
address
|
2009-01-16 01:09:52 +01:00
|
|
|
@param[in] Address The group address to leave
|
2008-11-18 10:29:44 +01:00
|
|
|
|
|
|
|
@retval EFI_NOT_FOUND The IP4 service instance isn't in the group
|
|
|
|
@retval EFI_SUCCESS Successfully leave the multicast group.
|
|
|
|
@retval Others Failed to leave the multicast group.
|
|
|
|
|
|
|
|
**/
|
2007-09-30 05:08:02 +02:00
|
|
|
EFI_STATUS
|
|
|
|
Ip4LeaveGroup (
|
2008-11-18 10:29:44 +01:00
|
|
|
IN IP4_PROTOCOL *IpInstance,
|
|
|
|
IN IP4_ADDR Address
|
2007-09-30 05:08:02 +02:00
|
|
|
);
|
|
|
|
|
2008-11-18 10:29:44 +01:00
|
|
|
/**
|
|
|
|
Handle the received IGMP message for the IP4 service instance.
|
|
|
|
|
2009-01-16 01:09:52 +01:00
|
|
|
@param[in] IpSb The IP4 service instance that received the message
|
|
|
|
@param[in] Head The IP4 header of the received message
|
|
|
|
@param[in] Packet The IGMP message, without IP4 header
|
2008-11-18 10:29:44 +01:00
|
|
|
|
|
|
|
@retval EFI_INVALID_PARAMETER The IGMP message is malformated.
|
|
|
|
@retval EFI_SUCCESS The IGMP message is successfully processed.
|
|
|
|
|
|
|
|
**/
|
2007-09-30 05:08:02 +02:00
|
|
|
EFI_STATUS
|
|
|
|
Ip4IgmpHandle (
|
2008-11-18 10:29:44 +01:00
|
|
|
IN IP4_SERVICE *IpSb,
|
|
|
|
IN IP4_HEAD *Head,
|
|
|
|
IN NET_BUF *Packet
|
2007-09-30 05:08:02 +02:00
|
|
|
);
|
|
|
|
|
2008-11-18 10:29:44 +01:00
|
|
|
/**
|
|
|
|
The periodical timer function for IGMP. It does the following
|
|
|
|
things:
|
|
|
|
1. Decrease the Igmpv1QuerySeen to make it possible to refresh
|
|
|
|
the IGMP server type.
|
|
|
|
2. Decrease the report timer for each IGMP group in "delaying
|
|
|
|
member" state.
|
|
|
|
|
2009-01-16 01:09:52 +01:00
|
|
|
@param[in] IpSb The IP4 service instance that is ticking
|
2008-11-18 10:29:44 +01:00
|
|
|
|
|
|
|
**/
|
2007-09-30 05:08:02 +02:00
|
|
|
VOID
|
|
|
|
Ip4IgmpTicking (
|
2008-11-18 10:29:44 +01:00
|
|
|
IN IP4_SERVICE *IpSb
|
2007-09-30 05:08:02 +02:00
|
|
|
);
|
|
|
|
|
2008-11-18 10:29:44 +01:00
|
|
|
/**
|
|
|
|
Add a group address to the array of group addresses.
|
|
|
|
The caller should make sure that no duplicated address
|
|
|
|
existed in the array. Although the function doesn't
|
|
|
|
assume the byte order of the both Source and Addr, the
|
|
|
|
network byte order is used by the caller.
|
|
|
|
|
2009-01-16 01:09:52 +01:00
|
|
|
@param[in] Source The array of group addresses to add to
|
|
|
|
@param[in] Count The number of group addresses in the Source
|
|
|
|
@param[in] Addr The IP4 multicast address to add
|
2008-11-18 10:29:44 +01:00
|
|
|
|
|
|
|
@return NULL if failed to allocate memory for the new groups,
|
|
|
|
otherwise the new combined group addresses.
|
|
|
|
|
|
|
|
**/
|
2007-09-30 05:08:02 +02:00
|
|
|
IP4_ADDR *
|
|
|
|
Ip4CombineGroups (
|
2008-11-18 10:29:44 +01:00
|
|
|
IN IP4_ADDR *Source,
|
|
|
|
IN UINT32 Count,
|
|
|
|
IN IP4_ADDR Addr
|
2007-09-30 05:08:02 +02:00
|
|
|
);
|
|
|
|
|
2008-11-18 10:29:44 +01:00
|
|
|
/**
|
|
|
|
Remove a group address from the array of group addresses.
|
|
|
|
Although the function doesn't assume the byte order of the
|
|
|
|
both Groups and Addr, the network byte order is used by
|
|
|
|
the caller.
|
|
|
|
|
2009-01-16 01:09:52 +01:00
|
|
|
@param Groups The array of group addresses to remove from
|
|
|
|
@param Count The number of group addresses in the Groups
|
|
|
|
@param Addr The IP4 multicast address to remove
|
2008-11-18 10:29:44 +01:00
|
|
|
|
|
|
|
@return The nubmer of group addresses in the Groups after remove.
|
|
|
|
It is Count if the Addr isn't in the Groups.
|
|
|
|
|
|
|
|
**/
|
2007-09-30 05:08:02 +02:00
|
|
|
INTN
|
|
|
|
Ip4RemoveGroupAddr (
|
2008-11-18 10:29:44 +01:00
|
|
|
IN OUT IP4_ADDR *Groups,
|
|
|
|
IN UINT32 Count,
|
|
|
|
IN IP4_ADDR Addr
|
2007-09-30 05:08:02 +02:00
|
|
|
);
|
|
|
|
|
2008-11-18 10:29:44 +01:00
|
|
|
/**
|
|
|
|
Find the IGMP_GROUP structure which contains the status of multicast
|
|
|
|
group Address in this IGMP control block
|
|
|
|
|
2009-01-16 01:09:52 +01:00
|
|
|
@param[in] IgmpCtrl The IGMP control block to search from
|
|
|
|
@param[in] Address The multicast address to search
|
2008-11-18 10:29:44 +01:00
|
|
|
|
|
|
|
@return NULL if the multicast address isn't in the IGMP control block. Otherwise
|
|
|
|
the point to the IGMP_GROUP which contains the status of multicast group
|
|
|
|
for Address.
|
|
|
|
|
|
|
|
**/
|
2007-09-30 05:08:02 +02:00
|
|
|
IGMP_GROUP *
|
|
|
|
Ip4FindGroup (
|
2008-11-18 10:29:44 +01:00
|
|
|
IN IGMP_SERVICE_DATA *IgmpCtrl,
|
|
|
|
IN IP4_ADDR Address
|
2007-09-30 05:08:02 +02:00
|
|
|
);
|
|
|
|
#endif
|