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