Changeset - 4b9e91831d84
[Not reviewed]
default
0 4 1
Nathan Brink (binki) - 16 years ago 2009-07-25 00:28:54
ohnobinki@ohnopublishing.net
added remoteio info to options.c
5 files changed with 56 insertions and 7 deletions:
0 comments (0 inline, 0 general)
src/common/Makefile.am
Show inline comments
 
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@
src/common/libremoteio.h
Show inline comments
 
new file 100644
 
/*
 
  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 <http://www.gnu.org/licenses/>.
 
*/
 

	
 
#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
src/common/options.c
Show inline comments
 
@@ -21,6 +21,9 @@
 

	
 
#include "options.h"
 

	
 
/* privat-ish files for components we need to config */
 
#include "libremoteio.h"
 

	
 
#include <confuse.h>
 
#include <string.h>
 
#include <stdio.h>
 
@@ -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);
 
  
src/common/remoteio.c
Show inline comments
 
@@ -24,10 +24,7 @@
 
#include <stdlib.h>
 
#include <stdio.h>
 

	
 
/**
 
   @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;
src/common/remoteio.h
Show inline comments
 
@@ -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.
0 comments (0 inline, 0 general)