3 * Copyright (c) 2019 Apple Computer, Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * Structure definitions for the Service Registration Protocol gateway.
20 typedef struct subnet subnet_t
;
22 subnet_t
*NULLABLE next
;
28 typedef struct udp_validator udp_validator_t
;
29 struct udp_validator
{
30 udp_validator_t
*NULLABLE next
;
33 subnet_t
*NONNULL subnets
;
36 typedef struct delete delete_t
;
38 delete_t
*NULLABLE next
;
39 dns_name_t
*NONNULL name
;
40 dns_name_t
*NONNULL zone
;
44 typedef struct host_addr host_addr_t
;
46 host_addr_t
*NULLABLE next
;
49 typedef struct dns_host_description dns_host_description_t
;
50 struct dns_host_description
{
51 dns_name_t
*NONNULL name
;
52 host_addr_t
*NULLABLE addrs
;
53 dns_rr_t
*NULLABLE key
;
54 delete_t
*NULLABLE
delete;
58 typedef struct service service_t
;
60 service_t
*NULLABLE next
;
61 dns_rr_t
*NONNULL rr
; // The service name is rr->name.
62 dns_name_t
*NONNULL zone
;
65 typedef struct service_instance service_instance_t
;
66 struct service_instance
{
67 service_instance_t
*NULLABLE next
;
68 dns_host_description_t
*NULLABLE host
;
69 dns_name_t
*NONNULL name
;
70 delete_t
*NULLABLE
delete;
71 service_t
*NONNULL service
;
73 dns_rr_t
*NULLABLE srv
, *NULLABLE txt
;
76 // The update_t structure is used to maintain the ongoing state of a particular DNS Update.
78 typedef enum update_state update_state_t
;
80 connect_to_server
, // Establish a connection with the auth server.
81 create_nonexistent
, // Update service instance assuming it's not already there (case 1).
82 refresh_existing
, // Update service instance assuming it's already there and the same (case 2).
83 create_nonexistent_instance
, // Update service instance assuming it's not there
84 refresh_existing_instance
, // Update host assuming it's there and the same
85 create_nonexistent_host
, // Update a host that's not present (and also the services)
86 refresh_existing_host
, // Update a host that's present (and also the services)
87 delete_failed_instance
, // The update failed, so delete service instances that were successfully added.
90 typedef enum update_event update_event_t
;
92 update_event_connected
,
93 update_event_disconnected
,
94 update_event_response_received
97 typedef struct update update_t
;
99 comm_t
*NONNULL server
; // Connection to authoritative server
100 comm_t
*NONNULL client
; // Connection to SRP client (which might just be a UDP socket).
101 update_state_t state
;
102 dns_host_description_t
*NONNULL host
;
103 service_instance_t
*NONNULL instances
;
104 service_instance_t
*NULLABLE instance
; // If we are updating instances one at a time.
105 service_instance_t
*NULLABLE added_instances
; // Instances we have successfully added.
106 service_t
*NONNULL services
;
107 dns_name_t
*NULLABLE zone_name
; // If NULL, we are processing an update for services.arpa.
108 message_t
*NONNULL message
;
109 dns_message_t
*NONNULL parsed_message
;
110 dns_wire_t
*NONNULL update
; // The current update...
111 size_t update_length
;
113 uint8_t fail_rcode
; // rcode to return after deleting added service instances.
119 // c-file-style: "bsd"
122 // indent-tabs-mode: nil