Add Doxyfile, change docs
This commit is contained in:
+2
-2
@@ -22,8 +22,8 @@ struct IOMux {
|
||||
* The mux implementation must call iomux_timers_run after the
|
||||
* polling has occured (or if it's polling times out)
|
||||
*
|
||||
* @mux The IOMux instance
|
||||
* @timeout absolute time of a timeout - after which timers should run.
|
||||
* @param mux The IOMux instance
|
||||
* @param timeout absolute time of a timeout - after which timers should run.
|
||||
* If timeout is NULL, no timeout should be set on the poll.
|
||||
*/
|
||||
int (*run_impl)(struct IOMux *mux, struct timeval *timeout);
|
||||
|
||||
+22
-19
@@ -63,16 +63,16 @@ struct uc_log_destination;
|
||||
|
||||
/* Returns a string representation of the log level.
|
||||
*
|
||||
* @ll The log level
|
||||
* @param ll The log level
|
||||
* @return String representation of the log level. (This will be a string literal)
|
||||
*/
|
||||
const char *uc_ll_2_str(enum UC_LOG_LEVEL l);
|
||||
|
||||
/* creates a new uc_log_destination for printing on stderr.
|
||||
*
|
||||
* @log_level log level of this destination. only log messages
|
||||
* @param log_level log level of this destination. only log messages
|
||||
* with a log level >= the log level of the destination are actually logged.
|
||||
* @log_location whether to log info about the source file and line number
|
||||
* @param log_location whether to log info about the source file and line number
|
||||
* in a log message.
|
||||
*
|
||||
* @return An opaque uc_log_destination that can be added as a destination to
|
||||
@@ -82,11 +82,11 @@ struct uc_log_destination *uc_log_new_stderr(int log_level, int log_location);
|
||||
|
||||
/* creates a new uc_log_destination for logging to syslog
|
||||
*
|
||||
* @ident The ident as used in the syslog openlog() funcion
|
||||
* @facility The facility as used in the syslog openlog() function()
|
||||
* @log_level log level of this destination. only log messages
|
||||
* @param ident The ident as used in the syslog openlog() funcion
|
||||
* @param facility The facility as used in the syslog openlog() function()
|
||||
* @param log_level log level of this destination. only log messages
|
||||
* with a log level >= the log level of the destination are actually logged.
|
||||
* @log_location whether to log info about the source file and line number
|
||||
* @param log_location whether to log info about the source file and line number
|
||||
* in a log message.
|
||||
* @return An opaque uc_log_destination that can be added as a destination to
|
||||
* the ucore logging system
|
||||
@@ -95,44 +95,47 @@ struct uc_log_destination *uc_log_new_syslog(const char *ident, int facility, in
|
||||
|
||||
/* creates a new uc_log_destination for printing on stderr.
|
||||
*
|
||||
* @log_level log level of this destination. only log messages
|
||||
* @param log_level log level of this destination. only log messages
|
||||
* with a log level >= the log level of the destination are actually logged.
|
||||
* @log_location whether to log info about the source file and line number
|
||||
* @param log_location whether to log info about the source file and line number
|
||||
* in a log message.
|
||||
* @return An opaque uc_log_destination that can be added as a destination to
|
||||
* @param return An opaque uc_log_destination that can be added as a destination to
|
||||
* the ucore logging system
|
||||
*/
|
||||
struct uc_log_destination *uc_log_new_file(const char *filename, int log_level, int log_location);
|
||||
|
||||
/** Add a uc_log_destination to the logging system.
|
||||
*
|
||||
* @dest The uc_log_destination to add.
|
||||
* @param dest The uc_log_destination to add.
|
||||
*/
|
||||
void uc_log_add_destination(struct uc_log_destination *dest);
|
||||
|
||||
/** Remove a log destination.
|
||||
*
|
||||
* @dest The uc_log_destination to remove.
|
||||
* @param dest The uc_log_destination to remove.
|
||||
*/
|
||||
void uc_log_remove_destination(struct uc_log_destination *dest);
|
||||
|
||||
/** Change the log level of a module.
|
||||
*
|
||||
* @module The module to change, matched against the id member of a struct uc_log_module
|
||||
* @param module The module to change, matched against the id member of a struct uc_log_module
|
||||
* @param level The log level for this module
|
||||
*
|
||||
* @return 0 on success, non-zero if the module was not found.
|
||||
*/
|
||||
int uc_log_module_set_loglevel(int module, enum UC_LOG_LEVEL level);
|
||||
|
||||
/** Closes and re-opens all the UC_LDEST_FILE log destinations.
|
||||
* Intended for use when a log file is rotated externally.
|
||||
*
|
||||
* @return 0 on success, non-zero if an error occured when re-opening a file.
|
||||
* @param return 0 on success, non-zero if an error occured when re-opening a file.
|
||||
*/
|
||||
int uc_log_reopen_files(void);
|
||||
|
||||
/** Init the logging system. This function must be called before performing any other
|
||||
* logging action.
|
||||
*
|
||||
* @user_struct containing an array of all the modules defined by the application.
|
||||
* @param user_struct containing an array of all the modules defined by the application.
|
||||
*/
|
||||
void uc_log_init(struct uc_log_modules *user_modules);
|
||||
|
||||
@@ -149,10 +152,10 @@ void uc_logf(int log_level, int module, const char *file, int line, const char *
|
||||
* For log messages with UC_LL_DEBUG, the UC_DEBUGF() macro can be used,
|
||||
* UC_DEBUGF will only be compiled in if the DEBUG macro is defined
|
||||
*
|
||||
* @lvl log level of this log message
|
||||
* @mod module id of this log messagex.
|
||||
* @fmt printf style format string
|
||||
* @... printf style arguments
|
||||
* @param lvl log level of this log message
|
||||
* @param mod module id of this log messagex.
|
||||
* @param fmt printf style format string
|
||||
* @param ... printf style arguments
|
||||
*/
|
||||
#define UC_LOGF(lvl, mod, fmt, ...) uc_logf(lvl, mod, __FILE__, __LINE__, fmt, ## __VA_ARGS__)
|
||||
|
||||
|
||||
@@ -10,15 +10,15 @@ typedef struct {
|
||||
} MTRand;
|
||||
|
||||
/** Initialize a Mersenne Twister PRNG context.
|
||||
* @seed Starter seed for the PRNG
|
||||
* @r context for the PRNG
|
||||
* @param seed Starter seed for the PRNG
|
||||
* @param r context for the PRNG
|
||||
*/
|
||||
void mtsrand(int seed, MTRand *r);
|
||||
|
||||
/** Generate a new random number.
|
||||
* Generated range is 0 to UINT_MAX
|
||||
*
|
||||
* @r context for the PRNG
|
||||
* @param r context for the PRNG
|
||||
* @return A pseudo random number
|
||||
*/
|
||||
unsigned int mtrand(MTRand *r);
|
||||
|
||||
+32
-32
@@ -17,8 +17,8 @@
|
||||
|
||||
|
||||
/** Serialize a uint16_t to a byte array in little endian format.
|
||||
* @v The value to serialize
|
||||
* @r The byte array to place the integer in. Must be at least of size 2.
|
||||
* @param v The value to serialize
|
||||
* @param r The byte array to place the integer in. Must be at least of size 2.
|
||||
*/
|
||||
static UC_INLINE void uc_pack_16_le(uint16_t v, uint8_t *r)
|
||||
{
|
||||
@@ -27,8 +27,8 @@ static UC_INLINE void uc_pack_16_le(uint16_t v, uint8_t *r)
|
||||
}
|
||||
|
||||
/** De-serialize a uint16_t from a byte array in little endian format.
|
||||
* @r The byte array to containing the integer in. Must be at least of size 2.
|
||||
* @return The deserialized integer from the byte array.
|
||||
* @param r The byte array to containing the integer in. Must be at least of size 2.
|
||||
* @param return The deserialized integer from the byte array.
|
||||
*/
|
||||
static UC_INLINE uint16_t uc_unpack_16_le(const uint8_t *r)
|
||||
{
|
||||
@@ -43,8 +43,8 @@ static UC_INLINE uint16_t uc_unpack_16_le(const uint8_t *r)
|
||||
/** Serialize a uint32_t to a 3 byte(24 bits) array in little endian format.
|
||||
* Only the bottom 24 bits of the uint32_t are used.
|
||||
*
|
||||
* @v The value to serialize
|
||||
* @r The byte array to place the integer in. Must be at least of size 3.
|
||||
* @param v The value to serialize
|
||||
* @param r The byte array to place the integer in. Must be at least of size 3.
|
||||
*/
|
||||
static UC_INLINE void uc_pack_24_le(uint32_t v, uint8_t *r)
|
||||
{
|
||||
@@ -54,8 +54,8 @@ static UC_INLINE void uc_pack_24_le(uint32_t v, uint8_t *r)
|
||||
}
|
||||
|
||||
/** De-serialize a uint32_t from a 3 byte (24 bit) byte array in little endian format.
|
||||
* @r The byte array to containing the integer in. Must be at least of size 3.
|
||||
* @return The deserialized integer from the byte array.
|
||||
* @param r The byte array to containing the integer in. Must be at least of size 3.
|
||||
* @param return The deserialized integer from the byte array.
|
||||
*/
|
||||
static UC_INLINE uint32_t uc_unpack_24_le(const uint8_t *r)
|
||||
{
|
||||
@@ -69,8 +69,8 @@ static UC_INLINE uint32_t uc_unpack_24_le(const uint8_t *r)
|
||||
}
|
||||
|
||||
/** Serialize a uint32_t to a byte array in little endian format.
|
||||
* @v The value to serialize
|
||||
* @r The byte array to place the integer in. Must be at least of size 4.
|
||||
* @param v The value to serialize
|
||||
* @param r The byte array to place the integer in. Must be at least of size 4.
|
||||
*/
|
||||
static UC_INLINE void uc_pack_32_le(uint32_t v, uint8_t *r)
|
||||
{
|
||||
@@ -81,8 +81,8 @@ static UC_INLINE void uc_pack_32_le(uint32_t v, uint8_t *r)
|
||||
}
|
||||
|
||||
/** De-serialize a uint32_t from a byte array in little endian format.
|
||||
* @r The byte array to containing the integer in. Must be at least of size 4.
|
||||
* @return The deserialized integer from the byte array.
|
||||
* @param r The byte array to containing the integer in. Must be at least of size 4.
|
||||
* @param return The deserialized integer from the byte array.
|
||||
*/
|
||||
static UC_INLINE uint32_t uc_unpack_32_le(const uint8_t *r)
|
||||
{
|
||||
@@ -97,8 +97,8 @@ static UC_INLINE uint32_t uc_unpack_32_le(const uint8_t *r)
|
||||
}
|
||||
|
||||
/** Serialize a uint64_t to a byte array in little endian format.
|
||||
* @v The value to serialize
|
||||
* @r The byte array to place the integer in. Must be at least of size 8
|
||||
* @param v The value to serialize
|
||||
* @param r The byte array to place the integer in. Must be at least of size 8
|
||||
*/
|
||||
static UC_INLINE void uc_pack_64_le(uint64_t v, uint8_t *r)
|
||||
{
|
||||
@@ -113,8 +113,8 @@ static UC_INLINE void uc_pack_64_le(uint64_t v, uint8_t *r)
|
||||
}
|
||||
|
||||
/** De-serialize a uint64_t from a byte array in little endian format.
|
||||
* @r The byte array to containing the integer in. Must be at least of size 8.
|
||||
* @return The deserialized integer from the byte array
|
||||
* @param r The byte array to containing the integer in. Must be at least of size 8.
|
||||
* @param return The deserialized integer from the byte array
|
||||
*/
|
||||
static UC_INLINE uint64_t uc_unpack_64_le(const uint8_t *r)
|
||||
{
|
||||
@@ -133,8 +133,8 @@ static UC_INLINE uint64_t uc_unpack_64_le(const uint8_t *r)
|
||||
}
|
||||
|
||||
/** Serialize a uint16_t to a byte array in big endian format.
|
||||
* @v The value to serialize
|
||||
* @r The byte array to place the integer in. Must be at least of size 2.
|
||||
* @param v The value to serialize
|
||||
* @param r The byte array to place the integer in. Must be at least of size 2.
|
||||
*/
|
||||
static UC_INLINE void uc_pack_16_be(uint32_t v, uint8_t *r)
|
||||
{
|
||||
@@ -143,8 +143,8 @@ static UC_INLINE void uc_pack_16_be(uint32_t v, uint8_t *r)
|
||||
}
|
||||
|
||||
/** De-serialize a uint16_t from a byte array in big endian format.
|
||||
* @r The byte array to containing the integer in. Must be at least of size 2.
|
||||
* @return The deserialized integer from the byte array
|
||||
* @param r The byte array to containing the integer in. Must be at least of size 2.
|
||||
* @param return The deserialized integer from the byte array
|
||||
*/
|
||||
static UC_INLINE uint16_t uc_unpack_16_be(const uint8_t *r)
|
||||
{
|
||||
@@ -159,8 +159,8 @@ static UC_INLINE uint16_t uc_unpack_16_be(const uint8_t *r)
|
||||
/** Serialize a uint32_t to a 3 byte(24 bits) array in big endian format.
|
||||
* Only the bottom 24 bits of the uint32_t are used.
|
||||
*
|
||||
* @v The value to serialize
|
||||
* @r The byte array to place the integer in. Must be at least of size 3.
|
||||
* @param v The value to serialize
|
||||
* @param r The byte array to place the integer in. Must be at least of size 3.
|
||||
*/
|
||||
static UC_INLINE void uc_pack_24_be(uint32_t v, uint8_t *r)
|
||||
{
|
||||
@@ -170,8 +170,8 @@ static UC_INLINE void uc_pack_24_be(uint32_t v, uint8_t *r)
|
||||
}
|
||||
|
||||
/** De-serialize a uint32_t from a 3 byte (24 bit) byte array in big endian format.
|
||||
* @r The byte array to containing the integer in. Must be at least of size 3.
|
||||
* @return The deserialized integer from the byte array.
|
||||
* @param r The byte array to containing the integer in. Must be at least of size 3.
|
||||
* @param return The deserialized integer from the byte array.
|
||||
*/
|
||||
static UC_INLINE uint32_t uc_unpack_24_be(const uint8_t *r)
|
||||
{
|
||||
@@ -185,8 +185,8 @@ static UC_INLINE uint32_t uc_unpack_24_be(const uint8_t *r)
|
||||
}
|
||||
|
||||
/** Serialize a uint32_t to a byte array in big endian format.
|
||||
* @v The value to serialize
|
||||
* @r The byte array to place the integer in. Must be at least of size 4.
|
||||
* @param v The value to serialize
|
||||
* @param r The byte array to place the integer in. Must be at least of size 4.
|
||||
*/
|
||||
static UC_INLINE void uc_pack_32_be(uint32_t v, uint8_t *r)
|
||||
{
|
||||
@@ -197,8 +197,8 @@ static UC_INLINE void uc_pack_32_be(uint32_t v, uint8_t *r)
|
||||
}
|
||||
|
||||
/** De-serialize a uint32_t from a byte array in big endian format.
|
||||
* @r The byte array to containing the integer in. Must be at least of size 4.
|
||||
* @return The deserialized integer from the byte array
|
||||
* @param r The byte array to containing the integer in. Must be at least of size 4.
|
||||
* @param return The deserialized integer from the byte array
|
||||
*/
|
||||
static UC_INLINE uint32_t uc_unpack_32_be(const uint8_t *r)
|
||||
{
|
||||
@@ -213,8 +213,8 @@ static UC_INLINE uint32_t uc_unpack_32_be(const uint8_t *r)
|
||||
}
|
||||
|
||||
/** Serialize a uint16_t to a byte array in big endian format.
|
||||
* @v The value to serialize
|
||||
* @r The byte array to place the integer in. Must be at least of size 8
|
||||
* @param v The value to serialize
|
||||
* @param r The byte array to place the integer in. Must be at least of size 8
|
||||
*/
|
||||
static UC_INLINE void uc_pack_64_be(uint64_t v, uint8_t *r)
|
||||
{
|
||||
@@ -229,8 +229,8 @@ static UC_INLINE void uc_pack_64_be(uint64_t v, uint8_t *r)
|
||||
}
|
||||
|
||||
/** De-serialize a uint64_t from a byte array in big endian format.
|
||||
* @r The byte array to containing the integer in. Must be at least of size 4.
|
||||
* @return The deserialized integer from the byte array
|
||||
* @param r The byte array to containing the integer in. Must be at least of size 4.
|
||||
* @param return The deserialized integer from the byte array
|
||||
*/
|
||||
static UC_INLINE uint64_t uc_unpack_64_be(const uint8_t *r)
|
||||
{
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
* The content is terminated by a nul byte, regardless of whether the content
|
||||
* is binary or text. The returned length does not include this nul byte.
|
||||
*
|
||||
* @file_name name of the file
|
||||
* @length Returned length of the content read
|
||||
* @max Fail if the read content length is greater than max.
|
||||
* @param file_name name of the file
|
||||
* @param length Returned length of the content read
|
||||
* @param max Fail if the read content length is greater than max.
|
||||
* @return The content read from the file, or NULL if something failed
|
||||
* (inspect errno to see why it failed)
|
||||
*/
|
||||
|
||||
+4
-4
@@ -30,13 +30,13 @@ typedef struct SAlloc SAlloc;
|
||||
* for another 1000 struct Foo's.. All these memory pieces are released
|
||||
* when the uc_free_salloc() is called.
|
||||
*
|
||||
* @chunksz Size of each piece of memory block allocated.
|
||||
* @param chunksz Size of each piece of memory block allocated.
|
||||
* @return A new handle for a SAlloc, or NULL.
|
||||
*/
|
||||
SAlloc *uc_new_salloc(size_t chunksz);
|
||||
|
||||
/** Allocate memory from a SAlloc.
|
||||
* @sz size of the memory. This must be <= the chunksz the SAlloc was
|
||||
* @param sz size of the memory. This must be <= the chunksz the SAlloc was
|
||||
* created with.
|
||||
* @return The new memory, or NULL if sz > chunksz or an underlying
|
||||
* malloc call fails.
|
||||
@@ -49,7 +49,7 @@ void * uc_s_allocz(SAlloc *p,size_t sz);
|
||||
/** Free the SAlloc and all memory associated with this SAlloc.
|
||||
* The SAlloc is not usable any more after this call.
|
||||
*
|
||||
* @p The SAlloc to free.
|
||||
* @param p The SAlloc to free.
|
||||
*/
|
||||
void uc_free_salloc(SAlloc *p);
|
||||
|
||||
@@ -58,7 +58,7 @@ void uc_free_salloc(SAlloc *p);
|
||||
* The actual memory previously allocated from this SAlloc is cached,
|
||||
* and will be reused by subsequent uc_s_alloc calls.
|
||||
*
|
||||
* @p The SAlloc to reset.
|
||||
* @param p The SAlloc to reset.
|
||||
*/
|
||||
void uc_reset_salloc(SAlloc *p);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user