Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ns_mdns_api.h Source File

ns_mdns_api.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2017-2018, Arm Limited and affiliates.
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #ifndef _NS_MDNS_API_H_
00019 #define _NS_MDNS_API_H_
00020 
00021 /**
00022  * \file ns_mdns_api.h
00023  * \brief Nanostack mDNS-SD API.
00024  */
00025 
00026 /*!
00027  * \struct ns_mdns_t
00028  * \brief Structure for Nanostack mDNS instance
00029  */
00030 typedef struct ns_mdns *ns_mdns_t;  /**< Instance */
00031 
00032 /*!
00033  * \struct ns_mdns_service_t
00034  * \brief Structure for Nanostack mDNS service instance
00035  */
00036 typedef struct ns_mdns_service *ns_mdns_service_t;  /**< Service instance */
00037 
00038 /*!
00039  * \struct ns_mdns_service_param_t
00040  * \brief Structure for mDNS service parameters
00041  */
00042 typedef struct ns_mdns_service_param {
00043     const char *service_type;                   /**< Null-terminated string owned by the caller */
00044     uint16_t    service_port;                   /**< Service Port number */
00045     const uint8_t *(*service_get_txt)(void);    /**< Call-back function, which returns a pointer to the service TXT record (null-terminated).
00046                                                    If the service does not provide any TXT record, this parameter must be set to NULL. */
00047 } ns_mdns_service_param_t;
00048 
00049 /**
00050  * \brief Start mDNS server
00051  *
00052  * \param server_name NULL terminated string, max length 63 characters
00053  *
00054  * \param ttl time-to-live value in seconds, if set to 0 default value is used
00055  *
00056  * \param ttl_ip time-to-live in hop count, if set to 0 default value is used
00057  *
00058  * \param interface_id ID of the network interface where mDNS will operate
00059  *
00060  * \return mDNS server instace or NULL in case of failure..
00061  */
00062 ns_mdns_t ns_mdns_server_start(const char *server_name, uint32_t ttl, uint32_t ttl_ip, int8_t interface_id);
00063 
00064 /**
00065  * \brief Stop mDNS server
00066  *
00067  * \param ns_mdns_instance Server instance received from ns_mdns_server_start
00068  *
00069  */
00070 void ns_mdns_server_stop(ns_mdns_t ns_mdns_instance);
00071 
00072 /**
00073  * \brief Register service to mDNS server
00074  *
00075  * \param ns_mdns_instance Server instance received from ns_mdns_server_start
00076  *
00077  * \param service Parameters for service
00078  *
00079  * \return mDNS Service descriptor or NULL in case of failure.
00080  *
00081  */
00082 ns_mdns_service_t ns_mdns_service_register(ns_mdns_t ns_mdns_instance, ns_mdns_service_param_t *service);
00083 
00084 /**
00085  * \brief Unregister service from mDNS server
00086  *
00087  * \param service_desc mDNS Service descriptor received from call to ns_mdns_service_register.
00088  */
00089 
00090 void ns_mdns_service_unregister(ns_mdns_service_t service_desc);
00091 
00092 /**
00093  * \brief Send mDNS announcement. Application should call this method once application
00094  * advertised parameters has changed.
00095  *
00096  * \param ns_mdns_instance Server instance received from ns_mdns_server_start
00097  */
00098 
00099 void ns_mdns_announcement_send(ns_mdns_t ns_mdns_instance);
00100 
00101 #endif /* _NS_MDNS_API_H_ */
00102