Date: Sat Feb 15 22:24:58 CET 2003
User: Derick Rethans
Directory: srm/main/src
Log Message:
[6.00]
- Implemented protocol abstraction
#- This works, but I will need to clean up things, and make things work
# better. I also will need to re-instate the UNIX socket-only ini setting.
Deleted files:
srm/main/src/connect.c (last version: 1.47)
Modified files:
srm/main/main.c (version: 1.66)
srm/main/src/Makefile.am (version: 1.32)
srm/main/src/connection.c (version: 1.67)
srm/main/src/connection.h (version: 1.23)
srm/main/src/srm_client.c (version: 1.15)
srm/main/src/srm_client.h (version: 1.27)
Added files:
srm/main/src/srm_protocols.c (new version: 1.1)
srm/main/src/srm_protocols.h (new version: 1.1)
[FILE: /srm/main/main.c]
--- srm/main/main.c:1.65 Sat Jan 18 15:11:28 2003 GMT
+++ srm/main/main.c Sat Feb 15 20:24:57 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.65 2003/01/18 16:11:28 derick Exp $ */
+/* $Id: cvstemp,v 1.66 2003/02/15 21:24:57 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
@@ -41,6 +41,7 @@
#include "functions.h"
#include "ini_parser.h"
#include "srm_modules.h"
+#include "srm_protocols.h"
#include "srm_storage.h"
@@ -186,11 +187,10 @@
char *con_addr;
sigset_t signal_set;
pthread_t sig_thread;
- int rendezvous_s_in;
- int rendezvous_s_un = 0;
int client_in_len;
int client_un_len;
int fd;
+ int new_fd = 0;
struct sockaddr_in client_in;
struct sockaddr_un client_un;
struct timeval timeout;
@@ -266,15 +266,7 @@
/******************************************************************************
** Initializing connections
*/
-
- if (INI_SETTING(no_tcp_ip)) {
- srm_setup_socket (&rendezvous_s_un, AF_UNIX, 0, INI_SETTING(sockname));
- CP_SETUP(rendezvous_s_un, rendezvous_s_un);
- } else {
- srm_setup_socket (&rendezvous_s_in, AF_INET, (int) INI_SETTING(port), NULL);
- srm_setup_socket (&rendezvous_s_un, AF_UNIX, 0, INI_SETTING(sockname));
- CP_SETUP(rendezvous_s_in, rendezvous_s_un);
- }
+ srm_setup_protocols(&CP);
/******************************************************************************
** Main loop
@@ -286,28 +278,30 @@
timeout.tv_usec = 0;
CP_SELECT(timeout);
- if (!INI_SETTING(no_tcp_ip) && CP_ISNEWCONNECT(rendezvous_s_in)) {
- client_in_len = sizeof (client_in);
- fd = accept (rendezvous_s_in, (struct sockaddr *) &client_in, &client_in_len);
- iaddr = &client_in.sin_addr;
- con_addr = srm_gethostbyaddr ((char *) iaddr, sizeof (struct in_addr), AF_INET);
- srm_fmt_message (LL_CONNECTION, "Connect", "%s", con_addr);
- free (con_addr);
- CP_NEW_CONNECTION(fd);
-
- } else
-
- if (CP_ISNEWCONNECT(rendezvous_s_un)) {
- client_un_len = sizeof (client_un);
- fd = accept (rendezvous_s_un, (struct sockaddr *) &client_un, &client_un_len);
- srm_fmt_message (LL_CONNECTION, "Connect", "%s", INI_SETTING(sockname));
- CP_NEW_CONNECTION(fd);
- }
-
for (fd = 0; fd <= CP.max_fd; fd++) {
- if ((fd != rendezvous_s_in && fd != rendezvous_s_un) && CP_CONNECTION_AVAILABLE(fd)) {
+ if ((CP.status[fd] == SRM_STATUS_RENDEZVOUS) && CP_ISNEWCONNECT(fd)) {
+ if (CP.protocol[fd]->host.family == AF_UNIX) {
+ client_un_len = sizeof (client_un);
+ new_fd = accept (fd, (struct sockaddr *) &client_un, &client_un_len);
+ srm_fmt_message (LL_CONNECTION, "Connect", "%s", INI_SETTING(sockname));
+
+ } else if (CP.protocol[fd]->host.family == AF_INET) {
+ client_in_len = sizeof (client_in);
+ new_fd = accept (fd, (struct sockaddr *) &client_in, &client_in_len);
+ iaddr = &client_in.sin_addr;
+ con_addr = srm_gethostbyaddr ((char *) iaddr, sizeof (struct in_addr), AF_INET);
+ srm_fmt_message (LL_CONNECTION, "Connect", "%s", con_addr);
+ free (con_addr);
+ } else {
+ abort();
+ }
+ CP_NEW_CONNECTION(new_fd, fd);
+ }
+
+
+ if ((CP.status[fd] == SRM_STATUS_NORMAL) && CP_CONNECTION_AVAILABLE(fd)) {
/* srm_process_data processes all incoming packets */
- if (srm_process_data (fd) != SRM_SUCCESS) {
+ if (CP.protocol[fd]->process(fd) != SRM_SUCCESS) {
/* When a connection gets dropped, it is removed from
the set {FIX ME: this is now done in the processing
code itself */
@@ -371,8 +365,11 @@
srm_stop_logging ();
/* Closing sockets */
- close (rendezvous_s_in);
- close (rendezvous_s_un);
+ for (fd = 0; fd < CP.max_fd; fd++) {
+ if (CP.status[fd] != SRM_STATUS_NOT_USED) {
+ close(fd);
+ }
+ }
return 0;
}
[FILE: /srm/main/src/srm_protocols.c]
/* $Id: cvstemp,v 1.1 2003/02/15 21:24:58 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
* except in compliance with the License. You may obtain a copy of
* the License at http://www.vl-srm.net/vlpl/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is vl-srm.net code.
*
* 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.
*
* Contributor(s):
* Derick Rethans <d.rethans@jdimedia.nl>
*/
#include "connection.h"
#include "srm_protocols.h"
#include <stdio.h>
#include <sys/socket.h>
srm_protocol protocol_list[] = {
{ { "/var/srm.socket", 0, AF_UNIX }, NULL, NULL, srm_process_data },
{ { NULL, 7777, AF_INET }, NULL, NULL, srm_process_data },
{ { NULL, 0, 0}, NULL, NULL, NULL}
};
/******************************************************************************
** protocols
**/
void srm_setup_protocols (struct con_pool* cp)
{
int sock;
srm_protocol *protocol = protocol_list;
int i;
for (i = 0; i < FD_SETSIZE; i++) {
cp->status[i] = SRM_STATUS_NOT_USED;
cp->protocol[i] = NULL;
}
FD_ZERO(&(cp->test_set));
while (protocol->process) {
sock = srm_setup_socket(
protocol->host.family,
protocol->host.port,
protocol->host.host
);
cp->status[sock] = SRM_STATUS_RENDEZVOUS;
cp->protocol[sock] = protocol;
FD_SET(sock, &(cp->test_set));
if (sock > cp->max_fd) {
cp->max_fd = sock;
}
protocol++;
}
}
[FILE: /srm/main/src/srm_protocols.h]
/* $Id: cvstemp,v 1.1 2003/02/15 21:24:58 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
* except in compliance with the License. You may obtain a copy of
* the License at http://www.vl-srm.net/vlpl/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is vl-srm.net code.
*
* 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.
*
* Contributor(s):
* Derick Rethans <d.rethans@jdimedia.nl>
*/
#ifndef __PROTOCOLS_H__
#define __PROTOCOLS_H__
#include "srm_value.h"
#include "connection.h"
int srm_process_data (int fd);
void srm_setup_protocols (struct con_pool* cp);
#endif
[FILE: /srm/main/src/Makefile.am]
--- srm/main/src/Makefile.am:1.31 Sun Jan 26 15:34:11 2003 GMT
+++ srm/main/src/Makefile.am Sat Feb 15 20:24:58 2003 GMT
@@ -1,5 +1,5 @@
##
-## $Id: cvstemp,v 1.31 2003/01/26 16:34:11 derick Exp $
+## $Id: cvstemp,v 1.32 2003/02/15 21:24:58 derick Exp $
##
## The contents of this file are subject to the Vulcan Logic Public
@@ -18,15 +18,16 @@
## Group. Portions created by Vulcan Logic Group are Copyright (C)
## 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
##
-## Contributor(s):
+## Contributor(s):
+## Derick Rethans <d.rethans@jdimedia.nl>
##/
lib_LTLIBRARIES = libsrm_client.la
noinst_LIBRARIES = libsrm.a
-libsrm_client_la_SOURCES = srm_client.c connect.c storage.c connection.c functions.c srm_error.c srm_hash.c srm_llist.c srm_value.c srm_compat.c srm_storage.c srm_queue.c
+libsrm_client_la_SOURCES = srm_client.c storage.c connection.c functions.c srm_error.c srm_hash.c srm_llist.c srm_value.c srm_compat.c srm_storage.c srm_queue.c
-libsrm_a_SOURCES = connection.c srm_error.c ini_parser.c srm_modules.c functions.c srm_hash.c srm_llist.c srm_value.c srm_compat.c srm_storage.c srm_ini_parser.y srm_ini_scanner.l
+libsrm_a_SOURCES = connection.c srm_error.c ini_parser.c srm_modules.c functions.c srm_hash.c srm_llist.c srm_value.c srm_compat.c srm_protocols.c srm_storage.c srm_ini_parser.y srm_ini_scanner.l
noinst_HEADERS = connection.h ini_parser.h srm_modules.h srm_storage.h
include_HEADERS = functions.h srm_hash.h srm_client.h srm_modules.h srm_value.h srm_compat.h srm_llist.h srm_queue.h
[FILE: /srm/main/src/connection.c]
--- srm/main/src/connection.c:1.66 Sun Aug 25 10:07:40 2002 GMT
+++ srm/main/src/connection.c Sat Feb 15 20:24:58 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.66 2002/08/25 12:07:40 derick Exp $ */
+/* $Id: cvstemp,v 1.67 2003/02/15 21:24:58 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
@@ -17,6 +17,7 @@
* 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
*
* Contributor(s):
+ * Derick Rethans <d.rethans@jdimedia.nl>
*/
#include <stdio.h>
@@ -48,16 +49,16 @@
static srm_bool srm_session_key_is_empty (srm_ui8* packet);
static void srm_gen_session_key (srm_ui8* session_key);
-
/******************************************************************************
-** sockets
+** socket
**/
-void srm_setup_socket (int *ssocket, int domain, int port, char* path) /* {{{1 */
+int srm_setup_socket (int domain, int port, char* path) /* {{{1 */
{
- *ssocket = socket (domain, SOCK_STREAM, 0);
+ int ssocket = socket (domain, SOCK_STREAM, 0);
- if (*ssocket < 0) {
+ if (ssocket < 0) {
+ perror("srm_setup_socket");
srm_error (COM_ERROR_CREATE_SOCKET, "setup_socket: couldn't create socket");
}
@@ -70,7 +71,7 @@
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) {
+ 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;
@@ -83,7 +84,7 @@
strcpy (server_un.sun_path, path);
(void) unlink (path);
umask(0);
- if (bind (*ssocket, (struct sockaddr *) &server_un, sizeof(struct sockaddr_un)) < 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");
}
umask(0777);
@@ -91,9 +92,10 @@
break;
}
- if (listen (*ssocket, 5) == -1) {
+ if (listen (ssocket, 5) == -1) {
srm_error (COM_ERROR_LISTEN, "setup_socket: listen call failed");
}
+ return ssocket;
} /* 1}}} */
@@ -228,7 +230,8 @@
}
if (status == SRM_FAILED) {
- srm_set_error_string ((struct srm_value**) &ret_val, ERRMSG_FUNC_NOT_EXIST);
+ SRMVALP_SET_STR(ret_val, strdup(ERRMSG_FUNC_NOT_EXIST));
+ VALP_SET_ERROR(ret_val);
}
#ifdef SRM_DEBUG
srm_value_dump (ret_val, 1);
@@ -297,10 +300,12 @@
SRMVALP_BOOL(ret_val) = SRM_SUCCESS;
break;
case ERROR_KEY_EXISTS:
- srm_set_error_string ((struct srm_value**) &ret_val, ERRMSG_KEY_EXISTS);
+ SRMVALP_SET_STR(ret_val, strdup(ERRMSG_KEY_EXISTS));
+ VALP_SET_ERROR(ret_val);
break;
default:
- srm_set_error_string ((struct srm_value**) &ret_val, ERRMSG_UNKNOWN);
+ SRMVALP_SET_STR(ret_val, strdup(ERRMSG_UNKNOWN));
+ VALP_SET_ERROR(ret_val);
break;
}
@@ -412,11 +417,13 @@
VALP_SET_BOOL(ret_val);
SRMVALP_BOOL(ret_val) = SRM_SUCCESS;
break;
- case ERROR_KEY_NOT_EXISTS:
- srm_set_error_string ((struct srm_value**) &ret_val, ERRMSG_KEY_NOT_EXISTS);
+ case ERROR_KEY_EXISTS:
+ SRMVALP_SET_STR(ret_val, strdup(ERRMSG_KEY_EXISTS));
+ VALP_SET_ERROR(ret_val);
break;
default:
- srm_set_error_string ((struct srm_value**) &ret_val, ERRMSG_UNKNOWN);
+ SRMVALP_SET_STR(ret_val, strdup(ERRMSG_UNKNOWN));
+ VALP_SET_ERROR(ret_val);
break;
}
[FILE: /srm/main/src/connection.h]
--- srm/main/src/connection.h:1.22 Fri Jan 18 15:27:19 2002 GMT
+++ srm/main/src/connection.h Sat Feb 15 20:24:58 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.22 2002/01/18 16:27:19 derick Exp $ */
+/* $Id: cvstemp,v 1.23 2003/02/15 21:24:58 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
@@ -17,35 +17,21 @@
* 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
*
* Contributor(s):
+ * Derick Rethans <d.rethans@jdimedia.nl>
*/
#ifndef __CONNECTION_H__
#define __CONNECTION_H__
#include "srm_com.h"
+#include <sys/types.h>
typedef struct con_def {
sess_key_t* session_key;
} con_def;
-typedef struct con_pool {
- srm_bool status[FD_SETSIZE];
- con_def connection[FD_SETSIZE];
- srm_ui16 max_fd;
- srm_ui32 counter;
- fd_set test_set;
- fd_set ready_set;
-} con_pool;
-
#define CP connection_pool
-#define CP_SETUP(sock1,sock2) FD_ZERO (&connection_pool.test_set); \
- FD_SET ((sock1), &connection_pool.test_set); \
- FD_SET ((sock2), &connection_pool.test_set); \
- connection_pool.max_fd = (sock1); \
- if (sock2 > sock1) \
- connection_pool.max_fd = (sock2); \
-
#define CP_RESET memcpy (&connection_pool.ready_set, \
&connection_pool.test_set, sizeof connection_pool.test_set);
@@ -54,21 +40,52 @@
#define CP_ISNEWCONNECT(sock) FD_ISSET ((sock), &connection_pool.ready_set)
-#define CP_NEW_CONNECTION(fd) FD_SET ((fd), &connection_pool.test_set); \
+#define CP_NEW_CONNECTION(fd,pfd) FD_SET ((fd), &connection_pool.test_set); \
connection_pool.counter++; \
if ((fd) > (connection_pool.max_fd)) \
- connection_pool.max_fd = fd;
+ connection_pool.max_fd = fd; \
+ connection_pool.status[fd] = SRM_STATUS_NORMAL; \
+ connection_pool.protocol[fd] = connection_pool.protocol[pfd];
#define CP_CONNECTION_AVAILABLE(fd) \
FD_ISSET ((fd), &connection_pool.ready_set)
#define CP_CLOSE_CONNECTION(fd) FD_CLR ((fd), &connection_pool.test_set); \
+ connection_pool.status[fd] = SRM_STATUS_NOT_USED; \
close (fd)
extern struct con_pool connection_pool;
+typedef int (*prot_init_t)(int sock);
+typedef int (*prot_deinit_t)(int sock);
+typedef int (*prot_process_t)(int sock);
+
+typedef struct srm_protocol {
+ srm_host_t host; /* Connection specifier */
+
+ prot_init_t init; /* Initialization function */
+ prot_deinit_t deinit; /* De-initialization function */
+
+ prot_process_t process;
+} srm_protocol;
+
+#define SRM_STATUS_NOT_USED 0
+#define SRM_STATUS_RENDEZVOUS 1
+#define SRM_STATUS_NORMAL 2
+
+typedef struct con_pool {
+ srm_bool status[FD_SETSIZE];
+ con_def connection[FD_SETSIZE];
+ srm_protocol *protocol[FD_SETSIZE];
+ srm_ui16 max_fd;
+ srm_ui32 counter;
+ fd_set test_set;
+ fd_set ready_set;
+} con_pool;
+
+
void dump_packet (srm_ui8* packet, srm_ui8 size);
int srm_process_data (int fd);
-void srm_setup_socket (int* ssocket, int domain, int port, char *path);
+int srm_setup_socket (int domain, int port, char *path);
#endif
[FILE: /srm/main/src/srm_client.c]
--- srm/main/src/srm_client.c:1.14 Tue Feb 19 15:27:09 2002 GMT
+++ srm/main/src/srm_client.c Sat Feb 15 20:24:58 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.14 2002/02/19 16:27:09 derick Exp $ */
+/* $Id: cvstemp,v 1.15 2003/02/15 21:24:58 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
@@ -17,6 +17,8 @@
* 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
*
* Contributor(s):
+ * Sterling Hughes <sterling@bumblebury.com>
+ * Derick Rethans <d.rethans@jdimedia.nl>
*/
#include <stdio.h>
@@ -25,6 +27,7 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
+#include <sys/un.h>
#include <netinet/in.h>
#include <netdb.h>
#include <string.h>
@@ -35,6 +38,12 @@
#include "srm_com.h"
#include "srm_value.h"
+#define COM_ERROR_CREATE_SOCKET_STR "Cannot create socket: %s"
+#define COM_ERROR_GET_HOSTNAME_STR "Couldn't resolve hostname: %s"
+#define COM_ERROR_CANNOT_CONNECT_STR "Cannot connect to server: %s"
+
+extern int errno;
+
int clientlib_send_packet (connect_data_t connect_data, int type, srm_ui32 datasize, srm_ui8* data)
{
struct pkt_header header;
@@ -92,3 +101,118 @@
}
}
}
+
+struct srm_value *srm_connect (srm_host_t host, protocol_t prot, encryption_t enc, connect_data_t *connect_data)
+{
+ struct sockaddr_in server_in;
+ struct sockaddr_un server_un;
+ struct hostent *host_info;
+ srm_value *ret_val = NULL;
+ srm_ui32 size;
+ int ret=0;
+
+ connect_data->protocol = prot;
+ connect_data->encryption = enc;
+
+ 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)
+ {
+ case AF_INET: {
+ 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);
+ return ret_val;
+ }
+ 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);
+ 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);
+ ret = connect(connect_data->sock, (struct sockaddr *) &server_un, sizeof(server_un));
+ break;
+ }
+ }
+
+ if (ret < 0) {
+ SRMVALP_SET_STR(ret_val, srm_sprintf(COM_ERROR_CANNOT_CONNECT_STR, strerror(errno)));
+ VALP_SET_ERROR(ret_val);
+ return ret_val;
+ }
+
+/* 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);
+
+ 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);
+
+ return SRM_SUCCESS;
+}
+
+struct srm_value* srm_do_command (connect_data_t connect_data, char* cmd, struct srm_value* params)
+{
+ srm_ui32 size = 0;
+ struct srm_value* ret_val = NULL;
+ srm_ui8* packet_d = NULL;
+ struct srm_value* command = NULL;
+ struct srm_value* command_val = NULL;
+ srm_llist* parameters;
+
+ /* Create a list and srm_value */
+ 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);
+
+ /* Adding parameters to this list */
+ if (NULL != params) {
+ if (VALP_IS_LIST(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;
+
+ 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);
+
+ clientlib_receive_packet (&connect_data, NULL, NULL, (struct srm_value**) &ret_val);
+ return ret_val;
+}
+
+/*
+ * Local Variables:
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ * vim600: fdm=marker
+ * vim: noet sw=4 ts=4
+ */
[FILE: /srm/main/src/srm_client.h]
--- srm/main/src/srm_client.h:1.26 Sat Jan 18 15:11:29 2003 GMT
+++ srm/main/src/srm_client.h Sat Feb 15 20:24:58 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.26 2003/01/18 16:11:29 derick Exp $ */
+/* $Id: cvstemp,v 1.27 2003/02/15 21:24:58 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
@@ -42,7 +42,6 @@
/* From: srm_client.c */
int clientlib_send_packet (connect_data_t connect_data, int type, srm_ui32 datasize, srm_ui8* data);
int clientlib_receive_packet (connect_data_t *connect_data, int* type, srm_ui32* datasize, struct srm_value** sdata);
-void srm_set_error_string (srm_value** err_sval, char* format, ...);
/* From: connection.c */
struct srm_value* srm_connect (srm_host_t host, protocol_t prot, encryption_t enc, connect_data_t *connect_data);
Received on Sat Feb 15 22:13:17 2003
This archive was generated by hypermail 2.1.8 : Tue Jan 06 2009 - 07:00:03 CET