147e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt/* -*- Mode: C; tab-width: 4 -*- 247e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt * 347e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt * Copyright (c) 2003-2004, Apple Computer, Inc. All rights reserved. 447e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt * 547e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt * Redistribution and use in source and binary forms, with or without 647e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt * modification, are permitted provided that the following conditions are met: 747e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt * 847e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt * 1. Redistributions of source code must retain the above copyright notice, 947e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt * this list of conditions and the following disclaimer. 1047e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt * 2. Redistributions in binary form must reproduce the above copyright notice, 1147e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt * this list of conditions and the following disclaimer in the documentation 1247e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt * and/or other materials provided with the distribution. 1347e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of its 1447e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt * contributors may be used to endorse or promote products derived from this 1547e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt * software without specific prior written permission. 1647e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt * 1747e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 1847e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 1947e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 2047e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 2147e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 2247e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 2347e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 2447e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2547e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 2647e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2747e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt */ 2847e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt 2947e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt#ifndef DNSSD_IPC_H 3047e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt#define DNSSD_IPC_H 3147e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt 3247e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt#include "dns_sd.h" 3347e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt 3447e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt// 3547e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt// Common cross platform services 3647e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt// 3747e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt#if defined(WIN32) 3847e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# include <winsock2.h> 3947e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define dnssd_InvalidSocket INVALID_SOCKET 4047e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define dnssd_SocketValid(s) ((s) != INVALID_SOCKET) 4147e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define dnssd_EWOULDBLOCK WSAEWOULDBLOCK 4247e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define dnssd_EINTR WSAEINTR 4347e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define dnssd_ECONNRESET WSAECONNRESET 4447e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define dnssd_sock_t SOCKET 4547e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define dnssd_socklen_t int 4647e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define dnssd_close(sock) closesocket(sock) 4747e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define dnssd_errno WSAGetLastError() 4847e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define dnssd_strerror(X) win32_strerror(X) 4947e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define ssize_t int 5047e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define getpid _getpid 5147e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define unlink _unlink 5247e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwaltextern char *win32_strerror(int inErrorCode); 5347e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt#else 5447e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# include <sys/types.h> 5547e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# include <unistd.h> 56dd52342e088715929196886494c5055f9186d5c3Robert Greenwalt#ifdef __ANDROID__ 57dd52342e088715929196886494c5055f9186d5c3Robert Greenwalt# include <sys/socket.h> 58dd52342e088715929196886494c5055f9186d5c3Robert Greenwalt#endif 5947e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# include <sys/un.h> 6047e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# include <string.h> 6147e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# include <stdio.h> 6247e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# include <stdlib.h> 6347e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# include <sys/stat.h> 64dd52342e088715929196886494c5055f9186d5c3Robert Greenwalt#ifndef __ANDROID__ 6547e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# include <sys/socket.h> 66dd52342e088715929196886494c5055f9186d5c3Robert Greenwalt#endif 6747e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# include <netinet/in.h> 6847e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define dnssd_InvalidSocket -1 6947e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define dnssd_SocketValid(s) ((s) >= 0) 7047e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define dnssd_EWOULDBLOCK EWOULDBLOCK 7147e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define dnssd_EINTR EINTR 7247e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define dnssd_ECONNRESET ECONNRESET 7347e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define dnssd_EPIPE EPIPE 7447e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define dnssd_sock_t int 7547e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define dnssd_socklen_t unsigned int 7647e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define dnssd_close(sock) close(sock) 7747e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define dnssd_errno errno 7847e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define dnssd_strerror(X) strerror(X) 7947e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt#endif 8047e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt 8147e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt#if defined(USE_TCP_LOOPBACK) 8247e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define AF_DNSSD AF_INET 8347e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define MDNS_TCP_SERVERADDR "127.0.0.1" 8447e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define MDNS_TCP_SERVERPORT 5354 8547e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define LISTENQ 5 8647e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define dnssd_sockaddr_t struct sockaddr_in 8747e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt#else 8847e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define AF_DNSSD AF_LOCAL 8947e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# ifndef MDNS_UDS_SERVERPATH 9047e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define MDNS_UDS_SERVERPATH "/var/run/mDNSResponder" 9147e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# endif 9247e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define LISTENQ 100 9347e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt // longest legal control path length 9447e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define MAX_CTLPATH 256 9547e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# define dnssd_sockaddr_t struct sockaddr_un 9647e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt#endif 9747e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt 9847e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt// Compatibility workaround 9947e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt#ifndef AF_LOCAL 10047e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt#define AF_LOCAL AF_UNIX 10147e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt#endif 10247e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt 10347e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt// General UDS constants 10447e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt#define TXT_RECORD_INDEX ((uint32_t)(-1)) // record index for default text record 10547e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt 10647e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt// IPC data encoding constants and types 10747e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt#define VERSION 1 10847e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt#define IPC_FLAGS_NOREPLY 1 // set flag if no asynchronous replies are to be sent to client 10947e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt 11047e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt// Structure packing macro. If we're not using GNUC, it's not fatal. Most compilers naturally pack the on-the-wire 11147e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt// structures correctly anyway, so a plain "struct" is usually fine. In the event that structures are not packed 11247e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt// correctly, our compile-time assertion checks will catch it and prevent inadvertent generation of non-working code. 11347e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt#ifndef packedstruct 11447e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt #if ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 9))) 11547e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt #define packedstruct struct __attribute__((__packed__)) 11647e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt #define packedunion union __attribute__((__packed__)) 11747e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt #else 11847e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt #define packedstruct struct 11947e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt #define packedunion union 12047e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt #endif 12147e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt#endif 12247e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt 12347e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalttypedef enum 12447e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt { 12547e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt request_op_none = 0, // No request yet received on this connection 12647e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt connection_request = 1, // connected socket via DNSServiceConnect() 12747e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt reg_record_request, // reg/remove record only valid for connected sockets 12847e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt remove_record_request, 12947e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt enumeration_request, 13047e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt reg_service_request, 13147e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt browse_request, 13247e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt resolve_request, 13347e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt query_request, 13447e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt reconfirm_record_request, 13547e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt add_record_request, 13647e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt update_record_request, 13747e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt setdomain_request, // Up to here is in Tiger and B4W 1.0.3 13847e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt getproperty_request, // New in B4W 1.0.4 13947e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt port_mapping_request, // New in Leopard and B4W 2.0 14047e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt addrinfo_request, 14147e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt send_bpf, // New in SL 142afc86e3216439a9437ea54905853275111eac4e2Robert Greenwalt sethost_request, 14347e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt cancel_request = 63 14447e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt } request_op_t; 14547e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt 14647e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalttypedef enum 14747e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt { 14847e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt enumeration_reply_op = 64, 14947e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt reg_service_reply_op, 15047e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt browse_reply_op, 15147e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt resolve_reply_op, 15247e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt query_reply_op, 15347e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt reg_record_reply_op, // Up to here is in Tiger and B4W 1.0.3 15447e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt getproperty_reply_op, // New in B4W 1.0.4 15547e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt port_mapping_reply_op, // New in Leopard and B4W 2.0 156afc86e3216439a9437ea54905853275111eac4e2Robert Greenwalt addrinfo_reply_op, 157afc86e3216439a9437ea54905853275111eac4e2Robert Greenwalt sethost_reply, 15847e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt } reply_op_t; 15947e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt 16047e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt#if defined(_WIN64) 16147e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt# pragma pack(4) 16247e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt#endif 16347e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt 16447e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt// Define context object big enough to hold a 64-bit pointer, 16547e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt// to accomodate 64-bit clients communicating with 32-bit daemon. 16647e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt// There's no reason for the daemon to ever be a 64-bit process, but its clients might be 16747e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalttypedef packedunion 16847e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt { 16947e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt void *context; 17047e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt uint32_t u32[2]; 17147e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt } client_context_t; 17247e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt 17347e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalttypedef packedstruct 17447e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt { 17547e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt uint32_t version; 17647e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt uint32_t datalen; 17747e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt uint32_t ipc_flags; 17847e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt uint32_t op; // request_op_t or reply_op_t 17947e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt client_context_t client_context; // context passed from client, returned by server in corresponding reply 18047e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt uint32_t reg_index; // identifier for a record registered via DNSServiceRegisterRecord() on a 18147e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt // socket connected by DNSServiceCreateConnection(). Must be unique in the scope of the connection, such that and 18247e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt // index/socket pair uniquely identifies a record. (Used to select records for removal by DNSServiceRemoveRecord()) 18347e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt } ipc_msg_hdr; 18447e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt 18547e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt// routines to write to and extract data from message buffers. 18647e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt// caller responsible for bounds checking. 18747e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt// ptr is the address of the pointer to the start of the field. 18847e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt// it is advanced to point to the next field, or the end of the message 18947e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt 19047e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwaltvoid put_uint32(const uint32_t l, char **ptr); 19147e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwaltuint32_t get_uint32(const char **ptr, const char *end); 19247e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt 19347e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwaltvoid put_uint16(uint16_t s, char **ptr); 19447e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwaltuint16_t get_uint16(const char **ptr, const char *end); 19547e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt 19647e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt#define put_flags put_uint32 19747e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt#define get_flags get_uint32 19847e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt 19947e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt#define put_error_code put_uint32 20047e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt#define get_error_code get_uint32 20147e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt 20247e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwaltint put_string(const char *str, char **ptr); 20347e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwaltint get_string(const char **ptr, const char *const end, char *buffer, int buflen); 20447e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt 20547e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwaltvoid put_rdata(const int rdlen, const unsigned char *rdata, char **ptr); 20647e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwaltconst char *get_rdata(const char **ptr, const char *end, int rdlen); // return value is rdata pointed to by *ptr - 20747e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt // rdata is not copied from buffer. 20847e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt 20947e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwaltvoid ConvertHeaderBytes(ipc_msg_hdr *hdr); 21047e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt 21147e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwaltstruct CompileTimeAssertionChecks_dnssd_ipc 21247e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt { 21347e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt // Check that the compiler generated our on-the-wire packet format structure definitions 21447e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt // properly packed, without adding padding bytes to align fields on 32-bit or 64-bit boundaries. 21547e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt char assert0[(sizeof(client_context_t) == 8) ? 1 : -1]; 21647e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt char assert1[(sizeof(ipc_msg_hdr) == 28) ? 1 : -1]; 21747e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt }; 21847e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt 21947e4cebad7397422144bb03a21f3f7682c062c4aRobert Greenwalt#endif // DNSSD_IPC_H 220