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