Skip to content

Commit

Permalink
Merge pull request ARMmbed#1861 from ARMmbed/ws_dhcp_support
Browse files Browse the repository at this point in the history
Ws dhcp support
  • Loading branch information
Juha Heiskanen authored Oct 11, 2018
2 parents 0eea30d + 08155b1 commit cbf99e7
Show file tree
Hide file tree
Showing 9 changed files with 794 additions and 8 deletions.
13 changes: 12 additions & 1 deletion nanostack/dhcp_service_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
typedef enum dhcp_instance_type
{
DHCP_INSTANCE_CLIENT,
DHCP_INSTANCE_SERVER
DHCP_INSTANCE_SERVER,
DHCP_INTANCE_RELAY_AGENT
} dhcp_instance_type_e;

/**
Expand Down Expand Up @@ -124,6 +125,16 @@ typedef int (dhcp_service_receive_resp_cb)(uint16_t instance_id, void *ptr, uint

uint16_t dhcp_service_init(int8_t interface_id, dhcp_instance_type_e instance_type, dhcp_service_receive_req_cb *receive_req_cb);

/**
* \brief Enable DHCPv6 Relay Agent to server.
*
*
* \param instance The instance ID of the registered server.
* \param server_address global server IPv6 address
*/
void dhcp_service_relay_instance_enable(uint16_t instance, uint8_t *server_address);


/**
* \brief Deletes a server instance.
*
Expand Down
85 changes: 85 additions & 0 deletions source/DHCPv6_client/dhcpv6_client_api.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
* 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 DHCPV6_CLIENT_API_H_
#define DHCPV6_CLIENT_API_H_
#include <ns_types.h>

/* DHCP client implementation.
*
* Responsibilities of this module are:
* - handle Global address queries and refresh inside network.
*
*/

/* Initialize dhcp client.
*
* This instance needs to bee initialized once for each network interface.
* if only one thread instance is supported this is needed to call only once.
*
* /param interface interface id of this instance.
*
*/

void dhcp_client_init(int8_t interface);

/* Delete dhcp client.
*
* When this is called all addressed assigned by this module are removed from stack.
*/
void dhcp_client_delete(int8_t interface);

/* Global address handler.
*
* This module updates the addresses from dhcp server and sets them in stack.
* this module makes refresh of address when needed.
*
*/


/* give dhcp server and prefix for global address assignment
*
* /param interface interface where address is got
* /param dhcp_addr dhcp server ML16 address where address is registered.
* /param prefix dhcp server ML16 address where address is registered.
* /param mac64 64 bit mac address for identifieng client.
* /param error_cb error callback that is called if address cannot be created or becomes invalid.
* /param register_status true if address registered.
*
*/
typedef void (dhcp_client_global_adress_cb)(int8_t interface, uint8_t dhcp_addr[static 16], uint8_t prefix[static 16], bool register_status);

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);

/* Renew all leased adddresses might be used when short address changes
*
* /param interface interface where address is got
*/
void dhcp_client_global_address_renew(int8_t interface);

/* Delete address from device
* if prefix is NULL all are deleted
*
* /param interface interface where address is got
* /param prefix dhcp server ML16 address where address is registered.
*
*/
void dhcp_client_global_address_delete(int8_t interface, uint8_t dhcp_addr[static 16], uint8_t prefix[static 16]);



#endif /* DHCPV6_CLIENT_API_H_ */
Loading

0 comments on commit cbf99e7

Please sign in to comment.