Typedefs | |
| typedef void(* | cy_network_ip_change_callback_t) (cy_network_interface_context *iface_context, void *user_data) |
| IP change callback function prototype Callback function which can be registered to receive IP address changes must be of this prototype. | |
| typedef void(* | cy_network_activity_event_callback_t) (bool event_type) |
| Network activity callback function prototype. | |
Functions | |
| cy_rslt_t | cy_network_init () |
| Initializes the network stack, and allocates and initializes the resources needed by this library. | |
| cy_rslt_t | cy_network_deinit () |
| Deinitializes the network stack, and releases the resources allocated in the cy_network_init function. | |
| cy_rslt_t | cy_network_add_nw_interface (cy_network_hw_interface_type_t iface_type, uint8_t iface_idx, void *hw_interface, uint8_t *mac_address, cy_network_static_ip_addr_t *ipaddr, cy_network_interface_context **iface_context) |
| Adds a network interface. | |
| cy_rslt_t | cy_network_remove_nw_interface (cy_network_interface_context *iface_context) |
| Removes a network interface. | |
| void * | cy_network_get_nw_interface (cy_network_hw_interface_type_t iface_type, uint8_t iface_idx) |
| Returns the network interface for the given network interface type. | |
| cy_rslt_t | cy_network_ip_up (cy_network_interface_context *iface_context) |
| Brings up the network link layer and starts DHCP if required. | |
| cy_rslt_t | cy_network_ip_down (cy_network_interface_context *iface_context) |
| Brings down the network interface and network link layer, and stops DHCP. | |
| cy_rslt_t | cy_network_dhcp_renew (cy_network_interface_context *iface_context) |
| Invalidates all ARP entries and renews DHCP. | |
| void | cy_network_register_ip_change_cb (cy_network_interface_context *iface_context, cy_network_ip_change_callback_t cb, void *user_data) |
| Helps to register/unregister for any IP address changes from the network stack. | |
| void | cy_network_activity_register_cb (cy_network_activity_event_callback_t cb) |
| Helps to register/unregister a callback function that will be invoked on any Tx/Rx activity on any network interface. | |
| cy_rslt_t | cy_network_activity_notify (cy_network_activity_type_t activity_type) |
| Notifies the network activity to the Low Power Assistant (LPA) module. | |
| cy_rslt_t | cy_network_get_ip_address (cy_network_interface_context *iface_context, cy_nw_ip_address_t *ip_addr) |
| Retrieves the IPv4 address of the given interface. | |
| cy_rslt_t | cy_network_get_ipv6_address (cy_network_interface_context *iface_context, cy_network_ipv6_type_t type, cy_nw_ip_address_t *ip_addr) |
| Retrieves the IPv6 address of the given interface. | |
| cy_rslt_t | cy_network_get_gateway_ip_address (cy_network_interface_context *iface_context, cy_nw_ip_address_t *gateway_addr) |
| Retrieves the gateway IP address of the given interface. | |
| cy_rslt_t | cy_network_get_gateway_mac_address (cy_network_interface_context *iface_context, cy_nw_ip_mac_t *mac_addr) |
| Retrieves the MAC address of the gateway for the given interface. | |
| cy_rslt_t | cy_network_get_netmask_address (cy_network_interface_context *iface_context, cy_nw_ip_address_t *net_mask_addr) |
| Retrieves the subnet mask address of the given interface. | |
| cy_rslt_t | cy_network_ping (void *if_ctx, cy_nw_ip_address_t *address, uint32_t timeout_ms, uint32_t *elapsed_time_ms) |
| Sends a ping request to the given IP address. | |
| cy_rslt_t | cy_network_random_number_generate (unsigned char *output, size_t len, size_t *olen) |
| Random number generate using PDL trng APIs. | |
| typedef void(* cy_network_ip_change_callback_t) (cy_network_interface_context *iface_context, void *user_data) |
IP change callback function prototype Callback function which can be registered to receive IP address changes must be of this prototype.
| [in] | iface_context | Interface context that has been created with the cy_network_add_nw_interface function |
| [in] | user_data | User data provided at the time of callback registration |
| typedef void(* cy_network_activity_event_callback_t) (bool event_type) |
Network activity callback function prototype.
The callback function which can be registered/unregistered for any network activity must be of this prototype.
| cy_rslt_t cy_network_init | ( | ) |
Initializes the network stack, and allocates and initializes the resources needed by this library.
| cy_rslt_t cy_network_deinit | ( | ) |
Deinitializes the network stack, and releases the resources allocated in the cy_network_init function.
| cy_rslt_t cy_network_add_nw_interface | ( | cy_network_hw_interface_type_t | iface_type, |
| uint8_t | iface_idx, | ||
| void * | hw_interface, | ||
| uint8_t * | mac_address, | ||
| cy_network_static_ip_addr_t * | ipaddr, | ||
| cy_network_interface_context ** | iface_context | ||
| ) |
Adds a network interface.
Binds the hardware interface to the IP layer of the network stack.
| [in] | iface_type | Network interface type cy_network_hw_interface_type_t |
| [in] | iface_idx | Network interface index. If the cy_network_add_nw_interface function is called multiple times for same interface type, the index passed should be the hardware port available on the device. This is used to handle multiple Ethernet interfaces. For example, ethernet port0 will have index as 0 and ethernet port1 will have index as 1. |
| [in] | hw_interface | Handle to the already initialized HW interface. For example, the whd_interface_t pointer that is initialized using the cybsp_wifi_init_primary() function. Similarly for Ethernet, it can be the Ethernet interface pointer. |
| [in] | mac_address | MAC address to be configured to the network interface |
| [in] | ipaddr | Static IP address provided by the user |
| [out] | iface_context | Interface context. Network core library allocates memory for this structure and initializes it. Caller should not modify the contents of this structure, and should not free the memory. To free the memory allocated by this function, the caller should invoke the cy_network_remove_nw_interface function. |
| cy_rslt_t cy_network_remove_nw_interface | ( | cy_network_interface_context * | iface_context | ) |
Removes a network interface.
Unbinds the network interface from the IP layer of the network stack.
| [in] | iface_context | Interface context that has been created with the cy_network_add_nw_interface function. |
| void * cy_network_get_nw_interface | ( | cy_network_hw_interface_type_t | iface_type, |
| uint8_t | iface_idx | ||
| ) |
Returns the network interface for the given network interface type.
| [in] | iface_type | Network interface type |
| [in] | iface_idx | Network interface index |
| cy_rslt_t cy_network_ip_up | ( | cy_network_interface_context * | iface_context | ) |
Brings up the network link layer and starts DHCP if required.
| [in] | iface_context | Interface context that has been created with the cy_network_add_nw_interface function |
| cy_rslt_t cy_network_ip_down | ( | cy_network_interface_context * | iface_context | ) |
Brings down the network interface and network link layer, and stops DHCP.
| [in] | iface_context | Interface context that has been created with the cy_network_add_nw_interface function |
| cy_rslt_t cy_network_dhcp_renew | ( | cy_network_interface_context * | iface_context | ) |
Invalidates all ARP entries and renews DHCP.
| [in] | iface_context | Interface context that has been created with the cy_network_add_nw_interface function |
| void cy_network_register_ip_change_cb | ( | cy_network_interface_context * | iface_context, |
| cy_network_ip_change_callback_t | cb, | ||
| void * | user_data | ||
| ) |
Helps to register/unregister for any IP address changes from the network stack.
Passing "NULL" as callback will deregister the IP changes callback.
| [in] | iface_context | Interface context that has been created with the cy_network_add_nw_interface function |
| [in] | cb | IP address change callback function |
| [in] | user_data | User data that is passed to the callback function |
| void cy_network_activity_register_cb | ( | cy_network_activity_event_callback_t | cb | ) |
Helps to register/unregister a callback function that will be invoked on any Tx/Rx activity on any network interface.
Passing "NULL" as cb will deregister the activity callback.
| [in] | cb | Network activity callback function |
| cy_rslt_t cy_network_activity_notify | ( | cy_network_activity_type_t | activity_type | ) |
Notifies the network activity to the Low Power Assistant (LPA) module.
| [in] | activity_type | Network activity type cy_network_activity_type_t to be notified to the LPA module |
| cy_rslt_t cy_network_get_ip_address | ( | cy_network_interface_context * | iface_context, |
| cy_nw_ip_address_t * | ip_addr | ||
| ) |
Retrieves the IPv4 address of the given interface.
See cy_network_get_ipv6_address API to get IPv6 addresses.
| [in] | iface_context | : Interface context that has been created with the cy_network_add_nw_interface function |
| [out] | ip_addr | : Pointer to an IP address structure of type cy_nw_ip_address_t |
| cy_rslt_t cy_network_get_ipv6_address | ( | cy_network_interface_context * | iface_context, |
| cy_network_ipv6_type_t | type, | ||
| cy_nw_ip_address_t * | ip_addr | ||
| ) |
Retrieves the IPv6 address of the given interface.
| [in] | iface_context | : Interface context that has been created with the cy_network_add_nw_interface function |
| [in] | type | : IPv6 address type. Only IPv6 link-local address type is supported. |
| [out] | ip_addr | : Pointer to an IP address structure of type cy_nw_ip_address_t |
| cy_rslt_t cy_network_get_gateway_ip_address | ( | cy_network_interface_context * | iface_context, |
| cy_nw_ip_address_t * | gateway_addr | ||
| ) |
Retrieves the gateway IP address of the given interface.
| [in] | iface_context | : Interface context that has been created with the cy_network_add_nw_interface function |
| [out] | gateway_addr | : Pointer to an IP address structure of type cy_nw_ip_address_t to be filled with the gateway IP address |
| cy_rslt_t cy_network_get_gateway_mac_address | ( | cy_network_interface_context * | iface_context, |
| cy_nw_ip_mac_t * | mac_addr | ||
| ) |
Retrieves the MAC address of the gateway for the given interface.
Uses Address Resolution Protocol (ARP) to retrieve the gateway MAC address.
This function is a blocking call and uses an internal timeout while running ARP.
| [in] | iface_context | : Interface context that has been created with the cy_network_add_nw_interface function |
| [out] | mac_addr | : Pointer to a MAC address structure which is filled with the gateway's MAC address on successful return |
| cy_rslt_t cy_network_get_netmask_address | ( | cy_network_interface_context * | iface_context, |
| cy_nw_ip_address_t * | net_mask_addr | ||
| ) |
Retrieves the subnet mask address of the given interface.
| [in] | iface_context | : Interface context that has been created with the cy_network_add_nw_interface function |
| [out] | net_mask_addr | : Pointer to an IP address structure of type cy_nw_ip_address_t to be filled with the subnet mask address of the interface. |
| cy_rslt_t cy_network_ping | ( | void * | if_ctx, |
| cy_nw_ip_address_t * | address, | ||
| uint32_t | timeout_ms, | ||
| uint32_t * | elapsed_time_ms | ||
| ) |
Sends a ping request to the given IP address.
| [in] | if_ctx | : Pointer to the network interface context (typecast to void *) |
| [in] | address | : Pointer to the destination IP address structure to which the ping request will be sent |
| [in] | timeout_ms | : Ping request timeout in milliseconds |
| [in] | elapsed_time_ms | : Pointer to store the roundtrip time (in milliseconds), i.e., the time taken to receive the ping response from the destination |
| cy_rslt_t cy_network_random_number_generate | ( | unsigned char * | output, |
| size_t | len, | ||
| size_t * | olen | ||
| ) |
Random number generate using PDL trng APIs.
| [out] | output | : Data to fill |
| [in] | len | : Maximum size to provide |
| [out] | olen | : The actual amount of bytes put into the buffer (Can be 0) |