OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [net/] [ipv4/] [utils.c] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
2
 * INET         An implementation of the TCP/IP protocol suite for the LINUX
3
 *              operating system.  INET is implemented using the  BSD Socket
4
 *              interface as the means of communication with the user level.
5
 *
6
 *              Various kernel-resident INET utility functions; mainly
7
 *              for format conversion and debugging output.
8
 *
9
 * Version:     $Id: utils.c,v 1.1.1.1 2004-04-15 01:13:54 phoenix Exp $
10
 *
11
 * Author:      Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
12
 *
13
 * Fixes:
14
 *              Alan Cox        :       verify_area check.
15
 *              Alan Cox        :       removed old debugging.
16
 *              Andi Kleen      :       add net_ratelimit()
17
 *
18
 *              This program is free software; you can redistribute it and/or
19
 *              modify it under the terms of the GNU General Public License
20
 *              as published by the Free Software Foundation; either version
21
 *              2 of the License, or (at your option) any later version.
22
 */
23
 
24
#include <linux/types.h>
25
#include <asm/byteorder.h>
26
 
27
/*
28
 *      Convert an ASCII string to binary IP.
29
 */
30
 
31
__u32 in_aton(const char *str)
32
{
33
        unsigned long l;
34
        unsigned int val;
35
        int i;
36
 
37
        l = 0;
38
        for (i = 0; i < 4; i++)
39
        {
40
                l <<= 8;
41
                if (*str != '\0')
42
                {
43
                        val = 0;
44
                        while (*str != '\0' && *str != '.')
45
                        {
46
                                val *= 10;
47
                                val += *str - '0';
48
                                str++;
49
                        }
50
                        l |= val;
51
                        if (*str != '\0')
52
                                str++;
53
                }
54
        }
55
        return(htonl(l));
56
}
57
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.