net-snmp 5.7
file_utils.h
00001 #ifndef NETSNMP_FILE_UTILS_H
00002 #define NETSNMP_FILE_UTILS_H
00003 
00004 #ifdef __cplusplus
00005 extern "C" {
00006 #endif
00007 
00008     
00009     /*------------------------------------------------------------------
00010      *
00011      * structures
00012      *
00013      */
00014     typedef struct netsnmp_file_s {
00015         
00017         char                   *name;
00018         
00020         int                     fd;
00021 
00023         int                     fs_flags;
00024 
00026         mode_t                  mode;
00027 
00029         u_int                   ns_flags;
00030 
00032         struct stat            *stats;
00033 
00034         /*
00035          * future expansion
00036          */
00037         netsnmp_data_list      *extras;
00038 
00039     } netsnmp_file;
00040 
00041 
00042     
00043     /*------------------------------------------------------------------
00044      *
00045      * Prototypes
00046      *
00047      */
00048     netsnmp_file *netsnmp_file_new(const char *name, int fs_flags, mode_t mode,
00049                                    u_int ns_flags);
00050 
00051     netsnmp_file * netsnmp_file_create(void);
00052     netsnmp_file * netsnmp_file_fill(netsnmp_file * filei, const char* name,
00053                                      int fs_flags, mode_t mode, u_int ns_flags);
00054     int netsnmp_file_release(netsnmp_file * filei);
00055 
00056     int netsnmp_file_open(netsnmp_file * filei);
00057     int netsnmp_file_close(netsnmp_file * filei);
00058 
00060     int netsnmp_file_compare_name(netsnmp_file *lhs, netsnmp_file *rhs);
00061     void netsnmp_file_container_free(netsnmp_file *file, void *context);
00062 
00063 
00064 
00065     /*------------------------------------------------------------------
00066      *
00067      * flags
00068      *
00069      */
00070 #define NETSNMP_FILE_NO_AUTOCLOSE                         0x00000001
00071 #define NETSNMP_FILE_STATS                                0x00000002
00072 #define NETSNMP_FILE_AUTO_OPEN                            0x00000004
00073 
00074     /*------------------------------------------------------------------
00075      *
00076      * macros
00077      *
00078      */
00079 #define NS_FI_AUTOCLOSE(x) (0 == (x & NETSNMP_FILE_NO_AUTOCLOSE))
00080 #define NS_FI_(x) (0 == (x & NETSNMP_FILE_))
00081 
00082     
00083         
00084 #ifdef __cplusplus
00085 }
00086 #endif
00087 
00088 #endif /* NETSNMP_FILE_UTILS_H */