summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Igmp.h
blob: 8c01d1f629e82cbf6dd81024dff9d748e0c02a47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/** @file

Copyright (c) 2005 - 2006, Intel Corporation
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.


Module Name:

  Ip4Igmp.h

Abstract:


**/

#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()

//
// 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.
//
typedef struct {
  LIST_ENTRY              Link;
  INTN                    RefCnt;
  IP4_ADDR                Address;
  INTN                    DelayTime;
  BOOLEAN                 ReportByUs;
  EFI_MAC_ADDRESS         Mac;
} IGMP_GROUP;

//
// 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.
//
typedef struct {
  INTN                    Igmpv1QuerySeen;
  LIST_ENTRY              Groups;
} IGMP_SERVICE_DATA;

enum {
  //
  // 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
};

EFI_STATUS
Ip4InitIgmp (
  IN IP4_SERVICE          *IpService
  );

EFI_STATUS
Ip4JoinGroup (
  IN IP4_PROTOCOL         *IpInstance,
  IN IP4_ADDR             Address
  );

EFI_STATUS
Ip4LeaveGroup (
  IN IP4_PROTOCOL         *IpInstance,
  IN IP4_ADDR             Address
  );

EFI_STATUS
Ip4IgmpHandle (
  IN IP4_SERVICE          *IpService,
  IN IP4_HEAD             *Head,
  IN NET_BUF              *Packet
  );

VOID
Ip4IgmpTicking (
  IN IP4_SERVICE          *IpService
  );

IP4_ADDR *
Ip4CombineGroups (
  IN  IP4_ADDR            *SourceGroups,
  IN  UINT32              Count,
  IN  IP4_ADDR            Addr
  );

INTN
Ip4RemoveGroupAddr (
  IN IP4_ADDR             *Group,
  IN UINT32               GroupCnt,
  IN IP4_ADDR             Addr
  );

IGMP_GROUP *
Ip4FindGroup (
  IN IGMP_SERVICE_DATA    *IgmpCtrl,
  IN IP4_ADDR             Address
  );
#endif