Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc/network: Modify Documentation in the Network group #283

Merged
merged 1 commit into from
Jun 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/doxygen/src/media/udp_client_image.drawio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 0 additions & 14 deletions firmware/network/border_router/border_router.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,6 @@
#include "radio.h"
#include "net_tools.h"

int8_t get_wired_iface(void) {
int max_ifaces = gnrc_netif_numof();
if (max_ifaces > 0) {
gnrc_netif_t *iface;
iface = gnrc_netif_get_by_type(NETDEV_ANY, NETDEV_INDEX_ANY);
if (iface != NULL) {
return iface->pid;
} else {
return -1;
}
}
return -1;
}

int8_t border_router_setup(ipv6_addr_t addr, uint8_t prefix, uint8_t iface_type) {
ipv6_addr_t ip;
int8_t index;
Expand Down
28 changes: 6 additions & 22 deletions firmware/network/border_router/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@
@defgroup border_router Border router
@ingroup network

### What goes here?
### Border Router

This module is used to set up a border router using the USB CDC ECM. The module
sets ipv6 address to host.
sets an ipv6 address in a wireless or wired interface.

Eg: This code setup address "2001:db8:1::2" to host.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ipv6_addr_t address = {
.u8 = {0},
};
ipv6_addr_from_str(&address,"2001:db8:1::2");
border_router_ipv6_config(_UNICAST,&address);
border_router_setup(address, 64. WIRED_INTERFACE)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TO DO: set ipv6 address to the node.
@note: the param prefix (in the example is 64) is to known the prefix of the network,
This could be useful to subnet in ipv6 generally it's a prefix length between 128 and 64

# Network configuration for the border router

Expand Down Expand Up @@ -69,24 +71,6 @@ To test. Run from host:
$ ping6 <ipv6_address> -c3
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Network: added setting of wireless node to border router

Within the border_router_add_ipv6_node function, the border router is configured
by adding the ipv6 in the wireless

Note: The Node itself requires no configuration. All configuration happens on The Border Router.

- The first step is add an IPv6 address to the wireless interface of The Border Router.

- The second step to take is to initialize the RPL routing protocol to enable multi-hop networking with the
rpl_protocol using the function ``` rpl_init ```.

- In the next step, the following command added new RPL DODAG ``` gnrc_rpl_dodag_root ```, with the instance ID = CONFIG_DODAG_INSTANCE.

Note: With these two actions, RPL is active on The Border Router and should transmit DODAG Information Objects.

The Node should receive the DODAG Information Objects from The Border Router and should configure an address based on the prefix

## Border router diagram

This diagram shows the struct connection between the border router and a RPL network.
Expand Down
4 changes: 2 additions & 2 deletions firmware/network/chamos/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
@defgroup Chamos Chamos
@ingroup network

## What goes here?
## CHAMOS

The module CHAMOS (Communication Handler for Addressing Management | Origin Server) It's used for server-side communication for nib routing table.
This module also works with the \ref chamoc . this will let you generate a `MSG_NIB_ADD` or `MSG_NIB_DEL` request via local host (Linux) and
start an intercommunication between a pc and the m4a-24g board.

### This module contains:

- Turning on UDP socked.
- Turning on UDP socket.
- Receive the message.
- Process the message and adding it to NIB.
- Send the ack and the nack message to the client.
Expand Down
29 changes: 22 additions & 7 deletions firmware/network/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,31 @@
@defgroup network Network module
@ingroup m4a-firmware

### What goes here?
Specific documentation for our reference network;
In the next module you can find:
### Network Modules group

### udp_client
Here it's all modules and components required to manage and connect all device to the network.
Here could be found all relationated with settings of internet protocols under ipv6, the propose
to works under ipv6 is extend a big group of device in various mesh networks. this capacity is not
completed supported in ipv4.
The network group has all required functions to manage the network options, and the routing params
to create a network.

In this module is used to send the sensors values.
Here's some modules from this group:

### udp_server
- @ref border_router : Establish a connection between a host device and the wireless nodes in a network, Also a device could be its
wired interface connected to internet an provided it to others wireless nodes.

In this module is used to get the sensor values.
- @ref Chamos : It's an integration of an udp server, with the propose to works as a network protocol.

- @ref net_tools : Group of elements required to get an specify interface and set the ipv6 address in a device.

- @ref radio_module : Contains all params to set the wireless devices that works with IEEE802.15.4 standards, zigbee and 6lowpan.

- @ref rpl_protocol : Module dedicated to manage the routing protocol to Low compsuption devices.

- @ref udp_client : module to connect a device as an udp_client to an udp_server, This could sends data and wait or not a response

- @ref udp_server : module to establish a device as udp server, this could recolect data or attends request from various clients, that's will
depends to the offered service.

*/
39 changes: 39 additions & 0 deletions firmware/network/net_tools/doc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**

@defgroup network_net_tools Network Tools
@ingroup network

### Net_tools

Contains all about networks tools that could be used in others modules,
this will be a general settings options as the settings of ipv6 address
as the gets an specified interface (wired or wireless).

The main propose of the network tools is bring to an user manage all network
options to get the wished configuration. So the most protocols could be require
do changes in the ipv6 address or needs to manually call a specified interface
to manage physical configurations.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.c}
int8_t index;
index = get_wired_iface(void);
printf("The interface index is : %d", index); // should be any number if it's -1
the interface doesn't exist.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

### Getting an specified interface
currently the module only could check the wired interface, this should be ETHOS, SLIP or USB_CDC_ECM,
this function will return the index of the network interface.

### Ipv6 settings

If you want to set an ipv6 address global o multicast, you could use:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.c}
set_ipv6_global(iface_index, ip, prefix); // To global address
/* or */
set_ipv6_multicast(iface_index,ip, prefix); // To multicast address
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


*/
12 changes: 10 additions & 2 deletions firmware/network/net_tools/include/net_tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
*/

/**
* @defgroup net_tools Network tools
* @ingroup network
* @defgroup net_tools net_tools
* @ingroup network_net_tools
* @brief group of generic functions that could be used in various modules
*
* @{
Expand All @@ -44,6 +44,14 @@
extern "C" {
#endif

/**
* @brief Function to check if exist a wired interface
*
* @retval returns the index of the network interface.
* @retval -1 when the interface doesn't exist
*/
int8_t get_wired_iface(void);

/**
* @brief Function to check if exist an ipv6 global unicast
*
Expand Down
16 changes: 14 additions & 2 deletions firmware/network/net_tools/net_tools.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,20 @@
#include "net/ipv6/addr.h"
#include "net/gnrc/netif.h"

int8_t get_wired_iface(void) {
int max_ifaces = gnrc_netif_numof();
if (max_ifaces > 0) {
gnrc_netif_t *iface;
iface = gnrc_netif_get_by_type(NETDEV_ANY, NETDEV_INDEX_ANY);
if (iface != NULL) {
return iface->pid;
} else {
return -1;
}
}
return -1;
}

int8_t get_ipv6_global(kernel_pid_t iface_pid, ipv6_addr_t *addr) {
ipv6_addr_t ipv6[CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF];
netif_t *iface = netif_get_by_id(iface_pid);
Expand Down Expand Up @@ -101,5 +115,3 @@ int8_t set_ipv6_multicast(kernel_pid_t iface_index, ipv6_addr_t ip, uint8_t pref
}
return 0;
}

/* Implementation of the module */
60 changes: 60 additions & 0 deletions firmware/network/radio/doc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/**

@defgroup radio_module Radio Module
@ingroup network

### Radio

In this module are all low power and low consumption wireless device,
it can find devices based on the zigbee and 6lowpan protocols,
In addition to that, these devices can follow the guidelines established in
the IEEE802.14.5 standard.

The module works in the physical layer of the 802.15.4, to manage all settings
as the power transmission, the channel of the wireless networks that is upper to 2.4 GHz
it's between the range of 11 to 26 and in the case of the radio device is multiband.
you could works in the band under to 2.4GHz these channels are between 0 and 10.

The functionalities of the radio module allow to obtain and configure the characteristics of
the wireless networkInterface. This allows knowing the current state of the physical
configuration and manipulating it to obtain the better optimization.

The radio module includes a kconfig setup, this means to could be obtained an statically setup
of any device, also the kconfig, and the module it's adjusted to the specified device. this features
are provided by the following table:

| Driver |TX_POWER_MIN (dBm) | TX_POWER_MAX (dBm)|Dual band | channel range ||
|:---------:|:-----------------:|:-----------------:|:--------:|:-------------:|:------:|
| | | | |Sub 2.4 GHz | 2.4GHz |
| at86rf215 | -28 | +3 |yes |0 - 10 | 11 -26 |
| at86rf233 | -17 | +4 |no |xxxxxxx | ^ |
| cc2538 | -24 | +7 |no |xxxxxxx | ^ |

### getting an specify interface
CW-75 marked this conversation as resolved.
Show resolved Hide resolved

when you needs know what wireless interface require to get o set its features
you need use `get_ieee802154_iface(void)` this returns the index of an radio
device, an example is the at86rf233.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.c}
get_ieee802154_iface(void)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@note When it's used the at86rf215 you could has two network device.

### Getting and setting transmission power
Basic setup to get and set the transmission power of a radio device.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.c}
get_netopt_tx_power(int16_t txpower) // get the current TX_POWER of the radio device
set_netopt_tx_power(int16_t txpower) // set TX_POWER within of the radio device TX_POWER limits
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

### Getting and setting band channel
Basic setup to get and set the band channel of a radio device.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.c}
get_netopt_channel(int16_t channel) // get the current operative channel
set_netopt_channel(int16_t channel) /* sets the operative channel upper or under of 2.4 GHz
band, depending to the radio device if is multiband or not.*/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

*/
9 changes: 1 addition & 8 deletions firmware/network/radio/include/radio.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

/**
* @{
* @ingroup network
* @ingroup radio_module
* @file radio.h
* @brief this module content all functions of radio
* @author xkevin190 <[email protected]>
Expand All @@ -36,13 +36,6 @@
extern "C" {
#endif

/* These Params should be Set in IEEE802154.H
*
* Take a list to every specific radio driver to check
* hardware limitations to change TX_POWER
*
*/

/**
* @brief This function it's to get index of an IEEE802.15.4 interface
*
Expand Down
12 changes: 1 addition & 11 deletions firmware/network/radio/include/radio_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

/**
* @{
* @ingroup network
* @ingroup radio_module
* @file radio_params.h
* @brief this module content all params to set the radio
* @author xkevin190 <[email protected]>
Expand All @@ -36,16 +36,6 @@
extern "C" {
#endif

/**
* @brief Drivers Params List
*
* | Driver |TX_POWER_MIN (dBm) | TX_POWER_MAX (dBm)|
* |:---------:|:-----------------:|:-----------------:|
* | at86rf215 | -28 | +3 |
* | at86rf233 | -17 | +4 |
* | cc2538 | -24 | +7 |
*/

#ifdef MODULE_AT86RF233
#define TX_POWER_MAX (4)
#define TX_POWER_MIN (-17)
Expand Down
4 changes: 2 additions & 2 deletions firmware/network/rpl_protocol/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
@defgroup rpl_protocol RPL protocol module
@ingroup network

### What goes here?
### RPL (Routing Protocol in Low Power and Lossy Networks)

In this module you will find the functions to start RPL and add a node dodag (Root)
or dag (Slave) first RPL is initialized then it is verifies if the node is dodag or dag and
they are started an ipv6 is added where the dodag will be hosted one Once the dodag is started,
the DAG RIOT node is in charge of executing the entire routing process.

### How's work RPL protocol
### How's work RPL protocol?

the RPL protocol is quite complex in this document we will try to explain it as simple to understand as possible.

Expand Down
20 changes: 18 additions & 2 deletions firmware/network/udp_client/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,25 @@
@defgroup udp_client Udp Client
@ingroup network

### What goes here?
### Udp Client

UDP is the abbreviation of User Datagram Protocol. UDP makes use of Internet Protocol of the TCP/IP suit.
In communications using UDP, a client program sends a message packet to a destination server where in the
destination server also runs on UDP.
UDP is commonly used in time-sensitive communications where occasionally dropping packets is better than waiting.
Voice and video traffic are sent using this protocol because they are both time-sensitive and designed to handle
some level of loss. For example VOIP (voice over IP), which is used by many internet-based telephone services,
operates over UDP. This is because a staticy phone conversation is preferable to one that is crystal clear but
heavily delayed.

An Udp client makes request to a server that works under UDP protocol, once the request is processed the server response to the client.

This module is used to set an udp client. The function ``` udp_send ``` is used to send the sensors values specifying port,
address to which the message will be sent, the message (parameter) and the size of the message.
address to which the message will be sent, the message (parameter) and the size of the message. also could be used to send a string or byte array
to process a group of data.

An Udp client doesn't needs listen a response, an udp client could be a data collector. sending constantly times a group of data to the server Udp.

@image html udp_client_image.drawio.png Udp Client model as a data collector width=70%

*/
Loading