Commit 82fc59c1 authored by Ryan Jackson's avatar Ryan Jackson

Initial commit of the XML-ified tmcd.

- all db query code is in libtmcd.c (will become a separate library).
- request format the same as previous versions
- most responses are in XML (except for the ltmap, ltpmap, and topomap commands)
parent 96d35729
......@@ -22,7 +22,8 @@ include $(TESTBED_SRCDIR)/GNUmakerules
CFLAGS += -O -g -Wall -DUDP \
-I${OBJDIR} -I/usr/local/include \
-I${TESTBED_SRCDIR}/lib/libtb -I${TESTBED_SRCDIR}/pxe
-I${TESTBED_SRCDIR}/lib/libtb -I${TESTBED_SRCDIR}/pxe \
-L/usr/local/lib
TMLIBS = ${OBJDIR}/lib/libtb/libtb.a
BOOTINFO = ${OBJDIR}/pxe/bootinfo.o ${OBJDIR}/pxe/bootinfo_mysql.o
LDFLAGS += $(LDSTATIC)
......@@ -109,6 +110,15 @@ tmcd: tmcd.c ${TMCDLIBS} decls.h version.o $(SSLOBJ) $(BOOTINFO)
$(LFLAGS) -L/usr/local/lib/mysql -lmysqlclient \
$(ELVINFLAGS) $(TMCDLDFLAGS) $(TMCDLIBS) $(TMLIBS)
newtmcd: newtmcd.c libtmcd.o ${TMCDLIBS} decls.h version.o $(SSLOBJ) $(BOOTINFO)
$(CC) $(CFLAGS) $(SSLFLAGS) $(TMCDCFLAGS) -o tmcd $< \
libtmcd.o version.o $(SSLOBJ) $(BOOTINFO) \
$(LFLAGS) -L/usr/local/lib/mysql -lmysqlclient -lxml2 \
$(ELVINFLAGS) $(TMCDLDFLAGS) $(TMCDLIBS) $(TMLIBS)
libtmcd.o: libtmcd.c ${TMCDLIBS} decls.h version.o $(SSLOBJ) $(BOOTINFO)
$(CC) $(CFLAGS) -I/usr/local/include/libxml2 $(SSLFLAGS) $(TMCDCFLAGS) -c -o libtmcd.o $<
tmcc: tmcc.c decls.h $(SSLOBJ)
$(CC) $(CFLAGS) $(SSLFLAGS) $(LDSTATIC) -g -o tmcc $< $(SSLOBJ) \
$(LFLAGS) $(TMLIBS)
......
This diff is collapsed.
#ifndef _LIBTMCD_H_
#define _LIBTMCD_H_
#include <netinet/in.h>
#include <arpa/inet.h>
#include "tbdefs.h"
/*
* This structure is passed to each request function. The intent is to
* reduce the number of DB queries per request to a minimum.
*/
typedef struct {
int version;
struct in_addr client;
int allocated;
int jailflag;
int isvnode;
int issubnode;
int islocal;
int isssl;
int istcp;
int iscontrol;
int isplabdslice;
int isplabsvc;
int elab_in_elab;
int singlenet; /* Modifier for elab_in_elab */
int update_accounts;
int exptidx;
char nodeid[TBDB_FLEN_NODEID];
char vnodeid[TBDB_FLEN_NODEID];
char pnodeid[TBDB_FLEN_NODEID]; /* XXX */
char pid[TBDB_FLEN_PID];
char eid[TBDB_FLEN_EID];
char gid[TBDB_FLEN_GID];
char nickname[TBDB_FLEN_VNAME];
char type[TBDB_FLEN_NODETYPE];
char class[TBDB_FLEN_NODECLASS];
char ptype[TBDB_FLEN_NODETYPE]; /* Of physnode */
char pclass[TBDB_FLEN_NODECLASS]; /* Of physnode */
char creator[TBDB_FLEN_UID];
char swapper[TBDB_FLEN_UID];
char syncserver[TBDB_FLEN_VNAME]; /* The vname */
char keyhash[TBDB_FLEN_PRIVKEY];
char eventkey[TBDB_FLEN_PRIVKEY];
char sfshostid[TBDB_FLEN_SFSHOSTID];
char testdb[TBDB_FLEN_TINYTEXT];
} tmcdreq_t;
typedef struct {
char *data;
int length;
} tmcdresp_t;
int iptonodeid(struct in_addr, tmcdreq_t *);
int nodeidtoexp(char *nodeid, char *pid, char *eid, char *gid);
int checkprivkey(struct in_addr, char *);
int checkdbredirect(tmcdreq_t *);
void tmcd_free_response(tmcdresp_t *);
tmcdresp_t *tmcd_handle_request(int, char *, char *, tmcdreq_t *);
int tmcd_init(char *, struct in_addr *, int, int);
#endif /* _LIBTMCD_H_ */
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment