2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
32 #include <sys/types.h>
40 #define UDSDEBUG // verbose debug output
42 // General UDS constants
43 #define MDNS_UDS_SERVERPATH "/var/run/mDNSResponder"
45 #define TXT_RECORD_INDEX -1 // record index for default text record
46 #define MAX_CTLPATH 256 // longest legal control path length
48 // IPC data encoding constants and types
50 #define IPC_FLAGS_NOREPLY 1 // set flag if no asynchronous replies are to be sent to client
51 #define IPC_FLAGS_REUSE_SOCKET 2 // set flag if synchronous errors are to be sent via the primary socket
52 // (if not set, first string in message buffer must be path to error socket
57 connection
= 1, // connected socket via DNSServiceConnect()
58 reg_record_request
, // reg/remove record only valid for connected sockets
59 remove_record_request
,
65 reconfirm_record_request
,
72 enumeration_reply
= 64,
81 typedef struct ipc_msg_hdr_struct ipc_msg_hdr
;
84 // client stub callback to process message from server and deliver results to
87 typedef void (*process_reply_callback
)
94 // allow 64-bit client to interoperate w/ 32-bit daemon
102 typedef struct ipc_msg_hdr_struct
109 request_op_t request_op
;
112 client_context_t client_context
; // context passed from client, returned by server in corresponding reply
113 int reg_index
; // identifier for a record registered via DNSServiceRegisterRecord() on a
114 // socket connected by DNSServiceConnect(). Must be unique in the scope of the connection, such that and
115 // index/socket pair uniquely identifies a record. (Used to select records for removal by DNSServiceRemoveRecord())
116 } ipc_msg_hdr_struct
;
121 // routines to write to and extract data from message buffers.
122 // caller responsible for bounds checking.
123 // ptr is the address of the pointer to the start of the field.
124 // it is advanced to point to the next field, or the end of the message
127 void put_flags(const DNSServiceFlags flags
, char **ptr
);
128 DNSServiceFlags
get_flags(char **ptr
);
130 void put_long(const uint32_t l
, char **ptr
);
131 uint32_t get_long(char **ptr
);
133 void put_error_code(const DNSServiceErrorType
, char **ptr
);
134 DNSServiceErrorType
get_error_code(char **ptr
);
136 int put_string(const char *str
, char **ptr
);
137 int get_string(char **ptr
, char *buffer
, int buflen
);
139 void put_rdata(const int rdlen
, const char *rdata
, char **ptr
);
140 char *get_rdata(char **ptr
, int rdlen
); // return value is rdata pointed to by *ptr -
141 // rdata is not copied from buffer.
143 void put_short(uint16_t s
, char **ptr
);
144 uint16_t get_short(char **ptr
);
148 #endif // DNSSD_IPC_H