agileRTOS (zrtos)  Version 0.8.0 (ghostbuster)
network.h File Reference
#include <zrtos/types.h>
Include dependency graph for network.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  zrtos_vfs_module_network_mac_t
 
struct  zrtos_vfs_module_network_ip4_t
 
struct  zrtos_vfs_module_network_subnet_mask_t
 

Functions

bool zrtos_vfs_module_network_ip4__init (zrtos_vfs_module_network_ip4_t *thiz, const char *src)
 

Function Documentation

◆ zrtos_vfs_module_network_ip4__init()

bool zrtos_vfs_module_network_ip4__init ( zrtos_vfs_module_network_ip4_t thiz,
const char *  src 
)

Definition at line 28 of file network.h.

31  {
32  char ch;
33  uint16_t val = 0;
34  size_t pos = 0;
35 
36  while(true){
37  ch = *src++;
38  if(zrtos_types__is_digit(ch)){
39  val += (ch - '0') * 10;
40  }else if(
41  (ch == '.' || ch == '\0')
42  && pos < 4
43  && val < 2560
44  ){
45  thiz->data[pos++] = val/10;
46  val = 0;
47  if(ch == '\0'){
48  break;
49  }
50  }else{
51  break;
52  }
53  }
54 
55  return pos == 4;
56 }
bool zrtos_types__is_digit(char c)
Definition: types.h:264
Here is the call graph for this function: