Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers kmp_addr.h Source File

kmp_addr.h

00001 /*
00002  * Copyright (c) 2016-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 KMP_ADDR_H_
00019 #define KMP_ADDR_H_
00020 
00021 typedef enum {
00022     KMP_ADDR_EUI_64 = 0,
00023     KMP_ADDR_EUI_64_AND_IP
00024 } kmp_addr_e;
00025 
00026 typedef struct {
00027     uint8_t type;
00028     uint8_t eui_64[8];
00029     address_t relay_address;
00030     uint16_t port;
00031 } kmp_addr_t;
00032 
00033 /**
00034  * kmp_address_init initializes address
00035  *
00036  * \param type address type
00037  * \param addr address
00038  * \param eui_64 EUI-64
00039  *
00040  */
00041 void kmp_address_init(kmp_addr_e type, kmp_addr_t *addr, const uint8_t *eui_64);
00042 
00043 
00044 /**
00045  * kmp_address_eui_64_get get EUI-64
00046  *
00047  * \param addr address
00048  *
00049  * \return EUI-64
00050  *
00051  */
00052 const uint8_t *kmp_address_eui_64_get(const kmp_addr_t *addr);
00053 
00054 /**
00055  * kmp_address_ip_get get IP address
00056  *
00057  * \param addr address
00058  *
00059  * \return IP address
00060  *
00061  */
00062 const uint8_t *kmp_address_ip_get(const kmp_addr_t *addr);
00063 
00064 
00065 /**
00066  * kmp_address_eui_64_set set EUI-64
00067  *
00068  * \param addr address
00069  * \param ip_addr EUI-64
00070  *
00071  * \return < 0 failure
00072  * \return >= 0 success
00073  *
00074  */
00075 int8_t kmp_address_eui_64_set(kmp_addr_t *addr, const uint8_t *eui64);
00076 
00077 /**
00078  * kmp_address_copy copies address
00079  *
00080  * \param to_addr address to copy to
00081  * \param from_addr address to copy from
00082  *
00083  * \return < 0 failure
00084  * \return >= 0 success
00085  *
00086  */
00087 int8_t kmp_address_copy(kmp_addr_t *to_addr, const kmp_addr_t *from_addr);
00088 
00089 #endif /* KMP_ADDR_H_ */