00001 #ifndef SNMP_SYSTEM_H 00002 #define SNMP_SYSTEM_H 00003 00004 #ifndef NET_SNMP_CONFIG_H 00005 #error "Please include <net-snmp/net-snmp-config.h> before this file" 00006 #endif 00007 00008 #ifdef __cplusplus 00009 extern "C" { 00010 #endif 00011 00012 /* Portions of this file are subject to the following copyrights. See 00013 * the Net-SNMP's COPYING file for more details and other copyrights 00014 * that may apply: 00015 */ 00016 /*********************************************************** 00017 Copyright 1993 by Carnegie Mellon University 00018 00019 All Rights Reserved 00020 00021 Permission to use, copy, modify, and distribute this software and its 00022 documentation for any purpose and without fee is hereby granted, 00023 provided that the above copyright notice appear in all copies and that 00024 both that copyright notice and this permission notice appear in 00025 supporting documentation, and that the name of CMU not be 00026 used in advertising or publicity pertaining to distribution of the 00027 software without specific, written prior permission. 00028 00029 CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 00030 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 00031 CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 00032 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 00033 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 00034 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 00035 SOFTWARE. 00036 ******************************************************************/ 00037 /* 00038 * portions Copyright © 2003 Sun Microsystems, Inc. All rights reserved. 00039 * Use is subject to license terms specified in the COPYING file 00040 * distributed with the Net-SNMP package. 00041 */ 00042 00043 00044 /* 00045 * function to create a daemon. Will fork and call setsid(). 00046 * 00047 * Returns: -1 : fork failed 00048 * 0 : No errors 00049 */ 00050 int netsnmp_daemonize(int quit_immediately, int stderr_log); 00051 00052 /* 00053 * Definitions for the system dependent library file 00054 */ 00055 #ifndef MSVC_PERL 00056 #ifdef WIN32 00057 00058 #ifndef HAVE_DIRENT_H /* MingGW has dirent.h but also defines WIN32 */ 00059 /* 00060 * structure of a directory entry 00061 */ 00062 typedef struct direct { 00063 long d_ino; /* inode number (not used by MS-DOS) */ 00064 int d_namlen; /* Name length */ 00065 char d_name[257]; /* file name */ 00066 } _DIRECT; 00067 00068 /* 00069 * structure for dir operations 00070 */ 00071 typedef struct _dir_struc { 00072 char *start; /* Starting position */ 00073 char *curr; /* Current position */ 00074 long size; /* Size of string table */ 00075 long nfiles; /* number if filenames in table */ 00076 struct direct dirstr; /* Directory structure to return */ 00077 } DIR; 00078 00079 DIR *opendir(const char *filename); 00080 struct direct *readdir(DIR * dirp); 00081 int closedir(DIR * dirp); 00082 #endif /* HAVE_DIRENT_H */ 00083 00084 #ifndef HAVE_GETTIMEOFDAY 00085 int gettimeofday(struct timeval *, struct timezone *tz); 00086 #endif 00087 #ifndef HAVE_STRCASECMP 00088 int strcasecmp(const char *s1, const char *s2); 00089 #endif 00090 #ifndef HAVE_STRNCASECMP 00091 int strncasecmp(const char *s1, const char *s2, size_t n); 00092 #endif 00093 00094 char *winsock_startup(void); 00095 void winsock_cleanup(void); 00096 00097 #define SOCK_STARTUP winsock_startup() 00098 #define SOCK_CLEANUP winsock_cleanup() 00099 00100 #else /* !WIN32 */ 00101 00102 #define SOCK_STARTUP 00103 #define SOCK_CLEANUP 00104 00105 #endif /* WIN32 */ 00106 #endif /* MSVC_PERL */ 00107 00108 #include <net-snmp/types.h> /* For definition of in_addr_t */ 00109 00110 /* Simply resolve a hostname and return first IPv4 address. 00111 * Returns -1 on error */ 00112 int netsnmp_gethostbyname_v4(const char* name, 00113 in_addr_t *addr_out); 00114 00115 in_addr_t get_myaddr(void); 00116 long get_uptime(void); 00117 00118 #ifndef HAVE_STRDUP 00119 char *strdup(const char *); 00120 #endif 00121 #ifndef HAVE_SETENV 00122 int setenv(const char *, const char *, int); 00123 #endif 00124 00125 int calculate_time_diff(struct timeval *, 00126 struct timeval *); 00127 u_int calculate_sectime_diff(struct timeval *now, 00128 struct timeval *then); 00129 00130 #ifndef HAVE_STRCASESTR 00131 char *strcasestr(const char *, const char *); 00132 #endif 00133 #ifndef HAVE_STRTOL 00134 long strtol(const char *, char **, int); 00135 #endif 00136 #ifndef HAVE_STRTOUL 00137 unsigned long strtoul(const char *, char **, int); 00138 #endif 00139 #ifndef HAVE_STRTOULL 00140 unsigned long strtoull(const char *, char **, int); 00141 #endif 00142 #ifndef HAVE_STRTOK_R 00143 char *strtok_r(char *, const char *, char **); 00144 #endif 00145 #ifndef HAVE_SNPRINTF 00146 int snprintf(char *, size_t, const char *, ...); 00147 #endif 00148 00149 int mkdirhier(const char *pathname, mode_t mode, 00150 int skiplast); 00151 const char *netsnmp_mktemp(void); 00152 #ifndef HAVE_STRLCPY 00153 size_t strlcpy(char *, const char *, size_t); 00154 #endif 00155 00156 int netsnmp_os_prematch(const char *ospmname, 00157 const char *ospmrelprefix); 00158 int netsnmp_os_kernel_width(void); 00159 00160 int netsnmp_str_to_uid(const char *useroruid); 00161 int netsnmp_str_to_gid(const char *grouporgid); 00162 00163 #ifdef __cplusplus 00164 } 00165 #endif 00166 #endif /* SNMP_SYSTEM_H */
Last modified: Wednesday, 01-Aug-2018 04:41:28 UTC
For questions regarding web content and site functionality, please write to the net-snmp-users mail list.