Next Previous Contents

3. Function-list

In the previous section we talked about the various files that contain the source to our daemon. In this section we will go into more detail and show you wich functions are present in which files.

3.1 main.c

main.c
\- main                         main responsibilities are to initialize and register. After that it will
                                call other functions and start the program.

3.2 server.c

server.c
|- clean_up_child_proces        clean up the forked process. make sure forked processes work like
|                               expected (no zombies etc.)
|- handle_connection            handle an incoming connection by calling the right protocol functions.
|- server_run                   start running the server (bind socket,...)
\- server_stop                  stop the server.

3.3 protocol.c

protocol.c
|- init_protocol                initialize all protocol functions.
|- authorize                    handle the total authorization sequence.
|- synchronize                  synchronize data with the client.
\- disconnect_client            send a bye to the client and disconnect.

3.4 messages.c

messages.c                       send or wait for respective messages and handle them.
|- send_ACK                      the same for all following functions..
|- send_SVR
|- send_FER
|- send_ERR
|- send_ERROR                   this one implements a generic error sending function
|                               only for use internally by send_FER and send_ERR
|- get_USR
|- get_CVR
|- send_SLT
|- get_PSW
|- get_GMA
|- send_TMA
|- get_ACK
|- send_ACT
|- get_TIM
|- send_ACC
|- send_BYE
\- get_BYE

3.5 databaseabstraction.c

FIXME: fill this in....

3.6 mysql.c

mysql.c
|- make_connection              make a connection with the database.
|- close_connection             close the connection with the database.
|- add_timereg                  add a timeregistration if user is authorized (user_allowed).
|- get_userinfo                 retrieve all the information of a user needed in the authorization.
|- user_allowed                 determines if the user is allowed to add a
|                               timeregistration to this activity.
|- get_password_from_user       retrieve the password from the given user.
\- get_activities               get all activities on which this users has write rights.

3.7 errorhandler.c

errorhandler.c
|- ctsd_error                   print the appropriate error. If verbose ALSO to screen.
\- ctsd_error_fatal             same as ctsd_error, but this one won't return (via system_error)

3.8 param.c

param.c
|- print_usage                  print the usage of the parameters.
|- parse_end                    this function free's dynamically allocated memory
|                               that is why you shouldn't call this function when
|                               you are not done yet with the parameters!
|
\- parse_parameters             parse the given parameters one by one.

3.9 ctsdconf.c

ctsdconf.c
|- revert_to_default            sets all configuration parameters to default values.
|- str_argument                 split up argument list and read the argument selected.
|- read_value                   reads the value of the proper directive.
|- read_string                  read and return the value of a string from the first " to the next "
|- open_config                  open configuration file, for internal use.
|- close_config                 close configuration file, for interal use.
\- read_config                  call the internal functions and parse the config file.

3.10 log.c

log.c
|- logfile_init                 initialize logging functions.
|- logfile_stop                 deinitialize logging functions.
|- open_logfile                 find and open logfile if available otherwise create it, internal use.
|- close_logfile                close logfile, internal use.
\- write_log                    write the given message to file and flush it.

3.11 md5.c

md5.c                           not written by us but RSA Datasecurity Inc.
FIXME: someone fill this in...


Next Previous Contents