#include "lwip/ip_addr.h"
#include "lwip/inet.h"
#include <string.h>
Include dependency graph for ip_addr.c:
Go to the source code of this file.
Defines | |
#define | htons HTONS |
#define | htonl HTONL |
Functions | |
int | get_int_from_char (char c) |
void | string2ip_addr (struct ip_addr *ip, char *name, int size) |
Variables | |
ip_addr | ip_addr_any = { 0x00000000UL } |
ip_addr | ip_addr_broadcast = { 0xffffffffUL } |
|
|
|
|
|
Definition at line 45 of file ip_addr.c. Referenced by string2ip_addr().
00045 { 00046 00047 /* 0-9 */ 00048 if((c >= 48) && (c <= 57)) return (c-48); 00049 return -1; 00050 } |
|
Definition at line 53 of file ip_addr.c. References get_int_from_char(), IP4_ADDR, name, and NULL. Referenced by udpecho_thread().
00053 { 00054 int i, index=0, sum[4]={0,0,0,0}, ciphers[3]={0,0,0},cont=0; 00055 00056 if(name != NULL){ 00057 for(i=0; i<3; i++){ 00058 do{ 00059 ciphers[cont]=get_int_from_char(name[index]); 00060 index++; 00061 cont++; 00062 }while(name[index] != 0x2e); //0x2e is the hex ascii code for '.' 00063 if(cont==3) 00064 sum[i] = ciphers[0]*100 + ciphers[1]*10 + ciphers[2]; 00065 else if(cont==2) 00066 sum[i] = ciphers[0]*10 + ciphers[1]; 00067 else 00068 sum[i] = ciphers[0]; 00069 index++; 00070 ciphers[0] = 0; ciphers[1]= 0; ciphers[2] = 0; cont = 0; 00071 } 00072 00073 while(name[index]!='\0'){ 00074 ciphers[cont]= get_int_from_char(name[index]); 00075 index++; 00076 cont++; 00077 } 00078 if(cont==3) 00079 sum[3] = ciphers[0]*100 + ciphers[1]*10 + ciphers[2]; 00080 else if(cont==2) 00081 sum[3] = ciphers[0]*10 + ciphers[1]; 00082 else 00083 sum[3] = ciphers[0]; 00084 00085 IP4_ADDR(ip, sum[0],sum[1],sum[2],sum[3]); 00086 } 00087 } |
Here is the call graph for this function:
|
|
|
|