Fix definitions and align code, so that trust router code compiles.
authorMargaret Wasserman <mrw@painless-security.com>
Mon, 3 Dec 2012 14:55:11 +0000 (09:55 -0500)
committerMargaret Wasserman <mrw@painless-security.com>
Mon, 3 Dec 2012 14:55:11 +0000 (09:55 -0500)
include/tpq.h
tpq/tpqc.c
tpq/tpqs.c
tr/tr_main.c

index 7748ae3..aa8cb45 100644 (file)
 
 #define TRUST_PATH_QUERY_PORT  12309
 
-typedef void (*TPQC_RESP_FUNC)(TPQC_INSTANCE *, TPQC_REQ *, TPQC_RESP *, void *);
+typedef struct tpq_name {
+  char *buf;
+  int len;
+} TPQ_NAME;
 
-struct tpqc_req_t {
-  struct tpqc_req_t next_req;
-  char realm[1024];
-  char coi[1024];
+typedef struct tpq_req {
+  struct tpq_req *next_req;
+  TPQ_NAME realm;
+  TPQ_NAME coi;
   int conn;
-  TPQC_RESP_FUNC *func
-};
+  void *resp_func;
+  void *cookie;
+} TPQ_REQ;
 
-typedef struct tpqc_req_t TPQC_REQ;
+typedef struct tpq_resp {
+  TPQ_NAME realm;
+  TPQ_NAME coi;
+  /* Address of AAA Server */
+  /* Credentials */
+} TPQ_RESP;
 
-struct tpqc_instance_t {
-  TPQC_REQ *req_list
-};
+typedef struct tpqc_instance {
+  TPQ_REQ *req_list;
+} TPQC_INSTANCE;
 
-typedef void TPQC_RESP;
-
-typedef struct tpqc_instance_t TPQC_INSTANCE;
+typedef void (*TPQC_RESP_FUNC)(TPQC_INSTANCE *, TPQ_REQ *, TPQ_RESP *, void *);
 
 TPQC_INSTANCE *tpqc_create (void);
-void tpqc_release (TPQC_INSTANCE *tpqc);
 int tpqc_open_connection (TPQC_INSTANCE *tpqc, char *server);
-TPQC_REQ *tpqc_send_request (TPQC_INSTANCE *tpqc, int conn, char *realm, char *coi, TPQC_RESP_FUNC *resp_handler);
+int tpqc_send_request (TPQC_INSTANCE *tpqc, int conn, char *realm, char *coi, TPQC_RESP_FUNC *resp_handler);
+void tpqc_destroy (TPQC_INSTANCE *tpqc);
 
 typedef void TPQS_INSTANCE;
 
-TPQS_INSTANCE *tpqs_init ();
+TPQS_INSTANCE *tpqs_create ();
 int tpqs_start (TPQS_INSTANCE *tpqs);
-
+void tpqs_destroy (TPQS_INSTANCE *tpqs);
 
 #endif
index 8fbdacd..085b3d6 100644 (file)
@@ -32,6 +32,8 @@
  *
  */
 
+#include <stdlib.h>
+
 #include <gsscon.h>
 #include <tpq.h>
 
index 271dbb4..6051d73 100644 (file)
  *
  */
 
+#include <stdlib.h>
+
 #include <tpq.h>
 
-TPQS_INSTANCE *tpqs_init ()
+TPQS_INSTANCE *tpqs_create ()
 {
-  TPQS_INSTANCE *t = 0;
-
-  return t;
+  TPQS_INSTANCE *tpqs = 0;
+  tpqs = malloc(sizeof(TPQS_INSTANCE));
+  return tpqs;
 }
 
 int tpqs_start (TPQS_INSTANCE *tpqs)
@@ -47,3 +49,9 @@ int tpqs_start (TPQS_INSTANCE *tpqs)
   return 1;
 }
 
+void tpqs_destroy (TPQS_INSTANCE *tpqs)
+{
+  free(tpqs);
+}
+
+
index ea3a8de..bc57024 100644 (file)
@@ -54,7 +54,7 @@ int main (int argc, const char *argv[])
   }
 
   /* initialize the trust path query server instance */
-  if (0 == (tpqs = tpqs_init ())) {
+  if (0 == (tpqs = tpqs_create ())) {
     printf ("Error initializing Trust Path Query Server instance.\n", err);
     return 1;
   }
@@ -68,5 +68,6 @@ int main (int argc, const char *argv[])
   /* start the trust router protocol engine -- TBD */
   while (1);
 
+  tpqs_destroy(tpqs);
   return 0;
 }