Home | History | Annotate | Line # | Download | only in ServiceRegistration
      1 /* advertising_proxy_services.h
      2  *
      3  * Copyright (c) 2020-2024 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  * This file contains definitions for the SRP Advertising Proxy management
     18  * API on MacOS, which is private API used to control and manage the advertising
     19  * proxy.
     20  */
     21 
     22 #ifndef DNSSD_PROXY_SERVICES_H
     23 #define DNSSD_PROXY_SERVICES_H
     24 
     25 #if !defined(__BEGIN_DECLS)
     26     #if defined(__cplusplus)
     27         #define __BEGIN_DECLS               extern "C" {
     28         #define __END_DECLS                     }
     29     #else
     30         #define __BEGIN_DECLS
     31         #define __END_DECLS
     32     #endif
     33 #endif
     34 
     35 __BEGIN_DECLS
     36 typedef void *run_context_t;
     37 typedef struct _cti_connection_t *advertising_proxy_conn_ref;
     38 #define ADV_CTL_SERVER_SOCKET_NAME "/var/run/adv-ctl-server-socket"
     39 #define RCHAR char
     40 #define RUCHAR uint8_t
     41 
     42 typedef struct advertising_proxy_subscription advertising_proxy_subscription_t;
     43 
     44 typedef struct advertising_proxy_host_address {
     45     uint16_t rrtype;
     46     RUCHAR *NULLABLE rdata;
     47     uint16_t rdlen;
     48 } advertising_proxy_host_address_t;
     49 
     50 typedef struct advertising_proxy_instance {
     51     RCHAR *NULLABLE instance_name;
     52     RCHAR *NULLABLE service_type;
     53     RCHAR *NULLABLE reg_type;
     54     uint16_t port;
     55     RUCHAR *NULLABLE txt_data;
     56     uint16_t txt_len;
     57 } advertising_proxy_instance_t;
     58 
     59 typedef struct advertising_proxy_host {
     60     int ref_count;
     61     RCHAR *NULLABLE hostname;
     62     RCHAR *NULLABLE regname;
     63     uint16_t num_addresses;
     64     uint32_t lease_time;
     65     advertising_proxy_host_address_t *NULLABLE addresses;
     66     uint16_t num_instances;
     67     advertising_proxy_instance_t *NULLABLE instances;
     68     bool removed;
     69     uint64_t server_id;
     70 } advertising_proxy_host_t;
     71 
     72 #if (defined(__GNUC__) && (__GNUC__ >= 4))
     73 #define DNS_SERVICES_EXPORT __attribute__((visibility("default")))
     74 #else
     75 #define DNS_SERVICES_EXPORT
     76 #endif
     77 
     78 typedef enum
     79 {
     80     kDNSSDAdvertisingProxyStatus_NoError                   =  0,
     81     kDNSSDAdvertisingProxyStatus_UnknownErr                = -65537,   /* 0xFFFE FFFF */
     82     kDNSSDAdvertisingProxyStatus_NoMemory                  = -65539,   /* No Memory   */
     83     kDNSSDAdvertisingProxyStatus_BadParam                  = -65540,   /* Client passed invalid arg */
     84     kDNSSDAdvertisingProxyStatus_Invalid                   = -65549,   /* Invalid message */
     85     kDNSSDAdvertisingProxyStatus_DaemonNotRunning          = -65563,   /* Daemon not running */
     86     kDNSSDAdvertisingProxyStatus_Disconnected              = -65569,   /* Daemon disconnected */
     87     kDNSSDAdvertisingProxyStatus_NotPermitted              = -65571
     88 } advertising_proxy_error_type;
     89 
     90 // Register for notification that TLS key has changed
     91 #define kDNSSDAdvertisingProxyTLSKeyUpdateNotification "com.apple.srp-mdns-proxy.tls-key-update"
     92 
     93 /*********************************************************************************************
     94  *
     95  *  DNSSD Advertising Proxy control/management library functions
     96  *
     97  *********************************************************************************************/
     98 
     99 /* advertising_proxy_reply: Callback from all DNSSD Advertising proxy library functions
    100  *
    101  * advertising_proxy_reply() parameters:
    102  *
    103  * conn_ref:                   The advertising_proxy_conn_ref initialized by the library function.
    104  *
    105  * errCode:                    Will be kDNSSDAdvertisingProxy_NoError on success, otherwise will indicate the
    106  *                             failure that occurred.
    107  *
    108  */
    109 
    110 typedef void (*advertising_proxy_reply)
    111 (
    112     advertising_proxy_conn_ref NULLABLE conn_ref,
    113     void *                     NULLABLE data,
    114     advertising_proxy_error_type        errCode
    115 );
    116 
    117 /* advertising_proxy_response_reply: Callback from all DNSSD Advertising proxy library functions
    118  *
    119  * advertising_proxy_response_reply() parameters:
    120  *
    121  * conn_ref:                   The advertising_proxy_conn_ref initialized by the library function.  Call advertising_proxy_
    122  *
    123  * context:                    context passed to advertising proxy call
    124  *
    125  * response:                   Any data returned by the advertising proxy in response to the request.
    126  *
    127  * errCode:                    Will be kDNSSDAdvertisingProxy_NoError on success, otherwise will indicate the
    128  *                             failure that occurred.
    129  *
    130  */
    131 
    132 typedef void (*advertising_proxy_response_reply)
    133 (
    134     advertising_proxy_conn_ref  NULLABLE conn_ref,
    135     void *                      NULLABLE context;
    136     void *                      NULLABLE response,
    137     advertising_proxy_error_type         errCode
    138 );
    139 
    140 
    141 
    142 /* advertising_proxy_flush_entries
    143  *
    144  * Flushes any host entries that have been registered with the advertising proxy.   For testing only:
    145  * this is never the right thing to do in production.
    146  *
    147  * advertising_proxy_flush_entries() Parameters:
    148  *
    149  * conn_ref:                  A pointer to advertising_proxy_conn_ref that is initialized to NULL.
    150  *                            If the call succeeds it will be initialized to a non-NULL value.
    151  *                            The same conn_ref can be used for more than one call.
    152  *
    153  * clientq:                   Queue the client wants to schedule the callback on (Note: Must not be NULL)
    154  *
    155  * callback:                  CallBack function for the client that indicates success or failure.
    156  *                            Callback is not called until either the command has failed, or has completed.
    157  *
    158  * return value:              Returns kDNSSDAdvertisingProxy_NoError when no error otherwise returns an
    159  *                            error code indicating the error that occurred. Note: A return value of
    160  *                            kDNSSDAdvertisingProxy_NoError does not mean that DNSSD Advertising Proxy host
    161  *                            table was successfully flushed. The callback may asynchronously return an
    162  *                            error (such as kDNSSDAdvertisingProxy_DaemonNotRunning)
    163  *
    164  */
    165 
    166 DNS_SERVICES_EXPORT
    167 advertising_proxy_error_type advertising_proxy_flush_entries
    168 (
    169     advertising_proxy_conn_ref NONNULL *NULLABLE conn_ref,
    170     run_context_t                        NONNULL clientq,
    171     advertising_proxy_reply             NULLABLE callback
    172 );
    173 
    174 /* advertising_proxy_get_service_list
    175  *
    176  * Returns a list of registered services on the advertising proxy.
    177  *
    178  * advertising_proxy_get_service_list() Parameters:
    179  *
    180  * conn_ref:                  A pointer to advertising_proxy_conn_ref that is initialized to NULL.
    181  *                            If the call succeeds it will be initialized to a non-NULL value.
    182  *                            The same conn_ref can be used for more than one call.
    183  *
    184  * clientq:                   Queue the client wants to schedule the callback on (Note: Must not be NULL)
    185  *
    186  * callback:                  CallBack function for the client that indicates success or failure.
    187  *                            Callback is not called until either the command has failed, or has completed.
    188  *
    189  * return value:              Returns kDNSSDAdvertisingProxy_NoError when no error otherwise returns an
    190  *                            error code indicating the error that occurred. Note: A return value of
    191  *                            kDNSSDAdvertisingProxy_NoError does not mean that DNSSD Advertising Proxy host
    192  *                            table was successfully flushed. The callback may asynchronously return an
    193  *                            error (such as kDNSSDAdvertisingProxy_DaemonNotRunning)
    194  *
    195  */
    196 
    197 DNS_SERVICES_EXPORT
    198 advertising_proxy_error_type advertising_proxy_get_service_list
    199 (
    200     advertising_proxy_conn_ref NONNULL *NULLABLE conn_ref,
    201     run_context_t                        NONNULL clientq,
    202     advertising_proxy_reply             NULLABLE callback
    203 );
    204 
    205 /* advertising_proxy_block_service
    206  *
    207  * For testing, block advertisement of SRP service on the thread network.
    208  *
    209  * advertising_proxy_block_service() Parameters:
    210  *
    211  * conn_ref:                  A pointer to advertising_proxy_conn_ref that is initialized to NULL.
    212  *                            If the call succeeds it will be initialized to a non-NULL value.
    213  *                            The same conn_ref can be used for more than one call.
    214  *
    215  * clientq:                   Queue the client wants to schedule the callback on (Note: Must not be NULL)
    216  *
    217  * callback:                  CallBack function for the client that indicates success or failure.
    218  *                            Callback is not called until either the command has failed, or has completed.
    219  *
    220  * return value:              Returns kDNSSDAdvertisingProxy_NoError when no error otherwise returns an
    221  *                            error code indicating the error that occurred. Note: A return value of
    222  *                            kDNSSDAdvertisingProxy_NoError does not mean that DNSSD Advertising Proxy host
    223  *                            table was successfully flushed. The callback may asynchronously return an
    224  *                            error (such as kDNSSDAdvertisingProxy_DaemonNotRunning)
    225  *
    226  */
    227 
    228 DNS_SERVICES_EXPORT
    229 advertising_proxy_error_type advertising_proxy_block_service
    230 (
    231     advertising_proxy_conn_ref NONNULL *NULLABLE conn_ref,
    232     run_context_t                        NONNULL clientq,
    233     advertising_proxy_reply             NULLABLE callback
    234 );
    235 
    236 /* advertising_proxy_unblock_service
    237  *
    238  * For testing, unblock advertisement of SRP service on the thread network.
    239  *
    240  * advertising_proxy_unblock_service() Parameters:
    241  *
    242  * conn_ref:                  A pointer to advertising_proxy_conn_ref that is initialized to NULL.
    243  *                            If the call succeeds it will be initialized to a non-NULL value.
    244  *                            The same conn_ref can be used for more than one call.
    245  *
    246  * clientq:                   Queue the client wants to schedule the callback on (Note: Must not be NULL)
    247  *
    248  * callback:                  CallBack function for the client that indicates success or failure.
    249  *                            Callback is not called until either the command has failed, or has completed.
    250  *
    251  * return value:              Returns kDNSSDAdvertisingProxy_NoError when no error otherwise returns an
    252  *                            error code indicating the error that occurred. Note: A return value of
    253  *                            kDNSSDAdvertisingProxy_NoError does not mean that DNSSD Advertising Proxy host
    254  *                            table was successfully flushed. The callback may asynchronously return an
    255  *                            error (such as kDNSSDAdvertisingProxy_DaemonNotRunning)
    256  *
    257  */
    258 
    259 DNS_SERVICES_EXPORT
    260 advertising_proxy_error_type advertising_proxy_unblock_service
    261 (
    262     advertising_proxy_conn_ref NONNULL *NULLABLE conn_ref,
    263     run_context_t                        NONNULL clientq,
    264     advertising_proxy_reply             NULLABLE callback
    265 );
    266 
    267 /* advertising_proxy_regenerate_ula
    268  *
    269  * For testing, generate a new ULA prefix
    270  *
    271  * advertising_proxy_regenerate_ula() Parameters:
    272  *
    273  * conn_ref:                  A pointer to advertising_proxy_conn_ref that is initialized to NULL.
    274  *                            If the call succeeds it will be initialized to a non-NULL value.
    275  *                            The same conn_ref can be used for more than one call.
    276  *
    277  * clientq:                   Queue the client wants to schedule the callback on (Note: Must not be NULL)
    278  *
    279  * callback:                  CallBack function for the client that indicates success or failure.
    280  *                            Callback is not called until either the command has failed, or has completed.
    281  *
    282  * return value:              Returns kDNSSDAdvertisingProxy_NoError when no error otherwise returns an
    283  *                            error code indicating the error that occurred. Note: A return value of
    284  *                            kDNSSDAdvertisingProxy_NoError does not mean that DNSSD Advertising Proxy host
    285  *                            table was successfully flushed. The callback may asynchronously return an
    286  *                            error (such as kDNSSDAdvertisingProxy_DaemonNotRunning)
    287  *
    288  */
    289 
    290 DNS_SERVICES_EXPORT
    291 advertising_proxy_error_type advertising_proxy_regenerate_ula
    292 (
    293     advertising_proxy_conn_ref NONNULL *NULLABLE conn_ref,
    294     run_context_t                        NONNULL clientq,
    295     advertising_proxy_reply             NULLABLE callback
    296 );
    297 
    298 /* advertising_proxy_advertise_prefix
    299  *
    300  * For testing, advertise it's own prefix to thread network
    301  *
    302  * advertising_proxy_advertise_prefix() Parameters:
    303  *
    304  * conn_ref:                  A pointer to advertising_proxy_conn_ref that is initialized to NULL.
    305  *                            If the call succeeds it will be initialized to a non-NULL value.
    306  *                            The same conn_ref can be used for more than one call.
    307  *
    308  * high:                      If true, advertise the prefix as high priority.
    309  *
    310  * clientq:                   Queue the client wants to schedule the callback on (Note: Must not be NULL)
    311  *
    312  * callback:                  Callback function for the client that indicates success or failure.
    313  *                            Callback is not called until either the command has failed, or has completed.
    314  *
    315  * return value:              Returns kDNSSDAdvertisingProxy_NoError when no error otherwise returns an
    316  *                            error code indicating the error that occurred. Note: A return value of
    317  *                            kDNSSDAdvertisingProxy_NoError does not mean that the prefix advertising
    318  *                            was successful. The callback may asynchronously return an
    319  *                            error (such as kDNSSDAdvertisingProxy_DaemonNotRunning)
    320  *
    321  */
    322 
    323 DNS_SERVICES_EXPORT
    324 advertising_proxy_error_type advertising_proxy_advertise_prefix
    325 (
    326     advertising_proxy_conn_ref NONNULL *NULLABLE conn_ref,
    327     bool                                         high,
    328     run_context_t                        NONNULL clientq,
    329     advertising_proxy_reply             NULLABLE callback
    330 );
    331 
    332 /* advertising_proxy_add_prefix
    333  *
    334  * For testing, stop advertising service
    335  *
    336  * advertising_proxy_add_prefix() Parameters:
    337  *
    338  * conn_ref:                  A pointer to advertising_proxy_conn_ref that is initialized to NULL.
    339  *                            If the call succeeds it will be initialized to a non-NULL value.
    340  *                            The same conn_ref can be used for more than one call.
    341  *
    342  * clientq:                   Queue the client wants to schedule the callback on (Note: Must not be NULL).
    343  *
    344  * callback:                  Callback function for the client that indicates success or failure.
    345  *                            Callback is not called until either the command has failed, or has completed.
    346  *
    347  * prefix_buf:                 Prefix to be added.
    348  *
    349  * buf_len:                    Length of the prefixbuf.
    350  *
    351  * return value:              Returns kDNSSDAdvertisingProxy_NoError when no error otherwise returns an
    352  *                            error code indicating the error that occurred. Note: A return value of
    353  *                            kDNSSDAdvertisingProxy_NoError does not mean that the service advertising
    354  *                            was stopped successfully. The callback may asynchronously return an
    355  *                            error (such as kDNSSDAdvertisingProxy_DaemonNotRunning).
    356  *
    357  */
    358 
    359 DNS_SERVICES_EXPORT
    360 advertising_proxy_error_type advertising_proxy_add_prefix
    361 (
    362     advertising_proxy_conn_ref NONNULL *NULLABLE conn_ref,
    363     run_context_t                        NONNULL clientq,
    364     advertising_proxy_reply             NULLABLE callback,
    365     const uint8_t                       *NONNULL prefix_buf,
    366     size_t                                       buf_len
    367 );
    368 
    369 /* advertising_proxy_remove_prefix
    370  *
    371  * For testing, stop advertising service
    372  *
    373  * advertising_proxy_remove_prefix() Parameters:
    374  *
    375  * conn_ref:                  A pointer to advertising_proxy_conn_ref that is initialized to NULL.
    376  *                            If the call succeeds it will be initialized to a non-NULL value.
    377  *                            The same conn_ref can be used for more than one call.
    378  *
    379  * clientq:                   Queue the client wants to schedule the callback on (Note: Must not be NULL).
    380  *
    381  * callback:                  Callback function for the client that indicates success or failure.
    382  *                            Callback is not called until either the command has failed, or has completed.
    383  *
    384  * prefix_buf:                Prefix to be added.
    385  *
    386  * buf_len:                   Length of the prefixbuf.
    387  *
    388  * return value:              Returns kDNSSDAdvertisingProxy_NoError when no error otherwise returns an
    389  *                            error code indicating the error that occurred. Note: A return value of
    390  *                            kDNSSDAdvertisingProxy_NoError does not mean that the service advertising
    391  *                            was stopped successfully. The callback may asynchronously return an
    392  *                            error (such as kDNSSDAdvertisingProxy_DaemonNotRunning).
    393  *
    394  */
    395 
    396 /* advertising_proxy_add_nat64_prefix
    397  *
    398  * For testing, add nat64 prefix
    399  *
    400  * advertising_proxy_add_nat64_prefix() Parameters:
    401  *
    402  * conn_ref:                  A pointer to advertising_proxy_conn_ref that is initialized to NULL.
    403  *                            If the call succeeds it will be initialized to a non-NULL value.
    404  *                            The same conn_ref can be used for more than one call.
    405  *
    406  * clientq:                   Queue the client wants to schedule the callback on (Note: Must not be NULL).
    407  *
    408  * callback:                  Callback function for the client that indicates success or failure.
    409  *                            Callback is not called until either the command has failed, or has completed.
    410  *
    411  * prefix_buf:                Prefix to be added.
    412  *
    413  * buf_len:                   Length of the prefixbuf.
    414  *
    415  * return value:              Returns kDNSSDAdvertisingProxy_NoError when no error otherwise returns an
    416  *                            error code indicating the error that occurred. Note: A return value of
    417  *                            kDNSSDAdvertisingProxy_NoError does not mean that the service advertising
    418  *                            was stopped successfully. The callback may asynchronously return an
    419  *                            error (such as kDNSSDAdvertisingProxy_DaemonNotRunning).
    420  *
    421  */
    422 
    423 DNS_SERVICES_EXPORT
    424 advertising_proxy_error_type advertising_proxy_add_nat64_prefix
    425 (
    426     advertising_proxy_conn_ref NONNULL *NULLABLE conn_ref,
    427     run_context_t                        NONNULL clientq,
    428     advertising_proxy_reply             NULLABLE callback,
    429     const uint8_t                       *NONNULL prefix_buf,
    430     size_t                                       buf_len
    431 );
    432 
    433 /* advertising_proxy_remove_nat64_prefix
    434  *
    435  * For testing, remove nat64 prefix
    436  *
    437  * advertising_proxy_remove_nat64_prefix() Parameters:
    438  *
    439  * conn_ref:                  A pointer to advertising_proxy_conn_ref that is initialized to NULL.
    440  *                            If the call succeeds it will be initialized to a non-NULL value.
    441  *                            The same conn_ref can be used for more than one call.
    442  *
    443  * clientq:                   Queue the client wants to schedule the callback on (Note: Must not be NULL).
    444  *
    445  * callback:                  Callback function for the client that indicates success or failure.
    446  *                            Callback is not called until either the command has failed, or has completed.
    447  *
    448  * prefix_buf:                Prefix to be removed.
    449  *
    450  * buf_len:                   Length of the prefixbuf.
    451  *
    452  * return value:              Returns kDNSSDAdvertisingProxy_NoError when no error otherwise returns an
    453  *                            error code indicating the error that occurred. Note: A return value of
    454  *                            kDNSSDAdvertisingProxy_NoError does not mean that the service advertising
    455  *                            was stopped successfully. The callback may asynchronously return an
    456  *                            error (such as kDNSSDAdvertisingProxy_DaemonNotRunning).
    457  *
    458  */
    459 DNS_SERVICES_EXPORT
    460 advertising_proxy_error_type advertising_proxy_remove_nat64_prefix
    461 (
    462     advertising_proxy_conn_ref NONNULL *NULLABLE conn_ref,
    463     run_context_t                        NONNULL clientq,
    464     advertising_proxy_reply             NULLABLE callback,
    465     const uint8_t                       *NONNULL prefix_buf,
    466     size_t                                       buf_len
    467 );
    468 
    469 DNS_SERVICES_EXPORT
    470 advertising_proxy_error_type advertising_proxy_remove_prefix
    471 (
    472     advertising_proxy_conn_ref NONNULL *NULLABLE conn_ref,
    473     run_context_t                        NONNULL clientq,
    474     advertising_proxy_reply             NULLABLE callback,
    475     const uint8_t                       *NONNULL prefix_buf,
    476     size_t                                       buf_len
    477 );
    478 
    479 /* advertising_proxy_stop
    480  *
    481  * For testing, stop advertising service
    482  *
    483  * advertising_proxy_stop() Parameters:
    484  *
    485  * conn_ref:                  A pointer to advertising_proxy_conn_ref that is initialized to NULL.
    486  *                            If the call succeeds it will be initialized to a non-NULL value.
    487  *                            The same conn_ref can be used for more than one call.
    488  *
    489  * clientq:                   Queue the client wants to schedule the callback on (Note: Must not be NULL).
    490  *
    491  * callback:                  Callback function for the client that indicates success or failure.
    492  *                            Callback is not called until either the command has failed, or has completed.
    493  *
    494  * return value:              Returns kDNSSDAdvertisingProxy_NoError when no error otherwise returns an
    495  *                            error code indicating the error that occurred. Note: A return value of
    496  *                            kDNSSDAdvertisingProxy_NoError does not mean that the service advertising
    497  *                            was stopped successfully. The callback may asynchronously return an
    498  *                            error (such as kDNSSDAdvertisingProxy_DaemonNotRunning).
    499  *
    500  */
    501 
    502 DNS_SERVICES_EXPORT
    503 advertising_proxy_error_type advertising_proxy_stop
    504 (
    505     advertising_proxy_conn_ref NONNULL *NULLABLE conn_ref,
    506     run_context_t                        NONNULL clientq,
    507     advertising_proxy_reply             NULLABLE callback
    508 );
    509 
    510 /* advertising_proxy_get_ula
    511  *
    512  * For testing, advertise it's own prefix to thread network
    513  *
    514  * advertising_proxy_get_ula() Parameters:
    515  *
    516  * conn_ref:                  A pointer to advertising_proxy_conn_ref that is initialized to NULL.
    517  *                            If the call succeeds it will be initialized to a non-NULL value.
    518  *                            The same conn_ref can be used for more than one call.
    519  *
    520  * clientq:                   Queue the client wants to schedule the callback on (Note: Must not be NULL)
    521  *
    522  * callback:                  Callback function for the client that indicates success or failure.
    523  *                            Callback is not called until either the command has failed, or has completed.
    524  *                            The response object in the callback is a pointer to a uint64_t containing the
    525  *                            prefix in host byte order.
    526  *
    527  * return value:              Returns kDNSSDAdvertisingProxy_NoError when no error otherwise returns an
    528  *                            error code indicating the error that occurred. Note: A return value of
    529  *                            kDNSSDAdvertisingProxy_NoError does not mean that the prefix advertising
    530  *                            was successful. The callback may asynchronously return an
    531  *                            error (such as kDNSSDAdvertisingProxy_DaemonNotRunning)
    532  *
    533  */
    534 
    535 DNS_SERVICES_EXPORT
    536 advertising_proxy_error_type advertising_proxy_get_ula
    537 (
    538     advertising_proxy_conn_ref NONNULL *NULLABLE conn_ref,
    539     run_context_t                        NONNULL clientq,
    540     advertising_proxy_reply             NULLABLE callback
    541 );
    542 
    543 /* advertising_proxy_disable_srp_replication
    544  *
    545  * For testing, disable SRP replication.
    546  *
    547  * advertising_proxy_disable_srp_replication() Parameters:
    548  *
    549  * conn_ref:                  A pointer to advertising_proxy_conn_ref that is initialized to NULL.
    550  *                            If the call succeeds it will be initialized to a non-NULL value.
    551  *                            The same conn_ref can be used for more than one call.
    552  *
    553  * clientq:                   Queue the client wants to schedule the callback on (Note: Must not be NULL)
    554  *
    555  * callback:                  Callback function for the client that indicates success or failure.
    556  *                            Callback is not called until either the command has failed, or has completed.
    557  *
    558  * return value:              Returns kDNSSDAdvertisingProxy_NoError when no error otherwise returns an
    559  *                            error code indicating the error that occurred. Note: A return value of
    560  *                            kDNSSDAdvertisingProxy_NoError does not mean that srp replication was disabled
    561  *                            successfully. The callback may asynchronously return an
    562  *                            error (such as kDNSSDAdvertisingProxy_DaemonNotRunning)
    563  *
    564  */
    565 
    566 DNS_SERVICES_EXPORT
    567 advertising_proxy_error_type advertising_proxy_disable_srp_replication
    568 (
    569     advertising_proxy_conn_ref NONNULL *NULLABLE conn_ref,
    570     run_context_t                        NONNULL clientq,
    571     advertising_proxy_reply             NULLABLE callback
    572 );
    573 
    574 /* advertising_proxy_undrop_srpl_advertisement
    575  *
    576  * For testing, undrop_srpl_advertisement
    577  *
    578  * advertising_proxy_undrop_srpl_advertisement() Parameters:
    579  *
    580  * conn_ref:                  A pointer to advertising_proxy_conn_ref that is initialized to NULL.
    581  *                            If the call succeeds it will be initialized to a non-NULL value.
    582  *                            The same conn_ref can be used for more than one call.
    583  *
    584  * clientq:                   Queue the client wants to schedule the callback on (Note: Must not be NULL)
    585  *
    586  * callback:                  Callback function for the client that indicates success or failure.
    587  *                            Callback is not called until either the command has failed, or has completed.
    588  *
    589  * return value:              Returns kDNSSDAdvertisingProxy_NoError when no error otherwise returns an
    590  *                            error code indicating the error that occurred. Note: A return value of
    591  *                            kDNSSDAdvertisingProxy_NoError does not mean that srp replication advertisements
    592  *                            were successfully resumed. The callback may asynchronously return an
    593  *                            error (such as kDNSSDAdvertisingProxy_DaemonNotRunning)
    594  *
    595  */
    596 
    597 DNS_SERVICES_EXPORT
    598 advertising_proxy_error_type advertising_proxy_undrop_srpl_advertisement
    599 (
    600     advertising_proxy_conn_ref NONNULL *NULLABLE conn_ref,
    601     run_context_t                        NONNULL clientq,
    602     advertising_proxy_reply             NULLABLE callback
    603 );
    604 
    605 /* advertising_proxy_undrop_srpl_connection
    606  *
    607  * For testing, restart all dropped srpl connections
    608  *
    609  * advertising_proxy_undrop_srpl_connection() Parameters:
    610  *
    611  * conn_ref:                  A pointer to advertising_proxy_conn_ref that is initialized to NULL.
    612  *                            If the call succeeds it will be initialized to a non-NULL value.
    613  *                            The same conn_ref can be used for more than one call.
    614  *
    615  * clientq:                   Queue the client wants to schedule the callback on (Note: Must not be NULL)
    616  *
    617  * callback:                  Callback function for the client that indicates success or failure.
    618  *                            Callback is not called until either the command has failed, or has completed.
    619  *
    620  * return value:              Returns kDNSSDAdvertisingProxy_NoError when no error otherwise returns an
    621  *                            error code indicating the error that occurred. Note: A return value of
    622  *                            kDNSSDAdvertisingProxy_NoError does not mean that srp replication connections
    623  *                            were successfully resumed. The callback may asynchronously return an
    624  *                            error (such as kDNSSDAdvertisingProxy_DaemonNotRunning)
    625  *
    626  */
    627 
    628 DNS_SERVICES_EXPORT
    629 advertising_proxy_error_type advertising_proxy_undrop_srpl_connection
    630 (
    631     advertising_proxy_conn_ref NONNULL *NULLABLE conn_ref,
    632     run_context_t                        NONNULL clientq,
    633     advertising_proxy_reply             NULLABLE callback
    634 );
    635 
    636 /* advertising_proxy_unblock_anycast_service
    637  *
    638  * For testing, unblock_anycast_service
    639  *
    640  * advertising_proxy_unblock_anycast_service() Parameters:
    641  *
    642  * conn_ref:                  A pointer to advertising_proxy_conn_ref that is initialized to NULL.
    643  *                            If the call succeeds it will be initialized to a non-NULL value.
    644  *                            The same conn_ref can be used for more than one call.
    645  *
    646  * clientq:                   Queue the client wants to schedule the callback on (Note: Must not be NULL)
    647  *
    648  * callback:                  Callback function for the client that indicates success or failure.
    649  *                            Callback is not called until either the command has failed, or has completed.
    650  *
    651  * return value:              Returns kDNSSDAdvertisingProxy_NoError when no error otherwise returns an
    652  *                            error code indicating the error that occurred. Note: A return value of
    653  *                            kDNSSDAdvertisingProxy_NoError does not mean that anycast service advertisements
    654  *                            were successfully unblocked. The callback may asynchronously return an
    655  *                            error (such as kDNSSDAdvertisingProxy_DaemonNotRunning)
    656  *
    657  */
    658 
    659 DNS_SERVICES_EXPORT
    660 advertising_proxy_error_type advertising_proxy_unblock_anycast_service
    661 (
    662     advertising_proxy_conn_ref NONNULL *NULLABLE conn_ref,
    663     run_context_t                        NONNULL clientq,
    664     advertising_proxy_reply             NULLABLE callback
    665 );
    666 
    667 /* advertising_proxy_drop_srpl_advertisement
    668  *
    669  * For testing, drop all srpl advertisements
    670  *
    671  * advertising_proxy_drop_srpl_advertisement() Parameters:
    672  *
    673  * conn_ref:                  A pointer to advertising_proxy_conn_ref that is initialized to NULL.
    674  *                            If the call succeeds it will be initialized to a non-NULL value.
    675  *                            The same conn_ref can be used for more than one call.
    676  *
    677  * clientq:                   Queue the client wants to schedule the callback on (Note: Must not be NULL)
    678  *
    679  * callback:                  Callback function for the client that indicates success or failure.
    680  *                            Callback is not called until either the command has failed, or has completed.
    681  *
    682  * return value:              Returns kDNSSDAdvertisingProxy_NoError when no error otherwise returns an
    683  *                            error code indicating the error that occurred. Note: A return value of
    684  *                            kDNSSDAdvertisingProxy_NoError does not mean that srp replication advertisements
    685  *                            were successfully discontinued. The callback may asynchronously return an
    686  *                            error (such as kDNSSDAdvertisingProxy_DaemonNotRunning)
    687  *
    688  */
    689 
    690 DNS_SERVICES_EXPORT
    691 advertising_proxy_error_type advertising_proxy_drop_srpl_advertisement
    692 (
    693     advertising_proxy_conn_ref NONNULL *NULLABLE conn_ref,
    694     run_context_t                        NONNULL clientq,
    695     advertising_proxy_reply             NULLABLE callback
    696 );
    697 
    698 /* advertising_proxy_drop_srpl_connection
    699  *
    700  * For testing, drop all srpl connections
    701  *
    702  * advertising_proxy_drop_srpl_connection() Parameters:
    703  *
    704  * conn_ref:                  A pointer to advertising_proxy_conn_ref that is initialized to NULL.
    705  *                            If the call succeeds it will be initialized to a non-NULL value.
    706  *                            The same conn_ref can be used for more than one call.
    707  *
    708  * clientq:                   Queue the client wants to schedule the callback on (Note: Must not be NULL)
    709  *
    710  * callback:                  Callback function for the client that indicates success or failure.
    711  *                            Callback is not called until either the command has failed, or has completed.
    712  *
    713  * return value:              Returns kDNSSDAdvertisingProxy_NoError when no error otherwise returns an
    714  *                            error code indicating the error that occurred. Note: A return value of
    715  *                            kDNSSDAdvertisingProxy_NoError does not mean that srp replication connections
    716  *                            were successfully dropped. The callback may asynchronously return an
    717  *                            error (such as kDNSSDAdvertisingProxy_DaemonNotRunning)
    718  *
    719  */
    720 
    721 DNS_SERVICES_EXPORT
    722 advertising_proxy_error_type advertising_proxy_drop_srpl_connection
    723 (
    724     advertising_proxy_conn_ref NONNULL *NULLABLE conn_ref,
    725     run_context_t                        NONNULL clientq,
    726     advertising_proxy_reply             NULLABLE callback
    727 );
    728 
    729 /* advertising_proxy_start_dropping_push_connections
    730  *
    731  * For testing, start dropping DNS Push connections every 90 seconds.
    732  *
    733  * advertising_proxy_start_dropping_push_connections() Parameters:
    734  *
    735  * conn_ref:                  A pointer to advertising_proxy_conn_ref that is initialized to NULL.
    736  *                            If the call succeeds it will be initialized to a non-NULL value.
    737  *                            The same conn_ref can be used for more than one call.
    738  *
    739  * clientq:                   Queue the client wants to schedule the callback on (Note: Must not be NULL)
    740  *
    741  * callback:                  Callback function for the client that indicates success or failure.
    742  *                            Callback is not called until either the command has failed, or has completed.
    743  *
    744  * return value:              Returns kDNSSDAdvertisingProxy_NoError when no error otherwise returns an
    745  *                            error code indicating the error that occurred. Note: A return value of
    746  *                            kDNSSDAdvertisingProxy_NoError does not mean that srp replication connections
    747  *                            were successfully dropped. The callback may asynchronously return an
    748  *                            error (such as kDNSSDAdvertisingProxy_DaemonNotRunning)
    749  *
    750  */
    751 
    752 DNS_SERVICES_EXPORT
    753 advertising_proxy_error_type advertising_proxy_start_dropping_push_connections
    754 (
    755     advertising_proxy_conn_ref NONNULL *NULLABLE conn_ref,
    756     run_context_t                        NONNULL clientq,
    757     advertising_proxy_reply             NULLABLE callback
    758 );
    759 
    760 /* advertising_proxy_block_anycast service
    761  *
    762  * For testing, block anycast service
    763  *
    764  * advertising_proxy_block_anycast_service() Parameters:
    765  *
    766  * conn_ref:                  A pointer to advertising_proxy_conn_ref that is initialized to NULL.
    767  *                            If the call succeeds it will be initialized to a non-NULL value.
    768  *                            The same conn_ref can be used for more than one call.
    769  *
    770  * clientq:                   Queue the client wants to schedule the callback on (Note: Must not be NULL)
    771  *
    772  * callback:                  Callback function for the client that indicates success or failure.
    773  *                            Callback is not called until either the command has failed, or has completed.
    774  *
    775  * return value:              Returns kDNSSDAdvertisingProxy_NoError when no error otherwise returns an
    776  *                            error code indicating the error that occurred. Note: A return value of
    777  *                            kDNSSDAdvertisingProxy_NoError does not mean that anycast service advertisements
    778  *                            were successfully blocked. The callback may asynchronously return an
    779  *                            error (such as kDNSSDAdvertisingProxy_DaemonNotRunning)
    780  *
    781  */
    782 
    783 DNS_SERVICES_EXPORT
    784 advertising_proxy_error_type advertising_proxy_block_anycast_service
    785 (
    786     advertising_proxy_conn_ref NONNULL *NULLABLE conn_ref,
    787     run_context_t                        NONNULL clientq,
    788     advertising_proxy_reply             NULLABLE callback
    789 );
    790 
    791 /* advertising_proxy_start_breaking_time_validation
    792  *
    793  * For testing, start breaking SIG(0) validation on replicated host messages. This tests that we correctly
    794  * handle such failures in the SRP replication protocol.
    795  *
    796  * advertising_proxy_start_dropping_push_connections() Parameters:
    797  *
    798  * conn_ref:                  A pointer to advertising_proxy_conn_ref that is initialized to NULL.
    799  *                            If the call succeeds it will be initialized to a non-NULL value.
    800  *                            The same conn_ref can be used for more than one call.
    801  *
    802  * clientq:                   Queue the client wants to schedule the callback on (Note: Must not be NULL)
    803  *
    804  * callback:                  Callback function for the client that indicates success or failure.
    805  *                            Callback is not called until either the command has failed, or has completed.
    806  *
    807  * return value:              Returns kDNSSDAdvertisingProxy_NoError when no error otherwise returns an
    808  *                            error code indicating the error that occurred. Note: A return value of
    809  *                            kDNSSDAdvertisingProxy_NoError does not mean that srp replication connections
    810  *                            were successfully dropped. The callback may asynchronously return an
    811  *                            error (such as kDNSSDAdvertisingProxy_DaemonNotRunning)
    812  *
    813  */
    814 
    815 DNS_SERVICES_EXPORT
    816 advertising_proxy_error_type advertising_proxy_start_breaking_time_validation
    817 (
    818     advertising_proxy_conn_ref NONNULL *NULLABLE conn_ref,
    819     run_context_t                        NONNULL clientq,
    820     advertising_proxy_reply             NULLABLE callback
    821 );
    822 
    823 /* advertising_proxy_start_start_thread_shutdown
    824  *
    825  * For testing, start breaking SIG(0) validation on replicated host messages. This tests that we correctly
    826  * handle such failures in the SRP replication protocol.
    827  *
    828  * advertising_proxy_start_dropping_push_connections() Parameters:
    829  *
    830  * conn_ref:                  A pointer to advertising_proxy_conn_ref that is initialized to NULL.
    831  *                            If the call succeeds it will be initialized to a non-NULL value.
    832  *                            The same conn_ref can be used for more than one call.
    833  *
    834  * clientq:                   Queue the client wants to schedule the callback on (Note: Must not be NULL)
    835  *
    836  * callback:                  Callback function for the client that indicates success or failure.
    837  *                            Callback is not called until either the command has failed, or has completed.
    838  *                            Completion in this case means that all Thread services and prefixes were
    839  *                            successfully removed from the Thread network data and a network data update
    840  *                            was seen with this information removed, or else two seconds passed without
    841  *                            seeing the update (in which case we give up).
    842  *
    843  * return value:              Returns kDNSSDAdvertisingProxy_NoError when no error otherwise returns an
    844  *                            error code indicating the error that occurred.
    845  *
    846  */
    847 
    848 DNS_SERVICES_EXPORT
    849 advertising_proxy_error_type advertising_proxy_start_thread_shutdown
    850 (
    851     advertising_proxy_conn_ref NONNULL *NULLABLE conn_ref,
    852     run_context_t                        NONNULL clientq,
    853     advertising_proxy_reply             NULLABLE callback
    854 );
    855 
    856 /* advertising_proxy_set-variable
    857  *
    858  * Set the specified variable to the specified value on the advertising proxy
    859  *
    860  * advertising_proxy_set_variable() Parameters:
    861  *
    862  * conn_ref:                  A pointer to advertising_proxy_conn_ref that is initialized to NULL.
    863  *                            If the call succeeds it will be initialized to a non-NULL value.
    864  *                            The same conn_ref can be used for more than one call.
    865  *
    866  * clientq:                   Queue the client wants to schedule the callback on (Note: Must not be NULL)
    867  *
    868  * callback:                  Callback function for the client that indicates success or failure.
    869  *                            Callback is not called until either the command has failed, or has completed.
    870  *
    871  * context:                   Context to return in callback
    872  *
    873  * variable:                  Name of variable to set
    874  *
    875  * value:                     Value to set. Value is a string which will be interpreted by the advertising proxy,
    876  *                            and can be a quoted string ("\"foo\""), "NULL", a number ("100"), or a boolean
    877  *                            ("true" or "false") depending on the variable's type.
    878  *
    879  * return value:              Returns kDNSSDAdvertisingProxy_NoError when no error otherwise returns an
    880  *                            error code indicating the error that occurred. Note: A return value of
    881  *                            kDNSSDAdvertisingProxy_NoError does not mean that the variable was set, just
    882  *                            that the variable set command was successfully created and sent.
    883  *
    884  */
    885 
    886 DNS_SERVICES_EXPORT
    887 advertising_proxy_error_type advertising_proxy_set_variable
    888 (
    889     advertising_proxy_conn_ref NONNULL *NULLABLE conn_ref,
    890     run_context_t                        NONNULL clientq,
    891     advertising_proxy_response_reply    NULLABLE callback,
    892     void *                              NULLABLE context,
    893     const char *                         NONNULL name,
    894     const char *                         NONNULL value
    895 );
    896 
    897 
    898 /* advertising_proxy_ref_dealloc()
    899  *
    900  * Terminate a connection with the daemon and free memory associated with the advertising_proxy_conn_ref.
    901  * When used on a advertising_proxy_conn_ref returned by advertising_proxy_enable, terminates the advertising
    902  * proxy.  When used on a call that subscribes to notifications about objects managed by the advertising proxy,
    903  * discontinues those notifications.
    904  *
    905  * conn_ref:        A advertising_proxy_conn_ref initialized by any of the advertising_proxy_*() calls.
    906  *
    907  */
    908 DNS_SERVICES_EXPORT void
    909 advertising_proxy_ref_dealloc(advertising_proxy_conn_ref NONNULL conn_ref);
    910 
    911 DNS_SERVICES_EXPORT advertising_proxy_error_type
    912 advertising_proxy_resolver_init(os_log_t NULLABLE log_thingy);
    913 
    914 DNS_SERVICES_EXPORT advertising_proxy_error_type
    915 advertising_proxy_browse_create(advertising_proxy_subscription_t *NULLABLE *NONNULL aref,
    916                                 run_context_t NONNULL clientq, const char *NONNULL regtype,
    917                                 advertising_proxy_browse_reply NONNULL callBack, void *NULLABLE context);
    918 
    919 DNS_SERVICES_EXPORT advertising_proxy_error_type
    920 advertising_proxy_resolve_create(advertising_proxy_subscription_t *NULLABLE *NONNULL subscription_ret,
    921                                  run_context_t NONNULL clientq,
    922                                  const char *NONNULL name, const char *NONNULL regtype,
    923                                  const char *NONNULL domain,
    924                                  advertising_proxy_resolve_reply NONNULL callback, void *NULLABLE context);
    925 DNS_SERVICES_EXPORT advertising_proxy_error_type
    926 advertising_proxy_registrar_create(advertising_proxy_subscription_t *NULLABLE *NONNULL subscription_ret,
    927                                    run_context_t NONNULL clientq,
    928                                    advertising_proxy_registrar_reply NONNULL callback,
    929                                    void *NULLABLE context);
    930 DNS_SERVICES_EXPORT advertising_proxy_error_type
    931 advertising_proxy_get_addresses(advertising_proxy_subscription_t *NONNULL *NULLABLE subscription_ret, run_context_t NONNULL clientq,
    932                                 const char *NULLABLE name, advertising_proxy_address_reply NONNULL callback, void *NULLABLEcontext);
    933 
    934 #define advertising_proxy_subscription_retain(subscription) advertising_proxy_subscription_retain_(subscription, __FILE__, __LINE__)
    935 DNS_SERVICES_EXPORT advertising_proxy_error_type
    936 advertising_proxy_subscription_retain_(advertising_proxy_subscription_t *NONNULL subscription, const char *NONNULL file, int line);
    937 
    938 #define advertising_proxy_subscription_release(subscription) advertising_proxy_subscription_release_(subscription, __FILE__, __LINE__)
    939 DNS_SERVICES_EXPORT advertising_proxy_error_type
    940 advertising_proxy_subscription_release_(advertising_proxy_subscription_t *NONNULL subscription, const char *NONNULL file, int line);
    941 
    942 DNS_SERVICES_EXPORT advertising_proxy_error_type
    943 advertising_proxy_subscription_cancel(advertising_proxy_subscription_t *NONNULL subscription);
    944 __END_DECLS
    945 #endif /* DNSSD_PROXY_SERVICES_H */
    946 
    947 // Local Variables:
    948 // mode: C
    949 // tab-width: 4
    950 // c-file-style: "bsd"
    951 // c-basic-offset: 4
    952 // fill-column: 108
    953 // indent-tabs-mode: nil
    954 // End:
    955