]> git.saurik.com Git - apple/mdnsresponder.git/blobdiff - mDNSVxWorks/mDNSVxWorks.h
mDNSResponder-161.1.tar.gz
[apple/mdnsresponder.git] / mDNSVxWorks / mDNSVxWorks.h
index 537c0eedcc7576c146cef683478057af02ea4962..eb62b4877ece633877a74aa87f343383a280218c 100644 (file)
@@ -1,49 +1,40 @@
-/*
- * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
+/* -*- Mode: C; tab-width: 4 -*-
  *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
+ * Copyright (c) 2002-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
 
-       Contains:       mDNS platform plugin for VxWorks.
-
-       Copyright:  Copyright (C) 2002-2003 Apple Computer, Inc., All Rights Reserved.
-
-       Change History (most recent first):
+    Change History (most recent first):
 
 $Log: mDNSVxWorks.h,v $
-Revision 1.2  2003/08/12 19:56:27  cheshire
-Update to APSL 2.0
+Revision 1.5  2006/08/14 23:25:18  cheshire
+Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
 
-Revision 1.1  2003/08/02 10:06:49  bradley
-mDNS platform plugin for VxWorks.
+Revision 1.4  2005/05/30 07:36:38  bradley
+New implementation of the mDNS platform plugin for VxWorks 5.5 or later with IPv6 support.
 
 */
 
-#ifndef        __MDNS_VXWORKS__
-#define        __MDNS_VXWORKS__
+#ifndef        __MDNS_VXWORKS_H__
+#define        __MDNS_VXWORKS_H__
 
 #include       "vxWorks.h"
+#include       "config.h"
+
 #include       "semLib.h"
 
-#include       "mDNSClientAPI.h"
+#include       "CommonServices.h"
+#include       "DebugServices.h"
 
 #ifdef __cplusplus
        extern "C" {
@@ -51,96 +42,91 @@ mDNS platform plugin for VxWorks.
 
 // Forward Declarations
 
-typedef struct MDNSInterfaceItem       MDNSInterfaceItem;
+typedef struct NetworkInterfaceInfoVxWorks             NetworkInterfaceInfoVxWorks;
 
 //---------------------------------------------------------------------------------------------------------------------------
-/*!    @struct         mDNS_PlatformSupport_struct
+/*!    @struct         SocketSet
 
-       @abstract       Structure containing platform-specific data.
+       @abstract       Data for IPv4 and IPv6 sockets.
 */
 
-struct mDNS_PlatformSupport_struct
+typedef struct SocketSet       SocketSet;
+struct SocketSet
 {
-       SEM_ID                                  lockID;
-       SEM_ID                                  readyEvent;
-       mStatus                                 taskInitErr;
-       SEM_ID                                  quitEvent;
-       MDNSInterfaceItem *             interfaceList;
-       int                                             commandPipe;
-       int                                             task;
-       mDNSBool                                quit;
-       long                                    configID;
-       int                                             rescheduled;
+       NetworkInterfaceInfoVxWorks *           info;
+       SocketRef                                                       sockV4;
+       SocketRef                                                       sockV6;
 };
 
 //---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       mDNSReconfigure
-       
-       @abstract       Tell mDNS that the configuration has changed. Call when IP address changes, link goes up after being down, etc.
-       
-       @discussion
-       
-       VxWorks does not provide a generic mechanism for getting notified when network interfaces change so this routines
-       provides a way for BSP-specific code to signal mDNS that something has changed and it should re-build its interfaces.
-*/
-
-void   mDNSReconfigure( void );
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @struct         ifaddrs
+/*!    @struct         NetworkInterfaceInfoVxWorks
 
-       @abstract       Interface information
+       @abstract       Interface info for VxWorks.
 */
 
-struct ifaddrs
+struct NetworkInterfaceInfoVxWorks
 {
-       struct ifaddrs *        ifa_next;
-       char *                          ifa_name;
-       u_int                           ifa_flags;
-       struct sockaddr *       ifa_addr;
-       struct sockaddr *       ifa_netmask;
-       struct sockaddr *       ifa_dstaddr;
-       void *                          ifa_data;
+       NetworkInterfaceInfo                            ifinfo;         // MUST be the first element in this structure.
+       NetworkInterfaceInfoVxWorks *           next;
+       mDNSu32                                                         exists;         // 1 = currently exists in getifaddrs list; 0 = doesn't.
+                                                                                                       // 2 = exists, but McastTxRx state changed.
+       mDNSs32                                                         lastSeen;       // If exists == 0, last time this interface appeared in getifaddrs list.
+       mDNSu32                                                         scopeID;        // Interface index / IPv6 scope ID.
+       int                                                                     family;         // Socket address family of the primary socket.
+       mDNSBool                                                        multicast;
+       SocketSet                                                       ss;
 };
 
 //---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       getifaddrs
-
-       @abstract       Builds a linked list of interfaces. Caller must free using freeifaddrs if successful.
-*/
-
-int    getifaddrs( struct ifaddrs **outAddrs );
-
-//---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       freeifaddrs
+/*!    @struct         mDNS_PlatformSupport_struct
 
-       @abstract       Frees a linked list of interfaces built with getifaddrs.
+       @abstract       Data for mDNS platform plugin.
 */
 
-void   freeifaddrs( struct ifaddrs *inAddrs );
+struct mDNS_PlatformSupport_struct
+{
+       NetworkInterfaceInfoVxWorks *           interfaceList;
+       SocketSet                                                       unicastSS;
+       domainlabel                                                     userNiceLabel;
+       domainlabel                                                     userHostLabel;
+       
+       SEM_ID                                                          lock;
+       SEM_ID                                                          initEvent;
+       mStatus                                                         initErr;
+       SEM_ID                                                          quitEvent;      
+       int                                                                     commandPipe;
+       int                                                                     taskID;
+       mDNSBool                                                        quit;
+};
 
 //---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       sock_pton
-
-       @abstract       Converts a 'p'resentation address string into a 'n'umeric sockaddr structure.
+/*!    @function       mDNSReconfigure
        
-       @result         0 if successful or an error code on failure.
+       @abstract       Tell mDNS that the configuration has changed. Call when IP address changes, link goes up after being down, etc.
+       
+       @discussion
+       
+       VxWorks does not provide a generic mechanism for getting notified when network interfaces change so this routines
+       provides a way for BSP-specific code to signal mDNS that something has changed and it should re-build its interfaces.
 */
 
-int    sock_pton( const char *inString, int inFamily, void *outAddr, size_t inAddrSize, size_t *outAddrSize );
+void   mDNSReconfigure( void );
 
 //---------------------------------------------------------------------------------------------------------------------------
-/*!    @function       sock_ntop
-
-       @abstract       Converts a 'n'umeric sockaddr structure into a 'p'resentation address string.
+/*!    @function       mDNSDeferIPv4
+       
+       @abstract       Tells mDNS whether to defer advertising of IPv4 interfaces.
+       
+       @discussion
        
-       @result         Ptr to 'p'resentation address string buffer if successful or NULL on failure.
+       To workaround problems with clients getting a link-local IPv4 address before a DHCP address is acquired, this allows
+       external code to defer advertising of IPv4 addresses until a DHCP lease has been acquired (or it times out).
 */
 
-char * sock_ntop( const void *inAddr, size_t inAddrSize, char *inBuffer, size_t inBufferSize );
+void   mDNSDeferIPv4( mDNSBool inDefer );
 
 #ifdef __cplusplus
        }
 #endif
 
-#endif // __MDNS_VXWORKS__
+#endif // __MDNS_VXWORKS_H__