diff --git a/src/common/Makefile.am b/src/common/Makefile.am --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -1,6 +1,6 @@ pkglib_LTLIBRARIES = libdistrencommon.la -libdistrencommon_la_SOURCES = options.c options.h execio.h execio.c remoteio.h remoteio.c +libdistrencommon_la_SOURCES = options.c options.h execio.h execio.c remoteio.h libremoteio.h remoteio.c #evidently the following should not be LDADD, but LDFLAGS because automake doesn't like the idea of LDADD for libraries for some reason... or I am very confused libdistrencommon_la_LIBADD = @DISTLIBS_LIBS@ libdistrencommon_la_CXXFLAGS = @DISTLIBS_CFLAGS@ diff --git a/src/common/libremoteio.h b/src/common/libremoteio.h new file mode 100644 --- /dev/null +++ b/src/common/libremoteio.h @@ -0,0 +1,34 @@ +/* + Copyright 2009 Nathan Phillip Brink + + This file is a part of DistRen. + + DistRen is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + DistRen is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with DistRen. If not, see . +*/ + +#ifndef _DISTREN_LIBREMOTEIO_H +#define _DISTREN_LIBREMOTEIO_H + +#include "remoteio.h" + +/** + private declarations for remoteio, to be included by options.c and remoteio.c + */ + +struct remoteio_opts { + char *ssh_command; +}; + + +#endif diff --git a/src/common/options.c b/src/common/options.c --- a/src/common/options.c +++ b/src/common/options.c @@ -21,6 +21,9 @@ #include "options.h" +/* privat-ish files for components we need to config */ +#include "libremoteio.h" + #include #include #include @@ -71,10 +74,22 @@ int options_init(int argc, char *argv[], return 1; } memset((*allopts)->data, '\0', sizeof(struct options_common_data)); + + (*allopts)->remoteio = malloc(sizeof(struct remoteio_opts)); + if(!(*allopts)->data) + { + perror("malloc"); + free(configfile); + free((*allopts)->data); + free(*allopts); + return 1; + } + memset((*allopts)->remoteio, '\0', sizeof(struct remoteio_opts)); - /* Conf File Parser */ + cfg_opt_t common_opts[] = { + CFG_SIMPLE_STR("ssh-command", &(*allopts)->remoteio->ssh_command), CFG_END() }; @@ -142,6 +157,7 @@ int options_free(struct options_common * cfg_free(opts->data->cfg); + free(opts->remoteio); free(opts->data); free(opts); diff --git a/src/common/remoteio.c b/src/common/remoteio.c --- a/src/common/remoteio.c +++ b/src/common/remoteio.c @@ -24,10 +24,7 @@ #include #include -/** - @todo there must be passage of a configuratoin struct to allow configuration of different ssh clients. - */ -int remoteio_open(struct remoteio **rem, char *servername) +int remoteio_open(struct remoteio **rem, struct remoteio_opts *opts, char *servername) { char *sshargs[] = {"ssh", servername, "distrend", "-d", (char *)NULL}; int rtn; diff --git a/src/common/remoteio.h b/src/common/remoteio.h --- a/src/common/remoteio.h +++ b/src/common/remoteio.h @@ -26,6 +26,8 @@ RemoteIO provides an abstraction to the method of talking to a remote distrend. It is a layer on top of execio that should provide an equivalent interface. */ +struct remoteio_opts; + struct remoteio { struct execio *execio; }; @@ -35,7 +37,7 @@ struct remoteio { @todo should this be asynchronous? */ -int remoteio_open(struct remoteio **rem, char *servername); +int remoteio_open(struct remoteio **rem, struct remoteio_opts *opts, char *servername); /** non-blocking I/O.