1/* -*- Mode: C; tab-width: 4 -*-
2 *
3 * Copyright (c) 2002-2003 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    Contains:	mDNS platform plugin for VxWorks.
18
19    Copyright:  Copyright (C) 2002-2003 Apple Computer, Inc., All Rights Reserved.
20
21 */
22
23#ifndef __MDNS_VXWORKS__
24#define __MDNS_VXWORKS__
25
26#include    "vxWorks.h"
27#include    "semLib.h"
28
29#include    "mDNSEmbeddedAPI.h"
30
31#ifdef  __cplusplus
32extern "C" {
33#endif
34
35// Forward Declarations
36
37typedef struct  MDNSInterfaceItem MDNSInterfaceItem;
38
39//---------------------------------------------------------------------------------------------------------------------------
40/*!	@struct		mDNS_PlatformSupport_struct
41
42    @abstract	Structure containing platform-specific data.
43 */
44
45struct  mDNS_PlatformSupport_struct
46{
47    SEM_ID lockID;
48    SEM_ID readyEvent;
49    mStatus taskInitErr;
50    SEM_ID quitEvent;
51    MDNSInterfaceItem *     interfaceList;
52    int commandPipe;
53    int task;
54    mDNSBool quit;
55    long configID;
56    int rescheduled;
57};
58
59//---------------------------------------------------------------------------------------------------------------------------
60/*!	@function	mDNSReconfigure
61
62    @abstract	Tell mDNS that the configuration has changed. Call when IP address changes, link goes up after being down, etc.
63
64    @discussion
65
66    VxWorks does not provide a generic mechanism for getting notified when network interfaces change so this routines
67    provides a way for BSP-specific code to signal mDNS that something has changed and it should re-build its interfaces.
68 */
69
70void    mDNSReconfigure( void );
71
72//---------------------------------------------------------------------------------------------------------------------------
73/*!	@struct		ifaddrs
74
75    @abstract	Interface information
76 */
77
78struct ifaddrs
79{
80    struct ifaddrs *    ifa_next;
81    char *              ifa_name;
82    u_int ifa_flags;
83    struct sockaddr *   ifa_addr;
84    struct sockaddr *   ifa_netmask;
85    struct sockaddr *   ifa_dstaddr;
86    void *              ifa_data;
87};
88
89//---------------------------------------------------------------------------------------------------------------------------
90/*!	@function	getifaddrs
91
92    @abstract	Builds a linked list of interfaces. Caller must free using freeifaddrs if successful.
93 */
94
95int getifaddrs( struct ifaddrs **outAddrs );
96
97//---------------------------------------------------------------------------------------------------------------------------
98/*!	@function	freeifaddrs
99
100    @abstract	Frees a linked list of interfaces built with getifaddrs.
101 */
102
103void    freeifaddrs( struct ifaddrs *inAddrs );
104
105//---------------------------------------------------------------------------------------------------------------------------
106/*!	@function	sock_pton
107
108    @abstract	Converts a 'p'resentation address string into a 'n'umeric sockaddr structure.
109
110    @result		0 if successful or an error code on failure.
111 */
112
113int sock_pton( const char *inString, int inFamily, void *outAddr, size_t inAddrSize, size_t *outAddrSize );
114
115//---------------------------------------------------------------------------------------------------------------------------
116/*!	@function	sock_ntop
117
118    @abstract	Converts a 'n'umeric sockaddr structure into a 'p'resentation address string.
119
120    @result		Ptr to 'p'resentation address string buffer if successful or NULL on failure.
121 */
122
123char *  sock_ntop( const void *inAddr, size_t inAddrSize, char *inBuffer, size_t inBufferSize );
124
125#ifdef  __cplusplus
126}
127#endif
128
129#endif  // __MDNS_VXWORKS__
130