#include #include -- | module Bindings.Librrd where import Bindings.Posix.Time import System.Posix.Types #strict_import -- Formerly rrd_nan_inf.h #cinline DNAN, IO CDouble #cinline DINF, IO CDouble #ccall rrd_set_to_DNAN, IO CDouble #ccall rrd_set_to_DINF, IO CDouble -- Transplanted from rrd_format.h #synonym_t rrd_value_t, CDouble -- Information about an rrd file #starttype struct rrd_file_t #field header_len, COff #field file_len , COff #field pos , COff #field pvt , Ptr () #stoptype -- information used for the conventional file access methods #starttype struct rrd_simple_file_t #field fd , CInt #if HAVE_MMAP #field file_start, Ptr CChar #field mm_prot , CInt #field mm_flags , CInt #endif #stoptype -- rrd info interface #starttype struct rrd_blob_t #field size, CULong #field ptr , Ptr CUChar #stoptype #integral_t rrd_info_type_t #num RD_I_VAL #num RD_I_CNT #num RD_I_STR #num RD_I_INT #num RD_I_BLO #starttype union rrd_infoval #union_field u_cnt, CULong #union_field u_val, #union_field u_str, CString #union_field u_int, CInt #union_field u_blo, #stoptype #synonym_t rrd_infoval_t, #starttype struct rrd_info_t #field key , CString #field type , #field value, #field next , Ptr #stoptype {-|The correct type for this callback should be @'Ptr' a -> 'CSize' -> 'Ptr' b -> 'IO' 'CSize'@ but that's impossible because of bindings-DSL restriction. -} #callback rrd_output_callback_t, Ptr () -> CSize -> Ptr () -> IO CSize -- main function blocks #ccall rrd_create , CInt -> Ptr CString -> IO CInt #ccall rrd_info , CInt -> Ptr CString -> IO (Ptr ) #cinline rrd_info_push , Ptr -> CString -> -> Ptr -> IO (Ptr ) #ccall rrd_info_print , Ptr -> IO () #ccall rrd_info_free , Ptr -> IO () #ccall rrd_update , CInt -> Ptr CString -> IO CInt #ccall rrd_update_v , CInt -> Ptr CString -> IO (Ptr ) #ccall rrd_graph , CInt -> Ptr CString -> Ptr (Ptr CString) -> Ptr CInt -> Ptr CInt -> Ptr CFile -> Ptr CDouble -> Ptr CDouble -> IO CInt #ccall rrd_graph_v , CInt -> Ptr CString -> IO (Ptr ) #ccall rrd_fetch , CInt -> Ptr CString -> Ptr CTime -> Ptr CTime -> Ptr CULong -> Ptr CULong -> Ptr (Ptr CString) -> Ptr (Ptr ) -> IO CInt #ccall rrd_restore , CInt -> Ptr CString -> IO CInt #ccall rrd_dump , CInt -> Ptr CString -> IO CInt #ccall rrd_tune , CInt -> Ptr CString -> IO CInt #ccall rrd_last , CInt -> Ptr CString -> IO CTime #ccall rrd_lastupdate , CInt -> Ptr CString -> Ptr CTime -> Ptr CULong -> Ptr (Ptr CString) -> Ptr (Ptr CString) -> IO CInt #ccall rrd_first , CInt -> Ptr CString -> IO CTime #ccall rrd_resize , CInt -> Ptr CString -> IO CInt #ccall rrd_strversion , IO CString #ccall rrd_version , IO CDouble #ccall rrd_xport , CInt -> Ptr CString -> Ptr CInt -> Ptr CTime -> Ptr CTime -> Ptr CULong -> Ptr CULong -> Ptr (Ptr CString) -> Ptr (Ptr ) -> IO CInt #ccall rrd_flushcached , CInt -> Ptr CString -> IO CInt #ccall rrd_freemem , Ptr a -> IO () -- thread-safe (hopefully) #ccall rrd_create_r , CString -> CULong -> CTime -> CInt -> Ptr CString -> IO CInt -- NOTE: rrd_update_r are only thread-safe if no at-style time -- specifications get used!!! #ccall rrd_info_r , CString -> IO (Ptr ) #ccall rrd_update_r , CString -> CString -> CInt -> Ptr CString -> IO CInt #ccall rrd_fetch_r , CString -> CString -> Ptr CTime -> Ptr CTime -> Ptr CULong -> Ptr CULong -> Ptr (Ptr CString) -> Ptr (Ptr ) -> IO CInt #ccall rrd_dump_r , CString -> CString -> IO CInt #ccall rrd_last_r , CString -> IO CTime #ccall rrd_lastupdate_r, CString -> Ptr CTime -> Ptr CULong -> Ptr (Ptr CString) -> Ptr (Ptr CString) -> IO CInt #ccall rrd_first_r , CString -> CInt -> IO CTime #ccall rrd_dump_cb_r , CString -> CInt -> -> Ptr b -> IO CInt -- Transplanted from rrd_parsetime.h #integral_t rrd_timetype_t #num ABSOLUTE_TIME #num RELATIVE_TO_START_TIME #num RELATIVE_TO_END_TIME #pointer TIME_OK #starttype struct rrd_time_value #field type , #field offset, CLong #field tm , #stoptype #synonym_t rrd_time_value_t, #ccall rrd_parsetime, CString -> Ptr -> IO CString #starttype struct rrd_context #array_field lib_errstr, CChar #array_field rrd_error , CChar #stoptype #synonym_t rrd_context_t, -- returns the current per-thread rrd_context #ccall rrd_get_context, IO (Ptr ) #ccall rrd_proc_start_end, Ptr -> Ptr -> Ptr CTime -> Ptr CTime -> IO CInt -- HELPER FUNCTIONS -- rrd_set_error() is unavailable as it uses C varargs. #ccall rrd_clear_error, IO () #ccall rrd_test_error , IO CInt #ccall rrd_get_error , IO CString -- rrd_strerror is thread safe, but still it uses a global buffer (but -- one per thread), thus subsequent calls within a single thread -- overwrite the same buffer #ccall rrd_strerror , CInt -> IO CString -- MULTITHREADED HELPER FUNCTIONS #ccall rrd_new_context , IO (Ptr ) #ccall rrd_free_context, Ptr -> IO () -- UTILITY FUNCTIONS #ccall rrd_random , IO CLong #ccall rrd_add_ptr , Ptr (Ptr (Ptr a)) -> Ptr CSize -> Ptr a -> IO CInt #ccall rrd_add_strdup, Ptr (Ptr CString) -> Ptr CSize -> CString -> IO CInt #ccall rrd_free_ptrs , Ptr (Ptr (Ptr a)) -> CSize -> IO () #ccall rrd_mkdir_p , CString -> CMode -> IO CInt