Main Page | Directories | File List | Globals

core.c File Reference

#include <agnix/agnix.h>
#include <agnix/adi/adi.h>
#include <agnix/init.h>
#include <agnix/net/net.h>
#include <agnix/memory.h>
#include <agnix/strings.h>
#include <agnix/console.h>
#include <agnix/types.h>

Include dependency graph for core.c:

Go to the source code of this file.

Defines

#define MOD_NAME   "NET: "

Functions

int net_addr (char *addr, struct net_addr_s *net_addr)
int net_layer_3_init (void)


Define Documentation

#define MOD_NAME   "NET: "
 

Definition at line 23 of file core.c.


Function Documentation

int net_addr char *  addr,
struct net_addr_s *  net_addr
 

Definition at line 25 of file core.c.

References buf, and strlen().

Referenced by agnix_console_arp_request(), and agnix_console_net_ifconfig().

00026 {
00027     char buf[NET_ADDR_STRING_MAX_LEN];
00028     char *ptr;
00029     int i, j;
00030     int dots;
00031 
00032     j = 0;
00033     dots = 0;
00034     for (i = 0; i < NET_ADDR_STRING_MAX_LEN; i++) {
00035         if (addr[i] == '.' && j > 0) {
00036             buf[i] = 0;
00037             j = 0;
00038             dots++;
00039             if (dots > 3)
00040                 return -1;
00041                 
00042         } else 
00043         if ((addr[i] >= '0') && (addr[i] <= '9') && (j < 3)) {
00044             buf[i] = addr[i];
00045             j++;
00046         } else
00047         if (addr[i] == 0 || addr[i] == '\n')
00048             break;
00049         else
00050             return -1;
00051     }
00052     
00053     if ((dots != 3) || (addr[i - 1] == '.'))
00054         return -1;
00055         
00056     buf[i] = 0;
00057     net_addr->address[0] = (u8)atoi(buf);
00058     ptr = buf + strlen(buf) + 1;
00059     net_addr->address[1] = (u8)atoi(ptr);
00060     ptr += strlen(ptr) + 1;
00061     net_addr->address[2] = (u8)atoi(ptr);
00062     ptr += strlen(ptr) + 1;
00063     net_addr->address[3] = (u8)atoi(ptr);
00064 
00065     return 0;
00066 }

Here is the call graph for this function:

int net_layer_3_init void   ) 
 

Definition at line 68 of file core.c.

References MOD_NAME, net_layer_3_ip_init(), and printk().

Referenced by network_init().

00069 {
00070     printk(MOD_NAME "\tLayer 3: core");
00071 
00072     net_layer_3_ip_init();
00073     
00074     printk("\n");
00075 
00076     return 0;
00077 }

Here is the call graph for this function:

Dokumentacje wygenerowano programem Doxygen 1.4.2 dla projektu Agnix