* silc_async_abort. Since this use pre-allocated context, the function
* silc_async_free need not be called. This function is equivalent
* to silc_async_alloc except this does not allocate any memory. The `op'
- * needs not be uninitialized.
+ * needs not be uninitialized. This returns always TRUE.
*
* If the `pause_cb' is provided then the upper layer may also halt and
* then later resume the execution of the operation, by calling the
j = 0;
pem = silc_scalloc(stack, ((len * 8 + 5) / 6) + 5, sizeof(*pem));
+ if (!pem)
+ return NULL;
for (i = 0; i < len; i++) {
c = data[i];
len = base64_len;
data = silc_scalloc(stack, ((len * 6) / 8), sizeof(*data));
+ if (!data)
+ return NULL;
for (i = 0; i < len; i++) {
c = base64[i];
* DESCRIPTION
*
* Encodes data into Base 64 (PEM) encoding. Returns NULL terminated
- * Base 64 encoded data string.
+ * Base 64 encoded data string. Returns NULL if system is out of memory.
*
* If `stack' is non-NULL the returned buffer is allocated from `stack'.
*
* DESCRIPTION
*
* Same as silc_base64_encode() but puts newline ('\n') every 72
- * characters.
+ * characters. Returns NULL if system is out of memory.
*
* If `stack' is non-NULL the returned buffer is allocated from `stack'.
*
*
* DESCRIPTION
*
- * Decodes Base 64 (PEM) into data. Returns the decoded data.
+ * Decodes Base 64 (PEM) into data. Returns the decoded data. Returns
+ * NULL if the data is not valid Base 64 encoded data.
*
* If `stack' is non-NULL the returned buffer is allocated from `stack'.
*
*
* DESCRIPTION
*
- * Allocates new SilcBuffer and returns it. Returns NULL on error.
+ * Allocates new SilcBuffer and returns it. Returns NULL if system is
+ * out of memory.
*
***/
*
* DESCRIPTION
*
- * Allocates new SilcBuffer and returns it.
+ * Allocates new SilcBuffer and returns it. Returns NULL if system is
+ * out of memory.
*
* This routine use SilcStack are memory source. If `stack' is NULL
* reverts back to normal allocating routine.
*
* Pulls current data area towards end. The length of the currently
* valid data area is also decremented. Returns pointer to the data
- * area before pulling. Returns NULL on error.
+ * area before pulling. Returns NULL if the pull would lead to buffer
+ * overflow or would go beyond the valid data area.
*
* EXAMPLE
*
*
* Pushes current data area towards beginning. Length of the currently
* valid data area is also incremented. Returns a pointer to the
- * data area before pushing. Returns NULL on error.
+ * data area before pushing. Returns NULL if the push would lead to
+ * buffer underflow or would go under the valid data area.
*
* EXAMPLE
*
*
* Pulls current tail section towards end. Length of the current valid
* data area is also incremented. Returns a pointer to the data area
- * before pulling. Returns NULL on error.
+ * before pulling. Returns NULL if the pull would lead to buffer overflow.
*
* EXAMPLE
*
*
* Pushes current tail section towards beginning. Length of the current
* valid data area is also decremented. Returns a pointer to the
- * tail section before pushing. Returns NULL on error.
+ * tail section before pushing. Returns NULL if the push would lead to
+ * buffer underflow or go under valid tail area.
*
* EXAMPLE
*
* DESCRIPTION
*
* Puts data at the head of the buffer. Returns pointer to the copied
- * data area. Returns NULL on error.
+ * data area. Returns NULL if the data is longer that the current head
+ * area.
*
* EXAMPLE
*
* DESCRIPTION
*
* Puts data at the start of the valid data area. Returns a pointer
- * to the copied data area. Returns NULL on error.
+ * to the copied data area. Returns NULL if the data is longer than the
+ * current data area.
*
* EXAMPLE
*
* DESCRIPTION
*
* Puts data at the tail of the buffer. Returns pointer to the copied
- * data area. Returns NULL on error.
+ * data area. Returns NULL if the data is longer than the current tail
+ * area.
*
* EXAMPLE
*
*
* Allocates `len' bytes size buffer and moves the tail area automatically
* `len' bytes so that the buffer is ready to use without calling the
- * silc_buffer_pull_tail. Returns NULL on error.
+ * silc_buffer_pull_tail. Returns NULL if system is out of memory.
*
***/
*
* Allocates `len' bytes size buffer and moves the tail area automatically
* `len' bytes so that the buffer is ready to use without calling the
- * silc_buffer_pull_tail.
+ * silc_buffer_pull_tail. Returns NULL if system is out of memory.
*
* This routine use SilcStack are memory source. If `stack' is NULL
* reverts back to normal allocating routine.
*
* Generates copy of a SilcBuffer. This copies everything inside the
* currently valid data area, nothing more. Use silc_buffer_clone to
- * copy entire buffer. Returns NULL on error.
+ * copy entire buffer. Returns NULL if system is out of memory.
*
***/
*
* Generates copy of a SilcBuffer. This copies everything inside the
* currently valid data area, nothing more. Use silc_buffer_clone to
- * copy entire buffer.
+ * copy entire buffer. Returns NULL if system is out of memory.
*
* This routine use SilcStack are memory source. If `stack' is NULL
* reverts back to normal allocating routine.
*
* Clones SilcBuffer. This generates new SilcBuffer and copies
* everything from the source buffer. The result is exact clone of
- * the original buffer. Returns NULL on error.
+ * the original buffer. Returns NULL if system is out of memory.
*
***/
*
* Clones SilcBuffer. This generates new SilcBuffer and copies
* everything from the source buffer. The result is exact clone of
- * the original buffer.
+ * the original buffer. Returns NULL if system is out of memory.
*
* This routine use SilcStack are memory source. If `stack' is NULL
* reverts back to normal allocating routine.
* Reallocates buffer. Old data is saved into the new buffer. The buffer
* is exact clone of the old one except that there is now more space
* at the end of buffer. This always returns the same `sb' unless `sb'
- * was NULL. Returns NULL on error.
+ * was NULL. Returns NULL if system is out of memory.
*
***/
*
* Reallocates buffer. Old data is saved into the new buffer. The buffer
* is exact clone of the old one except that there is now more space
- * at the end of buffer.
+ * at the end of buffer. Returns NULL if system is out of memory.
*
* This routine use SilcStack are memory source. If `stack' is NULL
* reverts back to normal allocating routine.
*
* Same as silc_buffer_realloc but moves moves the tail area
* automatically so that the buffer is ready to use without calling the
- * silc_buffer_pull_tail. Returns NULL on error.
+ * silc_buffer_pull_tail. Returns NULL if system is out of memory.
*
***/
*
* Same as silc_buffer_srealloc but moves moves the tail area
* automatically so that the buffer is ready to use without calling the
- * silc_buffer_pull_tail.
+ * silc_buffer_pull_tail. Returns NULL if system is out of memory.
*
* This routine use SilcStack are memory source. If `stack' is NULL
* reverts back to normal allocating routine.
* is at least the size of `size'. If there is more space than `size'
* in the data area this does not do anything. If there is enough
* space in the tail area this merely moves the tail area to reveal
- * the extra space. Returns FALSE on error.
+ * the extra space. Returns FALSE if system is out of memory.
*
***/
* is at least the size of `size'. If there is more space than `size'
* in the data area this does not do anything. If there is enough
* space in the tail area this merely moves the tail area to reveal
- * the extra space. Returns FALSE on error.
+ * the extra space. Returns FALSE if system is out of memory.
*
* This routine use SilcStack are memory source. If `stack' is NULL
* reverts back to normal allocating routine.
*
* DESCRIPTION
*
- * Formats a buffer from a variable argument list. Returns -1 on error
- * and the length of the formatted buffer otherwise. The buffer is
- * enlarged automatically during formatting, if it doesn't already have
- * enough space.
+ * Formats a buffer from a variable argument list. Returns -1 if the
+ * system is out of memory and the length of the formatted buffer otherwise.
+ * The buffer is enlarged automatically during formatting, if it doesn't
+ * already have enough space.
*
* EXAMPLE
*
* DESCRIPTION
*
* Same as silc_buffer_format but uses `stack' to allocate the memory.
- * if `stack' is NULL reverts back to silc_buffer_format call.
+ * if `stack' is NULL reverts back to silc_buffer_format call. Returns
+ * -1 if system is out of memory.
*
* Note that this call consumes the `stack'. The caller should push the
* stack before calling the function and pop it later.
* DESCRIPTION
*
* Formats a buffer from a variable argument list indicated by the `ap'.
- * Returns -1 on error and the length of the formatted buffer otherwise.
+ * Returns -1 if system is out of memory and the length of the formatted
+ * buffer otherwise.
*
***/
int silc_buffer_format_vp(SilcBuffer dst, va_list ap);
* DESCRIPTION
*
* Same as silc_buffer_format_vp but uses `stack' to allocate the memory.
- * if `stack' is NULL reverts back to silc_buffer_format_vp call.
+ * if `stack' is NULL reverts back to silc_buffer_format_vp call. Returns
+ * -1 if system is out of memory.
*
* Note that this call consumes the `stack'. The caller should push the
* stack before calling the function and pop it later.
* be end with SILC_STRFMT_END argument. This allows that a string in
* the list can be NULL, in which case it is skipped. This automatically
* allocates the space for the buffer data but `dst' must be already
- * allocated by the caller.
+ * allocated by the caller. Returns -1 if system is out of memory.
*
* EXAMPLE
*
* the list can be NULL, in which case it is skipped. This automatically
* allocates the space for the buffer data but `dst' must be already
* allocated by the caller. This function is equivalent to
- * silc_buffer_strformat but allocates memory from `stack'.
+ * silc_buffer_strformat but allocates memory from `stack'. Returns -1
+ * if system is out of memory.
*
* Note that this call consumes the `stack'. The caller should push the
* stack before calling the function and pop it later.
* Allocates SILC Condition variable context. The condition must
* be allocated before it can be used. It is freed by the
* silc_cond_free function. This returns TRUE and allocated
- * condition in to the `cond' pointer and FALSE on error.
+ * condition in to the `cond' pointer and FALSE if system is out of
+ * memory.
*
***/
SilcBool silc_cond_alloc(SilcCond *cond);
*
* DESCRIPTION
*
- * Initializes SilcDList. Returns the SilcDList context or NULL on error.
+ * Initializes SilcDList. Returns the SilcDList context or NULL if system
+ * is out of memory.
*
***/
* Sets the environment variable named `variable' with value `value'
* to the environment. If the `variable' already exists in the
* environment its value is changed to `value'. Returns FALSE if the
- * value could not be set or if environment variable are not supported.
+ * value could not be set or if environment variables are not supported.
*
***/
SilcBool silc_setenv(const char *variable, const char *value);
*
* Creates file descriptor stream for the open file descriptor indicated
* by `fd'. The stream is closed with the silc_stream_close and destroyed
- * with the silc_stream_destroy.
+ * with the silc_stream_destroy. Returns NULL if system is out of memory.
*
* If the silc_stream_set_notifier is called the stream is set to
* non-blocking mode.
* Creates file descriptor stream for the open file descriptors indicated
* by `read_fd' and `write_fd'. The `read_fd' must be opened for reading
* and `write_fd' opened for writing. The stream is closed with the
- * silc_stream_close and destroyed with the silc_stream_destroy.
+ * silc_stream_close and destroyed with the silc_stream_destroy. Returns
+ * NULL if system is out of memory.
*
* If the silc_stream_set_notifier is called the stream is set to
* non-blocking mode.
* Same as silc_fd_stream_create but creates the stream by opening the
* file indicated by `filename'. If the `reading' is TRUE the file is
* opened for reading. If the `writing' is TRUE the file is opened
- * for writing.
+ * for writing. Returns NULL if system is out of memory.
*
* If the silc_stream_set_notifier is called the stream is set to
* non-blocking mode.
* DESCRIPTION
*
* Same as silc_fd_stream_file but creates the stream by opening `read_file'
- * for reading and `write_file' for writing.
+ * for reading and `write_file' for writing. Returns NULL if system is
+ * out of memory.
*
* If the silc_stream_set_notifier is called the stream is set to
* non-blocking mode.
*
* Returns the file descriptors associated with the stream. The 'write_fd'
* is available only if the stream was created with silc_fd_stream_create2
- * function.
+ * function. Returns FALSE if the information is not available.
*
***/
SilcBool silc_fd_stream_get_info(SilcStream stream,
* caller must free the returned context with silc_fsm_free. The
* `fsm_context' is delivered to every FSM state function. The `schedule'
* is the caller's scheduler and the FSM will be run in the scheduler.
+ * Returns NULL if system is out of memory.
*
* EXAMPLE
*
* thread context with silc_fsm_free. If the 'real_thread' is TRUE
* then the thread will actually be executed in real thread, if platform
* supports them. The `thread_context' is delivered to every state
- * function in the thread.
+ * function in the thread. Returns NULL if the system is out of memory.
*
* NOTES
*
* some event happens, some thread moves to a specific state or similar.
* The FSM Events may also be used in FSM threads that are executed in
* real system threads. It is safe to wait and signal the event from
- * threads. The `fsm' must be the machine, not a thread.
+ * threads. The `fsm' must be the machine, not a thread. Returns NULL
+ * if system is out of memory or `fsm' is not FSM machine.
*
* Use the macros SILC_FSM_EVENT_WAIT and SILC_FSM_EVENT_TIMEDWAIT to wait
* for the event. Use the SILC_FSM_EVENT_SIGNAL macro to signal all the
* it should be a prime. The `hash', `compare' and `destructor' are
* the hash function, the key comparison function and key and context
* destructor function, respectively. The `hash' is mandatory, the others
- * are optional.
+ * are optional. Returns NULL if system is out of memory.
*
***/
SilcHashTable silc_hash_table_alloc(SilcStack stack,
*
* DESCRIPTION
*
- * Allocates SILC Mime message context.
+ * Allocates SILC Mime message context. Returns NULL if system is out of
+ * memory.
*
***/
SilcMime silc_mime_alloc(void);
*
* DESCRIPTION
*
- * Allocates MIME fragment assembler.
+ * Allocates MIME fragment assembler. Returns NULL if system is out of
+ * memory.
*
***/
SilcMimeAssembler silc_mime_assembler_alloc(void);