[insert project logo here (125x200px max)] Navigator Mailinglists Please report any errors or ommissions you find to our `Help' mailinglist, or post a message in the Forums. Copyright and Licensing Information Snap is (c) Jonathan T. Moore, 1999-2002 and licensed under the GNU General Public License (GPL). All other parts of Splash are (c) Willem de Bruijn, 2002-2003 and licensed under the BSD Open Source License. All sourcecode is made publicly available. Acknowledgement Splash and the Splash website are hosted by SourceForge.net |
Splash - DocumentationSNMP Plus a Lightweight API for SNAP Handlingsnap-1.1-wjdb/lib/loopback.cGo to the documentation of this file.00001 /* 00002 * lib/loopback.c This file contains the general hardware types. 00003 * 00004 * Version: @(#)loopback.c 1.10 10/07/93 00005 * 00006 * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> 00007 * Copyright 1993 MicroWalt Corporation 00008 * 00009 * Modifications: 00010 * 1998-07-01 - Arnaldo Carvalho de Melo - GNU gettext instead of catgets 00011 * 00012 * This program is free software; you can redistribute it 00013 * and/or modify it under the terms of the GNU General 00014 * Public License as published by the Free Software 00015 * Foundation; either version 2 of the License, or (at 00016 * your option) any later version. 00017 */ 00018 #include "config.h" 00019 00020 #include <sys/types.h> 00021 #include <sys/socket.h> 00022 #include <net/if_arp.h> 00023 #include <stdlib.h> 00024 #include <stdio.h> 00025 #include <errno.h> 00026 #include <ctype.h> 00027 #include <string.h> 00028 #include <unistd.h> 00029 #include "net-support.h" 00030 #include "pathnames.h" 00031 #include "intl.h" 00032 00033 /* Display an UNSPEC address. */ 00034 static char * 00035 pr_unspec(unsigned char *ptr) 00036 { 00037 static char buff[64]; 00038 char *pos; 00039 unsigned int i; 00040 00041 pos = buff; 00042 for(i = 0; i < sizeof(struct sockaddr); i++) { 00043 pos += sprintf(pos, "%02X-", (*ptr++ & 0377)); 00044 } 00045 buff[strlen(buff) - 1] = '\0'; 00046 return(buff); 00047 } 00048 00049 00050 /* Display an UNSPEC socket address. */ 00051 static char * 00052 pr_sunspec(struct sockaddr *sap) 00053 { 00054 static char buf[64]; 00055 00056 if (sap->sa_family == 0xFFFF || sap->sa_family == 0) 00057 return strncpy (buf, _("[NONE SET]"), sizeof (buf)); 00058 return(pr_unspec(sap->sa_data)); 00059 } 00060 00061 00062 struct hwtype unspec_hwtype = { 00063 "unspec", NULL, /*"UNSPEC",*/ -1, 0, 00064 pr_unspec, pr_sunspec, NULL, NULL 00065 }; 00066 00067 struct hwtype loop_hwtype = { 00068 "loop", NULL, /*"Local Loopback",*/ 255/*ARPHRD_LOOPBACK*/, 0, 00069 NULL, NULL, NULL, NULL 00070 }; |