summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2018-03-12 20:48:24 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2018-03-13 02:08:29 +0700
commitc08ddc73838b08f9538a966d6ad8f9f8bc856cf9 (patch)
treeae11d19be6463e94ce5d1878fa32e9d44f009a6c
parent4ccb2261b1ac2e207303393fe509878f160dd96b (diff)
fake_trx: unify the GPL license header
There is no need to manually put the license header as a variable in each application in order to print it. Let's use a common one. Change-Id: I1a6e8716a9069e7ade3ae15f2c04fd45d18e223c
-rwxr-xr-xsrc/target/fake_trx/burst_gen.py15
-rwxr-xr-xsrc/target/fake_trx/burst_send.py15
-rwxr-xr-xsrc/target/fake_trx/clck_gen.py18
-rw-r--r--src/target/fake_trx/copyright.py13
-rwxr-xr-xsrc/target/fake_trx/ctrl_cmd.py12
-rwxr-xr-xsrc/target/fake_trx/fake_trx.py17
-rwxr-xr-xsrc/target/fake_trx/trx_sniff.py12
7 files changed, 41 insertions, 61 deletions
diff --git a/src/target/fake_trx/burst_gen.py b/src/target/fake_trx/burst_gen.py
index 179dbcda..6a034cd5 100755
--- a/src/target/fake_trx/burst_gen.py
+++ b/src/target/fake_trx/burst_gen.py
@@ -22,6 +22,9 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+from copyright import print_copyright
+CR_HOLDERS = [("2017-2018", "Vadim Yanitskiy <axilirator@gmail.com>")]
+
import signal
import getopt
import sys
@@ -32,13 +35,6 @@ from data_if import DATAInterface
from gsm_shared import *
from data_msg import *
-COPYRIGHT = \
- "Copyright (C) 2017 by Vadim Yanitskiy <axilirator@gmail.com>\n" \
- "License GPLv2+: GNU GPL version 2 or later " \
- "<http://gnu.org/licenses/gpl.html>\n" \
- "This is free software: you are free to change and redistribute it.\n" \
- "There is NO WARRANTY, to the extent permitted by law.\n"
-
class Application:
# Application variables
remote_addr = "127.0.0.1"
@@ -59,7 +55,7 @@ class Application:
pwr = None
def __init__(self):
- self.print_copyright()
+ print_copyright(CR_HOLDERS)
self.parse_argv()
self.check_argv()
@@ -143,9 +139,6 @@ class Application:
if self.output_file is not None:
self.ddf.append_msg(msg)
- def print_copyright(self):
- print(COPYRIGHT)
-
def print_help(self, msg = None):
s = " Usage: " + sys.argv[0] + " [options]\n\n" \
" Some help...\n" \
diff --git a/src/target/fake_trx/burst_send.py b/src/target/fake_trx/burst_send.py
index 882fcd64..c588b3df 100755
--- a/src/target/fake_trx/burst_send.py
+++ b/src/target/fake_trx/burst_send.py
@@ -21,6 +21,9 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+from copyright import print_copyright
+CR_HOLDERS = [("2017-2018", "Vadim Yanitskiy <axilirator@gmail.com>")]
+
import signal
import getopt
import sys
@@ -30,13 +33,6 @@ from data_if import DATAInterface
from gsm_shared import *
from data_msg import *
-COPYRIGHT = \
- "Copyright (C) 2017-2018 by Vadim Yanitskiy <axilirator@gmail.com>\n" \
- "License GPLv2+: GNU GPL version 2 or later " \
- "<http://gnu.org/licenses/gpl.html>\n" \
- "This is free software: you are free to change and redistribute it.\n" \
- "There is NO WARRANTY, to the extent permitted by law.\n"
-
class Application:
# Application variables
remote_addr = "127.0.0.1"
@@ -56,7 +52,7 @@ class Application:
pf_tn = None
def __init__(self):
- self.print_copyright()
+ print_copyright(CR_HOLDERS)
self.parse_argv()
# Set up signal handlers
@@ -119,9 +115,6 @@ class Application:
# Burst passed ;)
return True
- def print_copyright(self):
- print(COPYRIGHT)
-
def print_help(self, msg = None):
s = " Usage: " + sys.argv[0] + " [options]\n\n" \
" Some help...\n" \
diff --git a/src/target/fake_trx/clck_gen.py b/src/target/fake_trx/clck_gen.py
index e7e58a3b..83c0a64d 100755
--- a/src/target/fake_trx/clck_gen.py
+++ b/src/target/fake_trx/clck_gen.py
@@ -4,7 +4,7 @@
# Virtual Um-interface (fake transceiver)
# Simple TDMA frame clock generator
#
-# (C) 2017 by Vadim Yanitskiy <axilirator@gmail.com>
+# (C) 2017-2018 by Vadim Yanitskiy <axilirator@gmail.com>
#
# All Rights Reserved
#
@@ -22,6 +22,9 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+from copyright import print_copyright
+CR_HOLDERS = [("2017-2018", "Vadim Yanitskiy <axilirator@gmail.com>")]
+
import signal
import time
import sys
@@ -30,13 +33,6 @@ from threading import Timer
from udp_link import UDPLink
from gsm_shared import *
-COPYRIGHT = \
- "Copyright (C) 2017 by Vadim Yanitskiy <axilirator@gmail.com>\n" \
- "License GPLv2+: GNU GPL version 2 or later " \
- "<http://gnu.org/licenses/gpl.html>\n" \
- "This is free software: you are free to change and redistribute it.\n" \
- "There is NO WARRANTY, to the extent permitted by law.\n"
-
class CLCKGen:
# GSM TDMA definitions
SEC_DELAY_US = 1000 * 1000
@@ -99,12 +95,12 @@ class CLCKGen:
# Just a wrapper for independent usage
class Application:
def __init__(self):
+ # Print copyright
+ print_copyright(CR_HOLDERS)
+
# Set up signal handlers
signal.signal(signal.SIGINT, self.sig_handler)
- # Print copyright
- print(COPYRIGHT)
-
def run(self):
self.link = UDPLink("127.0.0.1", 5800, 5700)
self.clck = CLCKGen([self.link], ind_period = 51)
diff --git a/src/target/fake_trx/copyright.py b/src/target/fake_trx/copyright.py
new file mode 100644
index 00000000..3d3597fd
--- /dev/null
+++ b/src/target/fake_trx/copyright.py
@@ -0,0 +1,13 @@
+#!/usr/bin/env python2
+# -*- coding: utf-8 -*-
+
+def print_copyright(holders = []):
+ # Print copyright holders if any
+ for date, author in holders:
+ print("Copyright (C) %s by %s" % (date, author))
+
+ # Print the license header itself
+ print("License GPLv2+: GNU GPL version 2 or later " \
+ "<http://gnu.org/licenses/gpl.html>\n" \
+ "This is free software: you are free to change and redistribute it.\n" \
+ "There is NO WARRANTY, to the extent permitted by law.\n")
diff --git a/src/target/fake_trx/ctrl_cmd.py b/src/target/fake_trx/ctrl_cmd.py
index 83baa197..3526eaa5 100755
--- a/src/target/fake_trx/ctrl_cmd.py
+++ b/src/target/fake_trx/ctrl_cmd.py
@@ -22,6 +22,9 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+from copyright import print_copyright
+CR_HOLDERS = [("2017-2018", "Vadim Yanitskiy <axilirator@gmail.com>")]
+
import signal
import getopt
import select
@@ -29,13 +32,6 @@ import sys
from udp_link import UDPLink
-COPYRIGHT = \
- "Copyright (C) 2017-2018 by Vadim Yanitskiy <axilirator@gmail.com>\n" \
- "License GPLv2+: GNU GPL version 2 or later " \
- "<http://gnu.org/licenses/gpl.html>\n" \
- "This is free software: you are free to change and redistribute it.\n" \
- "There is NO WARRANTY, to the extent permitted by law.\n"
-
class Application:
# Application variables
remote_addr = "127.0.0.1"
@@ -44,7 +40,7 @@ class Application:
fuzzing = False
def __init__(self):
- print(COPYRIGHT)
+ print_copyright(CR_HOLDERS)
self.parse_argv()
# Set up signal handlers
diff --git a/src/target/fake_trx/fake_trx.py b/src/target/fake_trx/fake_trx.py
index a0534fd2..4f0f2828 100755
--- a/src/target/fake_trx/fake_trx.py
+++ b/src/target/fake_trx/fake_trx.py
@@ -4,7 +4,7 @@
# Virtual Um-interface (fake transceiver)
# OsmocomBB <-> OsmoBTS bridge
#
-# (C) 2017 by Vadim Yanitskiy <axilirator@gmail.com>
+# (C) 2017-2018 by Vadim Yanitskiy <axilirator@gmail.com>
#
# All Rights Reserved
#
@@ -22,6 +22,9 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+from copyright import print_copyright
+CR_HOLDERS = [("2017-2018", "Vadim Yanitskiy <axilirator@gmail.com>")]
+
import signal
import getopt
import select
@@ -35,13 +38,6 @@ from fake_pm import FakePM
from udp_link import UDPLink
from clck_gen import CLCKGen
-COPYRIGHT = \
- "Copyright (C) 2017 by Vadim Yanitskiy <axilirator@gmail.com>\n" \
- "License GPLv2+: GNU GPL version 2 or later " \
- "<http://gnu.org/licenses/gpl.html>\n" \
- "This is free software: you are free to change and redistribute it.\n" \
- "There is NO WARRANTY, to the extent permitted by law.\n"
-
class Application:
# Application variables
bts_addr = "127.0.0.1"
@@ -56,7 +52,7 @@ class Application:
randomize_ul_rssi = False
def __init__(self):
- self.print_copyright()
+ print_copyright(CR_HOLDERS)
self.parse_argv()
# Set up signal handlers
@@ -137,9 +133,6 @@ class Application:
# Stop clock generator
self.clck_gen.stop()
- def print_copyright(self):
- print(COPYRIGHT)
-
def print_help(self, msg = None):
s = " Usage: " + sys.argv[0] + " [options]\n\n" \
" Some help...\n" \
diff --git a/src/target/fake_trx/trx_sniff.py b/src/target/fake_trx/trx_sniff.py
index f59e609b..fe1ddb09 100755
--- a/src/target/fake_trx/trx_sniff.py
+++ b/src/target/fake_trx/trx_sniff.py
@@ -21,6 +21,9 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+from copyright import print_copyright
+CR_HOLDERS = [("2018", "Vadim Yanitskiy <axilirator@gmail.com>")]
+
import signal
import getopt
import sys
@@ -30,13 +33,6 @@ import scapy.all
from data_dump import DATADumpFile
from data_msg import *
-COPYRIGHT = \
- "Copyright (C) 2018 by Vadim Yanitskiy <axilirator@gmail.com>\n" \
- "License GPLv2+: GNU GPL version 2 or later " \
- "<http://gnu.org/licenses/gpl.html>\n" \
- "This is free software: you are free to change and redistribute it.\n" \
- "There is NO WARRANTY, to the extent permitted by law.\n"
-
class Application:
# Application variables
sniff_interface = "lo"
@@ -67,7 +63,7 @@ class Application:
lo_trigger = False
def __init__(self):
- print(COPYRIGHT)
+ print_copyright(CR_HOLDERS)
self.parse_argv()
# Open requested capture file