[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/unix.cGo to the documentation of this file.00001 /* 00002 * lib/unix.c This file contains the general hardware types. 00003 * 00004 * Version: @(#)unix.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 * This program is free software; you can redistribute it 00010 * and/or modify it under the terms of the GNU General 00011 * Public License as published by the Free Software 00012 * Foundation; either version 2 of the License, or (at 00013 * your option) any later version. 00014 */ 00015 #include "config.h" 00016 00017 #include <sys/types.h> 00018 #include <sys/socket.h> 00019 #if HAVE_AFUNIX 00020 # include <sys/un.h> 00021 #endif 00022 #include <stdlib.h> 00023 #include <stdio.h> 00024 #include <errno.h> 00025 #include <ctype.h> 00026 #include <string.h> 00027 #include <unistd.h> 00028 #include "net-support.h" 00029 #include "pathnames.h" 00030 #include "intl.h" 00031 00032 00033 /* Display an UNSPEC address. */ 00034 static char * 00035 UNSPEC_print(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 UNSPEC_sprint(struct sockaddr *sap, int numeric) 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(UNSPEC_print(sap->sa_data)); 00059 } 00060 00061 00062 #if HAVE_AFUNIX 00063 00064 /* Display a UNIX domain address. */ 00065 static char * 00066 UNIX_print(unsigned char *ptr) 00067 { 00068 return(ptr); 00069 } 00070 00071 00072 /* Display a UNIX domain address. */ 00073 static char * 00074 UNIX_sprint(struct sockaddr *sap, int numeric) 00075 { 00076 static char buf[64]; 00077 00078 if (sap->sa_family == 0xFFFF || sap->sa_family == 0) 00079 return strncpy (buf, _("[NONE SET]"), sizeof(buf)); 00080 return(UNIX_print(sap->sa_data)); 00081 } 00082 00083 00084 struct aftype unix_aftype = { 00085 "unix", NULL, /*"UNIX Domain",*/ AF_UNIX, 0, 00086 UNIX_print, UNIX_sprint, NULL, NULL, 00087 NULL 00088 }; 00089 #endif /* HAVE_AFUNIX */ 00090 00091 00092 struct aftype unspec_aftype = { 00093 "unspec", NULL, /*"UNSPEC",*/ AF_UNSPEC, 0, 00094 UNSPEC_print, UNSPEC_sprint, NULL, NULL, 00095 NULL 00096 }; |