chiark / gitweb /
tuntap seems to sort of work
authorian <ian>
Thu, 26 Dec 2002 16:32:25 +0000 (16:32 +0000)
committerian <ian>
Thu, 26 Dec 2002 16:32:25 +0000 (16:32 +0000)
base/hook.c
base/idtable.c
base/tables-examples.tct
hbytes/hook.c
tuntap/tuntap.c

index b84306a..13f4d02 100644 (file)
@@ -368,9 +368,9 @@ int do_toplevel_dgram_socket(ClientData cd, Tcl_Interp *ip,
   return subcmd->func(0,ip,objc,objv);
 }
 
-int do_toplevel_tuntap_socket(ClientData cd, Tcl_Interp *ip,
-                            const TunSocket_SubCommand *subcmd,
-                            int objc, Tcl_Obj *const *objv) {
+int do_toplevel_tuntap_socket_raw(ClientData cd, Tcl_Interp *ip,
+                                 const TunSocket_SubCommand *subcmd,
+                                 int objc, Tcl_Obj *const *objv) {
   return subcmd->func(0,ip,objc,objv);
 }
 
index d2f3e04..ed5e5e6 100644 (file)
@@ -110,7 +110,7 @@ static void tabledataid_nt_ustr(Tcl_Obj *o) {
   char buf[75];
   const char *prefix;
 
-  prefix= o->internalRep.twoPtrValue.ptr2;
+  prefix= ((IdDataTable*)o->internalRep.twoPtrValue.ptr1)->prefix;
   snprintf(buf,sizeof(buf), "%lu",
           *(unsigned long*)o->internalRep.twoPtrValue.ptr2);
   obj_updatestr_vstringls(o,
index 1a02eb6..f8d44ef 100644 (file)
@@ -22,9 +22,9 @@ Table toplevel TopLevel_Command
        dgram-socket
                subcmd  enum(DgramSocket_SubCommand,"dgram-socket subcommand")
                ...     obj
-       tuntap-socket
-               subcmd  enum(TunSocket_SubCommand,"tuntap-socket subcommand")
-               ...     obj
+       tuntap-socket-raw
+           subcmd enum(TunSocket_SubCommand,"tuntap-socket-raw subcommand")
+           ... obj
        ulong
                subcmd  enum(ULong_SubCommand,"ulong subcommand")
                ...     obj
@@ -183,7 +183,7 @@ Table dgram_socket DgramSocket_SubCommand
                sock    iddata(&dgram_socks)
                ?script obj
 
-Table tuntap_socket TunSocket_SubCommand
+Table tuntap_socket_raw TunSocket_SubCommand
        create
                ?ifname string
                =>      iddata(&tuntap_socks)
index b84306a..13f4d02 100644 (file)
@@ -368,9 +368,9 @@ int do_toplevel_dgram_socket(ClientData cd, Tcl_Interp *ip,
   return subcmd->func(0,ip,objc,objv);
 }
 
-int do_toplevel_tuntap_socket(ClientData cd, Tcl_Interp *ip,
-                            const TunSocket_SubCommand *subcmd,
-                            int objc, Tcl_Obj *const *objv) {
+int do_toplevel_tuntap_socket_raw(ClientData cd, Tcl_Interp *ip,
+                                 const TunSocket_SubCommand *subcmd,
+                                 int objc, Tcl_Obj *const *objv) {
   return subcmd->func(0,ip,objc,objv);
 }
 
index ee8e99e..8de8247 100644 (file)
@@ -1,11 +1,11 @@
 /*
  */
 /*
- * tuntap-socket-rawlinux create [<ifname>] => <sockid>
- * tuntap-socket-rawlinux ifname <sockid> => <ifname>
- * tuntap-socket-rawlinux close <sockid>
- * tuntap-socket-rawlinux receive <sockid> <data>
- * tuntap-socket-rawlinux on-transmit <sockid> <mtu> [<script>]
+ * tuntap-socket-raw create [<ifname>] => <sockid>
+ * tuntap-socket-raw ifname <sockid> => <ifname>
+ * tuntap-socket-raw close <sockid>
+ * tuntap-socket-raw receive <sockid> <data>
+ * tuntap-socket-raw on-transmit <sockid> <mtu> [<script>]
  *    calls, effectively,  eval <script> [list <data> <socket>]
  *    if script not supplied, cancel
  */
@@ -29,8 +29,8 @@ typedef struct TunSocket {
 
 IdDataTable tuntap_socks= { "tuntap" };
 
-int do_tuntap_socket_create(ClientData cd, Tcl_Interp *ip,
-                           const char *ifname, void **sock_r) {
+int do_tuntap_socket_raw_create(ClientData cd, Tcl_Interp *ip,
+                               const char *ifname, void **sock_r) {
   int fd, r;
   struct ifreq ifr;
   TuntapSocket *sock;
@@ -66,8 +66,8 @@ int do_tuntap_socket_create(ClientData cd, Tcl_Interp *ip,
   return TCL_OK;
 }
 
-int do_tuntap_socket_receive(ClientData cd, Tcl_Interp *ip,
-                            void *sock_v, HBytes_Value data) {
+int do_tuntap_socket_raw_receive(ClientData cd, Tcl_Interp *ip,
+                                void *sock_v, HBytes_Value data) {
   TuntapSocket *sock= sock_v;
   int l, r;
 
@@ -78,8 +78,8 @@ int do_tuntap_socket_receive(ClientData cd, Tcl_Interp *ip,
   return TCL_OK;
 }
 
-int do_tuntap_socket_ifname(ClientData cd, Tcl_Interp *ip,
-                           void *sock_v, const char **result) {
+int do_tuntap_socket_raw_ifname(ClientData cd, Tcl_Interp *ip,
+                               void *sock_v, const char **result) {
   TuntapSocket *sock= sock_v;
   *result= sock->ifname;
   return TCL_OK;
@@ -121,8 +121,9 @@ x_rc:
   if (rc) Tcl_BackgroundError(ip);
 }
 
-int do_tuntap_socket_on_transmit(ClientData cd, Tcl_Interp *ip, void *sock_v,
-                                long mtu, Tcl_Obj *newscript) {
+int do_tuntap_socket_raw_on_transmit(ClientData cd, Tcl_Interp *ip,
+                                    void *sock_v,
+                                    long mtu, Tcl_Obj *newscript) {
   TuntapSocket *sock= sock_v;
   int rc;
 
@@ -142,7 +143,7 @@ int do_tuntap_socket_on_transmit(ClientData cd, Tcl_Interp *ip, void *sock_v,
   return TCL_OK;
 }
 
-int do_tuntap_socket_close(ClientData cd, Tcl_Interp *ip, void *sock_v) {
+int do_tuntap_socket_raw_close(ClientData cd, Tcl_Interp *ip, void *sock_v) {
   TuntapSocket *sock= sock_v;
   
   int sockix;