commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] gnuradio-examples/python/gmsk2 receive_path.py ...


From: Eric Blossom
Subject: [Commit-gnuradio] gnuradio-examples/python/gmsk2 receive_path.py ...
Date: Tue, 20 Jun 2006 06:15:37 +0000

CVSROOT:        /sources/gnuradio
Module name:    gnuradio-examples
Changes by:     Eric Blossom <eb>       06/06/20 06:15:37

Modified files:
        python/gmsk2   : receive_path.py tunnel_ip_null_mac.py 

Log message:
        working work-in-progress ;) Still a bit of cleanup to do

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnuradio-examples/python/gmsk2/receive_path.py?cvsroot=gnuradio&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnuradio-examples/python/gmsk2/tunnel_ip_null_mac.py?cvsroot=gnuradio&r1=1.12&r2=1.13

Patches:
Index: receive_path.py
===================================================================
RCS file: /sources/gnuradio/gnuradio-examples/python/gmsk2/receive_path.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- receive_path.py     20 Jun 2006 03:52:01 -0000      1.10
+++ receive_path.py     20 Jun 2006 06:15:37 -0000      1.11
@@ -87,7 +87,7 @@
 
         # Carrier Sensing Blocks
         alpha = 0.001
-        thresh = 10   # in dB, will have to adjust
+        thresh = 30   # in dB, will have to adjust
         self.probe = gr.probe_avg_mag_sqrd_c(thresh,alpha)
         fg.connect(self.chan_filt,self.probe)
 

Index: tunnel_ip_null_mac.py
===================================================================
RCS file: 
/sources/gnuradio/gnuradio-examples/python/gmsk2/tunnel_ip_null_mac.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- tunnel_ip_null_mac.py       19 Jun 2006 22:22:01 -0000      1.12
+++ tunnel_ip_null_mac.py       20 Jun 2006 06:15:37 -0000      1.13
@@ -41,15 +41,30 @@
 #raw_input('Attach and press enter')
 
 
+# /////////////////////////////////////////////////////////////////////////////
+#
+#   Use the Universal TUN/TAP device driver to moves packets to/from kernel
+#
+# See /usr/src/linux/Documentation/networking/tuntap.txt
+#
+# /////////////////////////////////////////////////////////////////////////////
+
 # Linux specific...
+# TUNSETIFF ifr flags from <linux/tun_if.h>
+
+IFF_TUN                = 0x0001   # tunnel IP packets
+IFF_TAP                = 0x0002   # tunnel ethernet frames
+IFF_NO_PI      = 0x1000   # don't pass extra packet info
+IFF_ONE_QUEUE  = 0x2000   # beats me ;)
+
 def open_tun_interface(tun_device_filename):
     from fcntl import ioctl
     
-    TUNMODE = 0x0001
+    mode = IFF_TAP | IFF_NO_PI
     TUNSETIFF = 0x400454ca
 
     tun = os.open(tun_device_filename, os.O_RDWR)
-    ifs = ioctl(tun, TUNSETIFF, struct.pack("16sH", "gr%d", TUNMODE))
+    ifs = ioctl(tun, TUNSETIFF, struct.pack("16sH", "gr%d", mode))
     ifname = ifs[:16].strip("\x00")
     return (tun, ifname)
     
@@ -165,7 +180,8 @@
         min_delay = 0.001               # seconds
 
         while 1:
-            payload = os.read(self.tun_fd, self.mtu)
+            #payload = os.read(self.tun_fd, self.mtu)
+            payload = os.read(self.tun_fd, 2*self.mtu)
             if not payload:
                 self.fg.send_pkt(eof=True)
                 break




reply via email to

[Prev in Thread] Current Thread [Next in Thread]