gnutls_global.c File Reference

#include <gnutls_int.h>
#include <gnutls_errors.h>
#include <libtasn1.h>
#include <gnutls_dh.h>
#include <pthread.h>
#include <gcrypt.h>
#include "internal.h"

Include dependency graph for gnutls_global.c:

Go to the source code of this file.

Defines

#define ENOMEM   12
#define MHD_gnutls_log_func   LOG_FUNC

Functions

void MHD_gtls_global_set_log_function (MHD_gnutls_log_func log_func)
void MHD_gtls_global_set_log_level (int level)
int MHD__gnutls_is_secure_mem_null (const void *)
int MHD__gnutls_global_init (void)
void MHD__gnutls_global_deinit (void)
void MHD__gnutls_transport_set_pull_function (MHD_gtls_session_t session, MHD_gtls_pull_func pull_func)
void MHD__gnutls_transport_set_push_function (MHD_gtls_session_t session, MHD_gtls_push_func push_func)

Variables

 GCRY_THREAD_OPTION_PTHREAD_IMPL
const ASN1_ARRAY_TYPE MHD_gnutlsMHD__asn1_tab []
const ASN1_ARRAY_TYPE MHD_pkix_asn1_tab []
LOG_FUNC MHD__gnutls_log_func
int MHD__gnutls_log_level = 0
ASN1_TYPE MHD__gnutls_pkix1_asn
ASN1_TYPE MHD__gnutlsMHD__gnutls_asn
static int MHD__gnutls_init_level = 0


Define Documentation

#define ENOMEM   12

Definition at line 38 of file gnutls_global.c.

Definition at line 47 of file gnutls_global.c.


Function Documentation

void MHD__gnutls_global_deinit ( void   ) 

MHD__gnutls_global_deinit - This function deinitializes the global data

This function deinitializes the global data, that were initialized using MHD__gnutls_global_init().

Note! This function is not thread safe. See the discussion for MHD__gnutls_global_init() for more information.

Definition at line 245 of file gnutls_global.c.

References MHD__asn1_delete_structure(), MHD__gnutls_init_level, and MHD_gc_done().

Referenced by MHD_stop_daemon().

Here is the call graph for this function:

Here is the caller graph for this function:

int MHD__gnutls_global_init ( void   ) 

MHD__gnutls_global_init - This function initializes the global data to defaults.

This function initializes the global data to defaults. Every gnutls application has a global data which holds common parameters shared by gnutls session structures. You must call MHD__gnutls_global_deinit() when gnutls usage is no longer needed Returns zero on success.

Note that this function will also initialize libgcrypt, if it has not been initialized before. Thus if you want to manually initialize libgcrypt you must do it before calling this function. This is useful in cases you want to disable libgcrypt's internal lockings etc.

This function increment a global counter, so that MHD__gnutls_global_deinit() only releases resources when it has been called as many times as MHD__gnutls_global_init(). This is useful when GnuTLS is used by more than one library in an application. This function can be called many times, but will only do something the first time.

Note! This function is not thread safe. If two threads call this function simultaneously, they can cause a race between checking the global counter and incrementing it, causing both threads to execute the library initialization code. That would lead to a memory leak. To handle this, your application could invoke this function after aquiring a thread mutex. To ignore the potential memory leak is also an option.

Definition at line 130 of file gnutls_global.c.

References ASN1_SUCCESS, GC_OK, GNUTLS_E_INCOMPATIBLE_CRYPTO_LIBRARY, GNUTLS_E_INCOMPATIBLE_GCRYPT_LIBRARY, GNUTLS_E_LIBRARY_VERSION_MISMATCH, MHD__asn1_array2tree(), MHD__asn1_delete_structure(), MHD__gnutls_debug_log, MHD__gnutls_init_level, MHD__gnutls_is_secure_memory, MHD_gc_init(), MHD_gc_pseudo_random(), MHD_gnutls_assert, MHD_gnutls_free, MHD_gnutls_malloc, MHD_gnutls_realloc, MHD_gnutls_secure_malloc, and MHD_gtls_asn2err().

Referenced by MHD_start_daemon_va().

Here is the call graph for this function:

Here is the caller graph for this function:

int MHD__gnutls_is_secure_mem_null ( const void *   ) 

Definition at line 37 of file gnutls_mem.c.

void MHD__gnutls_transport_set_pull_function ( MHD_gtls_session_t  session,
MHD_gtls_pull_func  pull_func 
)

MHD__gnutls_transport_set_pull_function - This function sets a read like function : a callback function similar to read() : gnutls session

This is the function where you set a function for gnutls to receive data. Normally, if you use berkeley style sockets, do not need to use this function since the default (recv(2)) will probably be ok.

PULL_FUNC is of the form, ssize_t (*MHD_gtls_pull_func)(MHD_gnutls_transport_ptr_t, void*, size_t);

Definition at line 277 of file gnutls_global.c.

References MHD_gtls_session_int::internals, and MHD_gtls_internals_st::MHD__gnutls_pull_func.

Referenced by MHD_accept_connection().

Here is the caller graph for this function:

void MHD__gnutls_transport_set_push_function ( MHD_gtls_session_t  session,
MHD_gtls_push_func  push_func 
)

MHD__gnutls_transport_set_push_function - This function sets the function to send data : a callback function similar to write() : gnutls session

This is the function where you set a push function for gnutls to use in order to send data. If you are going to use berkeley style sockets, you do not need to use this function since the default (send(2)) will probably be ok. Otherwise you should specify this function for gnutls to be able to send data.

PUSH_FUNC is of the form, ssize_t (*MHD_gtls_push_func)(MHD_gnutls_transport_ptr_t, const void*, size_t);

Definition at line 298 of file gnutls_global.c.

References MHD_gtls_session_int::internals, and MHD_gtls_internals_st::MHD__gnutls_push_func.

Referenced by MHD_accept_connection().

Here is the caller graph for this function:

void MHD_gtls_global_set_log_function ( MHD_gnutls_log_func  log_func  ) 

MHD_gtls_global_set_log_function - This function sets the logging function : it's a log function

This is the function where you set the logging function gnutls is going to use. This function only accepts a character array. Normally you may not use this function since it is only used for debugging purposes.

MHD_gnutls_log_func is of the form, void (*MHD_gnutls_log_func)( int level, const char*);

Definition at line 72 of file gnutls_global.c.

References MHD__gnutls_log_func.

void MHD_gtls_global_set_log_level ( int  level  ) 

MHD_gtls_global_set_log_level - This function sets the logging level : it's an integer from 0 to 9.

This is the function that allows you to set the log level. The level is an integer between 0 and 9. Higher values mean more verbosity. The default value is 0. Larger values should only be used with care, since they may reveal sensitive information.

Use a log level over 10 to enable all debugging options.

Definition at line 90 of file gnutls_global.c.

References MHD__gnutls_log_level.


Variable Documentation

Definition at line 45 of file gnutls_global.c.

int MHD__gnutls_init_level = 0 [static]

Definition at line 97 of file gnutls_global.c.

Referenced by MHD__gnutls_global_deinit(), and MHD__gnutls_global_init().

Definition at line 53 of file gnutls_global.c.

Referenced by MHD_gtls_global_set_log_function(), and MHD_gtls_log().

Definition at line 56 of file gnutls_global.c.

Definition at line 57 of file gnutls_global.c.

Definition at line 7 of file gnutls_asn1_tab.c.

Definition at line 7 of file pkix_asn1_tab.c.


Generated on Fri Feb 27 18:33:01 2009 for GNU libmicrohttpd by  doxygen 1.5.7.1