Asterisk - The Open Source Telephony Project GIT-master-7e7a603
Data Structures | Functions | Variables
spandspflow2pcap Namespace Reference

Data Structures

class  FaxPcap
 
class  SkipPacket
 
class  SpandspLog
 

Functions

def main (logname, pcapname)
 
def n2b (text)
 

Variables

bool EMPTY_RECOVERY = False
 
 IFP = namedtuple('IFP', 'date seqno data')
 
bool LOSSY = False
 

Function Documentation

◆ main()

def main (   logname,
  pcapname 
)

Definition at line 239 of file spandspflow2pcap.py.

239def main(logname, pcapname):
240 with open(sys.argv[1], 'r') as infile:
241 log = SpandspLog(infile)
242
243 # with open(sys.argv[2], 'xb') as outfile: # py3 exclusive write, bin
244 create_or_fail = os.O_CREAT | os.O_EXCL | os.O_WRONLY
245 try:
246 fd = os.open(sys.argv[2], create_or_fail, 0o600)
247 except Exception:
248 raise
249 else:
250 with os.fdopen(fd, 'wb') as outfile:
251 pcap = FaxPcap(outfile)
252 for data in log:
253 pcap.add(data)
254
255
def main(logname, pcapname)

References len(), and main().

Referenced by main().

◆ n2b()

def n2b (   text)
Convert "aa bb cc" to bytearray('\xaa\xbb\xcc').

Definition at line 44 of file spandspflow2pcap.py.

44def n2b(text):
45 """
46 Convert "aa bb cc" to bytearray('\xaa\xbb\xcc').
47 """
48 return bytearray(
49 b16decode(text.replace(' ', '').replace('\n', '').upper()))
50
51
static int replace(struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t len)
Definition: func_strings.c:888

References replace().

Referenced by SpandspLog.__iter__().

Variable Documentation

◆ EMPTY_RECOVERY

bool EMPTY_RECOVERY = False

Definition at line 38 of file spandspflow2pcap.py.

◆ IFP

IFP = namedtuple('IFP', 'date seqno data')

Definition at line 41 of file spandspflow2pcap.py.

Referenced by SpandspLog.__iter__(), and FaxPcap.add().

◆ LOSSY

bool LOSSY = False

Definition at line 37 of file spandspflow2pcap.py.