Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

bb_store.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define BB_STORE_DEFAULT_DUMP_FREQ   10

Functions

int store_init (const Octstr *type, const Octstr *fname, long dump_freq, void *pack_func, void *unpack_func)
int store_spool_init (const Octstr *fname)
int store_file_init (const Octstr *fname, long dump_freq)

Variables

long(* store_messages )(void)
int(* store_save )(Msg *msg)
int(* store_save_ack )(Msg *msg, ack_status_t status)
int(* store_load )(void(*receive_msg)(Msg *))
int(* store_dump )(void)
Octstr *(* store_msg_pack )(Msg *msg)
Msg *(* store_msg_unpack )(Octstr *os)
void(* store_shutdown )(void)
Octstr *(* store_status )(int status_type)


Define Documentation

#define BB_STORE_DEFAULT_DUMP_FREQ   10
 

Definition at line 66 of file bb_store.h.


Function Documentation

int store_file_init const Octstr fname,
long  dump_freq
 

Definition at line 592 of file bb_store_file.c.

References active, bakfile, dict_create(), dump_frequency, file_mutex, filename, gwlist_add_producer(), gwlist_create, loaded, msg_destroy_item(), mutex_create, newfile, octstr_duplicate, octstr_format(), octstr_get_cstr, octstr_len(), panic, sms_dict, store_dump, store_load, store_messages, store_save, store_save_ack, store_shutdown, and store_status.

Referenced by store_init().

00593 {
00594     /* Initialize function pointers */
00595     store_messages = store_file_messages;
00596     store_save = store_file_save;
00597     store_save_ack = store_file_save_ack;
00598     store_load = store_file_load;
00599     store_dump = store_file_dump;
00600     store_shutdown = store_file_shutdown;
00601     store_status = store_file_status;
00602 
00603     if (fname == NULL)
00604         return 0; /* we are done */
00605 
00606     if (octstr_len(fname) > (FILENAME_MAX-5))
00607         panic(0, "Store file filename too long: `%s', failed to init.",
00608           octstr_get_cstr(fname));
00609 
00610     filename = octstr_duplicate(fname);
00611     newfile = octstr_format("%s.new", octstr_get_cstr(filename));
00612     bakfile = octstr_format("%s.bak", octstr_get_cstr(filename));
00613 
00614     sms_dict = dict_create(1024, msg_destroy_item);
00615 
00616     if (dump_freq > 0)
00617         dump_frequency = dump_freq;
00618     else
00619         dump_frequency = BB_STORE_DEFAULT_DUMP_FREQ;
00620 
00621     file_mutex = mutex_create();
00622     active = 1;
00623 
00624     loaded = gwlist_create();
00625     gwlist_add_producer(loaded);
00626 
00627     return 0;
00628 }

Here is the call graph for this function:

int store_init const Octstr type,
const Octstr fname,
long  dump_freq,
void *  pack_func,
void *  unpack_func
 

Definition at line 81 of file bb_store.c.

References error(), octstr_str_compare(), store_file_init(), store_msg_pack, store_msg_unpack, store_spool_init(), and type.

Referenced by init_bearerbox(), and main().

00083 {
00084     int ret;
00085     
00086     store_msg_pack = pack_func;
00087     store_msg_unpack = unpack_func;
00088 
00089     if (type == NULL || octstr_str_compare(type, "file") == 0) {
00090         ret = store_file_init(fname, dump_freq);
00091     } else if (octstr_str_compare(type, "spool") == 0) {
00092         ret = store_spool_init(fname);
00093     } else {
00094         error(0, "Unknown 'store-type' defined.");
00095         ret = -1;
00096     }
00097 
00098     return ret;
00099 }

Here is the call graph for this function:

int store_spool_init const Octstr fname  ) 
 

Init functions for different store types.

Definition at line 402 of file bb_store_spool.c.

References counter, counter_create(), error(), gwlist_add_producer(), gwlist_create, loaded, octstr_duplicate, octstr_get_cstr, spool, store_dump, store_load, store_messages, store_save, store_save_ack, store_shutdown, and store_status.

Referenced by store_init().

00403 {
00404     DIR *dir;
00405 
00406     store_messages = store_spool_messages;
00407     store_save = store_spool_save;
00408     store_save_ack = store_spool_save_ack;
00409     store_load = store_spool_load;
00410     store_dump = store_spool_dump;
00411     store_shutdown = store_spool_shutdown;
00412     store_status = store_spool_status;
00413 
00414     if (store_dir == NULL)
00415         return 0;
00416 
00417     /* check if we can open directory */
00418     if ((dir = opendir(octstr_get_cstr(store_dir))) == NULL) {
00419         error(errno, "Could not open directory `%s'", octstr_get_cstr(store_dir));
00420         return -1;
00421     }
00422     closedir(dir);
00423 
00424     loaded = gwlist_create();
00425     gwlist_add_producer(loaded);
00426     spool = octstr_duplicate(store_dir);
00427     counter = counter_create();
00428 
00429     return 0;
00430 }

Here is the call graph for this function:


Variable Documentation

int(* store_dump)(void)
 

Definition at line 74 of file bb_store.c.

Referenced by store_dumper(), store_file_init(), and store_spool_init().

int(* store_load)(void(*receive_msg)(Msg *))
 

Definition at line 73 of file bb_store.c.

Referenced by main(), store_file_init(), and store_spool_init().

long(* store_messages)(void)
 

Definition at line 70 of file bb_store.c.

Referenced by bb_print_status(), store_file_init(), and store_spool_init().

Octstr*(* store_msg_pack)(Msg *msg)
 

Definition at line 77 of file bb_store.c.

Referenced by store_init(), store_spool_save(), and write_msg().

Msg*(* store_msg_unpack)(Octstr *os)
 

Definition at line 78 of file bb_store.c.

Referenced by dispatch(), read_msg(), status_cb(), and store_init().

int(* store_save)(Msg *msg)
 

Definition at line 71 of file bb_store.c.

Referenced by bb_smscconn_receive(), boxc_receiver(), check_concatenation(), clear_old_concat_parts(), deliver_sms_to_queue(), route_incoming_to_smsc(), store_file_init(), store_file_save_ack(), and store_spool_init().

int(* store_save_ack)(Msg *msg, ack_status_t status)
 

Definition at line 72 of file bb_store.c.

Referenced by bb_smscconn_receive(), bb_smscconn_send_failed(), bb_smscconn_sent(), check_concatenation(), clear_old_concat_parts(), deliver_sms_to_queue(), destroy_concatMsg(), route_incoming_to_smsc(), store_file_init(), and store_spool_init().

void(* store_shutdown)(void)
 

Definition at line 75 of file bb_store.c.

Referenced by main(), store_file_init(), and store_spool_init().

Octstr*(* store_status)(int status_type)
 

Definition at line 76 of file bb_store.c.

Referenced by httpd_store_status(), store_file_init(), and store_spool_init().

See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.