Home | History | Annotate | Line # | Download | only in ServiceRegistration
      1 /* cti-server.h
      2  *
      3  * Copyright (c) 2020 Apple Computer, 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  *     http://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  * External function signatures for cti-server
     18  */
     19 
     20 #ifndef __CTI_SERVER_H__
     21 #define __CTI_SERVER_H__
     22 
     23 #include <stdbool.h>
     24 
     25 #define CTI_EVENT_SERVICE      (1 << 1)
     26 #define CTI_EVENT_PREFIX       (1 << 2)
     27 #define CTI_EVENT_ROLE         (1 << 3)
     28 #define CTI_EVENT_PARTITION_ID (1 << 4)
     29 #define CTI_EVENT_STATE        (1 << 5)
     30 #define CTI_EVENT_XPANID       (1 << 6)
     31 
     32 #ifndef NO_IOLOOP
     33 #define NO_IOLOOP 1
     34 #endif
     35 
     36 #ifndef NOT_HAVE_SA_LEN
     37 #define NOT_HAVE_SA_LEN 1
     38 #endif
     39 
     40 #include "cti-common.h"
     41 
     42 int cti_init(void);
     43 void cti_fd_init(int *NONNULL p_nfds, fd_set *NONNULL r) GCCATTR((nonnull (1,2)));
     44 void cti_fd_process(fd_set *NONNULL r) GCCATTR((nonnull (1)));
     45 
     46 typedef int (*send_event_t)(cti_connection_t NONNULL connection, int event) GCCATTR((nonnull (1)));
     47 void cti_notify_event(unsigned int evt, send_event_t NONNULL evt_handler) GCCATTR((nonnull (2)));
     48 
     49 int ctiAddService(uint32_t enterprise_number, const uint8_t *NONNULL service_data,
     50 				  size_t service_data_length, const uint8_t *NONNULL server_data, size_t server_data_length)
     51     GCCATTR((nonnull (2, 4)));
     52 int ctiRemoveService(uint32_t enterprise_number,
     53 					 const uint8_t *service_data, size_t service_data_length) GCCATTR((nonnull (2)));
     54 int ctiRetrieveServiceList(cti_connection_t NONNULL connection, int event) GCCATTR((nonnull (1)));
     55 int ctiAddMeshPrefix(struct in6_addr *NONNULL prefix,
     56 					 size_t prefix_length, bool on_mesh, bool preferred, bool slaac, bool stable) GCCATTR((nonnull (1)));
     57 int ctiRemoveMeshPrefix(struct in6_addr *NONNULL prefix, size_t prefix_length) GCCATTR((nonnull (1)));
     58 int ctiRetrievePrefixList(cti_connection_t NONNULL connection, int event) GCCATTR((nonnull (1)));
     59 int ctiRetrievePartitionId(cti_connection_t NONNULL connection, int event) GCCATTR((nonnull (1)));
     60 int ctiRetrieveXPANID(cti_connection_t NONNULL connection, int event) GCCATTR((nonnull (1)));
     61 int ctiRetrieveTunnel(cti_connection_t NONNULL connection) GCCATTR((nonnull (1)));
     62 int ctiRetrieveNodeType(cti_connection_t NONNULL connection, int event) GCCATTR((nonnull (1)));
     63 
     64 #endif // __CTI_SERVER_H__
     65 
     66 // Local Variables:
     67 // mode: C
     68 // tab-width: 4
     69 // c-file-style: "bsd"
     70 // c-basic-offset: 4
     71 // fill-column: 108
     72 // indent-tabs-mode: nil
     73 // End:
     74