Home | History | Annotate | Line # | Download | only in ServiceRegistration
      1 /* srp-proxy.h
      2  *
      3  * Copyright (c) 2018-2021 Apple Inc. All rights reserved.
      4  *
      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
      8  *
      9  *     https://www.apache.org/licenses/LICENSE-2.0
     10  *
     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.
     16  *
     17  * Service Registration Protocol common definitions.
     18  */
     19 
     20 #ifndef __SRP_PROXY_H
     21 #define __SRP_PROXY_H
     22 
     23 typedef struct srp_proxy_listener_state srp_proxy_listener_state_t;
     24 typedef struct srp_server_state srp_server_t;
     25 typedef struct srpl_connection srpl_connection_t;
     26 typedef struct client_update client_update_t;
     27 
     28 void srp_proxy_listener_cancel(srp_proxy_listener_state_t *NONNULL listener_state);
     29 comm_t *NULLABLE srp_proxy_listen(uint16_t *NULLABLE avoid_ports, int num_avoid_ports, const char *NULLABLE interface_name,
     30                                   ready_callback_t NULLABLE ready, cancel_callback_t NULLABLE cancel,
     31                                   addr_t *NULLABLE address, finalize_callback_t NULLABLE context_callback, void *NONNULL context);
     32 void srp_proxy_init(const char *NONNULL update_zone);
     33 client_update_t *NULLABLE srp_evaluate(const char *NULLABLE remote_name,
     34                                        dns_message_t *NONNULL *NULLABLE in_parsed_message,
     35                                        message_t *NONNULL raw_message, int index);
     36 bool srp_update_start(client_update_t *NONNULL client_update);
     37 #define srp_parse_client_updates_free(messages) srp_parse_client_updates_free_(messages, __FILE__, __LINE__);
     38 void srp_parse_client_updates_free_(client_update_t *NULLABLE messages, const char *NONNULL file, int line);
     39 
     40 // Provided
     41 void dns_input(comm_t *NONNULL comm, message_t *NONNULL message, void *NULLABLE context);
     42 void srp_mdns_flush(srp_server_t *NONNULL server_state);
     43 bool srp_dns_evaluate(comm_t *NONNULL connection, srp_server_t *NULLABLE server_state,
     44                       message_t *NONNULL message, dns_message_t *NONNULL *NULLABLE p_parsed_message);
     45 bool srp_parse_host_messages_evaluate(srp_server_t *NONNULL server_state, srpl_connection_t *NONNULL srpl_connection,
     46                                       message_t *NONNULL *NONNULL messages, int num_messages);
     47 #endif // __SRP_PROXY_H
     48 
     49 // Local Variables:
     50 // mode: C
     51 // tab-width: 4
     52 // c-file-style: "bsd"
     53 // c-basic-offset: 4
     54 // fill-column: 108
     55 // indent-tabs-mode: nil
     56 // End:
     57