Skip to content

Commit

Permalink
Wi-sun neighbor hopping infor storage API definition
Browse files Browse the repository at this point in the history
  • Loading branch information
Juha Heiskanen authored and juhhei01 committed Mar 2, 2018
1 parent 1e94358 commit ae7945d
Showing 1 changed file with 90 additions and 0 deletions.
90 changes: 90 additions & 0 deletions source/6LoWPAN/ws/ws_neighbour_class.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
* Copyright (c) 2018, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef WS_NEIGHBOUR_CLASS_H_
#define WS_NEIGHBOUR_CLASS_H_

/**
* Neighbour Channel hopping information
*/
typedef struct ws_fhss_s {
uint32_t utt_timestamp; /*!< Timestamp from MAC for Unicast time UTT-IE */
uint32_t bt_timestamp; /*!< Timestamp from MAC for Broadcast time BT-IE */
uint32_t broadcast_interval;
uint32_t ufsi; /*!< Unicast Fractional Sequence Interval 24-bit */
uint32_t bti; /*!< Broadcast Interval_offset 24-bit */
uint16_t broadcast_slot_number; /*!< Broadcast Slot number */
uint16_t bsi; /*!< Broadcast schedule identifier */
uint8_t broadcast_dwell;
uint8_t unicast_dwell;
unsigned channel_function:3;
} ws_fhss_t;


typedef struct ws_neighbour_class_entry_s {
ws_fhss_t fhhs_data;
} ws_neighbour_class_entry_t;

/**
* Neighbour hopping info data base
*/
typedef struct ws_neighbour_class_s {
ws_neighbour_class_entry_t *neigh_info_list; /*!< Allocated hopping info array*/
uint8_t list_size; /*!< List size*/
} ws_neighbour_class_t;

/**
* ws_neighbour_class_alloc a function for allocate giving list size
*
* \param class_data pointer to structure which will be initialized by this function
* \param list_size define list size
*
* \return true Allocate Ok
* \return false Allocate Fail
*
*/
bool ws_neighbour_class_alloc(ws_neighbour_class_t *class_data, uint8_t list_size);

/**
* ws_neighbour_class_dealloc a function for free allocated neighbor hopping info
*
* \param class_data pointer to structure which will be initialized by this function
*
*/
void ws_neighbour_class_dealloc(ws_neighbour_class_t *class_data);

/**
* ws_neighbour_class_entry_get a function for search hopping info for giving neighbor attribut
*
* \param class_data pointer to structure which will be initialized by this function
* \param attribute_index define pointer to storage info
*
* \return NULL when Attribute is not correct
* \return Pointer to neighbor hopping info
*
*/
ws_neighbour_class_entry_t * ws_neighbour_class_entry_get(ws_neighbour_class_t *class_data, uint8_t attribute_index);
/**
* ws_neighbour_class_entry_remove a function for clean information should be call when neighbor is removed
*
* \param class_data pointer to structure which will be initialized by this function
* \param attribute_index define pointer to storage info
*
*/
void ws_neighbour_class_entry_remove(ws_neighbour_class_t *class_data, uint8_t attribute_index);

#endif /* WS_NEIGHBOUR_CLASS_H_ */

0 comments on commit ae7945d

Please sign in to comment.