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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [userland/] [route/] [lib/] [loopback.c] - Blame information for rev 745

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

Line No. Rev Author Line
1 745 simons
/*
2
 * lib/loopback.c     This file contains the general hardware types.
3
 *
4
 * Version:     $Id: loopback.c,v 1.1 2002-03-17 19:58:53 simons Exp $
5
 *
6
 * Author:      Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
7
 *              Copyright 1993 MicroWalt Corporation
8
 *
9
 * Modifications:
10
 * 1998-07-01 - Arnaldo Carvalho de Melo - GNU gettext instead of catgets
11
 *
12
 *              This program is free software; you can redistribute it
13
 *              and/or  modify it under  the terms of  the GNU General
14
 *              Public  License as  published  by  the  Free  Software
15
 *              Foundation;  either  version 2 of the License, or  (at
16
 *              your option) any later version.
17
 */
18
#include "config.h"
19
 
20
#include <sys/types.h>
21
#include <sys/socket.h>
22
#include <net/if_arp.h>
23
#include <stdlib.h>
24
#include <stdio.h>
25
#include <errno.h>
26
#include <ctype.h>
27
#include <string.h>
28
#include <unistd.h>
29
#include "net-support.h"
30
#include "pathnames.h"
31
#include "intl.h"
32
#include "util.h"
33
 
34
/* Display an UNSPEC address. */
35
static char *pr_unspec(unsigned char *ptr)
36
{
37
    static char buff[64];
38
    char *pos;
39
    unsigned int i;
40
 
41
    pos = buff;
42
    for (i = 0; i < sizeof(struct sockaddr); i++) {
43
        pos += sprintf(pos, "%02X-", (*ptr++ & 0377));
44
    }
45
    buff[strlen(buff) - 1] = '\0';
46
    return (buff);
47
}
48
 
49
 
50
/* Display an UNSPEC socket address. */
51
static char *pr_sunspec(struct sockaddr *sap)
52
{
53
    static char buf[64];
54
 
55
    if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
56
        return safe_strncpy(buf, _("[NONE SET]"), sizeof(buf));
57
    return (pr_unspec(sap->sa_data));
58
}
59
 
60
 
61
struct hwtype unspec_hwtype =
62
{
63
    "unspec", NULL, /*"UNSPEC", */ -1, 0,
64
    pr_unspec, pr_sunspec, NULL, NULL
65
};
66
 
67
struct hwtype loop_hwtype =
68
{
69
    "loop", NULL, /*"Local Loopback", */ ARPHRD_LOOPBACK, 0,
70
    NULL, NULL, NULL, NULL
71
};

powered by: WebSVN 2.1.0

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