~ubuntu-branches/ubuntu/gutsy/net-snmp/gutsy-security

« back to all changes in this revision

Viewing changes to include/net-snmp/library/system.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2004-09-13 12:06:21 UTC
  • Revision ID: james.westby@ubuntu.com-20040913120621-g952ntonlleihcvm
Tags: upstream-5.1.1
Import upstream version 5.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef SNMP_SYSTEM_H
 
2
#define SNMP_SYSTEM_H
 
3
 
 
4
#ifndef NET_SNMP_CONFIG_H
 
5
#error "Please include <net-snmp/net-snmp-config.h> before this file"
 
6
#endif
 
7
 
 
8
#ifdef __cplusplus
 
9
extern          "C" {
 
10
#endif
 
11
 
 
12
/* Portions of this file are subject to the following copyrights.  See
 
13
 * the Net-SNMP's COPYING file for more details and other copyrights
 
14
 * that may apply:
 
15
 */
 
16
/***********************************************************
 
17
        Copyright 1993 by Carnegie Mellon University
 
18
 
 
19
                      All Rights Reserved
 
20
 
 
21
Permission to use, copy, modify, and distribute this software and its
 
22
documentation for any purpose and without fee is hereby granted,
 
23
provided that the above copyright notice appear in all copies and that
 
24
both that copyright notice and this permission notice appear in
 
25
supporting documentation, and that the name of CMU not be
 
26
used in advertising or publicity pertaining to distribution of the
 
27
software without specific, written prior permission.
 
28
 
 
29
CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 
30
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
 
31
CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
 
32
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
 
33
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
 
34
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 
35
SOFTWARE.
 
36
******************************************************************/
 
37
/*
 
38
 * portions Copyright � 2003 Sun Microsystems, Inc. All rights reserved.
 
39
 * Use is subject to license terms specified in the COPYING file
 
40
 * distributed with the Net-SNMP package.
 
41
 */
 
42
 
 
43
 
 
44
    /*
 
45
     * function to create a daemon. Will fork and call setsid().
 
46
     *
 
47
     * Returns: -1 : fork failed
 
48
     *           0 : No errors
 
49
     */
 
50
    int netsnmp_daemonize(int quit_immediately, int stderr_log);
 
51
 
 
52
    /*
 
53
     * Definitions for the system dependent library file
 
54
     */
 
55
#ifndef MSVC_PERL
 
56
#ifdef WIN32
 
57
 
 
58
#ifndef HAVE_DIRENT_H /* MingGW has dirent.h but also defines WIN32 */
 
59
    /*
 
60
     * structure of a directory entry 
 
61
     */
 
62
    typedef struct direct {
 
63
        long            d_ino;  /* inode number (not used by MS-DOS) */
 
64
        int             d_namlen;       /* Name length */
 
65
        char            d_name[257];    /* file name */
 
66
    } _DIRECT;
 
67
 
 
68
    /*
 
69
     * structure for dir operations 
 
70
     */
 
71
    typedef struct _dir_struc {
 
72
        char           *start;  /* Starting position */
 
73
        char           *curr;   /* Current position */
 
74
        long            size;   /* Size of string table */
 
75
        long            nfiles; /* number if filenames in table */
 
76
        struct direct   dirstr; /* Directory structure to return */
 
77
    } DIR;
 
78
 
 
79
    DIR            *opendir(const char *filename);
 
80
    struct direct  *readdir(DIR * dirp);
 
81
    int             closedir(DIR * dirp);
 
82
#endif /* HAVE_DIRENT_H */
 
83
 
 
84
#ifndef HAVE_GETTIMEOFDAY
 
85
    int             gettimeofday(struct timeval *, struct timezone *tz);
 
86
#endif
 
87
#ifndef HAVE_STRCASECMP
 
88
    int             strcasecmp(const char *s1, const char *s2);
 
89
#endif
 
90
#ifndef HAVE_STRNCASECMP
 
91
    int             strncasecmp(const char *s1, const char *s2, size_t n);
 
92
#endif
 
93
 
 
94
    char           *winsock_startup(void);
 
95
    void            winsock_cleanup(void);
 
96
 
 
97
#define SOCK_STARTUP winsock_startup()
 
98
#define SOCK_CLEANUP winsock_cleanup()
 
99
 
 
100
#else                           /* !WIN32 */
 
101
 
 
102
#define SOCK_STARTUP
 
103
#define SOCK_CLEANUP
 
104
 
 
105
#endif                          /* WIN32 */
 
106
#endif                          /* MSVC_PERL */
 
107
 
 
108
#include <net-snmp/types.h>     /* For definition of in_addr_t */
 
109
 
 
110
    in_addr_t       get_myaddr(void);
 
111
    long            get_uptime(void);
 
112
 
 
113
#ifndef HAVE_STRDUP
 
114
    char           *strdup(const char *);
 
115
#endif
 
116
#ifndef HAVE_SETENV
 
117
    int             setenv(const char *, const char *, int);
 
118
#endif
 
119
 
 
120
    int             calculate_time_diff(struct timeval *,
 
121
                                        struct timeval *);
 
122
 
 
123
#ifndef HAVE_STRCASESTR
 
124
    char           *strcasestr(const char *, const char *);
 
125
#endif
 
126
#ifndef HAVE_STRTOL
 
127
    long            strtol(const char *, char **, int);
 
128
#endif
 
129
#ifndef HAVE_STRTOUL
 
130
    unsigned long   strtoul(const char *, char **, int);
 
131
#endif
 
132
#ifndef HAVE_SNPRINTF
 
133
    int             snprintf(char *, size_t, const char *, ...);
 
134
#endif
 
135
 
 
136
    int             mkdirhier(const char *pathname, mode_t mode,
 
137
                              int skiplast);
 
138
#ifndef HAVE_STRLCPY
 
139
    size_t            strlcpy(char *, const char *, size_t);
 
140
#endif
 
141
 
 
142
#ifdef __cplusplus
 
143
}
 
144
#endif
 
145
#endif                          /* SNMP_SYSTEM_H */