net-snmp
5.4.1
|
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 00016 /* 00017 * file name 00018 */ 00019 char *name; 00020 00021 /* 00022 * file descriptor for the file 00023 */ 00024 int fd; 00025 00026 /* 00027 * filesystem flags 00028 */ 00029 int fs_flags; 00030 00031 /* 00032 * open/create mode 00033 */ 00034 mode_t mode; 00035 00036 /* 00037 * netsnmp flags 00038 */ 00039 u_int ns_flags; 00040 00041 00042 00043 /* 00044 * future expansion 00045 */ 00046 netsnmp_data_list *extras; 00047 00048 } netsnmp_file; 00049 00050 00051 00052 /*------------------------------------------------------------------ 00053 * 00054 * Prototypes 00055 * 00056 */ 00057 netsnmp_file * netsnmp_file_create(void); 00058 netsnmp_file * netsnmp_file_fill(netsnmp_file * filei, const char* name, 00059 int fs_flags, mode_t mode, u_int ns_flags); 00060 int netsnmp_file_release(netsnmp_file * filei); 00061 00062 int netsnmp_file_open(netsnmp_file * filei); 00063 int netsnmp_file_close(netsnmp_file * filei); 00064 00065 00066 00067 /*------------------------------------------------------------------ 00068 * 00069 * flags 00070 * 00071 */ 00072 #define NETSNMP_FILE_NO_AUTOCLOSE 0x00000001 00073 #define NETSNMP_FILE_ 0x00000002 00074 00075 /*------------------------------------------------------------------ 00076 * 00077 * macros 00078 * 00079 */ 00080 #define NS_FI_AUTOCLOSE(x) (0 == (x & NETSNMP_FILE_NO_AUTOCLOSE)) 00081 #define NS_FI_(x) (0 == (x & NETSNMP_FILE_)) 00082 00083 00084 00085 #ifdef _cplusplus 00086 } 00087 #endif 00088 00089 #endif /* NETSNMP_FILE_UTILS_H */