#define THIS_MODULE VLM_controller_connection
 #include "vlog.h"
 
-void
-controller_init(struct controller_connection *cc,
-                const char *name, bool reliable)
+struct controller_connection {
+    bool reliable;
+    const char *name;
+    struct vconn *vconn;
+    bool connected;
+    struct queue txq;
+    time_t backoff_deadline;
+    int backoff;
+};
+
+struct controller_connection *
+controller_new(const char *name, bool reliable)
 {
+    struct controller_connection *cc = xmalloc(sizeof *cc);
     cc->reliable = reliable;
     cc->name = name;
     cc->vconn = NULL;
     queue_init(&cc->txq);
     cc->backoff_deadline = 0;
     cc->backoff = 0;
+    return cc;
 }
 
 static int
 
 #include <stdbool.h>
 #include <time.h>
 
-struct datapath;
-
-struct controller_connection {
-    bool reliable;
-    const char *name;
-    struct vconn *vconn;
-    bool connected;
-    struct queue txq;
-    time_t backoff_deadline;
-    int backoff;
-};
-
-void controller_init(struct controller_connection *,
-                     const char *name, bool reliable);
+struct controller_connection *controller_new(const char *name, bool reliable);
 void controller_run(struct controller_connection *);
 void controller_run_wait(struct controller_connection *);
 void controller_connect(struct controller_connection *);
 
 int
 main(int argc, char *argv[])
 {
-    struct controller_connection cc;
+    struct controller_connection *cc;
     int error;
 
     set_program_name(argv[0]);
         fatal(0, "missing controller argument; use --help for usage");
     }
 
-    controller_init(&cc, argv[optind], reliable);
-    error = dp_new(&dp, dpid, &cc);
+    cc = controller_new(argv[optind], reliable);
+    error = dp_new(&dp, dpid, cc);
     if (error) {
         fatal(error, "could not create datapath");
     }
     for (;;) {
         dp_run(dp);
         fwd_run(dp);
-        controller_run(&cc);
+        controller_run(cc);
         
         dp_wait(dp);
         fwd_run_wait(dp);
-        controller_run_wait(&cc);
+        controller_run_wait(cc);
         poll_block();
     }