|
| 1 | +/* |
| 2 | + * Copyright (c) 2018, Arm Limited and affiliates. |
| 3 | + * SPDX-License-Identifier: Apache-2.0 |
| 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 | + |
| 18 | +#ifndef DHCPV6_CLIENT_API_H_ |
| 19 | +#define DHCPV6_CLIENT_API_H_ |
| 20 | +#include <ns_types.h> |
| 21 | + |
| 22 | +/* DHCP client implementation. |
| 23 | + * |
| 24 | + * Responsibilities of this module are: |
| 25 | + * - handle Global address queries and refresh inside network. |
| 26 | + * |
| 27 | + */ |
| 28 | + |
| 29 | +/* Initialize dhcp client. |
| 30 | + * |
| 31 | + * This instance needs to bee initialized once for each network interface. |
| 32 | + * if only one thread instance is supported this is needed to call only once. |
| 33 | + * |
| 34 | + * /param interface interface id of this instance. |
| 35 | + * |
| 36 | + */ |
| 37 | + |
| 38 | +void dhcp_client_init(int8_t interface); |
| 39 | + |
| 40 | +/* Delete dhcp client. |
| 41 | + * |
| 42 | + * When this is called all addressed assigned by this module are removed from stack. |
| 43 | + */ |
| 44 | +void dhcp_client_delete(int8_t interface); |
| 45 | + |
| 46 | +/* Global address handler. |
| 47 | + * |
| 48 | + * This module updates the addresses from dhcp server and sets them in stack. |
| 49 | + * this module makes refresh of address when needed. |
| 50 | + * |
| 51 | + */ |
| 52 | + |
| 53 | + |
| 54 | +/* give dhcp server and prefix for global address assignment |
| 55 | + * |
| 56 | + * /param interface interface where address is got |
| 57 | + * /param dhcp_addr dhcp server ML16 address where address is registered. |
| 58 | + * /param prefix dhcp server ML16 address where address is registered. |
| 59 | + * /param mac64 64 bit mac address for identifieng client. |
| 60 | + * /param error_cb error callback that is called if address cannot be created or becomes invalid. |
| 61 | + * /param register_status true if address registered. |
| 62 | + * |
| 63 | + */ |
| 64 | +typedef void (dhcp_client_global_adress_cb)(int8_t interface, uint8_t dhcp_addr[static 16], uint8_t prefix[static 16], bool register_status); |
| 65 | + |
| 66 | +int dhcp_client_get_global_address(int8_t interface, uint8_t dhcp_addr[static 16], uint8_t prefix[static 16], uint8_t mac64[static 8], dhcp_client_global_adress_cb *error_cb); |
| 67 | + |
| 68 | +/* Renew all leased adddresses might be used when short address changes |
| 69 | + * |
| 70 | + * /param interface interface where address is got |
| 71 | + */ |
| 72 | +void dhcp_client_global_address_renew(int8_t interface); |
| 73 | + |
| 74 | +/* Delete address from device |
| 75 | + * if prefix is NULL all are deleted |
| 76 | + * |
| 77 | + * /param interface interface where address is got |
| 78 | + * /param prefix dhcp server ML16 address where address is registered. |
| 79 | + * |
| 80 | + */ |
| 81 | +void dhcp_client_global_address_delete(int8_t interface, uint8_t dhcp_addr[static 16], uint8_t prefix[static 16]); |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | +#endif /* DHCPV6_CLIENT_API_H_ */ |
0 commit comments