Date: Sun Feb 16 14:02:20 CET 2003
User: Derick Rethans
Directory: srm/main/src
Log Message:
[1.00]
- Enforcing CS
- Header maintenance
Modified files:
srm/main/src/connection.c (version: 1.68)
srm/main/src/connection.h (version: 1.24)
srm/main/src/functions.c (version: 1.31)
srm/main/src/functions.h (version: 1.38)
srm/main/src/ini_parser.h (version: 1.22)
srm/main/src/srm_client.c (version: 1.16)
srm/main/src/srm_client.h (version: 1.28)
srm/main/src/srm_compat.c (version: 1.18)
srm/main/src/srm_compat.h (version: 1.10)
srm/main/src/srm_error.c (version: 1.29)
srm/main/src/srm_hash.c (version: 1.34)
srm/main/src/srm_hash.h (version: 1.22)
srm/main/src/srm_llist.c (version: 1.13)
srm/main/src/srm_llist.h (version: 1.9)
srm/main/src/srm_modules.c (version: 1.69)
srm/main/src/srm_modules.h (version: 1.37)
srm/main/src/srm_protocols.c (version: 1.4)
srm/main/src/srm_protocols.h (version: 1.3)
srm/main/src/srm_queue.c (version: 1.5)
srm/main/src/srm_queue.h (version: 1.7)
srm/main/src/srm_storage.c (version: 1.35)
srm/main/src/srm_storage.h (version: 1.17)
srm/main/src/srm_value.c (version: 1.50)
srm/main/src/srm_value.h (version: 1.54)
srm/main/src/storage.c (version: 1.20)
[FILE: /srm/main/src/connection.c]
--- srm/main/src/connection.c:1.67 Sat Feb 15 20:24:58 2003 GMT
+++ srm/main/src/connection.c Sun Feb 16 12:02:18 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.67 2003/02/15 21:24:58 derick Exp $ */
+/* $Id: cvstemp,v 1.68 2003/02/16 13:02:18 derick Exp $ */
/* The contents of this file are subject to the Vulcan Logic Public
* License Version 1.1 (the "License"); you may not use this file
@@ -14,7 +14,7 @@
*
* The Initial Developer of the Original Code is the Vulcan Logic
* Group. Portions created by Vulcan Logic Group are Copyright (C)
- * 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
+ * 2000, 2001, 2002, 2003 Vulcan Logic Group. All Rights Reserved.
*
* Contributor(s):
* Derick Rethans <d.rethans@jdimedia.nl>
@@ -55,45 +55,45 @@
int srm_setup_socket (int domain, int port, char* path) /* {{{1 */
{
- int ssocket = socket (domain, SOCK_STREAM, 0);
+ int ssocket = socket(domain, SOCK_STREAM, 0);
if (ssocket < 0) {
perror("srm_setup_socket");
- srm_error (COM_ERROR_CREATE_SOCKET, "setup_socket: couldn't create socket");
+ srm_error(COM_ERROR_CREATE_SOCKET, "setup_socket: couldn't create socket");
}
switch(domain) {
case AF_INET: {
struct sockaddr_in server_in;
- memset (&server_in, 0, sizeof(struct sockaddr));
+ memset(&server_in, 0, sizeof(struct sockaddr));
server_in.sin_family = AF_INET;
server_in.sin_addr.s_addr = htonl(INADDR_ANY);
server_in.sin_port = htons((int) port);
- if (bind (ssocket, (struct sockaddr *) &server_in, sizeof(struct sockaddr_in)) < 0) {
- srm_error (COM_ERROR_BIND, "setup_socket: couldn't bind AF_INET socket. Is there an srmd already running?");
+ if (bind(ssocket, (struct sockaddr *) &server_in, sizeof(struct sockaddr_in)) < 0) {
+ srm_error(COM_ERROR_BIND, "setup_socket: couldn't bind AF_INET socket. Is there an srmd already running?");
}
break;
}
case AF_UNIX: {
struct sockaddr_un server_un;
- memset (&server_un, 0, sizeof(struct sockaddr));
+ memset(&server_un, 0, sizeof(struct sockaddr));
server_un.sun_family = AF_UNIX;
- strcpy (server_un.sun_path, path);
- (void) unlink (path);
+ strcpy(server_un.sun_path, path);
+ (void) unlink(path);
umask(0);
- if (bind (ssocket, (struct sockaddr *) &server_un, sizeof(struct sockaddr_un)) < 0) {
- srm_error (COM_ERROR_BIND, "setup_socket: couldn't bind AF_UNIX socket");
+ if (bind(ssocket, (struct sockaddr *) &server_un, sizeof(struct sockaddr_un)) < 0) {
+ srm_error(COM_ERROR_BIND, "setup_socket: couldn't bind AF_UNIX socket");
}
umask(0777);
}
break;
}
- if (listen (ssocket, 5) == -1) {
- srm_error (COM_ERROR_LISTEN, "setup_socket: listen call failed");
+ if (listen(ssocket, 5) == -1) {
+ srm_error(COM_ERROR_LISTEN, "setup_socket: listen call failed");
}
return ssocket;
} /* 1}}} */
@@ -108,11 +108,11 @@
int i;
for (i = 0; i < size; i++) {
if (i % 16 == 0) {
- printf ("\n");
+ printf("\n");
}
- printf ("%02X ", packet[i]);
+ printf("%02X ", packet[i]);
}
- printf ("\n\n");
+ printf("\n\n");
} /* 1}}} */
void srm_pkt_set_version (pkt_header* header) /* {{{1 */
@@ -128,15 +128,15 @@
/* Return data, first the header */
memset (&header, 0, sizeof (header));
header.type = type;
- srm_pkt_set_version (&header);
+ srm_pkt_set_version(&header);
if (old_packet != NULL) {
header.protocol = ((pkt_header*) old_packet)->protocol;
header.encryption = ((pkt_header*) old_packet)->encryption;
if (srm_session_key_is_empty (old_packet)) {
- srm_gen_session_key ((srm_ui8*) &header.session_key);
+ srm_gen_session_key((srm_ui8*) &header.session_key);
} else {
- memcpy ((char*) &header.session_key, ((pkt_header*) old_packet)->session_key, sizeof (sess_key_t));
+ memcpy((char*) &header.session_key, ((pkt_header*) old_packet)->session_key, sizeof (sess_key_t));
}
} else {
header.protocol = PROTOCOL_NATIVE;
@@ -146,15 +146,15 @@
header.data_length = size;
#ifdef SRM_DEBUG
- dump_packet ((srm_ui8*) &header, sizeof (header));
+ dump_packet((srm_ui8*) &header, sizeof (header));
#endif
- write (fd, &header, sizeof (header));
+ write(fd, &header, sizeof (header));
/* Now the data */
if (size > 0) {
#ifdef SRM_DEBUG
- dump_packet (data, size);
+ dump_packet(data, size);
#endif
- write (fd, data, size);
+ write(fd, data, size);
}
} /* 1}}} */
@@ -182,8 +182,8 @@
srm_ui16 r;
for (i = 0; i < 16; i++) {
- r = rand ();
- memcpy ((srm_ui8*) session_key + (i * 2), &r, 2);
+ r = rand();
+ memcpy((srm_ui8*) session_key + (i * 2), &r, 2);
}
} /* 1}}} */
@@ -193,8 +193,8 @@
static void srm_do_handshake (int fd, srm_ui8* packet/*, srm_ui8 size*/) /* {{{1 */
{
- srm_fmt_message (LL_PROTOCOL, "Notice", "Handshake 2");
- server_send_packet (fd, PKT_HANDSHAKE2, NULL, 0, packet);
+ srm_fmt_message(LL_PROTOCOL, "Notice", "Handshake 2");
+ server_send_packet(fd, PKT_HANDSHAKE2, NULL, 0, packet);
} /* 1}}} */
static void srm_process_command (int fd, srm_ui8* packet, srm_ui8 size, srm_ui8* data, srm_ui32 dsize) /* {{{1 */
@@ -211,22 +211,22 @@
ret_val = srm_value_init();
/* Get command from packet */
#ifdef SRM_DEBUG
- dump_packet ((srm_ui8*) data, dsize);
+ dump_packet((srm_ui8*) data, dsize);
#endif
- deserialize (data, dsize, (struct srm_value**) &command, 0);
+ deserialize(data, dsize, (struct srm_value**) &command, 0);
#ifdef SRM_DEBUG
- srm_value_dump (command, 0);
+ srm_value_dump(command, 0);
#endif
params = SRMVALP_LIST(command);
- cmd = (struct srm_value *) SRM_LLIST_VALP (SRM_LLIST_HEAD (params));
- srm_fmt_message (LL_DATA, "Notice", "Process Command: %s", cmd->s_value);
+ cmd = (struct srm_value *) SRM_LLIST_VALP(SRM_LLIST_HEAD (params));
+ srm_fmt_message(LL_DATA, "Notice", "Process Command: %s", cmd->s_value);
/* Get parameters from packet */
- memcpy (session_key, &packet[16], 32);
+ memcpy(session_key, &packet[16], 32);
/* Check if there are paremeters */
- if (srm_llist_count (params) > 1) {
- status = srm_call_function (session_key, cmd->s_value, params, ret_val);
+ if (srm_llist_count(params) > 1) {
+ status = srm_call_function(session_key, cmd->s_value, params, ret_val);
} else {
- status = srm_call_function (session_key, cmd->s_value, NULL, ret_val);
+ status = srm_call_function(session_key, cmd->s_value, NULL, ret_val);
}
if (status == SRM_FAILED) {
@@ -234,20 +234,20 @@
VALP_SET_ERROR(ret_val);
}
#ifdef SRM_DEBUG
- srm_value_dump (ret_val, 1);
+ srm_value_dump(ret_val, 1);
#endif
/* Sending the result */
- serialize (ret_val, (srm_ui8**) &ret_data, &length);
+ serialize(ret_val, (srm_ui8**) &ret_data, &length);
#ifdef SRM_DEBUG
- dump_packet (ret_data, length);
+ dump_packet(ret_data, length);
#endif
- server_send_packet (fd, PKT_DATA, ret_data, length, packet);
+ server_send_packet(fd, PKT_DATA, ret_data, length, packet);
- srm_value_free (ret_val);
- free (ret_data);
+ srm_value_free(ret_val);
+ free(ret_data);
} /* 1}}} */
static void srm_process_store_data (int fd, srm_ui8* packet, srm_ui8 size, srm_ui8* pdata, srm_ui8 dsize) /* {{{1 */
@@ -264,31 +264,31 @@
ret_val = srm_value_init();
/* Getting data from packet */
#ifdef SRM_DEBUG
- dump_packet ((srm_ui8*) pdata, dsize);
+ dump_packet((srm_ui8*) pdata, dsize);
#endif
- deserialize (pdata, dsize, (struct srm_value**) &command, 0);
- srm_fmt_message (LL_DATA, "Notice", "Store data");
- e = SRM_LLIST_HEAD (command->list);
+ deserialize(pdata, dsize, (struct srm_value**) &command, 0);
+ srm_fmt_message(LL_DATA, "Notice", "Store data");
+ e = SRM_LLIST_HEAD(command->list);
store = (struct srm_value *) SRM_LLIST_VALP(e);
e = SRM_LLIST_NEXT(e);
key = (struct srm_value *) SRM_LLIST_VALP(e);
e = SRM_LLIST_NEXT(e);
data = (struct srm_value *) SRM_LLIST_VALP(e);
- srm_fmt_message (LL_DATA, "Store", "Store = %d", store->u8_value);
+ srm_fmt_message(LL_DATA, "Store", "Store = %d", store->u8_value);
#ifdef SRM_DEBUG
- srm_value_dump (data, 0);
+ srm_value_dump(data, 0);
#endif
switch (store->u8_value) {
case SRM_ST_APPLICATION:
- ret = srm_global_data_store (key->s_value, key->value_length, data);
+ ret = srm_global_data_store(key->s_value, key->value_length, data);
break;
case SRM_ST_SESSION:
- session = malloc (sizeof(sess_key_t) + key->value_length);
- memcpy (session, &packet[16], sizeof (sess_key_t));
- memcpy (&session[sizeof (sess_key_t)], key->s_value, key->value_length);
- ret = srm_session_data_store (session, sizeof(sess_key_t) + key->value_length, data);
- free (session);
+ session = malloc(sizeof(sess_key_t) + key->value_length);
+ memcpy(session, &packet[16], sizeof (sess_key_t));
+ memcpy(&session[sizeof (sess_key_t)], key->s_value, key->value_length);
+ ret = srm_session_data_store(session, sizeof(sess_key_t) + key->value_length, data);
+ free(session);
break;
default:
ret = ERROR_UNKNOWN_STORE;
@@ -310,11 +310,11 @@
}
/* Sending the result */
- serialize (ret_val, (srm_ui8**) &ret_data, &length);
- server_send_packet (fd, PKT_DATA, ret_data, length, packet);
+ serialize(ret_val, (srm_ui8**) &ret_data, &length);
+ server_send_packet(fd, PKT_DATA, ret_data, length, packet);
- free (ret_val);
- free (ret_data);
+ free(ret_val);
+ free(ret_data);
} /* 1}}} */
static void srm_process_retrieve_data (int fd, srm_ui8* packet, srm_ui8 size, srm_ui8* pdata, srm_ui8 dsize) /* {{{1 */
@@ -329,41 +329,41 @@
ret_val = srm_value_init();
/* Getting data from packet */
#ifdef SRM_DEBUG
- dump_packet ((srm_ui8*) pdata, dsize);
+ dump_packet((srm_ui8*) pdata, dsize);
#endif
- deserialize (pdata, dsize, (struct srm_value**) &command, 0);
- srm_fmt_message (LL_DATA, "Notice", "Retrieve data");
- store = (struct srm_value *) SRM_LLIST_VALP (SRM_LLIST_HEAD (command->list));
- key = (struct srm_value *) SRM_LLIST_VALP (SRM_LLIST_NEXT (SRM_LLIST_HEAD (command->list)));
- srm_fmt_message (LL_DATA, "Retrieve", "Store = %d", store->u8_value);
+ deserialize(pdata, dsize, (struct srm_value**) &command, 0);
+ srm_fmt_message(LL_DATA, "Notice", "Retrieve data");
+ store = (struct srm_value *) SRM_LLIST_VALP(SRM_LLIST_HEAD (command->list));
+ key = (struct srm_value *) SRM_LLIST_VALP(SRM_LLIST_NEXT (SRM_LLIST_HEAD (command->list)));
+ srm_fmt_message(LL_DATA, "Retrieve", "Store = %d", store->u8_value);
switch (store->u8_value) {
case SRM_ST_APPLICATION:
- if ((ret_val = srm_global_data_retrieve (key->s_value, key->value_length)) == NULL) {
+ if ((ret_val = srm_global_data_retrieve(key->s_value, key->value_length)) == NULL) {
ret_val = srm_value_init();
VALP_SET_NULL(ret_val);
}
break;
case SRM_ST_SESSION:
- session = malloc (sizeof(sess_key_t) + key->value_length);
- memcpy (session, &packet[16], sizeof (sess_key_t));
- memcpy (&session[sizeof (sess_key_t)], key->s_value, key->value_length);
+ session = malloc(sizeof(sess_key_t) + key->value_length);
+ memcpy(session, &packet[16], sizeof (sess_key_t));
+ memcpy(&session[sizeof (sess_key_t)], key->s_value, key->value_length);
- if ((ret_val = srm_session_data_retrieve (session, sizeof(sess_key_t) + key->value_length)) == NULL) {
+ if ((ret_val = srm_session_data_retrieve(session, sizeof(sess_key_t) + key->value_length)) == NULL) {
ret_val = srm_value_init();
VALP_SET_NULL(ret_val);
}
- free (session);
+ free(session);
break;
}
/* Sending the result */
#ifdef SRM_DEBUG
- srm_value_dump (ret_val, 0);
+ srm_value_dump(ret_val, 0);
#endif
- serialize (ret_val, (srm_ui8**) &ret_data, &length);
- server_send_packet (fd, PKT_DATA, ret_data, length, packet);
+ serialize(ret_val, (srm_ui8**) &ret_data, &length);
+ server_send_packet(fd, PKT_DATA, ret_data, length, packet);
if (SRM_IS_ERROR(ret_val)) {
free (ret_val);
@@ -385,28 +385,28 @@
ret_val = srm_value_init();
/* Getting data from packet */
#ifdef SRM_DEBUG
- dump_packet ((srm_ui8*) pdata, dsize);
+ dump_packet((srm_ui8*) pdata, dsize);
#endif
- deserialize (pdata, dsize, (struct srm_value**) &command, 0);
- srm_fmt_message (LL_DATA, "Notice", "Delete data");
- store = (struct srm_value *) SRM_LLIST_VALP (SRM_LLIST_HEAD (command->list));
- key = (struct srm_value *) SRM_LLIST_VALP (SRM_LLIST_NEXT (SRM_LLIST_HEAD (command->list)));
+ deserialize(pdata, dsize, (struct srm_value**) &command, 0);
+ srm_fmt_message(LL_DATA, "Notice", "Delete data");
+ store = (struct srm_value *) SRM_LLIST_VALP(SRM_LLIST_HEAD (command->list));
+ key = (struct srm_value *) SRM_LLIST_VALP(SRM_LLIST_NEXT (SRM_LLIST_HEAD (command->list)));
#ifdef SRM_DEBUG
- srm_fmt_message (LL_DATA, "Delete", "Store = %d", store->u8_value);
+ srm_fmt_message(LL_DATA, "Delete", "Store = %d", store->u8_value);
#endif
switch (store->u8_value) {
case SRM_ST_APPLICATION:
- ret = srm_global_data_delete (key->s_value, key->value_length);
+ ret = srm_global_data_delete(key->s_value, key->value_length);
break;
case SRM_ST_SESSION:
- session = malloc (sizeof(sess_key_t) + key->value_length);
- memcpy (session, &packet[16], sizeof (sess_key_t));
- memcpy (&session[sizeof (sess_key_t)], key->s_value, key->value_length);
+ session = malloc(sizeof(sess_key_t) + key->value_length);
+ memcpy(session, &packet[16], sizeof (sess_key_t));
+ memcpy(&session[sizeof (sess_key_t)], key->s_value, key->value_length);
- ret = srm_session_data_delete (session, sizeof(sess_key_t) + key->value_length);
+ ret = srm_session_data_delete(session, sizeof(sess_key_t) + key->value_length);
- free (session);
+ free(session);
break;
default:
ret = ERROR_UNKNOWN_STORE;
@@ -428,30 +428,30 @@
}
/* Sending the result */
- serialize (ret_val, (srm_ui8**) &ret_data, &length);
- server_send_packet (fd, PKT_DATA, ret_data, length, packet);
+ serialize(ret_val, (srm_ui8**) &ret_data, &length);
+ server_send_packet(fd, PKT_DATA, ret_data, length, packet);
- free (ret_val);
- free (ret_data);
+ free(ret_val);
+ free(ret_data);
} /* 1}}} */
static void connection_abort (int fd) /* {{{1 */
{
- srm_fmt_message (LL_CONNECTION_ERROR, "Notice", "Connection aborted");
- CP_CLOSE_CONNECTION (fd);
+ srm_fmt_message(LL_CONNECTION_ERROR, "Notice", "Connection aborted");
+ CP_CLOSE_CONNECTION(fd);
} /* 1}}} */
static void connection_close (int fd) /* {{{1 */
{
- srm_fmt_message (LL_CONNECTION, "Notice", "Connection closed");
- CP_CLOSE_CONNECTION (fd);
+ srm_fmt_message(LL_CONNECTION, "Notice", "Connection closed");
+ CP_CLOSE_CONNECTION(fd);
} /* 1}}} */
static void connection_abort_with_error (int fd, char* string) /* {{{1 */
{
- srm_fmt_message (LL_CONNECTION_ERROR, "Notice", "Connection aborted with error: %s", string);
- server_send_packet (fd, PKT_ABORT, NULL, 0, NULL);
- CP_CLOSE_CONNECTION (fd);
+ srm_fmt_message(LL_CONNECTION_ERROR, "Notice", "Connection aborted with error: %s", string);
+ server_send_packet(fd, PKT_ABORT, NULL, 0, NULL);
+ CP_CLOSE_CONNECTION(fd);
} /* 1}}} */
/******************************************************************************
@@ -464,62 +464,61 @@
srm_ui8 * data = NULL;
srm_ui32 length = 0, n = 0, read_bytes = 0;
- length = read (fd, &header, sizeof (header));
- if (length < sizeof (header) || length == -1) {
+ length = read(fd, &header, sizeof(header));
+ if (length < sizeof(header) || length == -1) {
/* Packet did not contain a full header */
- connection_abort (fd);
+ connection_abort(fd);
return SRM_FAILED;
} else {
#ifdef SRM_DEBUG
- dump_packet ((srm_ui8*) &header, length);
+ dump_packet((srm_ui8*) &header, length);
#endif
/* Checking for more data if needed */
if (header.data_length != 0) {
/* FIX ME: realloc on read instead of pre-alloc with the giving
* length of the data block */
- data = malloc (header.data_length);
+ data = malloc(header.data_length);
while (read_bytes < header.data_length) {
- n = read (fd, data + read_bytes, header.data_length - read_bytes);
+ n = read(fd, data + read_bytes, header.data_length - read_bytes);
if (n < 0) {
break;
}
read_bytes += n;
}
if (read_bytes < header.data_length) {
- connection_abort_with_error (fd, "Packet is invalid");
+ connection_abort_with_error(fd, "Packet is invalid");
}
}
- if (/*srm_pkt_validate (fd, header, length)*/TRUE)
- {
+ if (/*srm_pkt_validate (fd, header, length)*/TRUE) {
switch (header.type) {
case PKT_HANDSHAKE1:
- srm_do_handshake (fd, (srm_ui8*) &header);
+ srm_do_handshake(fd, (srm_ui8*) &header);
break;
case PKT_COMMAND:
- srm_process_command (fd, (srm_ui8*) &header, length, (srm_ui8*) data, header.data_length);
+ srm_process_command(fd, (srm_ui8*) &header, length, (srm_ui8*) data, header.data_length);
break;
case PKT_DISCONNECT:
- connection_close (fd);
+ connection_close(fd);
break;
case PKT_STORE_DATA:
- srm_process_store_data (fd, (srm_ui8*) &header, length, (srm_ui8*) data, header.data_length);
+ srm_process_store_data(fd, (srm_ui8*) &header, length, (srm_ui8*) data, header.data_length);
break;
case PKT_RETRIEVE_DATA:
- srm_process_retrieve_data (fd, (srm_ui8*) &header, length, (srm_ui8*) data, header.data_length);
+ srm_process_retrieve_data(fd, (srm_ui8*) &header, length, (srm_ui8*) data, header.data_length);
break;
case PKT_DELETE_DATA:
- srm_process_delete_data (fd, (srm_ui8*) &header, length, (srm_ui8*) data, header.data_length);
+ srm_process_delete_data(fd, (srm_ui8*) &header, length, (srm_ui8*) data, header.data_length);
break;
default:
- connection_abort_with_error (fd, "Unknown packet type");
+ connection_abort_with_error(fd, "Unknown packet type");
}
} else {
- connection_abort_with_error (fd, "Packet is invalid");
+ connection_abort_with_error(fd, "Packet is invalid");
}
}
/* Free data block if additional data was received */
if (data) {
- free (data);
+ free(data);
}
if (length == 0) {
[FILE: /srm/main/src/connection.h]
--- srm/main/src/connection.h:1.23 Sat Feb 15 20:24:58 2003 GMT
+++ srm/main/src/connection.h Sun Feb 16 12:02:18 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.23 2003/02/15 21:24:58 derick Exp $ */
+/* $Id: cvstemp,v 1.24 2003/02/16 13:02:18 derick Exp $ */
/* The contents of this file are subject to the Vulcan Logic Public
* License Version 1.1 (the "License"); you may not use this file
@@ -14,7 +14,7 @@
*
* The Initial Developer of the Original Code is the Vulcan Logic
* Group. Portions created by Vulcan Logic Group are Copyright (C)
- * 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
+ * 2000, 2001, 2002, 2003 Vulcan Logic Group. All Rights Reserved.
*
* Contributor(s):
* Derick Rethans <d.rethans@jdimedia.nl>
[FILE: /srm/main/src/functions.c]
--- srm/main/src/functions.c:1.30 Sun Feb 10 18:54:27 2002 GMT
+++ srm/main/src/functions.c Sun Feb 16 12:02:18 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.30 2002/02/10 19:54:27 sterling Exp $ */
+/* $Id: cvstemp,v 1.31 2003/02/16 13:02:18 derick Exp $ */
/* The contents of this file are subject to the Vulcan Logic Public
* License Version 1.1 (the "License"); you may not use this file
@@ -14,9 +14,10 @@
*
* The Initial Developer of the Original Code is the Vulcan Logic
* Group. Portions created by Vulcan Logic Group are Copyright (C)
- * 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
+ * 2000, 2001, 2002, 2003 Vulcan Logic Group. All Rights Reserved.
*
- * Contributor(s):
+ * Contributor(s):
+ * Derick Rethans <d.rethans@jdimedia.nl>
*/
#include <stdio.h>
@@ -27,7 +28,7 @@
srm_hash* function_hash;
-int srm_functionlist_init(void)
+int srm_functionlist_init (void)
{
function_hash = srm_hash_alloc(200, (void *) *free);
return function_hash ? TRUE : FALSE;
@@ -38,7 +39,7 @@
srm_function_info *info = NULL;
int (*j)(SRM_FUNCTION_PARAMETERS);
- if (!srm_hash_find (function_hash, cmd, strlen(cmd), (void *) &info))
+ if (!srm_hash_find(function_hash, cmd, strlen(cmd), (void *) &info))
/* Function struct not found in hash */
return SRM_FAILED;
@@ -49,7 +50,7 @@
}
if (NULL == params) { /* By no parameters don't pass them through */
- j (sesskey, NULL, ret_val, cmd, strlen(cmd));
+ j(sesskey, NULL, ret_val, cmd, strlen(cmd));
} else { /* Pass parameters to the function */
j(sesskey,
SRM_LLIST_VALP (SRM_LLIST_NEXT (SRM_LLIST_HEAD (params))),
@@ -58,7 +59,7 @@
strlen(cmd));
}
info->count++;
- srm_fmt_message (LL_STATS, "Notice", "Function %s called for the %d time.", cmd, info->count);
+ srm_fmt_message(LL_STATS, "Notice", "Function %s called for the %d time.", cmd, info->count);
return SRM_SUCCESS;
}
[FILE: /srm/main/src/functions.h]
--- srm/main/src/functions.h:1.37 Sun Feb 10 18:54:27 2002 GMT
+++ srm/main/src/functions.h Sun Feb 16 12:02:18 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.37 2002/02/10 19:54:27 sterling Exp $ */
+/* $Id: cvstemp,v 1.38 2003/02/16 13:02:18 derick Exp $ */
/* The contents of this file are subject to the Vulcan Logic Public
* License Version 1.1 (the "License"); you may not use this file
@@ -14,7 +14,7 @@
*
* The Initial Developer of the Original Code is the Vulcan Logic
* Group. Portions created by Vulcan Logic Group are Copyright (C)
- * 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
+ * 2000, 2001, 2002, 2003 Vulcan Logic Group. All Rights Reserved.
*
* Contributor(s):
* Derick Rethans <derick@vl-srm.net>
@@ -185,7 +185,7 @@
/* {{{ Functions prototypes */
int srm_functionlist_init(void);
-int srm_call_function (sess_key_t sesskey, char* cmd, srm_llist* params, srm_value * output);
+int srm_call_function(sess_key_t sesskey, char* cmd, srm_llist* params, srm_value * output);
void srm_functionlist_dump(void);
/* }}} */
[FILE: /srm/main/src/ini_parser.h]
--- srm/main/src/ini_parser.h:1.21 Mon Jan 14 18:53:52 2002 GMT
+++ srm/main/src/ini_parser.h Sun Feb 16 12:02:18 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.21 2002/01/14 19:53:52 peter Exp $ */
+/* $Id: cvstemp,v 1.22 2003/02/16 13:02:18 derick Exp $ */
/* The contents of this file are subject to the Vulcan Logic Public
* License Version 1.1 (the "License"); you may not use this file
@@ -14,9 +14,10 @@
*
* The Initial Developer of the Original Code is the Vulcan Logic
* Group. Portions created by Vulcan Logic Group are Copyright (C)
- * 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
+ * 2000, 2001, 2002, 2003 Vulcan Logic Group. All Rights Reserved.
*
* Contributor(s):
+ * Derick Rethans <d.rethans@jdimedia.nl>
*/
#ifndef __INI_PARSER_H__
@@ -25,13 +26,13 @@
#include <stdlib.h>
#include "srm_value.h"
-/* This stuff is complex, ask for information if you need it */
+/* This stuff is complex, don't ask for information, even if you need it */
#define MAX_INI_ENTRIES 256
-int srm_read_ini_file (void);
+int srm_read_ini_file(void);
srm_bool srm_compare_ini_entry (int index, char* group, char* key, struct srm_value* value);
/* for debug */
-void srm_dump_ini_file (void);
+void srm_dump_ini_file(void);
#endif
[FILE: /srm/main/src/srm_client.c]
--- srm/main/src/srm_client.c:1.15 Sat Feb 15 20:24:58 2003 GMT
+++ srm/main/src/srm_client.c Sun Feb 16 12:02:19 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.15 2003/02/15 21:24:58 derick Exp $ */
+/* $Id: cvstemp,v 1.16 2003/02/16 13:02:19 derick Exp $ */
/* The contents of this file are subject to the Vulcan Logic Public
* License Version 1.1 (the "License"); you may not use this file
@@ -14,7 +14,7 @@
*
* The Initial Developer of the Original Code is the Vulcan Logic
* Group. Portions created by Vulcan Logic Group are Copyright (C)
- * 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
+ * 2000, 2001, 2002, 2003 Vulcan Logic Group. All Rights Reserved.
*
* Contributor(s):
* Sterling Hughes <sterling@bumblebury.com>
@@ -48,17 +48,17 @@
{
struct pkt_header header;
- memset (&header, 0, sizeof (header));
+ memset(&header, 0, sizeof(header));
header.type = type;
- srm_pkt_set_version (&header);
+ srm_pkt_set_version(&header);
header.protocol = connect_data.protocol;
header.encryption = connect_data.encryption;
header.data_length = datasize;
- memcpy ((char*) &header.session_key, connect_data.sess_key , sizeof (sess_key_t));
+ memcpy((char*) &header.session_key, connect_data.sess_key, sizeof (sess_key_t));
- write (connect_data.sock, &header, sizeof (header));
+ write(connect_data.sock, &header, sizeof (header));
if (data != NULL && datasize > 0) {
- write (connect_data.sock, data, datasize);
+ write(connect_data.sock, data, datasize);
}
return SRM_SUCCESS;
}
@@ -70,30 +70,30 @@
struct srm_value *val;
srm_ui8 *data = NULL;
- length = read (connect_data->sock, &packet, sizeof (packet));
+ length = read(connect_data->sock, &packet, sizeof (packet));
- if (length < sizeof (packet) || length == -1) {
+ if (length < sizeof(packet) || length == -1) {
return SRM_FAILED;
} else {
if (NULL != type) {
*type = packet.type;
}
- memcpy (connect_data->sess_key, packet.session_key, sizeof (sess_key_t));
+ memcpy(connect_data->sess_key, packet.session_key, sizeof (sess_key_t));
if (packet.data_length != 0) {
- data = malloc (packet.data_length);
+ data = malloc(packet.data_length);
dlength = 0;
while (packet.data_length != dlength) {
- dlength += read (connect_data->sock, data + dlength, packet.data_length - dlength);
+ dlength += read(connect_data->sock, data + dlength, packet.data_length - dlength);
}
- deserialize (data, dlength, (struct srm_value**) &val, 0);
- free (data);
+ deserialize(data, dlength, (struct srm_value**) &val, 0);
+ free(data);
if (NULL != sdata) {
*sdata = val;
}
return SRM_SUCCESS;
} else {
val = srm_value_init();
- VALP_SET_NULL (val);
+ VALP_SET_NULL(val);
if (NULL != sdata) {
*sdata = val;
}
@@ -114,17 +114,16 @@
connect_data->protocol = prot;
connect_data->encryption = enc;
- connect_data->sock = socket (host.family, SOCK_STREAM, 0);
+ connect_data->sock = socket(host.family, SOCK_STREAM, 0);
if (connect_data->sock < 0) {
SRMVALP_SET_STR(ret_val, srm_sprintf(COM_ERROR_CREATE_SOCKET_STR, strerror(errno)));
VALP_SET_ERROR(ret_val);
return ret_val;
}
- switch(host.family)
- {
+ switch (host.family) {
case AF_INET: {
- host_info = gethostbyname (host.host);
+ host_info = gethostbyname(host.host);
if (host_info == NULL) {
SRMVALP_SET_STR(ret_val, srm_sprintf(COM_ERROR_GET_HOSTNAME_STR, strerror(errno)));
VALP_SET_ERROR(ret_val);
@@ -132,14 +131,14 @@
}
server_in.sin_family = host_info->h_addrtype;
memcpy ((char*) &server_in.sin_addr, host_info->h_addr, host_info->h_length);
- server_in.sin_port = htons (host.port);
+ server_in.sin_port = htons(host.port);
ret = connect(connect_data->sock, (struct sockaddr *) &server_in, sizeof(server_in));
break;
}
case AF_UNIX: {
server_un.sun_family = AF_UNIX;
- strcpy (server_un.sun_path, host.host);
+ strcpy(server_un.sun_path, host.host);
ret = connect(connect_data->sock, (struct sockaddr *) &server_un, sizeof(server_un));
break;
}
@@ -152,16 +151,16 @@
}
/* Starting handshake (part 1: option packet) */
- clientlib_send_packet (*connect_data, PKT_HANDSHAKE1, 0, NULL);
- clientlib_receive_packet (connect_data, NULL, &size, (struct srm_value**) &ret_val);
+ clientlib_send_packet(*connect_data, PKT_HANDSHAKE1, 0, NULL);
+ clientlib_receive_packet(connect_data, NULL, &size, (struct srm_value**) &ret_val);
return ret_val;
}
srm_bool srm_disconnect (connect_data_t connect_data)
{
- clientlib_send_packet (connect_data, PKT_DISCONNECT, 0, NULL);
- close (connect_data.sock);
+ clientlib_send_packet(connect_data, PKT_DISCONNECT, 0, NULL);
+ close(connect_data.sock);
return SRM_SUCCESS;
}
@@ -176,35 +175,34 @@
srm_llist* parameters;
/* Create a list and srm_value */
- parameters = srm_llist_alloc (SRM_LLIST_VALUE_FREE);
- command = srm_value_init ();
+ parameters = srm_llist_alloc(SRM_LLIST_VALUE_FREE);
+ command = srm_value_init();
/* Adding the command name to the list */
- SRMVALP_SET_STR (command_val, strdup((char *) cmd));
- srm_llist_insert_next (parameters, NULL, (void *) command_val);
+ SRMVALP_SET_STR(command_val, strdup((char *) cmd));
+ srm_llist_insert_next(parameters, NULL, (void *) command_val);
/* Adding parameters to this list */
if (NULL != params) {
if (VALP_IS_LIST(params)) {
- srm_llist_insert_next (parameters, SRM_LLIST_TAIL (parameters),
- (void *) params);
+ srm_llist_insert_next (parameters, SRM_LLIST_TAIL (parameters), (void *) params);
}
}
/* Setting command to the list */
- VALP_SET_LIST (command);
- SRMVALP_LIST (command) = (void *) parameters;
+ VALP_SET_LIST(command);
+ SRMVALP_LIST(command) = (void *) parameters;
- serialize (command, (srm_ui8**) &packet_d, &size);
- clientlib_send_packet (connect_data, PKT_COMMAND, size, packet_d);
+ serialize(command, (srm_ui8**) &packet_d, &size);
+ clientlib_send_packet(connect_data, PKT_COMMAND, size, packet_d);
if (NULL != params) {
srm_llist_remove(parameters, SRM_LLIST_TAIL (parameters), (void *) NULL);
}
- free (packet_d);
- srm_value_free (command);
+ free(packet_d);
+ srm_value_free(command);
- clientlib_receive_packet (&connect_data, NULL, NULL, (struct srm_value**) &ret_val);
+ clientlib_receive_packet(&connect_data, NULL, NULL, (struct srm_value**) &ret_val);
return ret_val;
}
[FILE: /srm/main/src/srm_client.h]
--- srm/main/src/srm_client.h:1.27 Sat Feb 15 20:24:58 2003 GMT
+++ srm/main/src/srm_client.h Sun Feb 16 12:02:19 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.27 2003/02/15 21:24:58 derick Exp $ */
+/* $Id: cvstemp,v 1.28 2003/02/16 13:02:19 derick Exp $ */
/* The contents of this file are subject to the Vulcan Logic Public
* License Version 1.1 (the "License"); you may not use this file
@@ -14,9 +14,10 @@
*
* The Initial Developer of the Original Code is the Vulcan Logic
* Group. Portions created by Vulcan Logic Group are Copyright (C)
- * 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
+ * 2000, 2001, 2002, 2003 Vulcan Logic Group. All Rights Reserved.
*
* Contributor(s):
+ * Derick Rethans <d.rethans@jdimedia.nl>
*/
#ifndef __SRM_CLIENT_H__
[FILE: /srm/main/src/srm_compat.c]
--- srm/main/src/srm_compat.c:1.17 Sat Feb 15 19:47:10 2003 GMT
+++ srm/main/src/srm_compat.c Sun Feb 16 12:02:19 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.17 2003/02/15 20:47:10 derick Exp $ */
+/* $Id: cvstemp,v 1.18 2003/02/16 13:02:19 derick Exp $ */
/* The contents of this file are subject to the Vulcan Logic Public
* License Version 1.1 (the "License"); you may not use this file
@@ -14,7 +14,7 @@
*
* The Initial Developer of the Original Code is the Vulcan Logic
* Group. Portions created by Vulcan Logic Group are Copyright (C)
- * 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
+ * 2000, 2001, 2002, 2003 Vulcan Logic Group. All Rights Reserved.
*
* Contributor(s):
* Derick Rethans <d.rethans@jdimedia.nl>
@@ -42,17 +42,17 @@
struct hostent* host;
char* temp;
- host = gethostbyaddr ((char *) addr, sizeof (addr), AF_INET);
+ host = gethostbyaddr((char *) addr, sizeof (addr), AF_INET);
if (NULL == host) {
- temp = malloc (16);
- sprintf (temp, "%d.%d.%d.%d",
- (int) (ntohl (addr->s_addr) >> 24) & 0xFF,
- (int) (ntohl (addr->s_addr) >> 16) & 0xFF,
- (int) (ntohl (addr->s_addr) >> 8) & 0xFF,
- (int) ntohl (addr->s_addr) & 0xFF
+ temp = malloc(16);
+ sprintf(temp, "%d.%d.%d.%d",
+ (int) (ntohl(addr->s_addr) >> 24) & 0xFF,
+ (int) (ntohl(addr->s_addr) >> 16) & 0xFF,
+ (int) (ntohl(addr->s_addr) >> 8) & 0xFF,
+ (int) ntohl(addr->s_addr) & 0xFF
);
} else {
- temp = strdup (host->h_name);
+ temp = strdup(host->h_name);
}
return temp;
}
@@ -63,7 +63,7 @@
to.tv_sec = sec;
to.tv_usec = usec;
- select (0, NULL, NULL, NULL, &to);
+ select(0, NULL, NULL, NULL, &to);
}
char *srm_sprintf (const char* fmt, ...)
@@ -72,11 +72,11 @@
int size = 1;
va_list args;
- new_str = (char *) malloc (size);
+ new_str = (char *) malloc(size);
va_start(args, fmt);
for (;;) {
- int n = vsnprintf (new_str, size, fmt, args);
+ int n = vsnprintf(new_str, size, fmt, args);
if (n > -1 && n < size) {
break;
}
@@ -85,9 +85,9 @@
} else {
size = n + 1;
}
- new_str = (char *) realloc (new_str, size);
+ new_str = (char *) realloc(new_str, size);
}
- va_end (args);
+ va_end(args);
return new_str;
}
[FILE: /srm/main/src/srm_compat.h]
--- srm/main/src/srm_compat.h:1.9 Sat Feb 15 19:47:10 2003 GMT
+++ srm/main/src/srm_compat.h Sun Feb 16 12:02:19 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.9 2003/02/15 20:47:10 derick Exp $ */
+/* $Id: cvstemp,v 1.10 2003/02/16 13:02:19 derick Exp $ */
/* The contents of this file are subject to the Vulcan Logic Public
* License Version 1.1 (the "License"); you may not use this file
@@ -14,9 +14,10 @@
*
* The Initial Developer of the Original Code is the Vulcan Logic
* Group. Portions created by Vulcan Logic Group are Copyright (C)
- * 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
+ * 2000, 2001, 2002, 2003 Vulcan Logic Group. All Rights Reserved.
*
- * Contributor(s):
+ * Contributor(s):
+ * Derick Rethans <d.rethans@jdimedia.nl>
*/
#ifndef __SRM_COMPAT_H__
[FILE: /srm/main/src/srm_error.c]
--- srm/main/src/srm_error.c:1.28 Sat Feb 15 23:25:14 2003 GMT
+++ srm/main/src/srm_error.c Sun Feb 16 12:02:19 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.28 2003/02/16 00:25:14 derick Exp $ */
+/* $Id: cvstemp,v 1.29 2003/02/16 13:02:19 derick Exp $ */
/* The contents of this file are subject to the Vulcan Logic Public
* License Version 1.1 (the "License"); you may not use this file
@@ -14,7 +14,7 @@
*
* The Initial Developer of the Original Code is the Vulcan Logic
* Group. Portions created by Vulcan Logic Group are Copyright (C)
- * 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
+ * 2000, 2001, 2002, 2003 Vulcan Logic Group. All Rights Reserved.
*
* Contributor(s):
* Derick Rethans <d.rethans@jdimedia.nl>
@@ -39,23 +39,23 @@
FILE *ffile;
if (log_to_screen == 1) {
- ffile = fdopen (2, "w");
+ ffile = fdopen(2, "w");
} else {
- if ((ffile = fopen (file, "a")) == NULL) {
- if ((ffile = fopen ("/var/log/srm", "a")) == NULL) {
- exit (ERROR_CANT_OPEN_LOGFILE);
+ if ((ffile = fopen(file, "a")) == NULL) {
+ if ((ffile = fopen("/var/log/srm", "a")) == NULL) {
+ exit(ERROR_CANT_OPEN_LOGFILE);
}
}
}
logfile = ffile;
debug_level = loglevel;
- fprintf (logfile, "\n");
- srm_fmt_message (LL_STARTUP, "Log", "Logfile opened (level %d)", loglevel);
+ fprintf(logfile, "\n");
+ srm_fmt_message(LL_STARTUP, "Log", "Logfile opened (level %d)", loglevel);
}
void srm_stop_logging (void)
{
- srm_fmt_message (LL_SHUTDOWN, "Log", "Logfile ended");
+ srm_fmt_message(LL_SHUTDOWN, "Log", "Logfile ended");
fclose(logfile);
}
@@ -70,21 +70,22 @@
buffer = malloc(24);
cur_time = time(NULL);
- strftime (buffer, 24, "%Y-%m-%d %H:%M:%S ", gmtime (&cur_time));
+ strftime(buffer, 24, "%Y-%m-%d %H:%M:%S ", gmtime (&cur_time));
if (logfile == NULL) {
openedlog = 1;
- logfile = fdopen (2, "w");
+ logfile = fdopen(2, "w");
}
- fprintf (logfile, buffer);
+ fprintf(logfile, buffer);
- fprintf (logfile, "[Error] ");
+ fprintf(logfile, "[Error] ");
va_start(ap, format);
(void) vfprintf(logfile, format, ap);
va_end(ap);
- fprintf (logfile, "\n");
+ fprintf(logfile, "\n");
fflush(logfile);
- if (openedlog == 1)
+ if (openedlog == 1) {
fclose (logfile);
+ }
exit (value);
}
@@ -100,34 +101,33 @@
time_t cur_time;
pthread_mutex_lock(&log_mtx);
- if (level <= debug_level)
- {
+ if (level <= debug_level) {
tbuffer = malloc(24);
cur_time = time(NULL);
- strftime (tbuffer, 24, "%Y-%m-%d %H:%M:%S ", gmtime (&cur_time));
- fprintf (logfile, tbuffer);
- free (tbuffer);
+ strftime(tbuffer, 24, "%Y-%m-%d %H:%M:%S ", gmtime (&cur_time));
+ fprintf(logfile, tbuffer);
+ free(tbuffer);
buffer = malloc(12);
- length = strlen (group);
+ length = strlen(group);
if (length > 8) {
- tbuffer = strdup (group);
+ tbuffer = strdup(group);
tbuffer[8] = 0;
- fprintf (logfile, "[%s] ", tbuffer);
+ fprintf(logfile, "[%s] ", tbuffer);
free(tbuffer);
} else {
memset (buffer, ' ', 12);
buffer[0] = '[';
buffer[11] = 0;
- memcpy (buffer + 1, group, length);
+ memcpy(buffer + 1, group, length);
buffer[1 + length] = ']';
- fprintf (logfile, "%s", buffer);
+ fprintf(logfile, "%s", buffer);
}
va_start(ap, format);
(void) vfprintf(logfile, format, ap);
va_end(ap);
- fprintf (logfile, "\n");
- free (buffer);
+ fprintf(logfile, "\n");
+ free(buffer);
fflush(logfile);
}
pthread_mutex_unlock(&log_mtx);
[FILE: /srm/main/src/srm_hash.c]
--- srm/main/src/srm_hash.c:1.33 Sun Apr 14 19:41:03 2002 GMT
+++ srm/main/src/srm_hash.c Sun Feb 16 12:02:19 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.33 2002/04/14 21:41:03 sterling Exp $ */
+/* $Id: cvstemp,v 1.34 2003/02/16 13:02:19 derick Exp $ */
/* The contents of this file are subject to the Vulcan Logic Public
* License Version 1.1 (the "License"); you may not use this file
@@ -14,9 +14,10 @@
*
* The Initial Developer of the Original Code is the Vulcan Logic
* Group. Portions created by Vulcan Logic Group are Copyright (C)
- * 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
+ * 2000, 2001, 2002, 2003 Vulcan Logic Group. All Rights Reserved.
*
- * Author(s): Sterling Hughes <sterling@php.net>
+ * Author(s):
+ * Sterling Hughes <sterling@php.net>
*/
#include <string.h>
@@ -36,8 +37,8 @@
{
char *tmp;
- tmp = calloc (key->value.str.len + 1, 1);
- memcpy (tmp, key->value.str.val, key->value.str.len);
+ tmp = calloc(key->value.str.len + 1, 1);
+ memcpy(tmp, key->value.str.val, key->value.str.len);
*new_len = key->value.str.len;
return tmp;
@@ -122,14 +123,17 @@
static int srm_hash_key_compare(srm_hash_key *key1, srm_hash_key *key2)
{
if (key1->type == SRM_HASH_KEY_IS_NUM) {
- if (key2->type == SRM_HASH_KEY_IS_STRING)
+ if (key2->type == SRM_HASH_KEY_IS_STRING) {
return 0;
+ }
- if (key1->value.num == key2->value.num)
+ if (key1->value.num == key2->value.num) {
return 1;
+ }
} else {
- if (key2->type == SRM_HASH_KEY_IS_NUM)
+ if (key2->type == SRM_HASH_KEY_IS_NUM) {
return 0;
+ }
if (key1->value.str.len == key2->value.str.len &&
*key1->value.str.val == *key2->value.str.val &&
[FILE: /srm/main/src/srm_hash.h]
--- srm/main/src/srm_hash.h:1.21 Mon Jan 14 18:53:53 2002 GMT
+++ srm/main/src/srm_hash.h Sun Feb 16 12:02:19 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.21 2002/01/14 19:53:53 peter Exp $ */
+/* $Id: cvstemp,v 1.22 2003/02/16 13:02:19 derick Exp $ */
/* The contents of this file are subject to the Vulcan Logic Public
* License Version 1.1 (the "License"); you may not use this file
@@ -14,7 +14,7 @@
*
* The Initial Developer of the Original Code is the Vulcan Logic
* Group. Portions created by Vulcan Logic Group are Copyright (C)
- * 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
+ * 2000, 2001, 2002, 2003 Vulcan Logic Group. All Rights Reserved.
*
* Contributor(s):
*/
[FILE: /srm/main/src/srm_llist.c]
--- srm/main/src/srm_llist.c:1.12 Sat Feb 15 23:25:15 2003 GMT
+++ srm/main/src/srm_llist.c Sun Feb 16 12:02:19 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.12 2003/02/16 00:25:15 derick Exp $ */
+/* $Id: cvstemp,v 1.13 2003/02/16 13:02:19 derick Exp $ */
/* The contents of this file are subject to the Vulcan Logic Public
* License Version 1.1 (the "License"); you may not use this file
@@ -14,9 +14,10 @@
*
* The Initial Developer of the Original Code is the Vulcan Logic
* Group. Portions created by Vulcan Logic Group are Copyright (C)
- * 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
+ * 2000, 2001, 2002, 2003 Vulcan Logic Group. All Rights Reserved.
*
- * Author(s): Sterling Hughes <sterling@php.net>
+ * Author(s):
+ * Sterling Hughes <sterling@php.net>
*/
#include <stdlib.h>
@@ -88,10 +89,11 @@
} else {
ne->next = e;
ne->prev = e->prev;
- if (e->prev)
+ if (e->prev) {
e->prev->next = ne;
- else
+ } else {
l->head = ne;
+ }
e->prev = ne;
}
@@ -108,16 +110,18 @@
if (e == l->head) {
l->head = e->next;
- if (l->head == NULL)
+ if (l->head == NULL) {
l->tail = NULL;
- else
+ } else {
e->next->prev = NULL;
+ }
} else {
e->prev->next = e->next;
- if (!e->next)
+ if (!e->next) {
l->tail = e->prev;
- else
+ } else {
e->next->prev = e->prev;
+ }
}
if (l->dtor) {
[FILE: /srm/main/src/srm_llist.h]
--- srm/main/src/srm_llist.h:1.8 Sun Feb 24 02:58:52 2002 GMT
+++ srm/main/src/srm_llist.h Sun Feb 16 12:02:19 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.8 2002/02/24 03:58:52 kalowsky Exp $ */
+/* $Id: cvstemp,v 1.9 2003/02/16 13:02:19 derick Exp $ */
/* The contents of this file are subject to the Vulcan Logic Public
* License Version 1.1 (the "License"); you may not use this file
@@ -14,9 +14,10 @@
*
* The Initial Developer of the Original Code is the Vulcan Logic
* Group. Portions created by Vulcan Logic Group are Copyright (C)
- * 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
+ * 2000, 2001, 2002, 2003 Vulcan Logic Group. All Rights Reserved.
*
- * Contributor(s): Sterling Hughes <sterling@php.net>
+ * Contributor(s):
+ * Sterling Hughes <sterling@php.net>
* Daniel R. Kalowsky <dank@deadmime.org>
*/
[FILE: /srm/main/src/srm_modules.c]
--- srm/main/src/srm_modules.c:1.68 Sat Feb 15 23:25:15 2003 GMT
+++ srm/main/src/srm_modules.c Sun Feb 16 12:02:19 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.68 2003/02/16 00:25:15 derick Exp $ */
+/* $Id: cvstemp,v 1.69 2003/02/16 13:02:19 derick Exp $ */
/* The contents of this file are subject to the Vulcan Logic Public
* License Version 1.1 (the "License"); you may not use this file
@@ -14,7 +14,7 @@
*
* The Initial Developer of the Original Code is the Vulcan Logic
* Group. Portions created by Vulcan Logic Group are Copyright (C)
- * 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
+ * 2000, 2001, 2002, 2003 Vulcan Logic Group. All Rights Reserved.
*
* Contributor(s):
* Daniel R. Kalowsky <dank@deadmime.org>
@@ -82,10 +82,10 @@
NSSymbol srm_bundle_symbol(void *bundle_handle, const char *symbol_name)
{
NSSymbol symbol;
- char *tmp = malloc (strlen(symbol_name) + 2);
- sprintf (tmp, "_%s", symbol_name);
+ char *tmp = malloc(strlen(symbol_name) + 2);
+ sprintf(tmp, "_%s", symbol_name);
symbol = NSLookupSymbolInModule(bundle_handle, tmp);
- free (tmp);
+ free(tmp);
return NSAddressOfSymbol(symbol);
}
@@ -117,8 +117,8 @@
{
void* arg = NULL;
- if (pthread_create (&thread, NULL, (void*)function, arg) != 0) {
- srm_error (ERROR_CREATE_PTHREAD, "Could't create thread.");
+ if (pthread_create(&thread, NULL, (void*)function, arg) != 0) {
+ srm_error(ERROR_CREATE_PTHREAD, "Could't create thread.");
return 0;
} else {
return thread;
@@ -131,18 +131,13 @@
*/
static void srm_module_info (s_module_entry *module_entry)
{
- srm_fmt_message (LL_STARTUP, "Module", "%s",
- module_entry->info.name);
- srm_fmt_message (LL_INFO, "Module", "Version: %s",
- module_entry->info.version_string);
- srm_fmt_message (LL_INFO, "Module", "Vendor: %s",
- module_entry->info.vendor);
- srm_fmt_message (LL_INFO, "Module", "Description: %s",
- module_entry->info.description);
- srm_fmt_message (LL_INFO, "Module", "SRM API version: %d",
- module_entry->info.api_version);
+ srm_fmt_message(LL_STARTUP, "Module", "%s", module_entry->info.name);
+ srm_fmt_message(LL_INFO, "Module", "Version: %s", module_entry->info.version_string);
+ srm_fmt_message(LL_INFO, "Module", "Vendor: %s", module_entry->info.vendor);
+ srm_fmt_message(LL_INFO, "Module", "Description: %s", module_entry->info.description);
+ srm_fmt_message(LL_INFO, "Module", "SRM API version: %d", module_entry->info.api_version);
if (module_entry->thread) {
- srm_fmt_message (LL_INFO, "Thread", "Module thread number: %d", (int) module_entry->thread);
+ srm_fmt_message(LL_INFO, "Thread", "Module thread number: %d", (int) module_entry->thread);
}
}
@@ -152,7 +147,7 @@
*/
static void srm_register_module(s_module_entry *module_entry, void *handle)
{
- srm_hash_add (module_hash, module_entry->name, strlen(module_entry->name), module_entry);
+ srm_hash_add(module_hash, module_entry->name, strlen(module_entry->name), module_entry);
}
@@ -161,15 +156,15 @@
*/
static void srm_register_functions(srm_function_entry *function_list)
{
- srm_fmt_message (LL_STARTUP, "Module","Loading functions...");
- srm_fmt_message (LL_INFO, "Module","Addr: %08X", function_list);
+ srm_fmt_message(LL_STARTUP, "Module", "Loading functions...");
+ srm_fmt_message(LL_INFO, "Module", "Addr: %08X", function_list);
while (function_list->name) {
if (function_list->handler) {
- srm_fmt_message (LL_INFO, "Func","- Loaded %s", function_list->name);
- REGISTER_FUNCTION (function_list->name, strlen(function_list->name), function_list->handler);
+ srm_fmt_message(LL_INFO, "Func", "- Loaded %s", function_list->name);
+ REGISTER_FUNCTION(function_list->name, strlen(function_list->name), function_list->handler);
} else {
- srm_fmt_message (LL_STARTUP, "Error","- Error loading %s", function_list->name);
+ srm_fmt_message(LL_STARTUP, "Error", "- Error loading %s", function_list->name);
}
function_list++;
}
@@ -190,26 +185,26 @@
int ret;
void *dummy;
- srm_fmt_message (LL_LOAD, "--------","------------------------------------------------");
+ srm_fmt_message(LL_LOAD, "--------","------------------------------------------------");
if (module_entry->info.api_version != SRM_API_VERSION) {
- srm_fmt_message (LL_STARTUP, "Error","- API version mismatch.");
- } else if (!srm_hash_find (module_hash, module_entry->name, strlen(module_entry->name), &dummy)) {
+ srm_fmt_message(LL_STARTUP, "Error", "- API version mismatch.");
+ } else if (!srm_hash_find(module_hash, module_entry->name, strlen(module_entry->name), &dummy)) {
/* - If a module has an init function, execute it */
if (module_entry->srm_module_load != NULL) {
- srm_fmt_message (LL_STARTUP, "Module","Initializing module...");
+ srm_fmt_message(LL_STARTUP, "Module", "Initializing module...");
if ((ret = module_entry->srm_module_load()) == SRM_FAILED) {
- srm_fmt_message (LL_STARTUP, "Error","- Module intialization failed.");
+ srm_fmt_message(LL_STARTUP, "Error", "- Module intialization failed.");
} else {
- srm_fmt_message (LL_STARTUP, "Module","- Module intialization OK.");
+ srm_fmt_message(LL_STARTUP, "Module", "- Module intialization OK.");
}
}
/* - If module has threads, create them */
if (module_entry->thread != NULL) {
- module_entry->thread = (void *) srm_init_thread ((pthread_t) module_entry->thread, module_entry->entry_point);
+ module_entry->thread = (void *) srm_init_thread((pthread_t) module_entry->thread, module_entry->entry_point);
}
srm_module_info(module_entry);
@@ -239,25 +234,25 @@
name_len = strlen(module_entry->name);
- srm_fmt_message (LL_SHUTDOWN, "--------","------------------------------------------------");
- srm_fmt_message (LL_SHUTDOWN, "Module","Shutting down module: %s", module_entry->name);
+ srm_fmt_message(LL_SHUTDOWN, "--------", "------------------------------------------------");
+ srm_fmt_message(LL_SHUTDOWN, "Module", "Shutting down module: %s", module_entry->name);
if (srm_hash_find (module_hash, module_entry->name, name_len, &dummy)) {
/* - If a module has an de-init function, execute it */
if (module_entry->srm_module_unload) {
- srm_fmt_message (LL_SHUTDOWN, "Module","- Running module internal shutdown function...");
+ srm_fmt_message(LL_SHUTDOWN, "Module", "- Running module internal shutdown function...");
if (module_entry->srm_module_unload() == SRM_FAILED) {
- srm_fmt_message (LL_SHUTDOWN, "Error"," - Shutdown function failed.");
+ srm_fmt_message(LL_SHUTDOWN, "Error", " - Shutdown function failed.");
} else {
- srm_fmt_message (LL_SHUTDOWN, "Module"," - Shutdown function OK.");
+ srm_fmt_message(LL_SHUTDOWN, "Module", " - Shutdown function OK.");
}
}
} else {
- srm_fmt_message (LL_SHUTDOWN, "Error","- Module shutdown failed.");
+ srm_fmt_message(LL_SHUTDOWN, "Error", "- Module shutdown failed.");
return SRM_FAILED;
}
- srm_fmt_message (LL_SHUTDOWN, "Module","- Module shutdown OK.");
+ srm_fmt_message(LL_SHUTDOWN, "Module", "- Module shutdown OK.");
return SRM_SUCCESS;
}
@@ -272,21 +267,21 @@
s_module_entry *module_entry;
/* - Trying to obtain handle to the .so file */
- handle = DL_LOAD (module_name);
+ handle = DL_LOAD(module_name);
if (!handle) {
- srm_error (ERROR_OPEN_MODULE, "Cannot open module: %s", DL_ERROR());
+ srm_error(ERROR_OPEN_MODULE, "Cannot open module: %s", DL_ERROR());
}
/* - Obtaining the module_entry symbol */
get_module = (s_module_entry *(*)(void)) DL_FETCH_SYM (handle, "get_module");
if (!get_module) {
- srm_error (ERROR_LOAD_MODULE, "Cannot find entry table in module.");
+ srm_error(ERROR_LOAD_MODULE, "Cannot find entry table in module.");
DL_UNLOAD(handle);
} else {
module_entry = get_module();
if ((srm_module_init(module_entry, handle)) != SRM_SUCCESS) {
- srm_fmt_message (LL_STARTUP, "Warning","Module '%s' already loaded!", module_entry->info.name);
+ srm_fmt_message(LL_STARTUP, "Warning", "Module '%s' already loaded!", module_entry->info.name);
DL_UNLOAD(handle);
}
}
@@ -305,14 +300,14 @@
srm_startup_internal_modules();
/* - Loading modules from ini settings, this should be optimized some time */
- e = SRM_LLIST_HEAD (module_list);
+ e = SRM_LLIST_HEAD(module_list);
while (e != NULL) {
tmp = (char *) SRM_LLIST_VALP(e);
if (tmp) {
srm_load_module(tmp);
}
- e = SRM_LLIST_NEXT (e);
+ e = SRM_LLIST_NEXT(e);
}
}
@@ -347,7 +342,7 @@
srm_module_deinit(module_entry);
if (handle != NULL ) { /* Only unload non-static modules */
-//# srm_sleep (4, 0);
+/* srm_sleep (4, 0); */
DL_UNLOAD(handle);
}
}
@@ -362,18 +357,16 @@
*/
void srm_unload_modules (void)
{
-/* - Builtin modules (internal_functions.c) */
-// srm_shutdown_internal_modules();
+/* Builtin modules (internal_functions.c) */
+/* srm_shutdown_internal_modules(); */
-/* - Unloading modules */
- srm_hash_apply (module_hash, NULL, srm_unload_module);
+/* Unloading modules */
+ srm_hash_apply(module_hash, NULL, srm_unload_module);
-/*
- * Cleaning up structures
- */
- srm_hash_destroy (function_hash);
- srm_hash_destroy (module_hash);
- srm_llist_destroy (module_list, NULL);
+/* Cleaning up structures */
+ srm_hash_destroy(function_hash);
+ srm_hash_destroy(module_hash);
+ srm_llist_destroy(module_list, NULL);
}
[FILE: /srm/main/src/srm_modules.h]
--- srm/main/src/srm_modules.h:1.36 Sat Feb 15 23:25:15 2003 GMT
+++ srm/main/src/srm_modules.h Sun Feb 16 12:02:19 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.36 2003/02/16 00:25:15 derick Exp $ */
+/* $Id: cvstemp,v 1.37 2003/02/16 13:02:19 derick Exp $ */
/* The contents of this file are subject to the Vulcan Logic Public
* License Version 1.1 (the "License"); you may not use this file
@@ -14,7 +14,7 @@
*
* The Initial Developer of the Original Code is the Vulcan Logic
* Group. Portions created by Vulcan Logic Group are Copyright (C)
- * 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
+ * 2000, 2001, 2002, 2003 Vulcan Logic Group. All Rights Reserved.
*
* Contributor(s):
* Daniel R. Kalowsky <dank@deadmime.org>
[FILE: /srm/main/src/srm_protocols.c]
--- srm/main/src/srm_protocols.c:1.3 Sat Feb 15 23:25:15 2003 GMT
+++ srm/main/src/srm_protocols.c Sun Feb 16 12:02:19 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.3 2003/02/16 00:25:15 derick Exp $ */
+/* $Id: cvstemp,v 1.4 2003/02/16 13:02:19 derick Exp $ */
/* The contents of this file are subject to the Vulcan Logic Public
* License Version 1.1 (the "License"); you may not use this file
@@ -14,7 +14,7 @@
*
* The Initial Developer of the Original Code is the Vulcan Logic
* Group. Portions created by Vulcan Logic Group are Copyright (C)
- * 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
+ * 2000, 2001, 2002, 2003 Vulcan Logic Group. All Rights Reserved.
*
* Contributor(s):
* Derick Rethans <d.rethans@jdimedia.nl>
[FILE: /srm/main/src/srm_protocols.h]
--- srm/main/src/srm_protocols.h:1.2 Sat Feb 15 22:23:07 2003 GMT
+++ srm/main/src/srm_protocols.h Sun Feb 16 12:02:19 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.2 2003/02/15 23:23:07 derick Exp $ */
+/* $Id: cvstemp,v 1.3 2003/02/16 13:02:19 derick Exp $ */
/* The contents of this file are subject to the Vulcan Logic Public
* License Version 1.1 (the "License"); you may not use this file
@@ -14,7 +14,7 @@
*
* The Initial Developer of the Original Code is the Vulcan Logic
* Group. Portions created by Vulcan Logic Group are Copyright (C)
- * 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
+ * 2000, 2001, 2002, 2003 Vulcan Logic Group. All Rights Reserved.
*
* Contributor(s):
* Derick Rethans <d.rethans@jdimedia.nl>
[FILE: /srm/main/src/srm_queue.c]
--- srm/main/src/srm_queue.c:1.4 Thu Jan 24 15:38:00 2002 GMT
+++ srm/main/src/srm_queue.c Sun Feb 16 12:02:19 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.4 2002/01/24 16:38:00 sterling Exp $ */
+/* $Id: cvstemp,v 1.5 2003/02/16 13:02:19 derick Exp $ */
/* The contents of this file are subject to the Vulcan Logic Public
* License Version 1.1 (the "License"); you may not use this file
@@ -14,7 +14,7 @@
*
* The Initial Developer of the Original Code is the Vulcan Logic
* Group. Portions created by Vulcan Logic Group are Copyright (C)
- * 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
+ * 2000, 2001, 2002, 2003 Vulcan Logic Group. All Rights Reserved.
*
* Author(s): Sterling Hughes <sterling@php.net>
*/
[FILE: /srm/main/src/srm_queue.h]
--- srm/main/src/srm_queue.h:1.6 Fri Jan 25 10:32:29 2002 GMT
+++ srm/main/src/srm_queue.h Sun Feb 16 12:02:19 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.6 2002/01/25 11:32:29 peter Exp $ */
+/* $Id: cvstemp,v 1.7 2003/02/16 13:02:19 derick Exp $ */
/* The contents of this file are subject to the Vulcan Logic Public
* License Version 1.1 (the "License"); you may not use this file
@@ -14,9 +14,10 @@
*
* The Initial Developer of the Original Code is the Vulcan Logic
* Group. Portions created by Vulcan Logic Group are Copyright (C)
- * 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
+ * 2000, 2001, 2002, 2003 Vulcan Logic Group. All Rights Reserved.
*
- * Contributor(s): Sterling Hughes <sterling@php.net>
+ * Contributor(s):
+ * Sterling Hughes <sterling@php.net>
*/
#ifndef __SRM_QUEUE_H__
[FILE: /srm/main/src/srm_storage.c]
--- srm/main/src/srm_storage.c:1.34 Sat Feb 15 22:48:58 2003 GMT
+++ srm/main/src/srm_storage.c Sun Feb 16 12:02:19 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.34 2003/02/15 23:48:58 derick Exp $ */
+/* $Id: cvstemp,v 1.35 2003/02/16 13:02:19 derick Exp $ */
/* The contents of this file are subject to the Vulcan Logic Public
* License Version 1.1 (the "License"); you may not use this file
@@ -14,7 +14,7 @@
*
* The Initial Developer of the Original Code is the Vulcan Logic
* Group. Portions created by Vulcan Logic Group are Copyright (C)
- * 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
+ * 2000, 2001, 2002, 2003 Vulcan Logic Group. All Rights Reserved.
*
* Contributor(s):
* Derick Rethans <derick@vl-srm.net>
@@ -43,47 +43,47 @@
FILE *dump;
srm_ui8 *data;
- filename = calloc (strlen(path) + strlen(fname) + 2, 1);
- strcpy (filename, path);
- strcat (filename, "/");
- strcat (filename, fname);
+ filename = calloc(strlen(path) + strlen(fname) + 2, 1);
+ strcpy(filename, path);
+ strcat(filename, "/");
+ strcat(filename, fname);
- if (stat (filename, &finfo) != -1) {
+ if (stat(filename, &finfo) != -1) {
/* File was stat-ed, checking if it can be opened */
- dump = fopen (filename, "r");
+ dump = fopen(filename, "r");
if (dump != NULL) {
- if ((data = malloc (finfo.st_size)) != NULL) {
+ if ((data = malloc(finfo.st_size)) != NULL) {
/* File could be opened, proceed with reading */
- fread (data, finfo.st_size, 1, dump);
- fclose (dump);
+ fread(data, finfo.st_size, 1, dump);
+ fclose(dump);
- deserialize (data, finfo.st_size, (struct srm_value**) &sval_temp, 0);
- free (data);
+ deserialize(data, finfo.st_size, (struct srm_value**) &sval_temp, 0);
+ free(data);
hash_temp = sval_temp->hash;
/* Invalidate hash, so that srm_value_free can be called */
sval_temp->hash = NULL;
VALP_SET_NULL(sval_temp);
- srm_value_free (sval_temp);
+ srm_value_free(sval_temp);
if (hash_temp != NULL) { /* Only return with correct hash */
- free (filename);
+ free(filename);
return hash_temp;
} else { /* else issue warning and fall through */
- srm_fmt_message (LL_STARTUP, "Store", "Deserialization of hash has failed");
+ srm_fmt_message(LL_STARTUP, "Store", "Deserialization of hash has failed");
}
}
} else {
- srm_fmt_message (LL_STARTUP, "Store", "Could not load dump of session data");
+ srm_fmt_message(LL_STARTUP, "Store", "Could not load dump of session data");
}
}
- free (filename);
+ free(filename);
/* Some error occured, so create a new hash table and return it */
if ((hash_temp = srm_hash_alloc(size, SRM_VALUE_FREE)) != NULL) {
return hash_temp;
}
/* If even that failed, bomb out */
- srm_error (
+ srm_error(
ERROR_INIT_HASH,
"Could not initialize hash '%s' with size '%lu'",
(int unsigned) size
@@ -94,10 +94,10 @@
void srm_store_init (STORE_SETTINGS_DEF)
{
- AST = srm_create_store (STORE_SETTING(save_path), "srmd.application_data", STORE_SETTING(global_hash_size));
- SST = srm_create_store (STORE_SETTING(save_path), "srmd.session_data", STORE_SETTING(session_hash_size));
- ALH = srm_create_store (STORE_SETTING(save_path), "srmd.application_lock_data", STORE_SETTING(global_lock_hash_size));
- SLH = srm_create_store (STORE_SETTING(save_path), "srmd.session_lock_data", STORE_SETTING(session_lock_hash_size));
+ AST = srm_create_store(STORE_SETTING(save_path), "srmd.application_data", STORE_SETTING(global_hash_size));
+ SST = srm_create_store(STORE_SETTING(save_path), "srmd.session_data", STORE_SETTING(session_hash_size));
+ ALH = srm_create_store(STORE_SETTING(save_path), "srmd.application_lock_data", STORE_SETTING(global_lock_hash_size));
+ SLH = srm_create_store(STORE_SETTING(save_path), "srmd.session_lock_data", STORE_SETTING(session_lock_hash_size));
}
static void srm_destroy_store (srm_hash* store, char *path, char *fname)
@@ -108,23 +108,23 @@
srm_ui8 *data;
srm_ui32 dlength;
- filename = calloc (strlen (path) + strlen (fname) + 2, 1);
- strcpy (filename, path);
- strcat (filename, "/");
- strcat (filename, fname);
+ filename = calloc(strlen (path) + strlen (fname) + 2, 1);
+ strcpy(filename, path);
+ strcat(filename, "/");
+ strcat(filename, fname);
dump_val = srm_value_init();
VALP_SET_HASH(dump_val);
dump_val->hash = store;
- serialize (dump_val, (srm_ui8**) &data, &dlength);
+ serialize(dump_val, (srm_ui8**) &data, &dlength);
umask(066);
- dump = fopen (filename, "w");
+ dump = fopen(filename, "w");
if (dump != NULL) {
- fwrite (data, dlength, 1, dump);
- fclose (dump);
+ fwrite(data, dlength, 1, dump);
+ fclose(dump);
} else {
- srm_fmt_message (LL_SHUTDOWN, "Store", "Could not create dump (%s/%s) of session data", path, fname);
+ srm_fmt_message(LL_SHUTDOWN, "Store", "Could not create dump (%s/%s) of session data", path, fname);
}
srm_value_free(dump_val);
free(data);
@@ -134,10 +134,10 @@
void srm_store_close (STORE_SETTINGS_DEF)
{
- srm_destroy_store (AST, STORE_SETTING(save_path), "srmd.application_data");
- srm_destroy_store (SST, STORE_SETTING(save_path), "srmd.session_data");
- srm_destroy_store (ALH, STORE_SETTING(save_path), "srmd.application_lock_data");
- srm_destroy_store (SLH, STORE_SETTING(save_path), "srmd.session_lock_data");
+ srm_destroy_store(AST, STORE_SETTING(save_path), "srmd.application_data");
+ srm_destroy_store(SST, STORE_SETTING(save_path), "srmd.session_data");
+ srm_destroy_store(ALH, STORE_SETTING(save_path), "srmd.application_lock_data");
+ srm_destroy_store(SLH, STORE_SETTING(save_path), "srmd.session_lock_data");
}
/******************************************************************************
@@ -147,9 +147,9 @@
int srm_global_data_store (srm_ui8* key, srm_ui8 key_length, struct srm_value* data)
{
#ifdef SRM_DEBUG
- srm_fmt_message (LL_DATA, "Notice", "Storing data with key `%s`", key);
+ srm_fmt_message(LL_DATA, "Notice", "Storing data with key `%s`", key);
#endif
- srm_hash_add (AST, key, key_length, (void*) data);
+ srm_hash_add(AST, key, key_length, (void*) data);
return SRM_SUCCESS;
}
@@ -159,19 +159,21 @@
/* Check if data is locked -> return SRM_LOCKED */
/* Check if key exists in store -> return SRM_NOT_EXISTS */
/* Fetch data from store */
- if (srm_hash_find (AST, key, key_length, (void *) &tmp) == SRM_FAILED)
+ if (srm_hash_find(AST, key, key_length, (void *) &tmp) == SRM_FAILED) {
return NULL;
- else
+ } else {
return tmp;
+ }
}
int srm_global_data_delete (srm_ui8* key, srm_ui8 key_length)
{
/* Delete data from store */
- if (srm_hash_delete (AST, key, key_length) == SRM_FAILED)
+ if (srm_hash_delete(AST, key, key_length) == SRM_FAILED) {
return ERROR_KEY_NOT_EXISTS;
- else
+ } else {
return SRM_SUCCESS;
+ }
}
/******************************************************************************
@@ -181,9 +183,9 @@
int srm_session_data_store (srm_ui8* key, srm_ui8 key_length, struct srm_value* data)
{
#ifdef SRM_DEBUG
- srm_fmt_message (LL_DATA, "Notice", "Storing data with key `%s`", key);
+ srm_fmt_message(LL_DATA, "Notice", "Storing data with key `%s`", key);
#endif
- srm_hash_add (SST, key, key_length, (void*) data);
+ srm_hash_add(SST, key, key_length, (void*) data);
return SRM_SUCCESS;
}
@@ -193,17 +195,19 @@
/* Check if data is locked -> return SRM_LOCKED */
/* Check if key exists in store -> return SRM_NOT_EXISTS */
/* Fetch data from store */
- if (srm_hash_find (SST, key, key_length, &tmp) == SRM_FAILED)
+ if (srm_hash_find(SST, key, key_length, &tmp) == SRM_FAILED) {
return NULL;
- else
+ } else {
return tmp;
+ }
&nb