1/* -*- Mode: C; tab-width: 4 -*-
2 *
3 * Copyright (c) 2002-2005 Apple Computer, Inc. All rights reserved.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *     http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef __MDNS_VXWORKS_H__
19#define __MDNS_VXWORKS_H__
20
21#include    "vxWorks.h"
22#include    "config.h"
23
24#include    "semLib.h"
25
26#include    "CommonServices.h"
27#include    "DebugServices.h"
28
29#ifdef  __cplusplus
30extern "C" {
31#endif
32
33// Forward Declarations
34
35typedef struct  NetworkInterfaceInfoVxWorks NetworkInterfaceInfoVxWorks;
36
37//---------------------------------------------------------------------------------------------------------------------------
38/*!	@struct		SocketSet
39
40    @abstract	Data for IPv4 and IPv6 sockets.
41 */
42
43typedef struct  SocketSet SocketSet;
44struct  SocketSet
45{
46    NetworkInterfaceInfoVxWorks *       info;
47    SocketRef sockV4;
48    SocketRef sockV6;
49};
50
51//---------------------------------------------------------------------------------------------------------------------------
52/*!	@struct		NetworkInterfaceInfoVxWorks
53
54    @abstract	Interface info for VxWorks.
55 */
56
57struct  NetworkInterfaceInfoVxWorks
58{
59    NetworkInterfaceInfo ifinfo;                    // MUST be the first element in this structure.
60    NetworkInterfaceInfoVxWorks *       next;
61    mDNSu32 exists;                                 // 1 = currently exists in getifaddrs list; 0 = doesn't.
62                                                    // 2 = exists, but McastTxRx state changed.
63    mDNSs32 lastSeen;                               // If exists == 0, last time this interface appeared in getifaddrs list.
64    mDNSu32 scopeID;                                // Interface index / IPv6 scope ID.
65    int family;                                     // Socket address family of the primary socket.
66    mDNSBool multicast;
67    SocketSet ss;
68};
69
70//---------------------------------------------------------------------------------------------------------------------------
71/*!	@struct		mDNS_PlatformSupport_struct
72
73    @abstract	Data for mDNS platform plugin.
74 */
75
76struct  mDNS_PlatformSupport_struct
77{
78    NetworkInterfaceInfoVxWorks *       interfaceList;
79    SocketSet unicastSS;
80    domainlabel userNiceLabel;
81    domainlabel userHostLabel;
82
83    SEM_ID lock;
84    SEM_ID initEvent;
85    mStatus initErr;
86    SEM_ID quitEvent;
87    int commandPipe;
88    int taskID;
89    mDNSBool quit;
90};
91
92//---------------------------------------------------------------------------------------------------------------------------
93/*!	@function	mDNSReconfigure
94
95    @abstract	Tell mDNS that the configuration has changed. Call when IP address changes, link goes up after being down, etc.
96
97    @discussion
98
99    VxWorks does not provide a generic mechanism for getting notified when network interfaces change so this routines
100    provides a way for BSP-specific code to signal mDNS that something has changed and it should re-build its interfaces.
101 */
102
103void    mDNSReconfigure( void );
104
105//---------------------------------------------------------------------------------------------------------------------------
106/*!	@function	mDNSDeferIPv4
107
108    @abstract	Tells mDNS whether to defer advertising of IPv4 interfaces.
109
110    @discussion
111
112    To workaround problems with clients getting a link-local IPv4 address before a DHCP address is acquired, this allows
113    external code to defer advertising of IPv4 addresses until a DHCP lease has been acquired (or it times out).
114 */
115
116void    mDNSDeferIPv4( mDNSBool inDefer );
117
118#ifdef  __cplusplus
119}
120#endif
121
122#endif  // __MDNS_VXWORKS_H__
123