code
stringlengths
2
1.05M
repo_name
stringlengths
5
104
path
stringlengths
4
251
language
stringclasses
1 value
license
stringclasses
15 values
size
int32
2
1.05M
# Copyright (c) 2010 Resolver Systems Ltd. # All Rights Reserved # from functionaltest import FunctionalTest class Test_2595_Throbber(FunctionalTest): def test_spinner_appears_during_recalcs(self): # * Harold likes to know when dirigible is working hard on his calculations # * He logs in and creates a new sheet self.login_and_create_new_sheet() # * When the grid has appeared, the spinner might be visible, but it disappears # rapidly as the initial empty recalc completes. self.wait_for_spinner_to_stop() # * and enters some hard-working user-code self.append_usercode('import time\ntime.sleep(20)\nworksheet[1,1].value="ready"') # * He spots the spinner on the page self.wait_for(self.is_spinner_visible, lambda : 'spinner not present', timeout_seconds = 5) # * When the recalc is done, he sees the spinner go away self.wait_for_cell_value(1, 1, 'ready', timeout_seconds=25) self.assertTrue(self.is_element_present('css=#id_spinner_image.hidden'))
jmptrader/dirigible-spreadsheet
dirigible/fts/tests/test_2595_Spinner.py
Python
mit
1,149
#!/usr/bin/env python # coding:utf-8 import select import socket from nbNetUtils import DEBUG, dbgPrint __all__ = ["nbNet"] class STATE: def __init__(self): self.state = "accept" # 定义状态 self.have_read = 0 # 记录读了的字节 self.need_read = 10 # 头文件需要读取10个字节 self.have_write = 0 # 记录读了的字节 self.need_write = 0 # 需要写的字节 self.buff_read = "" # 读缓存 self.buff_write = "" # 写缓存 self.sock_obj = "" # sock对象 def printState(self): if DEBUG: dbgPrint('\n - current state of fd: %d' % self.sock_obj.fileno()) dbgPrint(" - - state: %s" % self.state) dbgPrint(" - - have_read: %s" % self.have_read) dbgPrint(" - - need_read: %s" % self.need_read) dbgPrint(" - - have_write: %s" % self.have_write) dbgPrint(" - - need_write: %s" % self.need_write) dbgPrint(" - - buff_read: %s" % self.buff_read) dbgPrint(" - - buff_write: %s" % self.buff_write) dbgPrint(" - - sock_obj: %s" % self.sock_obj) class nbNetBase: def setFd(self, sock): dbgPrint("\n setFd start") tmp_state = STATE() # 实例化类 tmp_state.sock_obj = sock # 定义类中sock self.conn_state[sock.fileno()] = tmp_state # 把sock加入到字典中 self.conn_state[sock.fileno()].printState() dbgPrint("\n setFd end") def accept(self, fd): dbgPrint("\n accept start!") sock_state = self.conn_state[fd] # 取出fd对应连接 sock = sock_state.sock_obj # 取出fd的sock conn, addr = sock.accept() # 取出连接请求 conn.setblocking(0) # 设置非阻塞模式 return conn # 返回连接 def close(self, fd): try: sock = self.conn_state[fd].sock_obj # 取出fd的sock sock.close() # 关闭sock except: dbgPrint("Close fd: %s" % fd) finally: self.epoll_sock.unregister(fd) # 将fd重epoll中注销 self.conn_state.pop(fd) # 踢出字典 def read(self, fd): try: sock_state = self.conn_state[fd] # 取出fd对应连接 conn = sock_state.sock_obj # 取出fd连接请求 if sock_state.need_read <= 0: # 需要读取字节为空报错 raise socket.error one_read = conn.recv(sock_state.need_read) # 读取传输的字符 dbgPrint("\n func fd: %d, one_read: %s, need_read: %d" % (fd, one_read, sock_state.need_read)) if len(one_read) == 0: # 读取数据为0报错 raise socket.error sock_state.buff_read += one_read # 把读取数据存到读缓存中 sock_state.have_read += len(one_read) # 已经读取完的数据量 sock_state.need_read -= len(one_read) # 还需要读取数据的量 sock_state.printState() if sock_state.have_read == 10: # 10字节为头文件处理 header_said_need_read = int(sock_state.have_read) # 读取数据的量 if header_said_need_read <= 0: # 如果还需读0字节报错 raise socket.error sock_state.need_read += header_said_need_read # 还需读取数量变化 sock_state.buff_read = '' # 读缓存清空 sock_state.printState() return "readcontent" # 还需读取数据 elif sock_state.need_read == 0: return "process" # 读取数据完成,转换状态 else: return "readmore" # 还需读取数据 except (socket.error, ValueError), msg: try: if msg.errno == 11: # errno等于11,尝试进行一次读取 dbgPrint("11" + msg) return "retry" except: pass return "closing" def write(self, fd): sock_state = self.conn_state[fd] # 取出fd对应的连接构造体 conn = sock_state.sock_obj # 取出fd对于连接 last_have_send = sock_state.have_write # 已经写数据的量 try: have_send = conn.send( sock_state.buff_write[last_have_send:]) # 发送剩下的数据 sock_state.have_write += have_send # 已经写的数据量 sock_state.need_write -= have_send # 还需写的数据量 if sock_state.need_write == 0 and sock_state.have_write != 0: # 写数据完成 sock_state.printState() dbgPrint("\n write date end") return "writecomplete" # 返回写入完成 else: return "writemore" # 返回计算写入 except socket.error, msg: return "closing" def run(self): while True: epoll_list = self.epoll_sock.poll() # 定义poll()事件发生的list for fd, events in epoll_list: sock_state = self.conn_state[fd] # 取出fd构造体 if select.EPOLLHUP & events: # 文件描述符挂断 dbgPrint("EPOLLHUP") sock_state.state = "closing" # fd状态设置为closing elif select.EPOLLERR & events: dbgPrint("EPOLLERR") # 文件描述符出错 sock_state.state = "closing" # 对应fd状态为closing self.state_machine(fd) # 状态机调用 def state_machine(self, fd): sock_state = self.conn_state[fd] # fd构造体 self.sm[sock_state.state](fd) # 通过sm字典调用对应状态的函数 class nbNet(nbNetBase): def __init__(self, addr, port, logic): dbgPrint('\n__init__: start!') self.conn_state = {} # 定义字典保存每个连接状态 self.listen_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) self.listen_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.listen_sock.bind((addr, port)) self.listen_sock.listen(10) # 排队长度 self.setFd(self.listen_sock) # 定义listen socket 放入字典conn_state self.epoll_sock = select.epoll() # 初始化fd的epoll self.epoll_sock.register( self.listen_sock.fileno(), select.EPOLLIN) # linten可以读的描述符 self.logic = logic # 业务处理 self.sm = { "accept": self.accept2read, "read": self.read2process, "write": self.write2read, "process": self.process, "closing": self.close, } # 状态调用机的字典 dbgPrint('\n__init__: end, register no: %s' % self.listen_sock.fileno()) def process(self, fd): sock_state = self.conn_state[fd] response = self.logic(sock_state.buff_read) # 业务函数处理 sock_state.buff_write = "%010d%s" % (len(response), response) # 发送的数据 sock_state.need_write = len(sock_state.buff_write) # 需要发送的长度 sock_state.state = "write" # fd对应的状态 self.epoll_sock.modify(fd, select.EPOLLOUT) # fd对应的epoll为改写模式 sock_state.printState() def accept2read(self, fd): conn = self.accept(fd) self.epoll_sock.register( conn.fileno(), select.EPOLLIN) # 发送数据后重新将fd的epoll改成读 self.setFd(conn) # fd生成构造体 self.conn_state[conn.fileno()].state = "read" # fd状态为read dbgPrint("\n -- accept end!") def read2process(self, fd): read_ret = "" # 状态转换 try: read_ret = self.read(fd) # read函数返回值 except (Exception), msg: dbgPrint(msg) read_ret = "closing" if read_ret == "process": # 读取完成,转换到process self.process(fd) elif read_ret == "readcontent": # readcontent、readmore、retry 继续读取 pass elif read_ret == "readmore": pass elif read_ret == "retry": pass elif read_ret == "closing": self.conn_state[fd].state = 'closing' # 状态为closing关闭连接 self.state_machine(fd) else: raise Exception("impossible state returned by self.read") def write2read(self, fd): try: write_ret = self.write(fd) # 函数write返回值 except socket.error, msg: # 出错关闭连接 write_ret = "closing" if write_ret == "writemore": # 继续写 pass elif write_ret == "writecomplete": # 写完成 sock_state = self.conn_state[fd] conn = sock_state.sock_obj self.setFd(conn) # 重置见连接fd构造体 self.conn_state[fd].state = "read" # 将fd状态设置为read self.epoll_sock.modify(fd, select.EPOLLIN) # epoll状态为可读 elif write_ret == "closing": # 发生错误关闭 dbgPrint(msg) self.conn_state[fd].state = 'closing' self.state_machine(fd) if __name__ == '__main__': def logic(d_in): return(d_in[::-1]) reverseD = nbNet('0.0.0.0', 9060, logic) reverseD.run()
VictorXianwu/Python-Program
net/cpNbnet.py
Python
mit
9,406
''' Created on 20 Sep 2013 @author: jowr ''' # New example with R407F mixture from pyrp.refpropClasses import RefpropSI import CoolProp.CoolProp as cp p = 30000 T = 273.15 ref = False if ref: xkg = [0.473194694453358, 0.205109095413331, 0.321696210133311] names = "R32|R125|R134a" RP = RefpropSI() RP.SETUPFLEX(xkg=xkg, FluidNames=names) T_A, p_A, D_A, Dl_A, Dv_A, q_A, e_A, h_A, s_A, cv_A, cp_A, w_A = RP.PQFLSH(p, 0) T_B, p_B, D_B, Dl_B, Dv_B, q_B, e_B, h_B, s_B, cv_B, cp_B, w_B = RP.PQFLSH(p, 1) T_C, p_C, D_C, Dl_C, Dv_C, q_C, e_C, h_C, s_C, cv_C, cp_C, w_C = RP.TQFLSH(T, 0) hlb = h_A / 1000. hrb = h_B / 1000. h200 = h_C / 1000. print("Refprop: %s %s %s" % (hlb, hrb, h200)) else: R407F = 'REFPROP-MIX:R32[0.473194694453358]&R125[0.205109095413331]&R134a[0.321696210133311]' # R407F='REFPROP-MIX:R32[0.651669604033581]&R125[0.122438378639971]&R134a[0.225892017326446]' hlb = cp.Props('H', 'P', 30, 'Q', 0, R407F) # 30 kPa saturated liquid hrb = cp.Props('H', 'P', 30, 'Q', 1, R407F) # 30 kPa saturated vapour h200 = cp.Props('H', 'T', 273.15, 'Q', 0, R407F) # saturated liquid at 0C IIR print("CoolProp: %s %s %s" % (hlb, hrb, h200))
henningjp/CoolProp
dev/Tickets/SF-89.py
Python
mit
1,217
# PyMM - Python MP3 Manager # Copyright (C) 2000 Pierre Hjalm <[email protected]> # # Modified by Alexander Kanavin <[email protected]> # Removed ID tags support and added VBR support # Used http://home.swipnet.se/grd/mp3info/ for information # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. """ mp3.py Reads information from an mp3 file. This is a python port of code taken from the mpg123 input module of xmms. """ import struct def header(buf): return struct.unpack(">I",buf)[0] def head_check(head): if ((head & 0xffe00000L) != 0xffe00000L): return 0 if (not ((head >> 17) & 3)): return 0 if (((head >> 12) & 0xf) == 0xf): return 0 if ( not ((head >> 12) & 0xf)): return 0 if (((head >> 10) & 0x3) == 0x3): return 0 if (((head >> 19) & 1) == 1 and ((head >> 17) & 3) == 3 and ((head >> 16) & 1) == 1): return 0 if ((head & 0xffff0000L) == 0xfffe0000L): return 0 return 1 def filesize(file): """ Returns the size of file sans any ID3 tag """ f=open(file) f.seek(0,2) size=f.tell() try: f.seek(-128,2) except: f.close() return 0 buf=f.read(3) f.close() if buf=="TAG": size=size-128 if size<0: return 0 else: return size table=[[ [0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448], [0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384], [0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320]], [ [0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256], [0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160], [0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160]]] def decode_header(head): """ Decode the mp3 header and put the information in a frame structure """ freqs=[44100, 48000, 32000, 22050, 24000, 16000, 11025, 12000, 8000] fr={} if head & (1 << 20): if head & (1 << 19): fr["lsf"]=0 else: fr["lsf"]=1 fr["mpeg25"] = 0 else: fr["lsf"] = 1 fr["mpeg25"] = 1 fr["lay"] = 4 - ((head >> 17) & 3) if fr["mpeg25"]: fr["sampling_frequency"] = freqs[6 + ((head >> 10) & 0x3)] else: fr["sampling_frequency"] = freqs[((head >> 10) & 0x3) + (fr["lsf"] * 3)] fr["error_protection"] = ((head >> 16) & 0x1) ^ 0x1 fr["bitrate_index"] = ((head >> 12) & 0xf) fr["bitrate"]=table[fr["lsf"]][fr["lay"]-1][fr["bitrate_index"]] fr["padding"]=((head>>9) & 0x1) fr["channel_mode"]=((head>>6) & 0x3) if fr["lay"]==1: fr["framesize"]=table[fr["lsf"]][0][fr["bitrate_index"]]*12000 fr["framesize"]=fr["framesize"]/fr["sampling_frequency"] fr["framesize"]=((fr["framesize"]+fr["padding"])<<2)-4 elif fr["lay"]==2: fr["framesize"]=table[fr["lsf"]][1][fr["bitrate_index"]]*144000 fr["framesize"]=fr["framesize"]/fr["sampling_frequency"] fr["framesize"]=fr["framesize"]+fr["padding"]-1 elif fr["lay"]==3: fr["framesize"]=table[fr["lsf"]][2][fr["bitrate_index"]]*144000 fr["framesize"]=fr["framesize"]/fr["sampling_frequency"]<<fr["lsf"] fr["framesize"]=fr["framesize"]+fr["padding"]-4 pass else: return 0 return fr def decode_vbr(buf): vbr = {} if buf[:4] != "Xing": return 0 frames_flag = ord(buf[7]) & 1 if not frames_flag: return 0 vbr["frames"] = header(buf[8:]) return vbr def decode_synch_integer(buf): return (ord(buf[0])<<21)+(ord(buf[1])<<14)+(ord(buf[2])<<7)+ord(buf[3]) def detect_mp3(filename): """ Determines whether this is an mp3 file and if so reads information from it. """ try: f=open(filename,"rb") except: return 0 try: tmp=f.read(4) except: f.close() return 0 if tmp[:3] == 'ID3': try: tmp = f.read(6) f.seek(decode_synch_integer(tmp[2:])+10) tmp=f.read(4) except: f.close() return 0 try: head=header(tmp) except: return 0 while not head_check(head): # This is a real time waster, but an mp3 stream can start anywhere # in a file so we have to search the entire file which can take a # while for large non-mp3 files. try: buf=f.read(1024) except: f.close() return 0 if buf=="": f.close() return 0 for i in range(0,len(buf)-1): head=long(head)<<8; head=head|ord(buf[i]) if head_check(head): f.seek(i+1-len(buf),1) break mhead=decode_header(head) if mhead: # Decode VBR header if there's any. pos = f.tell() mhead["vbr"] = 0 if not mhead["lsf"]: if mhead["channel_mode"] == 3: vbrpos = 17 else: vbrpos = 32 else: if mhead["channel_mode"] == 3: vbrpos = 9 else: vbrpos = 17 try: f.seek(vbrpos,1) vbr = decode_vbr(f.read(12)) mhead["vbrframes"] = vbr["frames"] if mhead["vbrframes"] >0: mhead["vbr"] = 1 except: pass # We found something which looks like a MPEG-header # We check the next frame too, to be sure if f.seek(pos+mhead["framesize"]): f.close() return 0 try: tmp=f.read(4) except: f.close() return 0 if len(tmp)!=4: f.close() return 0 htmp=header(tmp) if not (head_check(htmp) and decode_header(htmp)): f.close() return 0 f.close() # If we have found a valid mp3 add some more info the head data. if mhead: mhead["filesize"]=filesize(filename) if not mhead["vbr"]: if mhead["bitrate"] and mhead["filesize"]: mhead["time"]=int(float(mhead["filesize"])/(mhead["bitrate"]*1000)*8) else: mhead["time"]=0 else: if mhead["filesize"] and mhead["sampling_frequency"]: medframesize = float(mhead["filesize"])/float(mhead["vbrframes"]) if mhead["lsf"]: coef = 12 else: coef = 144 vbrrate = medframesize*mhead["sampling_frequency"]/(1000*coef) mhead["time"]=int(float(mhead["filesize"])/(vbrrate*1000)*8) mhead["vbrrate"] = int(vbrrate) return mhead else: return 0 if __name__=="__main__": import sys mp3info=detect_mp3(sys.argv[1]) if mp3info: print mp3info else: print "Not an mp3 file."
JoeGermuska/worblehat
reference/pyarchive/pyarchive/mp3.py
Python
mit
7,381
# usr/bin/sh # -*- coding:utf8 -*- # @function listDeal # @parma {list} list def listDeal(list): listString = '' for i in range(0,len(list)): print(i) if i!=(len(list)-1): listString += list[i]+','; else: listString += 'and '+list[i] print(listString) spam = ['apples','bananas','tofu','cats'] listDeal(spam)
liuyepiaoxiang/es6-learning
032-python/chap2/4.9.py
Python
mit
369
#!/usr/bin/python import os,sys,glob,re import numpy as np import scipy from scipy import stats import datetime import time from datetime import timedelta #import matplotlib #matplotlib.use('Agg') #import matplotlib.pyplot as plt #from matplotlib import colors as c #from matplotlib import cm from scipy.stats.kde import gaussian_kde from numpy import linspace from scipy.stats import kruskal #from scipy.stats import nanmean #from scipy.stats import nanmedian import pandas as pd import statsmodels.api as sm from scipy.stats import mstats #freqlist = ["numberofbouts_min", "numberofbouts_10min", "dpixnumberofbouts_min", "dpixnumberofbouts_10min", "aveinterboutinterval_min", "aveinterboutinterval_10min", "avedpixinterboutinterval_min", "avedpixinterboutinterval_10min", "dpixsecpermin", "dpixminper10min", "distsecpermin", "distminper10min"] #loclist = ["interboutcenterfrac", "interboutaverhofrac", "centerfrac", "averhofrac"] #featlist = ["dpixavebouttime_min", "dpixavebouttime_10min", "aveboutvel_min", "aveboutvel_10min", "avebouttime_min", "avebouttime_10min", "aveboutspeed_min", "aveboutspeed_10min", "aveboutdist_min", "aveboutdist_10min", "aveboutdisp_min", "aveboutdisp_10min", "aveboutcumdpix_min", "aveboutcumdpix_10min"] nonstimcombos = {"Frequency of movement": ["numberofbouts_min", "numberofbouts_10min", "dpixnumberofbouts_min", "dpixnumberofbouts_10min", "aveinterboutinterval_min", "aveinterboutinterval_10min", "avedpixinterboutinterval_min", "avedpixinterboutinterval_10min", "dpixsecper_min", "dpixminper_10min", "distsecper_min", "distminper_10min"], "Location in well": ["interboutcenterfrac_min", "interboutaverhofrac_min", "centerfrac_min", "averhofrac_min","interboutcenterfrac_10min", "interboutaverhofrac_10min", "centerfrac_10min", "averhofrac_10min"], "Features of movement": ["dpixavebouttime_min", "dpixavebouttime_10min", "aveboutvel_min", "aveboutvel_10min", "avebouttime_min", "avebouttime_10min", "aveboutspeed_min", "aveboutspeed_10min", "aveboutdist_min", "aveboutdist_10min", "aveboutdisp_min", "aveboutdisp_10min", "aveboutcumdpix_min", "aveboutcumdpix_10min"]} typecombos = [["Night tap habituation", "Day tap habituation 1", "Day tap habituation 2", "Day tap habituation 3"], ["Day light flash", "Night light flash"],["Night early prepulse tap", "Day early prepulse tap"], ["Night all prepulse tap", "Day all prepulse tap"], ["Day all strong tap", "Night all strong tap"], ["Day early strong tap","Night early strong tap"],["Night early weak tap", "Day early weak tap"], ["Day all weak tap", "Night all weak tap"], ["Dark flash block 3 start","Dark flash block 3 end","Dark flash block 4 start","Dark flash block 4 end","Dark flash block 1 start","Dark flash block 1 end","Dark flash block 2 start","Dark flash block 2 end"]] stimcombos = { #"Day light flash and weak tap": ["106106"], #"Night light flash and weak tap": ["night106106"], "Night tap habituation": ["nighttaphab102", "nighttaphab1"], "Day tap habituation 1": ["adaytaphab102", "adaytaphab1"], "Day tap habituation 3": ["cdaytaphab102", "cdaytaphab1"], "Day tap habituation 2": ["bdaytaphab102", "bdaytaphab1"], "Day light flash": ["lightflash104"], #"Day light flash": ["lightflash104", "lightflash0"], "Night light flash": ["nightlightflash104"], #"Night light flash": ["nightlightflash104", "nightlightflash0"], "Night early prepulse tap": ["shortnightprepulseinhibition100b"], #"Night early prepulse tap": ["shortnightprepulseinhibition100b", "shortnightprepulseinhibition100c"], "Night all prepulse tap": ["nightprepulseinhibition100b"], #"Night all prepulse tap": ["nightprepulseinhibition100b", "nightprepulseinhibition100c"], "Day early prepulse tap": ["shortdayprepulseinhibition100b"], #"Day early prepulse tap": ["shortdayprepulseinhibition100b", "shortdayprepulseinhibition100c"], "Day all prepulse tap": ["dayprepulseinhibition100b"], #"Day all prepulse tap": ["dayprepulseinhibition100b", "dayprepulseinhibition100c"], "Day all weak tap": ["dayprepulseinhibition100a", "dayprepulseinhibition101"], "Day early weak tap": ["shortdayprepulseinhibition100a", "shortdayprepulseinhibition101"], "Night all weak tap": ["nightprepulseinhibition100a", "nightprepulseinhibition101"], "Night early weak tap": ["shortnightprepulseinhibition100a", "shortnightprepulseinhibition101"], "Day early strong tap": ["adaytappre102", "shortdayprepulseinhibition102"], #"Day early strong tap": ["adaytappre102", "adaytappre1", "shortdayprepulseinhibition102"], "Day all strong tap": ["dayprepulseinhibition102", "adaytappostbdaytappre102","bdaytappostcdaytappre102", "cdaytappost102"], #"Day all strong tap": ["dayprepulseinhibition102", "adaytappostbdaytappre102","bdaytappostcdaytappre102", "bdaytappostcdaytappre1", "cdaytappost1", "cdaytappost102","adaytappostbdaytappre1"], "Night early strong tap": ["nighttappre102"], #"Night early strong tap": ["nighttappre1", "nighttappre102"], "Night all strong tap": ["nightprepulseinhibition102","nighttappost102"], #"Night all strong tap": ["nightprepulseinhibition102","nighttappost102", "nighttappost1"], #"Dark flash all blocks": ["darkflash103", "darkflash0"], "Dark flash block 3 start": ["cdarkflash103"], "Dark flash block 3 end": ["c2darkflash103"], "Dark flash block 1 start": ["adarkflash103"], "Dark flash block 1 end": ["a2darkflash103"], "Dark flash block 2 start": ["bdarkflash103"], "Dark flash block 2 end": ["b2darkflash103"], "Dark flash block 4 start": ["ddarkflash103"], "Dark flash block 4 end": ["d2darkflash103"]} # "Dark flash block 3 start": ["cdarkflash103", "cdarkflash0"], # "Dark flash block 3 end": ["c2darkflash103", "c2darkflash0"], # "Dark flash block 1 start": ["adarkflash103", "adarkflash0"], # "Dark flash block 1 end": ["a2darkflash103", "a2darkflash0"], # "Dark flash block 2 start": ["bdarkflash103", "bdarkflash0"], # "Dark flash block 2 end": ["b2darkflash103", "b2darkflash0"], # "Dark flash block 4 start": ["ddarkflash103", "ddarkflash0"], # "Dark flash block 4 end": ["d2darkflash103", "d2darkflash0"]} #direction = { # "aveboutspeed": 1 # "aveboutspeed": 1 # ones that are opposite of expected # fullboutdatamaxloc (max peak location (larger is less strong of response)) # latency (longer is less good), similar to max peak # aveinterboutinterval # rho or centerfrac, not sure which orientation would want # make wall-hugging positive # lower centerfrac means more positive, which is how it is right now I think, yes, so if I default everything to switching signs, then averhofrac is the odd one out and should be skipped # for most, larger should mean - and should mean mutant is stronger response or more movement # need to make most into opposite # standard # cumdpix, displacement, distance, speed, velocity, secpermin, numberofbouts, frequency of response, polygonarea # unsure - fullboutdata as done with linear model, and also the dark flash ones done with linear model #} direction_swaps = ["rhofrac", "latency", "interboutinterval", "fullboutdatamaxloc"] for file in glob.glob("*linearmodel*"): # THIS IS WHAT THE PRINT OUTPUT MUST POINT TO, CAN HAVE SOMETHING AT END, BUT MUST START THIS WAY if "finalsorted" in file: continue dir = os.path.basename(os.path.dirname(os.path.realpath(__file__))) ffile = open('finalsortedupdatedCP4or2_' + file + "_" + dir, 'w') ofile = open(file, 'r') lines = ofile.readlines() pdict = {} for line in lines: # anova data if line.startswith("anova:"): pval = line.split(":")[3].strip().split()[3].strip() #anova: ribgraph_mean_ribbon_latencyresponse_dpix_nighttappost102.png : Mean of array wt, mut, H-stat, P-value: 25.8557471264 21.4177419355 2.63243902441 0.104700765405 meanwtminmut = float(line.split(":")[3].strip().split()[0]) - float(line.split(":")[3].strip().split()[1]) name = line.split(":")[1].strip() pdict[name] = [pval, meanwtminmut] # ffile.write(str(pval)) # ffile.write(', ') # ffile.write(str(meanwtminmut)) # ffile.write(', ') # ffile.write(name.strip()) # ffile.write('\n') # linear mixed model data - this formatting could change if I change the linear model I'm using else: list = [] for line in range(0, len(lines)): #print lines[line] if lines[line].startswith("mutornot[T.wt] "): #print lines[line] if len(lines[line].split()) > 3: pvalue = lines[line].split()[4] coef = lines[line].split()[1] if float(pvalue) == 0: pvalue = 0.001 list.append((float(pvalue), float(coef), lines[line-13].strip())) #list.append((float(pvalue), lines[line-13].strip(), lines[line].split()[1:6])) # list2 = sorted(list, key=lambda x: x[0]) for fline in list: #pdict[str(fline[2])] = (str(fline[0])[:8], str(fline[1])[:8]) pdict[str(fline[2])] = [str(fline[0])[:8], str(fline[1])[:8]] #ffile.write(str(fline[0])[:8]) #ffile.write(', ') #ffile.write(str(fline[1])[:8]) #ffile.write(', ') #ffile.write(str(fline[2])) #ffile.write('\n') splitdict = {} for k in pdict: # k = ribgraph_mean_ribbonbout_dpixavebouttime_min_day1taps.png # section = day1taps # or section = adaytappostbdaytappre102 if k.startswith("ratio"): continue section = k.split('.')[0].split('_')[-1] for k2 in nonstimcombos.keys(): # k2 = "Frequency of movement" for v2 in nonstimcombos[k2]: # v2 = numberofbouts_min if v2 in k: test = False for k3 in splitdict.keys(): if (k2 + " " + section) == k3: test = True if test == False: splitdict[k2 + " " + section] = [] splitdict[k2 + " " + section].append([k,pdict[k]]) else: splitdict[k2 + " " + section].append([k,pdict[k]]) break for sk2 in stimcombos.keys(): # sk2 = "Night light flash" for sv2 in stimcombos[sk2]: # sv2 = nightlightflash104 if sv2 == k.split('.')[0].split('_')[-1]: # combining everything for these stimuli responses test = False for sk3 in splitdict.keys(): if sk2 == sk3: test = True if test == False: splitdict[sk2] = [] splitdict[sk2].append([k,pdict[k]]) else: splitdict[sk2].append([k,pdict[k]]) break for skey in splitdict.keys(): lowest = 10 listints = [] cutpoint = 0.05 cutpointnumber = 3 if skey in stimcombos.keys(): cutpointnumber = 4 else: cutpointnumber = 3 cutlist = [] for t in typecombos: for tt in t: if skey == tt: #cutpointnumber = 4 #print "TEST", skey, t import copy shortt = copy.copy(t) shortt.remove(tt) #print shortt for svey0 in splitdict[skey]: if abs(float(svey0[1][0])) < cutpoint: if "bigmovesribgraph_mean_ribbon_freqresponse_dpix_" in svey0[0] and "100b.png" in svey0[0]: cutpointnumber = 0 #print "testing1 ", skey, svey0 for ttt in shortt: for tsvey in splitdict[ttt]: #print "testing3", ttt, tsvey if '_'.join(svey0[0].split('.')[0].split('_')[:-1]) == '_'.join(tsvey[0].split('.')[0].split('_')[:-1]): #print "testing4", ttt, tsvey, '_'.join(svey0[0].split('.')[0].split('_')[:-1]), '_'.join(tsvey[0].split('.')[0].split('_')[:-1]) if abs(float(tsvey[1][0])) < cutpoint: #print "testing5", tsvey cutpointnumber = 2 break for svey in splitdict[skey]: switch = False for x in direction_swaps: if x in svey[0]: switch = True if switch == False: if float(svey[1][1]) > 0: # change the sign of the original data # if wt is moving more than mutant (>0), want signs swapped so mutant is over wt (ie, mutant moving less than wt has - number) svey[1][0] = float(svey[1][0]) * -1 # else, data is fine as is else: # switch == True # in the cases where a switch is needed for the sign (such as interboutinterval because it's opposite when considering frequency) if float(svey[1][1]) < 0: # if wt has greater interboutinterval and then the number is positive (ie, mutant moves more), don't swap, do swap if < # change the sign of the original data svey[1][0] = float(svey[1][0]) * -1 #lowest = 10 #listints = [] #cutpoint = 0.05 #cutpointnumber = 3 #cutlist = [] for svey in splitdict[skey]: #print skey, svey listints.append(float(svey[1][0])) if abs(float(svey[1][0])) < abs(lowest): lowest = float(svey[1][0]) if abs(float(svey[1][0])) < cutpoint: cutlist.append(float(svey[1][0])) ave = np.mean(np.absolute(np.asarray(listints))) if lowest < 0: ave = ave * -1 if len(cutlist) > cutpointnumber: cutave = np.mean(np.absolute(np.asarray(cutlist))) if lowest < 0: cutave = cutave * -1 else: cutave = ave ffile.write("Lowest ") ffile.write(skey) ffile.write(": ") ffile.write(str(lowest)) ffile.write('\n') ffile.write("Average ") ffile.write(skey) ffile.write(": ") ffile.write(str(ave)) ffile.write('\n') ffile.write("Lowaverage (reg if not >")#3, <0.05) ") ffile.write(str(cutpointnumber)) ffile.write(", <0.05) ") ffile.write(skey) ffile.write(": ") ffile.write(str(cutave)) ffile.write('\n') for svey in splitdict[skey]: ffile.write(str(svey[0])) ffile.write(', ') ffile.write(str(svey[1][0])) ffile.write(', ') ffile.write(str(svey[1][1])) ffile.write('\n') #print splitdict #ffile.write(k) #ffile.write(', ') #ffile.write(str(pdict[k][0])) #ffile.write(', ') #ffile.write(str(pdict[k][1])) #ffile.write('\n')
sthyme/ZFSchizophrenia
BehaviorAnalysis/mergingbehaviordata/lmmanalysisave_septcut4and2ifsame.py
Python
mit
13,435
import numpy as np import sys import os from utils import * from utils_procs import * # extract letters and spaces, and transform to lower case # how: python proc_txt.py input_file_name # read input args # _, input_fname = 'temp', 'poetry_2' _, input_fname = sys.argv # constant input_path = '../story/' train_test_ratio = .9 def get_word_level_rep(text, output_path, train_test_ratio): # convert to word-level representation indices, _, words_dict = text_2_one_hot(text) index_string = list_of_int_to_int_string(indices) # save .npz word file and its dictionary save_list_of_int_to_npz(indices, words_dict, output_path, train_test_ratio) save_dict(words_dict, output_path) # write to output file - char level write2file(text, 'chars_we.txt', output_path) [text] = remove_end_markers([text]) write2file(text, 'chars_woe.txt', output_path) # read input text file input_path = os.path.join(input_path,input_fname) print('Input text from <%s>' % os.path.abspath(input_path)) input_file_path = os.path.join(input_path, input_fname + '.txt') input_file = open(input_file_path, 'r') text = input_file.read() # get output dir name and makr output dirs output_path = input_path make_output_cond_dirs(output_path) # remove pun markers... text = str2cleanstr(text) # create shuffling text_shufw = shuffle_words_in_state(text) text_shufs = shuffle_states_in_story(text) # conver to lower case [text, text_shufw, text_shufs] = to_lower_case([text, text_shufw, text_shufs]) # save word level representation get_word_level_rep(text, os.path.join(output_path, 'shuffle_none'), train_test_ratio) get_word_level_rep(text_shufw, os.path.join(output_path, 'shuffle_words'), train_test_ratio) get_word_level_rep(text_shufs, os.path.join(output_path, 'shuffle_states'), train_test_ratio)
ProjectSEM/narrative
src/proc_txt.py
Python
mit
1,798
#!/usr/bin/env python # -*- coding: latin-1 -*- import sys import datetime from threading import Thread class ProcPing(Thread): def __init__(self, name, data, qtdMsg): Thread.__init__(self) self.name = name self.data = data self.qtdMsg = qtdMsg self.mailBox = [] def setPeer(self, Peer): self.Peer = Peer def send(self, dado): self.Peer.mailBox = dado def recv(self): while True: if not len(self.mailBox) < len(self.data): print(self) self.mailBox = [] break def run(self): for i in range (0, self.qtdMsg + 1): self.send(self.data) if i < self.qtdMsg: self.recv() class PingPing(Thread): def __init__(self, tamMsg, qtdMsg): Thread.__init__(self) self.tamMsg = tamMsg self.qtdMsg = qtdMsg def run(self): index = 0 array = [1] while index < self.tamMsg -1: array.append(1) index = index + 1 p1 = ProcPing("1", array, self.qtdMsg) p2 = ProcPing("2", array, self.qtdMsg) p2.setPeer(p1) p1.setPeer(p2) timeStart = datetime.datetime.now() p1.start() p2.start() p1.join() p2.join() timeEnd = datetime.datetime.now() timeExec = timeEnd - timeStart line = "%d\t%d\t%s\n" % (self.tamMsg, self.qtdMsg, timeExec) try: arq = open('saida.txt', 'r') textoSaida = arq.read() arq.close() except: arq = open('saida.txt', 'w') textoSaida = "" arq.close() arq = open('saida.txt', 'w') textoSaida = textoSaida + line arq.write(textoSaida) arq.close() def main(): param = sys.argv[1:] tamMsg = int(param[0]) qtdMsg = int(param[1]) pingPing = PingPing(tamMsg, qtdMsg) pingPing.start() if __name__=="__main__": main()
jucimarjr/uarini
examples/MPI_Benchmark/source_code/pingping/python/pingping.py
Python
mit
1,681
import unittest from broca.tokenize import keyword, util, LemmaTokenizer class KeywordTokenizeTests(unittest.TestCase): def setUp(self): self.docs = [ 'This cat dog is running happy.', 'This cat dog runs sad.' ] def test_overkill(self): expected_t_docs = [ ['cat dog', 'run', 'happy'], ['cat dog', 'run', 'sad'] ] t_docs = keyword.OverkillTokenizer(lemmatize=True, min_count=1, threshold=0.1).tokenize(self.docs) self.assertEqual(t_docs, expected_t_docs) def test_rake(self): expected_t_docs = [ ['cat dog', 'running happy'], ['cat dog runs sad'] ] t_docs = keyword.RAKETokenizer().tokenize(self.docs) # Order not necessarily preserved for i, output in enumerate(t_docs): self.assertEqual(set(output), set(expected_t_docs[i])) def test_apriori(self): expected_t_docs = [ ['cat dog'], ['cat dog'] ] t_docs = keyword.AprioriTokenizer().tokenize(self.docs) self.assertEqual(t_docs, expected_t_docs) def test_pos(self): expected_t_docs = [ ['cat dog'], ['cat dog'] ] t_docs = keyword.POSTokenizer().tokenize(self.docs) self.assertEqual(t_docs, expected_t_docs) def test_overkill_parallel(self): expected_t_docs = [ ['cat dog', 'run', 'happy'], ['cat dog', 'run', 'sad'] ] t_docs = keyword.OverkillTokenizer(lemmatize=True, min_count=1, threshold=0.1, n_jobs=2).tokenize(self.docs) self.assertEqual(t_docs, expected_t_docs) def test_rake_parallel(self): expected_t_docs = [ ['cat dog', 'running happy'], ['cat dog runs sad'] ] t_docs = keyword.RAKETokenizer(n_jobs=-1).tokenize(self.docs) # Order not necessarily preserved for i, output in enumerate(t_docs): self.assertEqual(set(output), set(expected_t_docs[i])) class TokenizeTests(unittest.TestCase): def setUp(self): self.docs = [ 'This cat dog is running happy.', 'This cat dog runs sad.' ] def test_lemma(self): expected_t_docs = [ ['cat', 'dog', 'run', 'happy', '.'], ['cat', 'dog', 'run', 'sad', '.'] ] t_docs = LemmaTokenizer().tokenize(self.docs) self.assertEqual(t_docs, expected_t_docs) def test_prune(self): t_docs = [ ['cat', 'cat dog', 'happy', 'dog', 'dog'], ['cat', 'cat dog', 'sad'] ] expected_t_docs = [ ['cat dog', 'happy', 'dog', 'dog'], ['cat dog', 'sad'] ] t_docs = util.prune(t_docs) self.assertEqual(t_docs, expected_t_docs)
frnsys/broca
tests/test_tokenize.py
Python
mit
3,072
from lxml import etree from okcupyd import xpath def test_selected_attribute(): node = xpath.XPathNode(element='element', selected_attribute='value') assert node.xpath == '//element/@value' tree = etree.XML("<top><container><element value='1'>" "</element><element value='2'></element>" "</container></top>") builder = xpath.xpb.container.element.select_attribute_('value') assert builder.xpath == './/container//element/@value' assert builder.apply_(tree) == ['1', '2'] assert xpath.xpb.element.select_attribute_('value', elem=tree) == \ ['1', '2'] def test_text_for_many(): tree = etree.XML("<top><container>" "<element value='1'>one</element>" "<element value='2'>two</element>" "</container></top>") result = xpath.xpb.container.element.text_.apply_(tree) assert set(result) == set(['one', 'two']) def test_attribute_contains(): tree = etree.XML("<top><elem a='complete'></elem></top>") assert xpath.xpb.elem.attribute_contains('a', 'complet').apply_(tree) != [] def test_text_contains(): element_text = "cool stuff44" tree = etree.XML("<top><elem>{0}</elem><elem></elem>" "<elem>other things</elem></top>".format(element_text)) result = xpath.xpb.elem.text_contains_("stuff").text_.apply_(tree) result_text, = result assert result_text == element_text result = xpath.xpb.elem.text_contains_("afdsafdsa").text_.apply_(tree) assert result == []
IvanMalison/okcupyd
tests/xpath_test.py
Python
mit
1,572
import pygame from Game.Shared import GameConstants from Game.Bricks import Brick from Game.Ball import Ball class BallSpawningBrick(Brick): def __init__(self, position, game, points=400, color=(150, 150, 150), sprite=pygame.Surface(GameConstants.BRICK_SIZE)): super(BallSpawningBrick, self).__init__(position, game, points=points, color=color, sprite=sprite) pygame.font.init() font = pygame.font.Font(None, 16) renderedText = font.render("Extra", True, (0, 0, 0)) textWidth, textHeight = renderedText.get_size() blitX = int(GameConstants.BRICK_SIZE[0] / 2.0) - int(textWidth / 2.0) blitY = int(GameConstants.BRICK_SIZE[1] / 2.0) - int(textHeight / 2.0) self.sprite.blit(renderedText, (blitX, blitY)) def hit(self, ball): super(BallSpawningBrick,self).hit(ball) positionX = self.position[0] + int(GameConstants.BRICK_SIZE[0] / 2.0) - int(GameConstants.BALL_SIZE[0] / 2.0) positionY = self.position[1] + int(GameConstants.BRICK_SIZE[1] / 2.0) - int(GameConstants.BALL_SIZE[1] / 2.0) self.game.balls.append(Ball(self.game, position=(positionX, positionY)))
msegeya/breakout-clone
Game/Bricks/BallSpawningBrick.py
Python
mit
1,231
from som.interp_type import is_ast_interpreter from som.primitives.primitives import Primitives from som.vm.globals import trueObject, falseObject, nilObject from som.vmobjects.primitive import UnaryPrimitive, BinaryPrimitive, TernaryPrimitive if is_ast_interpreter(): from som.vmobjects.block_ast import AstBlock as _Block else: from som.vmobjects.block_bc import BcBlock as _Block def _not(_rcvr): return falseObject def _or(_rcvr, _arg): return trueObject def _and_and_if_true(_rcvr, arg): if isinstance(arg, _Block): block_method = arg.get_method() return block_method.invoke_1(arg) return arg def _if_false(_rcvr, _arg): return nilObject def _if_true_if_false(_rcvr, true_block, _false_block): if isinstance(true_block, _Block): block_method = true_block.get_method() return block_method.invoke_1(true_block) return true_block class TruePrimitivesBase(Primitives): def install_primitives(self): self._install_instance_primitive(UnaryPrimitive("not", _not)) self._install_instance_primitive(BinaryPrimitive("or:", _or)) self._install_instance_primitive(BinaryPrimitive("||", _or)) self._install_instance_primitive(BinaryPrimitive("and:", _and_and_if_true)) self._install_instance_primitive(BinaryPrimitive("&&", _and_and_if_true)) self._install_instance_primitive(BinaryPrimitive("ifTrue:", _and_and_if_true)) self._install_instance_primitive(BinaryPrimitive("ifFalse:", _if_false)) self._install_instance_primitive( TernaryPrimitive("ifTrue:ifFalse:", _if_true_if_false) )
SOM-st/PySOM
src/som/primitives/true_primitives.py
Python
mit
1,649
#### NOTICE: THIS FILE IS AUTOGENERATED #### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY #### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES from swgpy.object import * def create(kernel): result = Intangible() result.template = "object/draft_schematic/droid/component/shared_advanced_droid_frame.iff" result.attribute_template_id = -1 result.stfName("string_id_table","") #### BEGIN MODIFICATIONS #### #### END MODIFICATIONS #### return result
anhstudios/swganh
data/scripts/templates/object/draft_schematic/droid/component/shared_advanced_droid_frame.py
Python
mit
465
#!/usr/bin/env python import rospy from geometry_msgs.msg import Twist def callback_function(data): #FILL IN HERE global publisher_name, msg msg.linear.x = -data.linear.x msg.angular.z = -data.angular.z publisher_name.publish(msg) def subscriber_name(): # Initialize node rospy.init_node('subscriber_name', anonymous=True) #FILL IN HERE global publisher_name,msg msg = Twist() publisher_name = rospy.Publisher('remapped_topic_name',Twist,queue_size = 16) rospy.Subscriber('turtle1/cmd_vel', Twist, callback_function) rospy.Rate(30) rospy.spin() if __name__ == '__main__': try: subscriber_name() except rospy.ROSInterruptException: pass
BARCproject/barc
workspace/src/labs/src/lab1/remapping.py
Python
mit
721
from django.http import HttpRequest from django.conf import settings from django.utils.translation import ugettext_lazy as _ try: from allauth.account import app_settings as allauth_settings from allauth.utils import (email_address_exists, get_username_max_length) from allauth.account.adapter import get_adapter from allauth.account.utils import setup_user_email except ImportError: raise ImportError("allauth needs to be added to INSTALLED_APPS.") from rest_framework import serializers from requests.exceptions import HTTPError # Import is needed only if we are using social login, in which # case the allauth.socialaccount will be declared if 'allauth.socialaccount' in settings.INSTALLED_APPS: from allauth.socialaccount.helpers import complete_social_login class SocialLoginSerializer(serializers.Serializer): access_token = serializers.CharField(required=False, allow_blank=True) code = serializers.CharField(required=False, allow_blank=True) def _get_request(self): request = self.context.get('request') if not isinstance(request, HttpRequest): request = request._request return request def get_social_login(self, adapter, app, token, response): """ :param adapter: allauth.socialaccount Adapter subclass. Usually OAuthAdapter or Auth2Adapter :param app: `allauth.socialaccount.SocialApp` instance :param token: `allauth.socialaccount.SocialToken` instance :param response: Provider's response for OAuth1. Not used in the :returns: A populated instance of the `allauth.socialaccount.SocialLoginView` instance """ request = self._get_request() social_login = adapter.complete_login(request, app, token, response=response) social_login.token = token return social_login def validate(self, attrs): view = self.context.get('view') request = self._get_request() if not view: raise serializers.ValidationError( _("View is not defined, pass it as a context variable") ) adapter_class = getattr(view, 'adapter_class', None) if not adapter_class: raise serializers.ValidationError(_("Define adapter_class in view")) adapter = adapter_class(request) app = adapter.get_provider().get_app(request) # More info on code vs access_token # http://stackoverflow.com/questions/8666316/facebook-oauth-2-0-code-and-token # Case 1: We received the access_token if attrs.get('access_token'): access_token = attrs.get('access_token') # Case 2: We received the authorization code elif attrs.get('code'): self.callback_url = getattr(view, 'callback_url', None) self.client_class = getattr(view, 'client_class', None) if not self.callback_url: raise serializers.ValidationError( _("Define callback_url in view") ) if not self.client_class: raise serializers.ValidationError( _("Define client_class in view") ) code = attrs.get('code') provider = adapter.get_provider() scope = provider.get_scope(request) client = self.client_class( request, app.client_id, app.secret, adapter.access_token_method, adapter.access_token_url, self.callback_url, scope ) token = client.get_access_token(code) access_token = token['access_token'] else: raise serializers.ValidationError( _("Incorrect input. access_token or code is required.")) social_token = adapter.parse_token({'access_token': access_token}) social_token.app = app try: login = self.get_social_login(adapter, app, social_token, access_token) complete_social_login(request, login) except HTTPError: raise serializers.ValidationError(_('Incorrect value')) if not login.is_existing: login.lookup() login.save(request, connect=True) attrs['user'] = login.account.user return attrs class RegisterSerializer(serializers.Serializer): username = serializers.CharField( max_length=get_username_max_length(), min_length=allauth_settings.USERNAME_MIN_LENGTH, required=allauth_settings.USERNAME_REQUIRED ) email = serializers.EmailField(required=allauth_settings.EMAIL_REQUIRED) password1 = serializers.CharField(write_only=True) password2 = serializers.CharField(write_only=True) def validate_username(self, username): username = get_adapter().clean_username(username) return username def validate_email(self, email): email = get_adapter().clean_email(email) if allauth_settings.UNIQUE_EMAIL: if email and email_address_exists(email): raise serializers.ValidationError( _("A user is already registered with this e-mail address.")) return email def validate_password1(self, password): return get_adapter().clean_password(password) def validate(self, data): if data['password1'] != data['password2']: raise serializers.ValidationError(_("The two password fields didn't match.")) return data def custom_signup(self, request, user): pass def get_cleaned_data(self): return { 'username': self.validated_data.get('username', ''), 'password1': self.validated_data.get('password1', ''), 'email': self.validated_data.get('email', '') } def save(self, request): adapter = get_adapter() user = adapter.new_user(request) self.cleaned_data = self.get_cleaned_data() adapter.save_user(request, user, self) self.custom_signup(request, user) setup_user_email(request, user, []) return user class VerifyEmailSerializer(serializers.Serializer): key = serializers.CharField()
saurabhVisie/appserver
rest_auth/registration/serializers.py
Python
mit
6,316
#First parameter is path for binary file containing instructions to be injected #Second parameter is Process Identifier for process to be injected to import binascii import sys from ctypes import * if len(sys.argv) < 3: print("usage inject.py <shellcodefile.bin> <pid>") sys.exit(1) file = open(sys.argv[1],'rb') buff=file.read() file.close() print("buffer length = ") print(len(buff)) print("pid = "+sys.argv[2]) handle = windll.kernel32.OpenProcess(0x1f0fff,0, int(sys.argv[2])) if (handle == 0): print("handle == 0") sys.exit(1) addr = windll.kernel32.VirtualAllocEx(handle,0,len(buff),0x3000|0x1000,0x40) if(addr == 0): print("addr = = 0") sys.exit(1) bytes = c_ubyte() windll.kernel32.WriteProcessMemory(handle, addr , buff, len(buff), byref(bytes)) handle1=windll.kernel32.CreateRemoteThread(handle , 0x0, 0x0 , addr, 0x0,0x0 , 0x0) if(handle1 == 0): print("handle1 = = 0"); sys.exit(1) windll.kernel32.CloseHandle(handle)
idkwim/snippets
inject.py
Python
mit
956
# Django settings for testautoslug project. import os PROJECT_ROOT = os.path.dirname(__file__) DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', '[email protected]'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 'NAME': os.path.join(PROJECT_ROOT, 'dev.db'), # Or path to database file if using sqlite3. 'USER': '', # Not used with sqlite3. 'PASSWORD': '', # Not used with sqlite3. 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. 'PORT': '', # Set to empty string for default. Not used with sqlite3. } } # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be available on all operating systems. # On Unix systems, a value of None will cause Django to use the same # timezone as the operating system. # If running in a Windows environment this must be set to the same as your # system time zone. TIME_ZONE = 'America/Chicago' # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html LANGUAGE_CODE = 'en-us' SITE_ID = 1 # If you set this to False, Django will make some optimizations so as not # to load the internationalization machinery. USE_I18N = True # If you set this to False, Django will not format dates, numbers and # calendars according to the current locale USE_L10N = True # Absolute path to the directory that holds media. # Example: "/home/media/media.lawrence.com/" MEDIA_ROOT = '' # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash if there is a path component (optional in other cases). # Examples: "http://media.lawrence.com", "http://example.com/media/" MEDIA_URL = '' # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # trailing slash. # Examples: "http://foo.com/media/", "/media/". ADMIN_MEDIA_PREFIX = '/media/' # Make this unique, and don't share it with anybody. SECRET_KEY = '44mxeh8nkm^ycwef-eznwgk&8_lwc!j9r)h3y_^ypz1iom18pa' # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', # 'django.template.loaders.eggs.Loader', ) MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', ) ROOT_URLCONF = 'testautoslug.urls' TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. ) INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.admin', 'testapp', )
Egregors/django-autoslug-field
testautoslug/settings.py
Python
mit
3,357
import zmq class JRPC: def __init__(self): self.id = 0 def make_noti(self, method, params=None): noti = {"jsonrpc":"2.0", "method":method} if params is not None: noti["params"] = params return noti def make_req(self, method, params=None): req = self.make_noti(method, params) req["id"] = self.id self.id += 1 return req zctx = zmq.Context.instance() zsock = zctx.socket(zmq.REQ) zsock.connect("tcp://127.0.0.1:10000") jrpc = JRPC() # test "echo" method req = jrpc.make_req("echo", [10, 5]) zsock.send_json(req) rep = zsock.recv_json() assert(rep['result']==req['params']) # test "counter" method and batch req = jrpc.make_req("counter") zsock.send_json([req]*10) batchrep = zsock.recv_json() counts = [rep['result'] for rep in batchrep] for k in range(1,len(counts)): assert counts[k] - counts[k-1] == 1 # test "sum" method and batch batchreq = [] for k in range(10): batchreq.append(jrpc.make_req("sum", range(1+k))) zsock.send_json(batchreq) batchrep = zsock.recv_json() for k in range(10): assert(batchrep[k]['result']==sum(range(1+k))) a = range(3) o = {1:1, 2:2, 3:3} d = { "one": "un", "two": 2, "three": 3.0, "four": True, "five": False, "six": None, "seven":a, "eight":o } req = jrpc.make_noti("iterate", d) zsock.send_json(req) rep = zsock.recv() assert not rep req = jrpc.make_noti("iterate", a) zsock.send_json(req) rep = zsock.recv() assert not rep req = jrpc.make_noti("foreach", d) zsock.send_json(req) rep = zsock.recv() assert not rep req = jrpc.make_noti("foreach", a) zsock.send_json(req) rep = zsock.recv() assert not rep
pijyoi/jsonrpc
testmethods.py
Python
mit
1,581
""" Discover Cambridge Audio StreamMagic devices. """ from . import SSDPDiscoverable class Discoverable(SSDPDiscoverable): """Add support for discovering Cambridge Audio StreamMagic devices.""" def get_entries(self): """Get all Cambridge Audio MediaRenderer uPnP entries.""" return self.find_by_device_description({ "manufacturer": "Cambridge Audio", "deviceType": "urn:schemas-upnp-org:device:MediaRenderer:1" })
balloob/netdisco
netdisco/discoverables/cambridgeaudio.py
Python
mit
473
"""Script to display a collection of paths after inserting one new path Usage: add_to_a_path.py [-U] PATHS PATH add_to_a_path.py [-U] (-s | -i INDEX ) PATHS PATH Options: -h, --help Show this help and exit -v, --version Show version number and exit -s, --start Add the path at start of list of paths -i INDEX, --index=INDEX The index at which the path will be inserted Examples of use: $ export PATH=/bin:/usr/bin $ add_to_a_path.py PATH /usr/local/bin PATH=/bin:/usr/bin:/usr/local/bin $ add_to_a_path.py PATH /usr/local/bin --start PATH=/usr/local/bin:/bin:/usr/bin """ from __future__ import print_function import os import sys import argparse from bdb import BdbQuit __version__ = '0.1.0' class ScriptError(NotImplementedError): pass def version(): print('%s %s' % (args, __version__)) raise SystemExit def parse_args(): """Parse out command line arguments""" parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) parser.add_argument('symbol', help='The bash symbol to be changed') parser.add_argument('path', help='The path to be added') parser.add_argument('-s', '--start', action='store_true', help='Add the path at start of list of paths') parser.add_argument('-i', '--index', type=int, help='The index at which the path will be inserted') parser.add_argument('-v', '--version', action='store_true', help='Show version') args = parser.parse_args() if args.version: version() if not args.index: if args.start: args.index = 0 else: args.index = False return args def _add_symbol_to_paths(paths, symbol, i): if i is False: i = len(paths) result = paths[:] if not symbol: return result if symbol not in result: result.insert(i, symbol) return result j = result.index(symbol) if i != j: del result[j] result.insert(i, symbol) return result def get_arg_path(args): path = args.path if not path: return '' user_path = os.path.expanduser(path) real_path = os.path.realpath(user_path) if not os.path.isdir(real_path): return '' return real_path def split_paths(string): if not string: return [] return [p for p in string.split(os.path.pathsep) if p] def get_paths(args): symbol = args.symbol paths_string = '' if symbol in os.environ: paths_string = os.environ[symbol] elif os.path.pathsep in symbol: paths_string = symbol return split_paths(paths_string) def script(args): arg_path = get_arg_path(args) paths = get_paths(args) if not arg_path: if not paths: return False elif os.path.isdir(arg_path): if arg_path in paths: paths.remove(arg_path) paths = _add_symbol_to_paths(paths, arg_path, args.index) else: return False print('='.join((args.symbol, os.path.pathsep.join(paths)))) return True def main(): """Run the script""" try: args = parse_args() return os.EX_OK if script(args) else not os.EX_OK except (SystemExit, BdbQuit): pass return os.EX_OK if __name__ == '__main__': sys.exit(main())
jalanb/jab
src/python/add_to_a_path.py
Python
mit
3,399
import os.path import SCons.Tool import aql #//---------------------------------------------------------------------------// _Warning = aql.Warning _Tool = SCons.Tool.Tool #//---------------------------------------------------------------------------// def generate( env ): toolsets = ( "aql_tool_gcc", "aql_tool_msvc", #~ "aql_tool_bcc" ) for tool in toolsets: tool = _Tool( tool ) if tool.exists( env ): tool( env ) return _Warning("C/C++ toolchain has not been found.") default_tool_name = os.path.splitext( os.path.basename( __file__ ) )[0] env['TOOLS'].remove( default_tool_name ) #//---------------------------------------------------------------------------// def exists(env): return 1
menify/sandbox
tags/aql_working_copy_16022008/tools/aql_deftool_cc.py
Python
mit
880
from setuptools import setup from os import path, environ from sys import argv here = path.abspath(path.dirname(__file__)) try: if argv[1] == "test": environ['PYTHONPATH'] = here except IndexError: pass with open(path.join(here, 'README.rst'), encoding='utf-8') as f: long_description = f.read() setup( name='libfs', version='0.1', description='Library Filesystem', long_description=long_description, author='Christof Hanke', author_email='[email protected]', url='https://github.com/ya-induhvidual/libfs', packages=['Libfs'], license='MIT', install_requires=['llfuse', 'mutagenx'], test_suite="test/test_all.py", scripts=['scripts/libfs.py'], keywords='fuse multimedia', classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: End Users/Desktop', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 3', 'Operating System :: MacOS :: MacOS X', 'Operating System :: POSIX :: BSD :: FreeBSD', 'Operating System :: POSIX :: Linux', 'Topic :: System :: Filesystems' ], )
ya-induhvidual/libfs
setup.py
Python
mit
1,167
#!/usr/bin/env python from __future__ import with_statement #------------------------------------------------------------------------------- import unittest from xml.etree.ElementTree import fromstring #------------------------------------------------------------------------------- from xmlbuilder import XMLBuilder #------------------------------------------------------------------------------- def xmlStructureEqual(xml1,xml2): tree1 = fromstring(xml1) tree2 = fromstring(xml2) return _xmlStructureEqual(tree1,tree2) #------------------------------------------------------------------------------- def _xmlStructureEqual(tree1,tree2): if tree1.tag != tree2.tag: return False attr1 = list(tree1.attrib.items()) attr1.sort() attr2 = list(tree2.attrib.items()) attr2.sort() if attr1 != attr2: return False return tree1.getchildren() == tree2.getchildren() #------------------------------------------------------------------------------- result1 = \ """ <root> <array /> <array len="10"> <el val="0" /> <el val="1">xyz</el> <el val="2">abc</el> <el val="3" /> <el val="4" /> <el val="5" /> <sup-el val="23">test </sup-el> </array> </root> """.strip() #------------------------------------------------------------------------------- class TestXMLBuilder(unittest.TestCase): def testShift(self): xml = (XMLBuilder() << ('root',)) self.assertEqual(str(xml),"<root />") xml = XMLBuilder() xml << ('root',"some text") self.assertEqual(str(xml),"<root>some text</root>") xml = XMLBuilder() xml << ('root',{'x':1,'y':'2'}) self.assert_(xmlStructureEqual(str(xml),"<root x='1' y='2'>some text</root>")) xml = XMLBuilder() xml << ('root',{'x':1,'y':'2'}) self.assert_(xmlStructureEqual(str(xml),"<root x='1' y='2'></root>")) xml = XMLBuilder() xml << ('root',{'x':1,'y':'2'}) self.assert_(not xmlStructureEqual(str(xml),"<root x='2' y='2'></root>")) xml = XMLBuilder() xml << ('root',"gonduras.ua",{'x':1,'y':'2'}) self.assert_(xmlStructureEqual(str(xml),"<root x='1' y='2'>gonduras.ua</root>")) xml = XMLBuilder() xml << ('root',"gonduras.ua",{'x':1,'y':'2'}) self.assert_(xmlStructureEqual(str(xml),"<root x='1' y='2'>gonduras.com</root>")) #--------------------------------------------------------------------------- def testWith(self): xml = XMLBuilder() with xml.root(lenght = 12): pass self.assertEqual(str(xml),'<root lenght="12" />') xml = XMLBuilder() with xml.root(): xml << "text1" << "text2" << ('some_node',) self.assertEqual(str(xml),"<root>text1text2<some_node /></root>") #--------------------------------------------------------------------------- def testFormat(self): x = XMLBuilder('utf-8',format = True) with x.root(): x << ('array',) with x.array(len = 10): with x.el(val = 0): pass with x.el('xyz',val = 1): pass x << ("el","abc",{'val':2}) << ('el',dict(val=3)) x << ('el',dict(val=4)) << ('el',dict(val='5')) with x('sup-el',val = 23): x << "test " self.assertEqual(str(x),result1) #------------------------------------------------------------------------------- if __name__ == '__main__': unittest.main() #-------------------------------------------------------------------------------
JDrosdeck/xml-builder-0.9
xmlbuilder/tests/__init__.py
Python
mit
3,828
# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2016-08-01 23:15 import autoslug.fields import common.utils import datetime from django.conf import settings import django.contrib.postgres.fields from django.db import migrations, models import django.db.models.deletion from django.utils.timezone import utc import open_humans.storage import private_sharing.models class Migration(migrations.Migration): initial = True dependencies = [ ('open_humans', '0003_auto_20151223_1827'), ('oauth2_provider', '__first__'), ('open_humans', '0004_member_badges'), ] operations = [ migrations.CreateModel( name='DataRequestProject', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('is_study', models.BooleanField(choices=[(True, 'Study'), (False, 'Activity')], help_text='A "study" is doing human subjects research and must have Institutional Review Board approval or equivalent ethics board oversight. Activities can be anything else, e.g. data visualizations.', verbose_name='Is this project a study or an activity?')), ('name', models.CharField(max_length=100, verbose_name='Project name')), ('leader', models.CharField(max_length=100, verbose_name='Leader(s) or principal investigator(s)')), ('organization', models.CharField(max_length=100, verbose_name='Organization or institution')), ('contact_email', models.EmailField(max_length=254, verbose_name='Contact email for your project')), ('info_url', models.URLField(verbose_name='URL for general information about your project')), ('short_description', models.CharField(max_length=140, verbose_name='A short description')), ('long_description', models.TextField(max_length=1000, verbose_name='A long description')), ('active', models.BooleanField(choices=[(True, 'Yes'), (False, 'No')], default=True, help_text='"Active" status is required to perform authorization\nprocesses, including during drafting stage. If a project is not active,\nit won\'t show up in listings, and new data sharing authorizations cannot occur.\nProjects which are "active" but not approved may have some information shared\nin an "In Development" section, so Open Humans members can see potential\nupcoming studies.')), ('badge_image', models.ImageField(blank=True, help_text="A badge that will be displayed on the user's profile once they've connected your project.", max_length=1024, storage=open_humans.storage.PublicStorage(), upload_to=private_sharing.models.badge_upload_path)), ('request_sources_access', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), help_text='List of sources this project is requesting access to on Open Humans.', size=None, verbose_name="Data sources you're requesting access to")), ('request_message_permission', models.BooleanField(choices=[(True, 'Yes'), (False, 'No')], help_text='Permission to send messages to the member. This does not grant access to their email address.', verbose_name='Are you requesting permission to message users?')), ('request_username_access', models.BooleanField(choices=[(True, 'Yes'), (False, 'No')], help_text="Access to the member's username. This implicitly enables access to anything the user is publicly sharing on Open Humans. Note that this is potentially sensitive and/or identifying.", verbose_name='Are you requesting Open Humans usernames?')), ('approved', models.BooleanField(default=False)), ('created', models.DateTimeField(auto_now_add=True)), ('last_updated', models.DateTimeField(auto_now=True)), ('api_access_secret', models.CharField(max_length=64)), ], options={ 'verbose_name_plural': 'Data request activities', }, ), migrations.CreateModel( name='DataRequestProjectMember', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('user_id_code', models.CharField(max_length=16)), ('message_permission', models.BooleanField()), ('username_shared', models.BooleanField()), ('sources_shared', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), size=None)), ('member', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='open_humans.Member')), ], ), migrations.CreateModel( name='OAuth2DataRequestProject', fields=[ ('datarequestproject_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='private_sharing.DataRequestProject')), ('enrollment_url', models.URLField(help_text="The URL we direct members to if they're interested in sharing data with your project.", verbose_name='Enrollment URL')), ('redirect_url', models.CharField(help_text='The return URL for our "authorization code" OAuth2 grant\n process. You can <a target="_blank" href="">read more about OAuth2\n "authorization code" transactions here</a>.', max_length=256, verbose_name='Redirect URL')), ('application', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.OAUTH2_PROVIDER_APPLICATION_MODEL)), ], options={ 'verbose_name': 'OAuth2 data request project', }, bases=('private_sharing.datarequestproject',), ), migrations.CreateModel( name='OnSiteDataRequestProject', fields=[ ('datarequestproject_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='private_sharing.DataRequestProject')), ('consent_text', models.TextField(help_text='The "informed consent" text that describes your project to Open Humans members.')), ('post_sharing_url', models.URLField(blank=True, help_text='If provided, after authorizing sharing the\nmember will be taken to this URL. If this URL includes "PROJECT_MEMBER_ID"\nwithin it, we will replace that with the member\'s project-specific\nproject_member_id. This allows you to direct them to an external survey you\noperate (e.g. using Google Forms) where a pre-filled project_member_id field\nallows you to connect those responses to corresponding data in Open Humans.', verbose_name='Post-sharing URL')), ], options={ 'verbose_name': 'On-site data request project', }, bases=('private_sharing.datarequestproject',), ), migrations.AddField( model_name='datarequestprojectmember', name='project', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='project_members', to='private_sharing.DataRequestProject'), ), migrations.AddField( model_name='datarequestproject', name='coordinator', field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='open_humans.Member'), ), migrations.AlterField( model_name='datarequestproject', name='long_description', field=models.TextField(max_length=1000, verbose_name='A long description (1000 characters max)'), ), migrations.AlterField( model_name='datarequestproject', name='short_description', field=models.CharField(max_length=140, verbose_name='A short description (140 characters max)'), ), migrations.AlterField( model_name='datarequestprojectmember', name='member', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='open_humans.Member'), ), migrations.RenameField( model_name='datarequestprojectmember', old_name='user_id_code', new_name='project_member_id', ), migrations.AlterField( model_name='datarequestprojectmember', name='project_member_id', field=models.CharField(max_length=16, unique=True), ), migrations.AlterField( model_name='datarequestproject', name='request_sources_access', field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), default=list, help_text='List of sources this project is requesting access to on Open Humans.', size=None, verbose_name="Data sources you're requesting access to"), ), migrations.AlterField( model_name='datarequestproject', name='active', field=models.BooleanField(choices=[(True, 'Yes'), (False, 'No')], default=True, help_text='"Active" status is required to perform authorization\nprocesses, including during drafting stage. If a project is not active, it\nwon\'t show up in listings, and new data sharing authorizations cannot occur.\nProjects which are "active" but not approved may have some information shared\nin an "In Development" section, so Open Humans members can see potential\nupcoming studies.'), ), migrations.AddField( model_name='datarequestprojectmember', name='created', field=models.DateTimeField(auto_now_add=True, default=datetime.datetime(2016, 3, 4, 5, 14, 50, 931889, tzinfo=utc)), preserve_default=False, ), migrations.AlterField( model_name='datarequestprojectmember', name='message_permission', field=models.BooleanField(default=False), ), migrations.AlterField( model_name='datarequestprojectmember', name='sources_shared', field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), default=list, size=None), ), migrations.AlterField( model_name='datarequestprojectmember', name='username_shared', field=models.BooleanField(default=False), ), migrations.AddField( model_name='datarequestproject', name='slug', field=autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True), ), migrations.AddField( model_name='datarequestprojectmember', name='revoked', field=models.BooleanField(default=False), ), migrations.AlterModelOptions( name='datarequestproject', options={}, ), migrations.AddField( model_name='datarequestprojectmember', name='authorized', field=models.BooleanField(default=False), ), migrations.AlterField( model_name='datarequestproject', name='slug', field=autoslug.fields.AutoSlugField(always_update=True, editable=False, populate_from='name', unique=True), ), migrations.AddField( model_name='datarequestproject', name='is_academic_or_nonprofit', field=models.BooleanField(choices=[(True, 'Yes'), (False, 'No')], default=False, verbose_name='Is this institution or organization an academic institution or non-profit organization?'), preserve_default=False, ), migrations.AddField( model_name='datarequestprojectmember', name='consent_text', field=models.TextField(blank=True), ), migrations.RemoveField( model_name='datarequestproject', name='api_access_secret', ), migrations.AddField( model_name='datarequestproject', name='master_access_token', field=models.CharField(default=common.utils.generate_id, max_length=64), ), migrations.AddField( model_name='datarequestprojectmember', name='joined', field=models.BooleanField(default=False), ), migrations.AlterField( model_name='datarequestproject', name='request_sources_access', field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), blank=True, default=list, help_text='List of sources this project is requesting access to on Open Humans.', size=None, verbose_name="Data sources you're requesting access to"), ), migrations.AlterField( model_name='datarequestproject', name='organization', field=models.CharField(blank=True, max_length=100, verbose_name='Organization or institution'), ), migrations.AddField( model_name='datarequestproject', name='returned_data_description', field=models.CharField(blank=True, help_text="Leave this blank if your project doesn't plan to add or return new data for your members.", max_length=140, verbose_name='Description of data you plan to upload to member accounts (140 characters max)'), ), migrations.AlterField( model_name='datarequestproject', name='active', field=models.BooleanField(choices=[(True, 'Yes'), (False, 'No')], default=True, help_text='"Active" status is required to perform authorization\nprocesses, including during drafting stage. If a project is not active, it\nwon\'t show up in listings of activities that can be joined by participants, and\nnew data sharing authorizations cannot occur. Projects which are "active" but\nnot approved may have some information shared in an "In Development" section,\nso Open Humans members can see potential upcoming studies. Removing "active"\nstatus from a project will not remove any uploaded files from a project\nmember\'s profile.'), ), migrations.AddField( model_name='datarequestproject', name='token_expiration_date', field=models.DateTimeField(default=private_sharing.models.now_plus_24_hours), ), migrations.AddField( model_name='datarequestproject', name='token_expiration_disabled', field=models.BooleanField(default=False), ), ]
PersonalGenomesOrg/open-humans
private_sharing/migrations/0001_squashed_0034_auto_20160727_2138.py
Python
mit
14,678
from django.db import models class RiverOutfall(models.Model): name = models.TextField() lat = models.FloatField(null=True) lon = models.FloatField(null=True) class RiverCso(models.Model): river_outfall = models.ForeignKey("RiverOutfall") open_time = models.DateTimeField() close_time = models.DateTimeField() class LakeOutfall(models.Model): name = models.TextField() lat = models.FloatField(null=True) lon = models.FloatField(null=True) class LakeReversal(models.Model): lake_outfall = models.ForeignKey("LakeOutfall") open_date = models.DateTimeField() close_date = models.DateTimeField() millions_of_gallons = models.FloatField()
NORCatUofC/rainapp
csos/models.py
Python
mit
694
width = 75 height = 75 data = [ 0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x01,0xf0,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x03,0xf0,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x03,0xf8,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x07,0xf8,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x0f,0xf8,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x1f,0xfc,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x1f,0xfc,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x3f,0xfc,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x7f,0xfe,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x7f,0xfe,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0xff,0xfe,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x01,0xff,0xff,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x03,0xff,0xff,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x03,0xff,0xff,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x07,0xff,0xff,0x80,0x00,0x00,0x00, 0x00,0x00,0x00,0x07,0xff,0xff,0x80,0x00,0x00,0x00, 0x00,0x00,0x00,0x07,0xff,0xff,0x80,0x00,0x00,0x00, 0x00,0x00,0x00,0x0f,0xff,0xff,0x80,0x00,0x00,0x00, 0x00,0x00,0x00,0x0f,0xff,0xff,0x80,0x00,0x00,0x00, 0x7f,0xff,0xfc,0x0f,0xff,0xff,0x80,0x00,0x00,0x00, 0xff,0xff,0xff,0x0f,0xff,0xff,0x80,0x00,0x00,0x00, 0xff,0xff,0xff,0xcf,0xff,0xff,0x80,0x00,0x00,0x00, 0xff,0xff,0xff,0xef,0xff,0xff,0x80,0x00,0x00,0x00, 0x7f,0xff,0xff,0xf7,0xff,0xff,0x80,0x00,0x00,0x00, 0x3f,0xff,0xff,0xff,0xfb,0xff,0x00,0x00,0x00,0x00, 0x3f,0xff,0xff,0xff,0xf1,0xff,0x3f,0xf0,0x00,0x00, 0x1f,0xff,0xff,0xff,0xf1,0xfe,0xff,0xfe,0x00,0x00, 0x0f,0xff,0xff,0xff,0xf1,0xff,0xff,0xff,0xc0,0x00, 0x0f,0xff,0xff,0xff,0xe1,0xff,0xff,0xff,0xf8,0x00, 0x07,0xff,0xff,0xff,0xe1,0xff,0xff,0xff,0xff,0x00, 0x03,0xff,0xff,0xff,0xe1,0xff,0xff,0xff,0xff,0xc0, 0x01,0xff,0xff,0x3f,0xe1,0xff,0xff,0xff,0xff,0xe0, 0x01,0xff,0xfe,0x07,0xe3,0xff,0xff,0xff,0xff,0xe0, 0x00,0xff,0xff,0x03,0xe3,0xff,0xff,0xff,0xff,0xe0, 0x00,0x7f,0xff,0x00,0xf7,0xff,0xff,0xff,0xff,0xc0, 0x00,0x3f,0xff,0xc0,0xff,0xc0,0x7f,0xff,0xff,0x80, 0x00,0x1f,0xff,0xf0,0xff,0x00,0x3f,0xff,0xff,0x00, 0x00,0x0f,0xff,0xff,0xff,0x00,0x7f,0xff,0xfc,0x00, 0x00,0x07,0xff,0xff,0xff,0x01,0xff,0xff,0xf8,0x00, 0x00,0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x00, 0x00,0x00,0x7f,0xff,0xff,0xff,0xff,0xff,0xc0,0x00, 0x00,0x00,0x1f,0xfc,0x7f,0xff,0xff,0xff,0x80,0x00, 0x00,0x00,0x7f,0xf8,0x78,0xff,0xff,0xfe,0x00,0x00, 0x00,0x00,0xff,0xf0,0x78,0x7f,0xff,0xfc,0x00,0x00, 0x00,0x01,0xff,0xe0,0xf8,0x7f,0xff,0xf0,0x00,0x00, 0x00,0x03,0xff,0xc0,0xf8,0x3f,0xdf,0xc0,0x00,0x00, 0x00,0x07,0xff,0xc1,0xfc,0x3f,0xe0,0x00,0x00,0x00, 0x00,0x07,0xff,0x87,0xfc,0x1f,0xf0,0x00,0x00,0x00, 0x00,0x0f,0xff,0xcf,0xfe,0x1f,0xf8,0x00,0x00,0x00, 0x00,0x0f,0xff,0xff,0xff,0x1f,0xf8,0x00,0x00,0x00, 0x00,0x1f,0xff,0xff,0xff,0x1f,0xfc,0x00,0x00,0x00, 0x00,0x1f,0xff,0xff,0xff,0xff,0xfc,0x00,0x00,0x00, 0x00,0x1f,0xff,0xff,0xff,0xff,0xfe,0x00,0x00,0x00, 0x00,0x3f,0xff,0xff,0xff,0xff,0xfe,0x00,0x00,0x00, 0x00,0x3f,0xff,0xff,0xff,0xff,0xfe,0x00,0x00,0x00, 0x00,0x3f,0xff,0xff,0x3f,0xff,0xfe,0x00,0x00,0x00, 0x00,0x7f,0xff,0xff,0x3f,0xff,0xfe,0x00,0x00,0x00, 0x00,0x7f,0xff,0xff,0x3f,0xff,0xfe,0x00,0x00,0x00, 0x00,0x7f,0xff,0xfe,0x3f,0xff,0xfe,0x00,0x00,0x00, 0x00,0xff,0xff,0xfc,0x1f,0xff,0xfe,0x00,0x00,0x00, 0x00,0xff,0xff,0xf8,0x1f,0xff,0xfe,0x00,0x00,0x00, 0x00,0xff,0xff,0xe0,0x0f,0xff,0xfe,0x00,0x00,0x00, 0x01,0xff,0xff,0x80,0x07,0xff,0xfe,0x00,0x00,0x00, 0x01,0xff,0xfc,0x00,0x03,0xff,0xfe,0x00,0x00,0x00, 0x01,0xff,0xe0,0x00,0x01,0xff,0xfe,0x00,0x00,0x00, 0x01,0xff,0x00,0x00,0x00,0xff,0xfe,0x00,0x00,0x00, 0x00,0xf8,0x00,0x00,0x00,0x7f,0xfe,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x1f,0xfe,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x0f,0xfe,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x07,0xfe,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x01,0xfe,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x00,0x00,0x00 ]
DAFRELECTRONICS/IoTprinter
gfx/adalogo.py
Python
cc0-1.0
4,011
import time from pygame.locals import * import gui MOUSE_LEFT_BUTTON = 1 MOUSE_MIDDLE_BUTTON = 2 MOUSE_RIGHT_BUTTON = 3 MOUSE_WHEELUP = 4 MOUSE_WHEELDOWN = 5 class Screen(object): """Base gui screen class every game screen class should inherit from this one """ __triggers = [] __old_hover = None __hover = None __hover_changed = False def __init__(self): pass def log_info(self, message): """Prints an INFO message to standard output""" ts = int(time.time()) print("# INFO %i ... %s" % (ts, message)) def log_error(self, message): """Prints an ERROR message to standard output""" ts = int(time.time()) print("! ERROR %i ... %s" % (ts, message)) def reset_triggers_list(self): """Clears the screen's trigger list""" self.__triggers = [] def add_trigger(self, trigger): """Appends given trigger to the end of screen's trigger list""" if not trigger.has_key('hover_id'): trigger['hover_id'] = None self.__triggers.append(trigger) def list_triggers(self): """Returns the screen's list of triggers""" return self.__triggers def get_timestamp(self, zoom = 1): """Returns an actual timestamp""" return int(time.time() * zoom) def get_image(self, img_key, subkey1 = None, subkey2 = None, subkey3 = None): """Returns an image object from GUI engine, identified by its key(s)""" return gui.GUI.get_image(img_key, subkey1, subkey2, subkey3) def redraw_flip(self): """Redraws the screen, takes care about mouse cursor and flips the graphic buffer to display""" self.draw() gui.GUI.highlight_triggers(self.list_triggers()) gui.GUI.flip() def redraw_noflip(self): """Redraws the screen, takes care about mouse cursor but doesn't flip the buffer to display""" self.draw() gui.GUI.highlight_triggers(self.list_triggers()) def prepare(self): """This method should be implemented by screens that require some special actions each time before the screen is run. For example to reset screen to a well known state to prevent unexpected behaviour. """ pass def draw(self): """All static graphic output should be implemented in this method. Unless there is only a dynamic graphic (animations), every screen should implement this method. """ pass def animate(self): """Entry point for Screen animations, e.g. ship trajectory on MainScreen. GUI engine calls this method periodically Animations should be time-dependant - such screens have to implement the timing! """ pass def get_escape_trigger(self): """Returns standard trigger for sending escape action""" return {'action': "ESCAPE"} def on_mousebuttonup(self, event): """Default implementation of mouse click event serving. Checks the mouse wheel events (up and down scrolling) and regular mouse buttons. If the event's subject is the left mouse button it checks the mouse position against the trigger list and returns the first trigger where mouse positions is within its rectangle. There is a good chance that no screen would have to override this method. """ if event.button == MOUSE_MIDDLE_BUTTON: print event elif event.button == MOUSE_WHEELUP: return {'action': "SCROLL_UP"} elif event.button == MOUSE_WHEELDOWN: return {'action': "SCROLL_DOWN"} else: triggers_list = self.list_triggers() for trigger in triggers_list: if trigger['rect'].collidepoint(event.pos): if event.button == MOUSE_LEFT_BUTTON: trigger['mouse_pos'] = event.pos return trigger elif event.button == MOUSE_RIGHT_BUTTON: return {'action': "help", 'help': trigger['action']} def on_keydown(self, event): """Default implementation of a keyboard event handling. If keypress is detected by a GUI engine it calls this method. The pressed key is checked against the trigger list. Returns the first trigger where the key matches the pressed or None if no trigger matches the keypress There is a good chance that no screen would have to override this method. """ print("@ screen.Screen::on_keydown()") print(" scancode = %i" % event.scancode) print(" key = %i" % event.key) if event.key == K_ESCAPE: return {'action': "ESCAPE"} else: triggers_list = self.list_triggers() for trigger in triggers_list: if trigger.has_key('key') and trigger['key'] == event.key: return trigger return {'action': "key", 'key': event.key} def update_hover(self, mouse_pos): """This method is invoked by a GUI engine on every pure mouse move and right before the screen's on_mousemotion() method. Mouse position is checked against screen's trigger list. If hover is detected (=mouse position is inside the trigger's rectangle) the trigger is copied and can be returned by get_hover() method Also if the previously stored value is different than the new one, the __hover_changed flag is set to True The idea is to handle mouse hover detection separately, so other methods could rely on get_hover() and hover_changed() methods. Probably no screen should require to override this method. """ for trigger in self.list_triggers(): if trigger.has_key('hover_id') and trigger['rect'].collidepoint(mouse_pos): if self.__hover != trigger: self.__hover_changed = True self.__hover = trigger break def get_hover(self): """Returns the current hover trigger""" return self.__hover def hover_changed(self): """Returns True if screen's hover has changed since last call of this method""" if self.__hover_changed: self.__hover_changed = False return True else: return False def on_mousemotion(self, event): """Invoked by a GUI engine on every pure (non-dragging) mouse move. Currently no screen requires to override this empty implementation. """ pass def get_drag_item(self, mouse_pos): """""" for trigger in self.list_triggers(): if trigger.has_key('drag_id') and trigger['rect'].collidepoint(mouse_pos): return trigger['drag_id'] return None def on_mousedrag(self, drag_item, pos, rel): """Invoked by a GUI engine when left mouse button is being held, drag item is set and mouse moves""" pass def on_mousedrop(self, drag_item, (mouse_x, mouse_y)): """Invoked by a GUI engine when mouse dragging stops (drag item was set and left mouse button was released). """ pass def process_trigger(self, trigger): """Empty implementation of a trigger handling If a screen trigger is positively evaluated (e.g. returned from on_mousebuttonup() or on_keydown() methods) it's passed as a trigger argument to this method Every screen should override this method to handle the proper actions. """ pass def enter(self): """ Called by GUI engine right before gui_client::run_screen() is invoked Suitable for saving initial state that can be reveresed by the screen's cancel() method """ pass def leave_confirm(self): """ Called by GUI engine when CONFIRM trigger is activated Every screen that sends data to the game server should implement this method """ pass def leave_cancel(self): """ Called by GUI engine when ESCAPE trigger is activated This is the right place to implement things like getting the screen to state before any changes were made """ pass
pjotrligthart/openmoo2-unofficial
game/gui/screen.py
Python
gpl-2.0
8,413
from __future__ import unicode_literals from __future__ import print_function from __future__ import absolute_import from __future__ import division ''' All things computer vision. ''' import cv2 from mousetrap.i18n import _ from mousetrap.image import Image import mousetrap.plugins.interface as interface import logging LOGGER = logging.getLogger(__name__) FRAME_WIDTH = 3 FRAME_HEIGHT = 4 class Camera(object): S_CAPTURE_OPEN_ERROR = _( 'Device #%d does not support video capture interface') S_CAPTURE_READ_ERROR = _('Error while capturing. Camera disconnected?') def __init__(self, config): self._config = config self._device = \ self._new_capture_device(config['camera']['device_index']) self.set_dimensions( config['camera']['width'], config['camera']['height'], ) @classmethod def _new_capture_device(cls, device_index): capture = cv2.VideoCapture(device_index) if not capture.isOpened(): capture.release() raise IOError(cls.S_CAPTURE_OPEN_ERROR % device_index) return capture def set_dimensions(self, width, height): self._device.set(FRAME_WIDTH, width) self._device.set(FRAME_HEIGHT, height) def read_image(self): ret, image = self._device.read() if not ret: raise IOError(self.S_CAPTURE_READ_ERROR) return Image(self._config, image) class HaarLoader(object): def __init__(self, config): self._config = config self._haar_files = config['haar_files'] self._haar_cache = {} def from_name(self, name): if not name in self._haar_files: raise HaarNameError(name) haar_file = self._haar_files[name] haar = self.from_file(haar_file, name) return haar def from_file(self, file_, cache_name=None): import os if cache_name in self._haar_cache: return self._haar_cache[cache_name] current_dir = os.path.dirname(os.path.realpath(__file__)) haar_file = os.path.join(current_dir, file_) haar = cv2.CascadeClassifier(haar_file) if not cache_name is None: if not cache_name in self._haar_cache: self._haar_cache[cache_name] = haar return haar class HaarNameError(Exception): pass class FeatureDetector(object): _INSTANCES = {} @classmethod def get_detector(cls, config, name, scale_factor=1.1, min_neighbors=3): key = (name, scale_factor, min_neighbors) if key in cls._INSTANCES: LOGGER.info("Reusing %s detector.", key) return cls._INSTANCES[key] cls._INSTANCES[key] = FeatureDetector( config, name, scale_factor, min_neighbors) return cls._INSTANCES[key] @classmethod def clear_all_detection_caches(cls): for instance in cls._INSTANCES.values(): instance.clear_cache() def __init__(self, config, name, scale_factor=1.1, min_neighbors=3): ''' name - name of feature to detect scale_factor - how much the image size is reduced at each image scale while searching. Default 1.1. min_neighbors - how many neighbors each candidate rectangle should have to retain it. Default 3. ''' LOGGER.info("Building detector: %s", (name, scale_factor, min_neighbors)) self._config = config self._name = name self._single = None self._plural = None self._image = None self._cascade = HaarLoader(config).from_name(name) self._scale_factor = scale_factor self._min_neighbors = min_neighbors self._last_attempt_successful = False self._detect_cache = {} def detect(self, image): if image in self._detect_cache: message = "Detection cache hit: %(image)d -> %(result)s" % \ {'image':id(image), 'result':self._detect_cache[image]} LOGGER.debug(message) if isinstance(self._detect_cache[image], FeatureNotFoundException): message = str(self._detect_cache[image]) raise FeatureNotFoundException(message, cause=self._detect_cache[image]) return self._detect_cache[image] try: self._image = image self._detect_plural() self._exit_if_none_detected() self._unpack_first() self._extract_image() self._calculate_center() self._detect_cache[image] = self._single return self._detect_cache[image] except FeatureNotFoundException as exception: self._detect_cache[image] = exception raise def _detect_plural(self): self._plural = self._cascade.detectMultiScale( self._image.to_cv_grayscale(), self._scale_factor, self._min_neighbors, ) def _exit_if_none_detected(self): if len(self._plural) == 0: message = _('Feature not detected: %s') % (self._name) if self._last_attempt_successful: self._last_attempt_successful = False LOGGER.info(message) raise FeatureNotFoundException(message) else: if not self._last_attempt_successful: self._last_attempt_successful = True message = _('Feature detected: %s') % (self._name) LOGGER.info(message) def _unpack_first(self): self._single = dict( zip(['x', 'y', 'width', 'height'], self._plural[0])) def _calculate_center(self): self._single["center"] = { "x": (self._single["x"] + self._single["width"]) // 2, "y": (self._single["y"] + self._single["height"]) // 2, } def _extract_image(self): single = self._single from_y = single['y'] to_y = single['y'] + single['height'] from_x = single['x'] to_x = single['x'] + single['width'] image_cv_grayscale = self._image.to_cv_grayscale() single["image"] = Image( self._config, image_cv_grayscale[from_y:to_y, from_x:to_x], is_grayscale=True, ) def clear_cache(self): self._detect_cache.clear() class FeatureDetectorClearCachePlugin(interface.Plugin): def __init__(self, config): super(FeatureDetectorClearCachePlugin, self).__init__(config) self._config = config def run(self, app): FeatureDetector.clear_all_detection_caches() class FeatureNotFoundException(Exception): def __init__(self, message, cause=None): if cause is not None: message = message + ', caused by ' + repr(cause) self.cause = cause super(FeatureNotFoundException, self).__init__(message)
GNOME-MouseTrap/mousetrap
src/mousetrap/vision.py
Python
gpl-2.0
6,987
# Copyright (C) 2020 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals import libdnf import hawkey from dnf.i18n import _ import dnf.exceptions import json VERSION_MAJOR = 0 VERSION_MINOR = 0 VERSION = "%s.%s" % (VERSION_MAJOR, VERSION_MINOR) """ The version of the stored transaction. MAJOR version denotes backwards incompatible changes (old dnf won't work with new transaction JSON). MINOR version denotes extending the format without breaking backwards compatibility (old dnf can work with new transaction JSON). Forwards compatibility needs to be handled by being able to process the old format as well as the new one. """ class TransactionError(dnf.exceptions.Error): def __init__(self, msg): super(TransactionError, self).__init__(msg) class TransactionReplayError(dnf.exceptions.Error): def __init__(self, filename, errors): """ :param filename: The name of the transaction file being replayed :param errors: a list of error classes or a string with an error description """ # store args in case someone wants to read them from a caught exception self.filename = filename if isinstance(errors, (list, tuple)): self.errors = errors else: self.errors = [errors] if filename: msg = _('The following problems occurred while replaying the transaction from file "{filename}":').format(filename=filename) else: msg = _('The following problems occurred while running a transaction:') for error in self.errors: msg += "\n " + str(error) super(TransactionReplayError, self).__init__(msg) class IncompatibleTransactionVersionError(TransactionReplayError): def __init__(self, filename, msg): super(IncompatibleTransactionVersionError, self).__init__(filename, msg) def _check_version(version, filename): major, minor = version.split('.') try: major = int(major) except ValueError as e: raise TransactionReplayError( filename, _('Invalid major version "{major}", number expected.').format(major=major) ) try: int(minor) # minor is unused, just check it's a number except ValueError as e: raise TransactionReplayError( filename, _('Invalid minor version "{minor}", number expected.').format(minor=minor) ) if major != VERSION_MAJOR: raise IncompatibleTransactionVersionError( filename, _('Incompatible major version "{major}", supported major version is "{major_supp}".') .format(major=major, major_supp=VERSION_MAJOR) ) def serialize_transaction(transaction): """ Serializes a transaction to a data structure that is equivalent to the stored JSON format. :param transaction: the transaction to serialize (an instance of dnf.db.history.TransactionWrapper) """ data = { "version": VERSION, } rpms = [] groups = [] environments = [] if transaction is None: return data for tsi in transaction.packages(): if tsi.is_package(): rpms.append({ "action": tsi.action_name, "nevra": tsi.nevra, "reason": libdnf.transaction.TransactionItemReasonToString(tsi.reason), "repo_id": tsi.from_repo }) elif tsi.is_group(): group = tsi.get_group() group_data = { "action": tsi.action_name, "id": group.getGroupId(), "packages": [], "package_types": libdnf.transaction.compsPackageTypeToString(group.getPackageTypes()) } for pkg in group.getPackages(): group_data["packages"].append({ "name": pkg.getName(), "installed": pkg.getInstalled(), "package_type": libdnf.transaction.compsPackageTypeToString(pkg.getPackageType()) }) groups.append(group_data) elif tsi.is_environment(): env = tsi.get_environment() env_data = { "action": tsi.action_name, "id": env.getEnvironmentId(), "groups": [], "package_types": libdnf.transaction.compsPackageTypeToString(env.getPackageTypes()) } for grp in env.getGroups(): env_data["groups"].append({ "id": grp.getGroupId(), "installed": grp.getInstalled(), "group_type": libdnf.transaction.compsPackageTypeToString(grp.getGroupType()) }) environments.append(env_data) if rpms: data["rpms"] = rpms if groups: data["groups"] = groups if environments: data["environments"] = environments return data class TransactionReplay(object): """ A class that encapsulates replaying a transaction. The transaction data are loaded and stored when the class is initialized. The transaction is run by calling the `run()` method, after the transaction is created (but before it is performed), the `post_transaction()` method needs to be called to verify no extra packages were pulled in and also to fix the reasons. """ def __init__( self, base, filename="", data=None, ignore_extras=False, ignore_installed=False, skip_unavailable=False ): """ :param base: the dnf base :param filename: the filename to load the transaction from (conflicts with the 'data' argument) :param data: the dictionary to load the transaction from (conflicts with the 'filename' argument) :param ignore_extras: whether to ignore extra package pulled into the transaction :param ignore_installed: whether to ignore installed versions of packages :param skip_unavailable: whether to skip transaction packages that aren't available """ self._base = base self._filename = filename self._ignore_installed = ignore_installed self._ignore_extras = ignore_extras self._skip_unavailable = skip_unavailable if not self._base.conf.strict: self._skip_unavailable = True self._nevra_cache = set() self._nevra_reason_cache = {} self._warnings = [] if filename and data: raise ValueError(_("Conflicting TransactionReplay arguments have been specified: filename, data")) elif filename: self._load_from_file(filename) else: self._load_from_data(data) def _load_from_file(self, fn): self._filename = fn with open(fn, "r") as f: try: replay_data = json.load(f) except json.decoder.JSONDecodeError as e: raise TransactionReplayError(fn, str(e) + ".") try: self._load_from_data(replay_data) except TransactionError as e: raise TransactionReplayError(fn, e) def _load_from_data(self, data): self._replay_data = data self._verify_toplevel_json(self._replay_data) self._rpms = self._replay_data.get("rpms", []) self._assert_type(self._rpms, list, "rpms", "array") self._groups = self._replay_data.get("groups", []) self._assert_type(self._groups, list, "groups", "array") self._environments = self._replay_data.get("environments", []) self._assert_type(self._environments, list, "environments", "array") def _raise_or_warn(self, warn_only, msg): if warn_only: self._warnings.append(msg) else: raise TransactionError(msg) def _assert_type(self, value, t, id, expected): if not isinstance(value, t): raise TransactionError(_('Unexpected type of "{id}", {exp} expected.').format(id=id, exp=expected)) def _verify_toplevel_json(self, replay_data): fn = self._filename if "version" not in replay_data: raise TransactionReplayError(fn, _('Missing key "{key}".'.format(key="version"))) self._assert_type(replay_data["version"], str, "version", "string") _check_version(replay_data["version"], fn) def _replay_pkg_action(self, pkg_data): try: action = pkg_data["action"] nevra = pkg_data["nevra"] repo_id = pkg_data["repo_id"] reason = libdnf.transaction.StringToTransactionItemReason(pkg_data["reason"]) except KeyError as e: raise TransactionError( _('Missing object key "{key}" in an rpm.').format(key=e.args[0]) ) except IndexError as e: raise TransactionError( _('Unexpected value of package reason "{reason}" for rpm nevra "{nevra}".') .format(reason=pkg_data["reason"], nevra=nevra) ) subj = hawkey.Subject(nevra) parsed_nevras = subj.get_nevra_possibilities(forms=[hawkey.FORM_NEVRA]) if len(parsed_nevras) != 1: raise TransactionError(_('Cannot parse NEVRA for package "{nevra}".').format(nevra=nevra)) parsed_nevra = parsed_nevras[0] na = "%s.%s" % (parsed_nevra.name, parsed_nevra.arch) query_na = self._base.sack.query().filter(name=parsed_nevra.name, arch=parsed_nevra.arch) epoch = parsed_nevra.epoch if parsed_nevra.epoch is not None else 0 query = query_na.filter(epoch=epoch, version=parsed_nevra.version, release=parsed_nevra.release) # In case the package is found in the same repo as in the original # transaction, limit the query to that plus installed packages. IOW # remove packages with the same NEVRA in case they are found in # multiple repos and the repo the package came from originally is one # of them. # This can e.g. make a difference in the system-upgrade plugin, in case # the same NEVRA is in two repos, this makes sure the same repo is used # for both download and upgrade steps of the plugin. if repo_id: query_repo = query.filter(reponame=repo_id) if query_repo: query = query_repo.union(query.installed()) if not query: self._raise_or_warn(self._skip_unavailable, _('Cannot find rpm nevra "{nevra}".').format(nevra=nevra)) return # a cache to check no extra packages were pulled into the transaction if action != "Reason Change": self._nevra_cache.add(nevra) # store reasons for forward actions and "Removed", the rest of the # actions reasons should stay as they were determined by the transaction if action in ("Install", "Upgrade", "Downgrade", "Reinstall", "Removed"): self._nevra_reason_cache[nevra] = reason if action in ("Install", "Upgrade", "Downgrade"): if action == "Install" and query_na.installed() and not self._base._get_installonly_query(query_na): self._raise_or_warn(self._ignore_installed, _('Package "{na}" is already installed for action "{action}".').format(na=na, action=action)) sltr = dnf.selector.Selector(self._base.sack).set(pkg=query) self._base.goal.install(select=sltr, optional=not self._base.conf.strict) elif action == "Reinstall": query = query.available() if not query: self._raise_or_warn(self._skip_unavailable, _('Package nevra "{nevra}" not available in repositories for action "{action}".') .format(nevra=nevra, action=action)) return sltr = dnf.selector.Selector(self._base.sack).set(pkg=query) self._base.goal.install(select=sltr, optional=not self._base.conf.strict) elif action in ("Upgraded", "Downgraded", "Reinstalled", "Removed", "Obsoleted"): query = query.installed() if not query: self._raise_or_warn(self._ignore_installed, _('Package nevra "{nevra}" not installed for action "{action}".').format(nevra=nevra, action=action)) return # erasing the original version (the reverse part of an action like # e.g. upgrade) is more robust, but we can't do it if # skip_unavailable is True, because if the forward part of the # action is skipped, we would simply remove the package here if not self._skip_unavailable or action == "Removed": for pkg in query: self._base.goal.erase(pkg, clean_deps=False) elif action == "Reason Change": self._base.history.set_reason(query[0], reason) else: raise TransactionError( _('Unexpected value of package action "{action}" for rpm nevra "{nevra}".') .format(action=action, nevra=nevra) ) def _create_swdb_group(self, group_id, pkg_types, pkgs): comps_group = self._base.comps._group_by_id(group_id) if not comps_group: self._raise_or_warn(self._skip_unavailable, _("Group id '%s' is not available.") % group_id) return None swdb_group = self._base.history.group.new(group_id, comps_group.name, comps_group.ui_name, pkg_types) try: for pkg in pkgs: name = pkg["name"] self._assert_type(name, str, "groups.packages.name", "string") installed = pkg["installed"] self._assert_type(installed, bool, "groups.packages.installed", "boolean") package_type = pkg["package_type"] self._assert_type(package_type, str, "groups.packages.package_type", "string") try: swdb_group.addPackage(name, installed, libdnf.transaction.stringToCompsPackageType(package_type)) except libdnf.error.Error as e: raise TransactionError(str(e)) except KeyError as e: raise TransactionError( _('Missing object key "{key}" in groups.packages.').format(key=e.args[0]) ) return swdb_group def _swdb_group_install(self, group_id, pkg_types, pkgs): swdb_group = self._create_swdb_group(group_id, pkg_types, pkgs) if swdb_group is not None: self._base.history.group.install(swdb_group) def _swdb_group_upgrade(self, group_id, pkg_types, pkgs): if not self._base.history.group.get(group_id): self._raise_or_warn( self._ignore_installed, _("Group id '%s' is not installed.") % group_id) return swdb_group = self._create_swdb_group(group_id, pkg_types, pkgs) if swdb_group is not None: self._base.history.group.upgrade(swdb_group) def _swdb_group_remove(self, group_id, pkg_types, pkgs): if not self._base.history.group.get(group_id): self._raise_or_warn(self._ignore_installed, _("Group id '%s' is not installed.") % group_id) return swdb_group = self._create_swdb_group(group_id, pkg_types, pkgs) if swdb_group is not None: self._base.history.group.remove(swdb_group) def _create_swdb_environment(self, env_id, pkg_types, groups): comps_env = self._base.comps._environment_by_id(env_id) if not comps_env: self._raise_or_warn(self._skip_unavailable, _("Environment id '%s' is not available.") % env_id) return None swdb_env = self._base.history.env.new(env_id, comps_env.name, comps_env.ui_name, pkg_types) try: for grp in groups: id = grp["id"] self._assert_type(id, str, "environments.groups.id", "string") installed = grp["installed"] self._assert_type(installed, bool, "environments.groups.installed", "boolean") group_type = grp["group_type"] self._assert_type(group_type, str, "environments.groups.group_type", "string") try: group_type = libdnf.transaction.stringToCompsPackageType(group_type) except libdnf.error.Error as e: raise TransactionError(str(e)) if group_type not in ( libdnf.transaction.CompsPackageType_MANDATORY, libdnf.transaction.CompsPackageType_OPTIONAL ): raise TransactionError( _('Invalid value "{group_type}" of environments.groups.group_type, ' 'only "mandatory" or "optional" is supported.' ).format(group_type=grp["group_type"]) ) swdb_env.addGroup(id, installed, group_type) except KeyError as e: raise TransactionError( _('Missing object key "{key}" in environments.groups.').format(key=e.args[0]) ) return swdb_env def _swdb_environment_install(self, env_id, pkg_types, groups): swdb_env = self._create_swdb_environment(env_id, pkg_types, groups) if swdb_env is not None: self._base.history.env.install(swdb_env) def _swdb_environment_upgrade(self, env_id, pkg_types, groups): if not self._base.history.env.get(env_id): self._raise_or_warn(self._ignore_installed,_("Environment id '%s' is not installed.") % env_id) return swdb_env = self._create_swdb_environment(env_id, pkg_types, groups) if swdb_env is not None: self._base.history.env.upgrade(swdb_env) def _swdb_environment_remove(self, env_id, pkg_types, groups): if not self._base.history.env.get(env_id): self._raise_or_warn(self._ignore_installed, _("Environment id '%s' is not installed.") % env_id) return swdb_env = self._create_swdb_environment(env_id, pkg_types, groups) if swdb_env is not None: self._base.history.env.remove(swdb_env) def get_data(self): """ :returns: the loaded data of the transaction """ return self._replay_data def get_warnings(self): """ :returns: an array of warnings gathered during the transaction replay """ return self._warnings def run(self): """ Replays the transaction. """ fn = self._filename errors = [] for pkg_data in self._rpms: try: self._replay_pkg_action(pkg_data) except TransactionError as e: errors.append(e) for group_data in self._groups: try: action = group_data["action"] group_id = group_data["id"] try: pkg_types = libdnf.transaction.stringToCompsPackageType(group_data["package_types"]) except libdnf.error.Error as e: errors.append(TransactionError(str(e))) continue if action == "Install": self._swdb_group_install(group_id, pkg_types, group_data["packages"]) elif action == "Upgrade": self._swdb_group_upgrade(group_id, pkg_types, group_data["packages"]) elif action == "Removed": self._swdb_group_remove(group_id, pkg_types, group_data["packages"]) else: errors.append(TransactionError( _('Unexpected value of group action "{action}" for group "{group}".') .format(action=action, group=group_id) )) except KeyError as e: errors.append(TransactionError( _('Missing object key "{key}" in a group.').format(key=e.args[0]) )) except TransactionError as e: errors.append(e) for env_data in self._environments: try: action = env_data["action"] env_id = env_data["id"] try: pkg_types = libdnf.transaction.stringToCompsPackageType(env_data["package_types"]) except libdnf.error.Error as e: errors.append(TransactionError(str(e))) continue if action == "Install": self._swdb_environment_install(env_id, pkg_types, env_data["groups"]) elif action == "Upgrade": self._swdb_environment_upgrade(env_id, pkg_types, env_data["groups"]) elif action == "Removed": self._swdb_environment_remove(env_id, pkg_types, env_data["groups"]) else: errors.append(TransactionError( _('Unexpected value of environment action "{action}" for environment "{env}".') .format(action=action, env=env_id) )) except KeyError as e: errors.append(TransactionError( _('Missing object key "{key}" in an environment.').format(key=e.args[0]) )) except TransactionError as e: errors.append(e) if errors: raise TransactionReplayError(fn, errors) def post_transaction(self): """ Sets reasons in the transaction history to values from the stored transaction. Also serves to check whether additional packages were pulled in by the transaction, which results in an error (unless ignore_extras is True). """ if not self._base.transaction: return errors = [] for tsi in self._base.transaction: try: pkg = tsi.pkg except KeyError as e: # the transaction item has no package, happens for action == "Reason Change" continue nevra = str(pkg) if nevra not in self._nevra_cache: # if ignore_installed is True, we don't want to check for # Upgraded/Downgraded/Reinstalled extras in the transaction, # basically those may be installed and we are ignoring them if not self._ignore_installed or not tsi.action in ( libdnf.transaction.TransactionItemAction_UPGRADED, libdnf.transaction.TransactionItemAction_DOWNGRADED, libdnf.transaction.TransactionItemAction_REINSTALLED ): msg = _('Package nevra "{nevra}", which is not present in the transaction file, was pulled ' 'into the transaction.' ).format(nevra=nevra) if not self._ignore_extras: errors.append(TransactionError(msg)) else: self._warnings.append(msg) try: replay_reason = self._nevra_reason_cache[nevra] if tsi.action in ( libdnf.transaction.TransactionItemAction_INSTALL, libdnf.transaction.TransactionItemAction_REMOVE ) or libdnf.transaction.TransactionItemReasonCompare(replay_reason, tsi.reason) > 0: tsi.reason = replay_reason except KeyError as e: # if the pkg nevra wasn't found, we don't want to change the reason pass if errors: raise TransactionReplayError(self._filename, errors)
rpm-software-management/dnf
dnf/transaction_sr.py
Python
gpl-2.0
24,701
# #################################################################### # gofed - set of tools to automize packaging of golang devel codes # Copyright (C) 2014 Jan Chaloupka, [email protected] # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # #################################################################### ################################################################### # TODO: # [ ] - detect more import paths/sources in spec file? # [ ] - detect from %files every build, analyze its content (downloading it from koji by detecting its name # from spec file => no koji latest-builds, which packages/builds are no arch, which are arch specific (el6 beast) # [ ] - all provides of source code import must in a form golang(import_path/...) # [ ] - what files/provides are optional, which should not be in provides (test files, example, ...) # [ ] - golang imports of examples are optional ################################################################### import tempfile from Utils import runCommand from SpecParser import SpecParser from Base import Base class RemoteSpecParser(Base): def __init__(self, branch, package): Base.__init__(self) self.branch = branch self.package = package self.sp_obj = None def parse(self): f = tempfile.NamedTemporaryFile(delete=True) cmd_str = "curl http://pkgs.fedoraproject.org/cgit/rpms/%s.git/plain/%s.spec > %s" runCommand(cmd_str % (self.package, self.package, f.name)) self.sp_obj = SpecParser(f.name) if not self.sp_obj.parse(): self.err = self.sp_obj.getError() f.close() return False f.close() return True def getProvides(self): """Fetch a spec file from pkgdb and get provides from all its [sub]packages""" if self.sp_obj == None: return {} return self.sp_obj.getProvides() def getPackageCommits(self): if self.sp_obj == None: return "" return self.sp_obj.getMacro("commit") def getPkgURL(self): if self.sp_obj == None: return "" return self.sp_obj.getTag("url")
ingvagabund/gofed
modules/RemoteSpecParser.py
Python
gpl-2.0
2,663
# YWeather by 2boom 2013 v.0.6 # xml from http://weather.yahooapis.com/forecastrss from Components.Converter.Converter import Converter from Components.Element import cached from Tools.Directories import fileExists from Poll import Poll import time import os class YWeather(Poll, Converter, object): weather_city = '711665' time_update = 20 time_update_ms = 30000 city = 0 country = 1 direction = 2 speed = 3 humidity = 4 visibility = 5 pressure = 6 pressurenm = 7 wtext = 8 temp = 9 picon = 10 wtext2 = 11 templow2 = 12 temphigh2 = 13 picon2 = 14 day2 = 15 date2 = 16 wtext3 = 17 templow3 = 18 temphigh3 = 19 picon3 = 20 day3 = 21 date3 = 22 wtext4 = 23 templow4 = 24 temphigh4 = 25 picon4 = 26 day4 = 27 date4 = 28 wtext5 = 29 templow5 = 30 temphigh5 = 31 picon5 = 32 day5 = 33 date5 = 34 def __init__(self, type): Converter.__init__(self, type) Poll.__init__(self) if type == "city": self.type = self.city elif type == "country": self.type = self.country elif type == "direction": self.type = self.direction elif type == "speed": self.type = self.speed elif type == "humidity": self.type = self.humidity elif type == "visibility": self.type = self.visibility elif type == "pressure": self.type = self.pressure elif type == "pressurenm": self.type = self.pressurenm elif type == "text": self.type = self.wtext elif type == "temp": self.type = self.temp elif type == "picon": self.type = self.picon elif type == "text2": self.type = self.wtext2 elif type == "templow2": self.type = self.templow2 elif type == "temphigh2": self.type = self.temphigh2 elif type == "day2": self.type = self.day2 elif type == "date2": self.type = self.date2 elif type == "picon2": self.type = self.picon2 elif type == "text3": self.type = self.wtext3 elif type == "templow3": self.type = self.templow3 elif type == "temphigh3": self.type = self.temphigh3 elif type == "day3": self.type = self.day3 elif type == "date3": self.type = self.date3 elif type == "picon3": self.type = self.picon3 elif type == "text4": self.type = self.wtext4 elif type == "templow4": self.type = self.templow4 elif type == "temphigh4": self.type = self.temphigh4 elif type == "day4": self.type = self.day4 elif type == "date4": self.type = self.date4 elif type == "picon4": self.type = self.picon4 elif type == "text5": self.type = self.wtext5 elif type == "templow5": self.type = self.templow5 elif type == "temphigh5": self.type = self.temphigh5 elif type == "day5": self.type = self.day5 elif type == "date5": self.type = self.date5 elif type == "picon5": self.type = self.picon5 self.poll_interval = self.time_update_ms self.poll_enabled = True @cached def getText(self): xweather = {'ycity':"N/A", 'ycountry':"N/A", 'ydirection':"N/A", 'yspeed':"N/A", 'yhumidity':"N/A", 'yvisibility':"N/A", 'ypressure':"N/A", 'ytext':"N/A", 'ytemp':"N/A", 'ypicon':"3200", 'yday2':"N/A", 'yday3':"N/A", 'yday4':"N/A", 'yday5':"N/A", 'ypiconday2':"3200", 'ypiconday3':"3200", 'ypiconday4':"3200", 'ypiconday5':"3200", 'ydate2':"N/A", 'ydate3':"N/A", 'ydate4':"N/A", 'ydate5':"N/A", 'ytextday2':"N/A", 'ytextday3':"N/A", 'ytextday4':"N/A", 'ytextday5':"N/A", 'ytemphighday2':"N/A", 'ytemphighday3':"N/A", 'ytemphighday4':"N/A", 'ytemphighday5':"N/A", 'ytemplowday2':"N/A", 'ytemplowday3':"N/A", 'ytemplowday4':"N/A", 'ytemplowday5':"N/A"} direct = 0 info = "" if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/iSkin/Weather/Config/Location_id"): self.weather_city = open("/usr/lib/enigma2/python/Plugins/Extensions/iSkin/Weather/Config/Location_id").read() elif fileExists("/usr/lib/enigma2/python/Plugins/Extensions/YahooWeather/Config/Location_id"): self.weather_city = open("/usr/lib/enigma2/python/Plugins/Extensions/YahooWeather/Config/Location_id").read() if fileExists("/tmp/yweather.xml"): if int((time.time() - os.stat("/tmp/yweather.xml").st_mtime)/60) >= self.time_update: os.system("rm /tmp/yweather.xml") os.system("wget -P /tmp -T2 'https://query.yahooapis.com/v1/public/yql?q=select%20%2A%20from%20weather.forecast%20where%20woeid=%s%20AND%20u=%22c%22' -O /tmp/yweather.xml" % self.weather_city) else: os.system("wget -P /tmp -T2 'https://query.yahooapis.com/v1/public/yql?q=select%20%2A%20from%20weather.forecast%20where%20woeid=%s%20AND%20u=%22c%22' -O /tmp/yweather.xml" % self.weather_city) if not fileExists("/tmp/yweather.xml"): os.system("echo -e 'None' >> /tmp/yweather.xml") return 'N/A' if not fileExists("/tmp/yweather.xml"): os.system("echo -e 'None' >> /tmp/yweather.xml") return 'N/A' wday = 1 for line in open("/tmp/yweather.xml"): if line.find("<yweather:location") > -1: xweather['ycity'] = line.split('city')[1].split('"')[1] xweather['ycountry'] = line.split('country')[1].split('"')[1] elif line.find("<yweather:wind") > -1: xweather['ydirection'] = line.split('direction')[1].split('"')[1] xweather['yspeed'] = line.split('speed')[1].split('"')[1] elif line.find("<yweather:atmosphere") > -1: xweather['yhumidity'] = line.split('humidity')[1].split('"')[1] xweather['yvisibility'] = line.split('visibility')[1].split('"')[1] xweather['ypressure'] = line.split('pressure')[1].split('"')[1] elif line.find("<yweather:condition") > -1: xweather['ytext'] = line.split('text')[1].split('"')[1] xweather['ypicon'] = line.split('code')[1].split('"')[1] xweather['ytemp'] = line.split('temp')[1].split('"')[1] elif line.find('yweather:forecast') > -1: if wday == 2: xweather['yday2'] = line.split('day')[1].split('"')[1] xweather['ydate2'] = line.split('date')[1].split('"')[1] xweather['ytextday2'] = line.split('text')[1].split('"')[1] xweather['ypiconday2'] = line.split('code')[1].split('"')[1] xweather['ytemphighday2'] = line.split('high')[1].split('"')[1] xweather['ytemplowday2'] = line.split('low')[1].split('"')[1] elif wday == 3: xweather['yday3'] = line.split('day')[1].split('"')[1] xweather['ydate3'] = line.split('date')[1].split('"')[1] xweather['ytextday3'] = line.split('text')[1].split('"')[1] xweather['ypiconday3'] = line.split('code')[1].split('"')[1] xweather['ytemphighday3'] = line.split('high')[1].split('"')[1] xweather['ytemplowday3'] = line.split('low')[1].split('"')[1] elif wday == 4: xweather['yday4'] = line.split('day')[1].split('"')[1] xweather['ydate4'] = line.split('date')[1].split('"')[1] xweather['ytextday4'] = line.split('text')[1].split('"')[1] xweather['ypiconday4'] = line.split('code')[1].split('"')[1] xweather['ytemphighday4'] = line.split('high')[1].split('"')[1] xweather['ytemplowday4'] = line.split('low')[1].split('"')[1] elif wday == 5: xweather['yday5'] = line.split('day')[1].split('"')[1] xweather['ydate5'] = line.split('date')[1].split('"')[1] xweather['ytextday5'] = line.split('text')[1].split('"')[1] xweather['ypiconday5'] = line.split('code')[1].split('"')[1] xweather['ytemphighday5'] = line.split('high')[1].split('"')[1] xweather['ytemplowday5'] = line.split('low')[1].split('"')[1] wday = wday + 1 if self.type == self.city: info = xweather['ycity'] elif self.type == self.country: info = xweather['ycountry'] elif self.type == self.direction: if xweather['ydirection'] != "N/A": direct = int(xweather['ydirection']) if direct >= 0 and direct <= 20: info = _('N') elif direct >= 21 and direct <= 35: info = _('nne') elif direct >= 36 and direct <= 55: info = _('ne') elif direct >= 56 and direct <= 70: info = _('ene') elif direct >= 71 and direct <= 110: info = _('E') elif direct >= 111 and direct <= 125: info = _('ese') elif direct >= 126 and direct <= 145: info = _('se') elif direct >= 146 and direct <= 160: info = _('sse') elif direct >= 161 and direct <= 200: info = _('S') elif direct >= 201 and direct <= 215: info = _('ssw') elif direct >= 216 and direct <= 235: info = _('sw') elif direct >= 236 and direct <= 250: info = _('wsw') elif direct >= 251 and direct <= 290: info = _('W') elif direct >= 291 and direct <= 305: info = _('wnw') elif direct >= 306 and direct <= 325: info = _('nw') elif direct >= 326 and direct <= 340: info = _('nnw') elif direct >= 341 and direct <= 360: info = _('N') else: info = "N/A" elif self.type == self.speed: info = xweather['yspeed'] + ' km/h' elif self.type == self.humidity: info = xweather['yhumidity'] + ' mb' elif self.type == self.visibility: info = xweather['yvisibility'] + ' km' elif self.type == self.pressure: info = xweather['ypressure'] + ' mb' elif self.type == self.pressurenm: if xweather['ypressure'] != "N/A": info = "%d mmHg" % round(float(xweather['ypressure']) * 0.75) else: info = "N/A" elif self.type == self.wtext: info = xweather['ytext'] elif self.type == self.temp: if info != "N/A": info = xweather['ytemp'] + '%s' % unichr(176).encode("latin-1") else: info = xweather['ytemp'] elif self.type == self.picon: info = xweather['ypicon'] elif self.type == self.wtext2: info = xweather['ytextday2'] elif self.type == self.templow2: if info != "N/A": info = xweather['ytemplowday2'] + '%s' % unichr(176).encode("latin-1") else: info = xweather['ytemplowday2'] elif self.type == self.temphigh2: if info != "N/A": info = xweather['ytemphighday2'] + '%s' % unichr(176).encode("latin-1") else: info = xweather['ytemphighday2'] elif self.type == self.picon2: info = xweather['ypiconday2'] elif self.type == self.day2: if xweather['yday2'] != "N/A": day = xweather['yday2'] if day == 'Mon': info = _('Mon') elif day == 'Tue': info = _('Tue') elif day == 'Wed': info = _('Wed') elif day == 'Thu': info = _('Thu') elif day == 'Fri': info = _('Fri') elif day == 'Sat': info = _('Sat') elif day == 'Sun': info = _('Sun') else: info = "N/A" elif self.type == self.date2: info = xweather['ydate2'] elif self.type == self.wtext3: info = xweather['ytextday3'] elif self.type == self.templow3: if info != "N/A": info = xweather['ytemplowday3'] + '%s' % unichr(176).encode("latin-1") else: info = xweather['ytemplowday3'] elif self.type == self.temphigh3: if info != "N/A": info = xweather['ytemphighday3'] + '%s' % unichr(176).encode("latin-1") else: info = xweather['ytemphighday3'] elif self.type == self.picon3: info = xweather['ypiconday3'] elif self.type == self.day3: if xweather['yday3'] != "N/A": day = xweather['yday3'] if day == 'Mon': info = _('Mon') elif day == 'Tue': info = _('Tue') elif day == 'Wed': info = _('Wed') elif day == 'Thu': info = _('Thu') elif day == 'Fri': info = _('Fri') elif day == 'Sat': info = _('Sat') elif day == 'Sun': info = _('Sun') else: info = "N/A" elif self.type == self.date3: info = xweather['ydate3'] elif self.type == self.wtext4: info = xweather['ytextday4'] elif self.type == self.templow4: if info != "N/A": info = xweather['ytemplowday4'] + '%s' % unichr(176).encode("latin-1") else: info = xweather['ytemplowday4'] elif self.type == self.temphigh4: if info != "N/A": info = xweather['ytemphighday4'] + '%s' % unichr(176).encode("latin-1") else: info = xweather['ytemphighday4'] elif self.type == self.picon4: info = xweather['ypiconday4'] elif self.type == self.day4: if xweather['yday4'] != "N/A": day = xweather['yday4'] if day == 'Mon': info = _('Mon') elif day == 'Tue': info = _('Tue') elif day == 'Wed': info = _('Wed') elif day == 'Thu': info = _('Thu') elif day == 'Fri': info = _('Fri') elif day == 'Sat': info = _('Sat') elif day == 'Sun': info = _('Sun') else: info = "N/A" elif self.type == self.date4: info = xweather['ydate4'] elif self.type == self.wtext5: info = xweather['ytextday5'] elif self.type == self.templow5: if info != "N/A": info = xweather['ytemplowday5'] + '%s' % unichr(176).encode("latin-1") else: info = xweather['ytemplowday5'] elif self.type == self.temphigh5: if info != "N/A": info = xweather['ytemphighday5'] + '%s' % unichr(176).encode("latin-1") else: info = xweather['ytemphighday5'] elif self.type == self.picon5: info = xweather['ypiconday5'] elif self.type == self.day5: if xweather['yday5'] != "N/A": day = xweather['yday5'] if day == 'Mon': info = _('Mon') elif day == 'Tue': info = _('Tue') elif day == 'Wed': info = _('Wed') elif day == 'Thu': info = _('Thu') elif day == 'Fri': info = _('Fri') elif day == 'Sat': info = _('Sat') elif day == 'Sun': info = _('Sun') else: info = "N/A" elif self.type == self.date5: info = xweather['ydate5'] return info text = property(getText) def changed(self, what): Converter.changed(self, (self.CHANGED_POLL,))
XTAv2/Enigma2
lib/python/Components/Converter/YWeather.py
Python
gpl-2.0
22,223
import time import os try: import enigma from Components.config import config except: print "Cannot import enigma" from Directories import resolveFilename, SCOPE_HDD def getTrashFolder(): # Returns trash folder without symlinks return os.path.realpath(os.path.join(resolveFilename(SCOPE_HDD), ".Trash")) def createTrashFolder(): trash = getTrashFolder() if not os.path.isdir(trash): os.mkdir(trash) return trash class Trashcan: def __init__(self, session): self.session = session session.nav.record_event.append(self.gotRecordEvent) self.gotRecordEvent(None, None) def gotRecordEvent(self, service, event): print "[Trashcan] gotRecordEvent", service, event self.recordings = len(self.session.nav.getRecordings()) if (event == enigma.iRecordableService.evEnd): self.cleanIfIdle() def destroy(self): if self.session is not None: self.session.nav.record_event.remove(self.gotRecordEvent) self.session = None def __del__(self): self.destroy() def cleanIfIdle(self): # RecordTimer calls this when preparing a recording. That is a # nice moment to clean up. if self.recordings: print "[Trashcan] Recording in progress", self.recordings return try: ctimeLimit = time.time() - (config.usage.movielist_trashcan_days.value * 3600 * 24) reserveBytes = 1024*1024*1024 * int(config.usage.movielist_trashcan_reserve.value) clean(ctimeLimit, reserveBytes) except Exception, e: print "[Trashcan] Weirdness:", e def clean(ctimeLimit, reserveBytes): # Remove expired items from trash, and attempt to have # reserveBytes of free disk space. trash = getTrashFolder() if not os.path.isdir(trash): print "[Trashcan] No trash.", trash return 0 diskstat = os.statvfs(trash) free = diskstat.f_bfree * diskstat.f_bsize bytesToRemove = reserveBytes - free candidates = [] print "[Trashcan] bytesToRemove", bytesToRemove size = 0 for root, dirs, files in os.walk(trash, topdown=False): for name in files: try: fn = os.path.join(root, name) st = os.stat(fn) if st.st_ctime < ctimeLimit: print "[Trashcan] Too old:", name, st.st_ctime enigma.eBackgroundFileEraser.getInstance().erase(fn) bytesToRemove -= st.st_size else: candidates.append((st.st_ctime, fn, st.st_size)) size += st.st_size except Exception, e: print "[Trashcan] Failed to stat %s:"% name, e # Remove empty directories if possible for name in dirs: try: os.rmdir(os.path.join(root, name)) except: pass candidates.sort() # Now we have a list of ctime, candidates, size. Sorted by ctime (=deletion time) print "[Trashcan] Bytes to remove:", bytesToRemove print "[Trashcan] Size now:", size for st_ctime, fn, st_size in candidates: if bytesToRemove < 0: break enigma.eBackgroundFileEraser.getInstance().erase(fn) bytesToRemove -= st_size size -= st_size print "[Trashcan] Size now:", size def cleanAll(): trash = getTrashFolder() if not os.path.isdir(trash): print "[Trashcan] No trash.", trash return 0 for root, dirs, files in os.walk(trash, topdown=False): for name in files: fn = os.path.join(root, name) try: enigma.eBackgroundFileEraser.getInstance().erase(fn) except Exception, e: print "[Trashcan] Failed to erase %s:"% name, e # Remove empty directories if possible for name in dirs: try: os.rmdir(os.path.join(root, name)) except: pass def init(session): global instance instance = Trashcan(session) # Unit test # (can be run outside enigma. Can be moved somewhere else later on) if __name__ == '__main__': class Fake: def __init__(self): self.record_event = [] self.nav = self self.RecordTimer = self self.usage = self self.movielist_trashcan_days = self self.movielist_trashcan_reserve = self self.value = 1 self.eBackgroundFileEraser = self self.iRecordableService = self self.evEnd = None def getInstance(self): # eBackgroundFileEraser return self def erase(self, fn): print "ERASE", fn def getNextRecordingTime(self): # RecordTimer return time.time() + 500 def getRecordings(self): return [] def destroy(self): if self.record_event: raise Exception, "record_event not empty" + str(self.record_event) s = Fake() createTrashFolder() config = s enigma = s init(s) diskstat = os.statvfs('/hdd/movie') free = diskstat.f_bfree * diskstat.f_bsize # Clean up one MB clean(1264606758, free + 1000000) cleanAll() instance.destroy() s.destroy()
openpli-arm/enigma2-arm
lib/python/Tools/Trashcan.py
Python
gpl-2.0
4,571
# -*- coding: utf-8 -*- # # AWL simulator - instructions # # Copyright 2012-2014 Michael Buesch <[email protected]> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # from __future__ import division, absolute_import, print_function, unicode_literals from awlsim.common.compat import * from awlsim.core.instructions.main import * #@nocy from awlsim.core.operators import * #from awlsim.core.instructions.main cimport * #@cy class AwlInsn_ASSERT_LT(AwlInsn): #+cdef __slots__ = () def __init__(self, cpu, rawInsn): AwlInsn.__init__(self, cpu, AwlInsn.TYPE_ASSERT_LT, rawInsn) self.assertOpCount(2) def run(self): #@cy cdef S7StatusWord s s = self.cpu.statusWord val0 = self.cpu.fetch(self.ops[0]) val1 = self.cpu.fetch(self.ops[1]) if not (val0 < val1): raise AwlSimError("Assertion failed") s.NER = 0
gion86/awlsim
awlsim/core/instructions/insn_assert_lt.py
Python
gpl-2.0
1,478
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers import pybindgen.settings import warnings class ErrorHandler(pybindgen.settings.ErrorHandler): def handle_error(self, wrapper, exception, traceback_): warnings.warn("exception %r in wrapper %s" % (exception, wrapper)) return True pybindgen.settings.error_handler = ErrorHandler() import sys def module_init(): root_module = Module('ns.network', cpp_namespace='::ns3') return root_module def register_types(module): root_module = module.get_root() ## packetbb.h (module 'network'): ns3::PbbAddressLength [enumeration] module.add_enum('PbbAddressLength', ['IPV4', 'IPV6']) ## ethernet-header.h (module 'network'): ns3::ethernet_header_t [enumeration] module.add_enum('ethernet_header_t', ['LENGTH', 'VLAN', 'QINQ']) ## address.h (module 'network'): ns3::Address [class] module.add_class('Address') ## address.h (module 'network'): ns3::Address::MaxSize_e [enumeration] module.add_enum('MaxSize_e', ['MAX_SIZE'], outer_class=root_module['ns3::Address']) ## application-container.h (module 'network'): ns3::ApplicationContainer [class] module.add_class('ApplicationContainer') ## trace-helper.h (module 'network'): ns3::AsciiTraceHelper [class] module.add_class('AsciiTraceHelper') ## trace-helper.h (module 'network'): ns3::AsciiTraceHelperForDevice [class] module.add_class('AsciiTraceHelperForDevice', allow_subclassing=True) ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList [class] module.add_class('AttributeConstructionList', import_from_module='ns.core') ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item [struct] module.add_class('Item', import_from_module='ns.core', outer_class=root_module['ns3::AttributeConstructionList']) ## buffer.h (module 'network'): ns3::Buffer [class] module.add_class('Buffer') ## buffer.h (module 'network'): ns3::Buffer::Iterator [class] module.add_class('Iterator', outer_class=root_module['ns3::Buffer']) ## packet.h (module 'network'): ns3::ByteTagIterator [class] module.add_class('ByteTagIterator') ## packet.h (module 'network'): ns3::ByteTagIterator::Item [class] module.add_class('Item', outer_class=root_module['ns3::ByteTagIterator']) ## byte-tag-list.h (module 'network'): ns3::ByteTagList [class] module.add_class('ByteTagList') ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator [class] module.add_class('Iterator', outer_class=root_module['ns3::ByteTagList']) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item [struct] module.add_class('Item', outer_class=root_module['ns3::ByteTagList::Iterator']) ## callback.h (module 'core'): ns3::CallbackBase [class] module.add_class('CallbackBase', import_from_module='ns.core') ## channel-list.h (module 'network'): ns3::ChannelList [class] module.add_class('ChannelList') ## data-rate.h (module 'network'): ns3::DataRate [class] module.add_class('DataRate') ## event-id.h (module 'core'): ns3::EventId [class] module.add_class('EventId', import_from_module='ns.core') ## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress [class] module.add_class('Inet6SocketAddress') ## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress [class] root_module['ns3::Inet6SocketAddress'].implicitly_converts_to(root_module['ns3::Address']) ## inet-socket-address.h (module 'network'): ns3::InetSocketAddress [class] module.add_class('InetSocketAddress') ## inet-socket-address.h (module 'network'): ns3::InetSocketAddress [class] root_module['ns3::InetSocketAddress'].implicitly_converts_to(root_module['ns3::Address']) ## ipv4-address.h (module 'network'): ns3::Ipv4Address [class] module.add_class('Ipv4Address') ## ipv4-address.h (module 'network'): ns3::Ipv4Address [class] root_module['ns3::Ipv4Address'].implicitly_converts_to(root_module['ns3::Address']) ## ipv4-address.h (module 'network'): ns3::Ipv4Mask [class] module.add_class('Ipv4Mask') ## ipv6-address.h (module 'network'): ns3::Ipv6Address [class] module.add_class('Ipv6Address') ## ipv6-address.h (module 'network'): ns3::Ipv6Address [class] root_module['ns3::Ipv6Address'].implicitly_converts_to(root_module['ns3::Address']) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix [class] module.add_class('Ipv6Prefix') ## mac48-address.h (module 'network'): ns3::Mac48Address [class] module.add_class('Mac48Address') ## mac48-address.h (module 'network'): ns3::Mac48Address [class] root_module['ns3::Mac48Address'].implicitly_converts_to(root_module['ns3::Address']) ## mac64-address.h (module 'network'): ns3::Mac64Address [class] module.add_class('Mac64Address') ## mac64-address.h (module 'network'): ns3::Mac64Address [class] root_module['ns3::Mac64Address'].implicitly_converts_to(root_module['ns3::Address']) ## net-device-container.h (module 'network'): ns3::NetDeviceContainer [class] module.add_class('NetDeviceContainer') ## node-container.h (module 'network'): ns3::NodeContainer [class] module.add_class('NodeContainer') ## node-list.h (module 'network'): ns3::NodeList [class] module.add_class('NodeList') ## object-base.h (module 'core'): ns3::ObjectBase [class] module.add_class('ObjectBase', allow_subclassing=True, import_from_module='ns.core') ## object.h (module 'core'): ns3::ObjectDeleter [struct] module.add_class('ObjectDeleter', import_from_module='ns.core') ## object-factory.h (module 'core'): ns3::ObjectFactory [class] module.add_class('ObjectFactory', import_from_module='ns.core') ## packet-metadata.h (module 'network'): ns3::PacketMetadata [class] module.add_class('PacketMetadata') ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item [struct] module.add_class('Item', outer_class=root_module['ns3::PacketMetadata']) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item [enumeration] module.add_enum('', ['PAYLOAD', 'HEADER', 'TRAILER'], outer_class=root_module['ns3::PacketMetadata::Item']) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator [class] module.add_class('ItemIterator', outer_class=root_module['ns3::PacketMetadata']) ## packet-socket-address.h (module 'network'): ns3::PacketSocketAddress [class] module.add_class('PacketSocketAddress') ## packet-socket-address.h (module 'network'): ns3::PacketSocketAddress [class] root_module['ns3::PacketSocketAddress'].implicitly_converts_to(root_module['ns3::Address']) ## packet-socket-helper.h (module 'network'): ns3::PacketSocketHelper [class] module.add_class('PacketSocketHelper') ## packet.h (module 'network'): ns3::PacketTagIterator [class] module.add_class('PacketTagIterator') ## packet.h (module 'network'): ns3::PacketTagIterator::Item [class] module.add_class('Item', outer_class=root_module['ns3::PacketTagIterator']) ## packet-tag-list.h (module 'network'): ns3::PacketTagList [class] module.add_class('PacketTagList') ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData [struct] module.add_class('TagData', outer_class=root_module['ns3::PacketTagList']) ## packetbb.h (module 'network'): ns3::PbbAddressTlvBlock [class] module.add_class('PbbAddressTlvBlock') ## packetbb.h (module 'network'): ns3::PbbTlvBlock [class] module.add_class('PbbTlvBlock') ## pcap-file.h (module 'network'): ns3::PcapFile [class] module.add_class('PcapFile') ## trace-helper.h (module 'network'): ns3::PcapHelper [class] module.add_class('PcapHelper') ## trace-helper.h (module 'network'): ns3::PcapHelper [enumeration] module.add_enum('', ['DLT_NULL', 'DLT_EN10MB', 'DLT_PPP', 'DLT_RAW', 'DLT_IEEE802_11', 'DLT_PRISM_HEADER', 'DLT_IEEE802_11_RADIO'], outer_class=root_module['ns3::PcapHelper']) ## trace-helper.h (module 'network'): ns3::PcapHelperForDevice [class] module.add_class('PcapHelperForDevice', allow_subclassing=True) ## random-variable.h (module 'core'): ns3::RandomVariable [class] module.add_class('RandomVariable', import_from_module='ns.core') ## rng-seed-manager.h (module 'core'): ns3::RngSeedManager [class] module.add_class('RngSeedManager', import_from_module='ns.core') ## sequence-number.h (module 'network'): ns3::SequenceNumber<unsigned int, int> [class] module.add_class('SequenceNumber32') ## sequence-number.h (module 'network'): ns3::SequenceNumber<unsigned short, short> [class] module.add_class('SequenceNumber16') ## random-variable.h (module 'core'): ns3::SequentialVariable [class] module.add_class('SequentialVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariable']) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Object', 'ns3::ObjectBase', 'ns3::ObjectDeleter'], parent=root_module['ns3::ObjectBase'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simulator.h (module 'core'): ns3::Simulator [class] module.add_class('Simulator', destructor_visibility='private', import_from_module='ns.core') ## system-wall-clock-ms.h (module 'core'): ns3::SystemWallClockMs [class] module.add_class('SystemWallClockMs', import_from_module='ns.core') ## tag.h (module 'network'): ns3::Tag [class] module.add_class('Tag', parent=root_module['ns3::ObjectBase']) ## tag-buffer.h (module 'network'): ns3::TagBuffer [class] module.add_class('TagBuffer') ## random-variable.h (module 'core'): ns3::TriangularVariable [class] module.add_class('TriangularVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariable']) ## type-id.h (module 'core'): ns3::TypeId [class] module.add_class('TypeId', import_from_module='ns.core') ## type-id.h (module 'core'): ns3::TypeId::AttributeFlag [enumeration] module.add_enum('AttributeFlag', ['ATTR_GET', 'ATTR_SET', 'ATTR_CONSTRUCT', 'ATTR_SGC'], outer_class=root_module['ns3::TypeId'], import_from_module='ns.core') ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation [struct] module.add_class('AttributeInformation', import_from_module='ns.core', outer_class=root_module['ns3::TypeId']) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation [struct] module.add_class('TraceSourceInformation', import_from_module='ns.core', outer_class=root_module['ns3::TypeId']) ## random-variable.h (module 'core'): ns3::UniformVariable [class] module.add_class('UniformVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariable']) ## random-variable.h (module 'core'): ns3::WeibullVariable [class] module.add_class('WeibullVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariable']) ## random-variable.h (module 'core'): ns3::ZetaVariable [class] module.add_class('ZetaVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariable']) ## random-variable.h (module 'core'): ns3::ZipfVariable [class] module.add_class('ZipfVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariable']) ## empty.h (module 'core'): ns3::empty [class] module.add_class('empty', import_from_module='ns.core') ## int64x64-double.h (module 'core'): ns3::int64x64_t [class] module.add_class('int64x64_t', import_from_module='ns.core') ## chunk.h (module 'network'): ns3::Chunk [class] module.add_class('Chunk', parent=root_module['ns3::ObjectBase']) ## random-variable.h (module 'core'): ns3::ConstantVariable [class] module.add_class('ConstantVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariable']) ## random-variable.h (module 'core'): ns3::DeterministicVariable [class] module.add_class('DeterministicVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariable']) ## random-variable.h (module 'core'): ns3::EmpiricalVariable [class] module.add_class('EmpiricalVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariable']) ## random-variable.h (module 'core'): ns3::ErlangVariable [class] module.add_class('ErlangVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariable']) ## random-variable.h (module 'core'): ns3::ExponentialVariable [class] module.add_class('ExponentialVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariable']) ## flow-id-tag.h (module 'network'): ns3::FlowIdTag [class] module.add_class('FlowIdTag', parent=root_module['ns3::Tag']) ## random-variable.h (module 'core'): ns3::GammaVariable [class] module.add_class('GammaVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariable']) ## header.h (module 'network'): ns3::Header [class] module.add_class('Header', parent=root_module['ns3::Chunk']) ## random-variable.h (module 'core'): ns3::IntEmpiricalVariable [class] module.add_class('IntEmpiricalVariable', import_from_module='ns.core', parent=root_module['ns3::EmpiricalVariable']) ## llc-snap-header.h (module 'network'): ns3::LlcSnapHeader [class] module.add_class('LlcSnapHeader', parent=root_module['ns3::Header']) ## random-variable.h (module 'core'): ns3::LogNormalVariable [class] module.add_class('LogNormalVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariable']) ## random-variable.h (module 'core'): ns3::NormalVariable [class] module.add_class('NormalVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariable']) ## object.h (module 'core'): ns3::Object [class] module.add_class('Object', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >']) ## object.h (module 'core'): ns3::Object::AggregateIterator [class] module.add_class('AggregateIterator', import_from_module='ns.core', outer_class=root_module['ns3::Object']) ## packet-burst.h (module 'network'): ns3::PacketBurst [class] module.add_class('PacketBurst', parent=root_module['ns3::Object']) ## random-variable.h (module 'core'): ns3::ParetoVariable [class] module.add_class('ParetoVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariable']) ## pcap-file-wrapper.h (module 'network'): ns3::PcapFileWrapper [class] module.add_class('PcapFileWrapper', parent=root_module['ns3::Object']) ## queue.h (module 'network'): ns3::Queue [class] module.add_class('Queue', parent=root_module['ns3::Object']) ## queue.h (module 'network'): ns3::Queue::QueueMode [enumeration] module.add_enum('QueueMode', ['QUEUE_MODE_PACKETS', 'QUEUE_MODE_BYTES'], outer_class=root_module['ns3::Queue']) ## radiotap-header.h (module 'network'): ns3::RadiotapHeader [class] module.add_class('RadiotapHeader', parent=root_module['ns3::Header']) ## radiotap-header.h (module 'network'): ns3::RadiotapHeader [enumeration] module.add_enum('', ['FRAME_FLAG_NONE', 'FRAME_FLAG_CFP', 'FRAME_FLAG_SHORT_PREAMBLE', 'FRAME_FLAG_WEP', 'FRAME_FLAG_FRAGMENTED', 'FRAME_FLAG_FCS_INCLUDED', 'FRAME_FLAG_DATA_PADDING', 'FRAME_FLAG_BAD_FCS', 'FRAME_FLAG_SHORT_GUARD'], outer_class=root_module['ns3::RadiotapHeader']) ## radiotap-header.h (module 'network'): ns3::RadiotapHeader [enumeration] module.add_enum('', ['CHANNEL_FLAG_NONE', 'CHANNEL_FLAG_TURBO', 'CHANNEL_FLAG_CCK', 'CHANNEL_FLAG_OFDM', 'CHANNEL_FLAG_SPECTRUM_2GHZ', 'CHANNEL_FLAG_SPECTRUM_5GHZ', 'CHANNEL_FLAG_PASSIVE', 'CHANNEL_FLAG_DYNAMIC', 'CHANNEL_FLAG_GFSK'], outer_class=root_module['ns3::RadiotapHeader']) ## red-queue.h (module 'network'): ns3::RedQueue [class] module.add_class('RedQueue', parent=root_module['ns3::Queue']) ## red-queue.h (module 'network'): ns3::RedQueue [enumeration] module.add_enum('', ['DTYPE_NONE', 'DTYPE_FORCED', 'DTYPE_UNFORCED'], outer_class=root_module['ns3::RedQueue']) ## red-queue.h (module 'network'): ns3::RedQueue::Stats [struct] module.add_class('Stats', outer_class=root_module['ns3::RedQueue']) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeChecker', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeChecker>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeValue', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeValue>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::CallbackImplBase', 'ns3::empty', 'ns3::DefaultDeleter<ns3::CallbackImplBase>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::EventImpl', 'ns3::empty', 'ns3::DefaultDeleter<ns3::EventImpl>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::NixVector', 'ns3::empty', 'ns3::DefaultDeleter<ns3::NixVector>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::OutputStreamWrapper', 'ns3::empty', 'ns3::DefaultDeleter<ns3::OutputStreamWrapper>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::Packet', 'ns3::empty', 'ns3::DefaultDeleter<ns3::Packet>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbAddressBlock, ns3::empty, ns3::DefaultDeleter<ns3::PbbAddressBlock> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::PbbAddressBlock', 'ns3::empty', 'ns3::DefaultDeleter<ns3::PbbAddressBlock>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbMessage, ns3::empty, ns3::DefaultDeleter<ns3::PbbMessage> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::PbbMessage', 'ns3::empty', 'ns3::DefaultDeleter<ns3::PbbMessage>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbPacket, ns3::Header, ns3::DefaultDeleter<ns3::PbbPacket> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::PbbPacket', 'ns3::Header', 'ns3::DefaultDeleter<ns3::PbbPacket>'], parent=root_module['ns3::Header'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbTlv, ns3::empty, ns3::DefaultDeleter<ns3::PbbTlv> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::PbbTlv', 'ns3::empty', 'ns3::DefaultDeleter<ns3::PbbTlv>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::TraceSourceAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TraceSourceAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) ## socket.h (module 'network'): ns3::Socket [class] module.add_class('Socket', parent=root_module['ns3::Object']) ## socket.h (module 'network'): ns3::Socket::SocketErrno [enumeration] module.add_enum('SocketErrno', ['ERROR_NOTERROR', 'ERROR_ISCONN', 'ERROR_NOTCONN', 'ERROR_MSGSIZE', 'ERROR_AGAIN', 'ERROR_SHUTDOWN', 'ERROR_OPNOTSUPP', 'ERROR_AFNOSUPPORT', 'ERROR_INVAL', 'ERROR_BADF', 'ERROR_NOROUTETOHOST', 'ERROR_NODEV', 'ERROR_ADDRNOTAVAIL', 'ERROR_ADDRINUSE', 'SOCKET_ERRNO_LAST'], outer_class=root_module['ns3::Socket']) ## socket.h (module 'network'): ns3::Socket::SocketType [enumeration] module.add_enum('SocketType', ['NS3_SOCK_STREAM', 'NS3_SOCK_SEQPACKET', 'NS3_SOCK_DGRAM', 'NS3_SOCK_RAW'], outer_class=root_module['ns3::Socket']) ## socket.h (module 'network'): ns3::SocketAddressTag [class] module.add_class('SocketAddressTag', parent=root_module['ns3::Tag']) ## socket-factory.h (module 'network'): ns3::SocketFactory [class] module.add_class('SocketFactory', parent=root_module['ns3::Object']) ## socket.h (module 'network'): ns3::SocketIpTtlTag [class] module.add_class('SocketIpTtlTag', parent=root_module['ns3::Tag']) ## socket.h (module 'network'): ns3::SocketSetDontFragmentTag [class] module.add_class('SocketSetDontFragmentTag', parent=root_module['ns3::Tag']) ## nstime.h (module 'core'): ns3::Time [class] module.add_class('Time', import_from_module='ns.core') ## nstime.h (module 'core'): ns3::Time::Unit [enumeration] module.add_enum('Unit', ['S', 'MS', 'US', 'NS', 'PS', 'FS', 'LAST'], outer_class=root_module['ns3::Time'], import_from_module='ns.core') ## nstime.h (module 'core'): ns3::Time [class] root_module['ns3::Time'].implicitly_converts_to(root_module['ns3::int64x64_t']) ## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor [class] module.add_class('TraceSourceAccessor', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >']) ## trailer.h (module 'network'): ns3::Trailer [class] module.add_class('Trailer', parent=root_module['ns3::Chunk']) ## application.h (module 'network'): ns3::Application [class] module.add_class('Application', parent=root_module['ns3::Object']) ## attribute.h (module 'core'): ns3::AttributeAccessor [class] module.add_class('AttributeAccessor', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >']) ## attribute.h (module 'core'): ns3::AttributeChecker [class] module.add_class('AttributeChecker', allow_subclassing=False, automatic_type_narrowing=True, import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >']) ## attribute.h (module 'core'): ns3::AttributeValue [class] module.add_class('AttributeValue', allow_subclassing=False, automatic_type_narrowing=True, import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >']) ## boolean.h (module 'core'): ns3::BooleanChecker [class] module.add_class('BooleanChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) ## boolean.h (module 'core'): ns3::BooleanValue [class] module.add_class('BooleanValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) ## callback.h (module 'core'): ns3::CallbackChecker [class] module.add_class('CallbackChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) ## callback.h (module 'core'): ns3::CallbackImplBase [class] module.add_class('CallbackImplBase', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >']) ## callback.h (module 'core'): ns3::CallbackValue [class] module.add_class('CallbackValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) ## channel.h (module 'network'): ns3::Channel [class] module.add_class('Channel', parent=root_module['ns3::Object']) ## data-rate.h (module 'network'): ns3::DataRateChecker [class] module.add_class('DataRateChecker', parent=root_module['ns3::AttributeChecker']) ## data-rate.h (module 'network'): ns3::DataRateValue [class] module.add_class('DataRateValue', parent=root_module['ns3::AttributeValue']) ## drop-tail-queue.h (module 'network'): ns3::DropTailQueue [class] module.add_class('DropTailQueue', parent=root_module['ns3::Queue']) ## attribute.h (module 'core'): ns3::EmptyAttributeValue [class] module.add_class('EmptyAttributeValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) ## error-model.h (module 'network'): ns3::ErrorModel [class] module.add_class('ErrorModel', parent=root_module['ns3::Object']) ## ethernet-header.h (module 'network'): ns3::EthernetHeader [class] module.add_class('EthernetHeader', parent=root_module['ns3::Header']) ## ethernet-trailer.h (module 'network'): ns3::EthernetTrailer [class] module.add_class('EthernetTrailer', parent=root_module['ns3::Trailer']) ## event-impl.h (module 'core'): ns3::EventImpl [class] module.add_class('EventImpl', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >']) ## ipv4-address.h (module 'network'): ns3::Ipv4AddressChecker [class] module.add_class('Ipv4AddressChecker', parent=root_module['ns3::AttributeChecker']) ## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue [class] module.add_class('Ipv4AddressValue', parent=root_module['ns3::AttributeValue']) ## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker [class] module.add_class('Ipv4MaskChecker', parent=root_module['ns3::AttributeChecker']) ## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue [class] module.add_class('Ipv4MaskValue', parent=root_module['ns3::AttributeValue']) ## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker [class] module.add_class('Ipv6AddressChecker', parent=root_module['ns3::AttributeChecker']) ## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue [class] module.add_class('Ipv6AddressValue', parent=root_module['ns3::AttributeValue']) ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker [class] module.add_class('Ipv6PrefixChecker', parent=root_module['ns3::AttributeChecker']) ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue [class] module.add_class('Ipv6PrefixValue', parent=root_module['ns3::AttributeValue']) ## error-model.h (module 'network'): ns3::ListErrorModel [class] module.add_class('ListErrorModel', parent=root_module['ns3::ErrorModel']) ## mac48-address.h (module 'network'): ns3::Mac48AddressChecker [class] module.add_class('Mac48AddressChecker', parent=root_module['ns3::AttributeChecker']) ## mac48-address.h (module 'network'): ns3::Mac48AddressValue [class] module.add_class('Mac48AddressValue', parent=root_module['ns3::AttributeValue']) ## net-device.h (module 'network'): ns3::NetDevice [class] module.add_class('NetDevice', parent=root_module['ns3::Object']) ## net-device.h (module 'network'): ns3::NetDevice::PacketType [enumeration] module.add_enum('PacketType', ['PACKET_HOST', 'NS3_PACKET_HOST', 'PACKET_BROADCAST', 'NS3_PACKET_BROADCAST', 'PACKET_MULTICAST', 'NS3_PACKET_MULTICAST', 'PACKET_OTHERHOST', 'NS3_PACKET_OTHERHOST'], outer_class=root_module['ns3::NetDevice']) ## nix-vector.h (module 'network'): ns3::NixVector [class] module.add_class('NixVector', parent=root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >']) ## node.h (module 'network'): ns3::Node [class] module.add_class('Node', parent=root_module['ns3::Object']) ## object-factory.h (module 'core'): ns3::ObjectFactoryChecker [class] module.add_class('ObjectFactoryChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) ## object-factory.h (module 'core'): ns3::ObjectFactoryValue [class] module.add_class('ObjectFactoryValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) ## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper [class] module.add_class('OutputStreamWrapper', parent=root_module['ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >']) ## packet.h (module 'network'): ns3::Packet [class] module.add_class('Packet', parent=root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >']) ## packet-socket.h (module 'network'): ns3::PacketSocket [class] module.add_class('PacketSocket', parent=root_module['ns3::Socket']) ## packet-socket-factory.h (module 'network'): ns3::PacketSocketFactory [class] module.add_class('PacketSocketFactory', parent=root_module['ns3::SocketFactory']) ## packetbb.h (module 'network'): ns3::PbbAddressBlock [class] module.add_class('PbbAddressBlock', parent=root_module['ns3::SimpleRefCount< ns3::PbbAddressBlock, ns3::empty, ns3::DefaultDeleter<ns3::PbbAddressBlock> >']) ## packetbb.h (module 'network'): ns3::PbbAddressBlockIpv4 [class] module.add_class('PbbAddressBlockIpv4', parent=root_module['ns3::PbbAddressBlock']) ## packetbb.h (module 'network'): ns3::PbbAddressBlockIpv6 [class] module.add_class('PbbAddressBlockIpv6', parent=root_module['ns3::PbbAddressBlock']) ## packetbb.h (module 'network'): ns3::PbbMessage [class] module.add_class('PbbMessage', parent=root_module['ns3::SimpleRefCount< ns3::PbbMessage, ns3::empty, ns3::DefaultDeleter<ns3::PbbMessage> >']) ## packetbb.h (module 'network'): ns3::PbbMessageIpv4 [class] module.add_class('PbbMessageIpv4', parent=root_module['ns3::PbbMessage']) ## packetbb.h (module 'network'): ns3::PbbMessageIpv6 [class] module.add_class('PbbMessageIpv6', parent=root_module['ns3::PbbMessage']) ## packetbb.h (module 'network'): ns3::PbbPacket [class] module.add_class('PbbPacket', parent=root_module['ns3::SimpleRefCount< ns3::PbbPacket, ns3::Header, ns3::DefaultDeleter<ns3::PbbPacket> >']) ## packetbb.h (module 'network'): ns3::PbbTlv [class] module.add_class('PbbTlv', parent=root_module['ns3::SimpleRefCount< ns3::PbbTlv, ns3::empty, ns3::DefaultDeleter<ns3::PbbTlv> >']) ## random-variable.h (module 'core'): ns3::RandomVariableChecker [class] module.add_class('RandomVariableChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) ## random-variable.h (module 'core'): ns3::RandomVariableValue [class] module.add_class('RandomVariableValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) ## error-model.h (module 'network'): ns3::RateErrorModel [class] module.add_class('RateErrorModel', parent=root_module['ns3::ErrorModel']) ## error-model.h (module 'network'): ns3::RateErrorModel::ErrorUnit [enumeration] module.add_enum('ErrorUnit', ['ERROR_UNIT_BIT', 'ERROR_UNIT_BYTE', 'ERROR_UNIT_PACKET'], outer_class=root_module['ns3::RateErrorModel']) ## error-model.h (module 'network'): ns3::ReceiveListErrorModel [class] module.add_class('ReceiveListErrorModel', parent=root_module['ns3::ErrorModel']) ## simple-channel.h (module 'network'): ns3::SimpleChannel [class] module.add_class('SimpleChannel', parent=root_module['ns3::Channel']) ## simple-net-device.h (module 'network'): ns3::SimpleNetDevice [class] module.add_class('SimpleNetDevice', parent=root_module['ns3::NetDevice']) ## nstime.h (module 'core'): ns3::TimeChecker [class] module.add_class('TimeChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) ## nstime.h (module 'core'): ns3::TimeValue [class] module.add_class('TimeValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) ## type-id.h (module 'core'): ns3::TypeIdChecker [class] module.add_class('TypeIdChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) ## type-id.h (module 'core'): ns3::TypeIdValue [class] module.add_class('TypeIdValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) ## address.h (module 'network'): ns3::AddressChecker [class] module.add_class('AddressChecker', parent=root_module['ns3::AttributeChecker']) ## address.h (module 'network'): ns3::AddressValue [class] module.add_class('AddressValue', parent=root_module['ns3::AttributeValue']) ## packetbb.h (module 'network'): ns3::PbbAddressTlv [class] module.add_class('PbbAddressTlv', parent=root_module['ns3::PbbTlv']) module.add_container('std::list< ns3::Ptr< ns3::Packet > >', 'ns3::Ptr< ns3::Packet >', container_type='list') module.add_container('std::list< unsigned int >', 'unsigned int', container_type='list') typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ns3::GenericPhyRxEndOkCallback') typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', 'ns3::GenericPhyRxEndOkCallback*') typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', 'ns3::GenericPhyRxEndOkCallback&') typehandlers.add_type_alias('ns3::SequenceNumber< unsigned short, short >', 'ns3::SequenceNumber16') typehandlers.add_type_alias('ns3::SequenceNumber< unsigned short, short >*', 'ns3::SequenceNumber16*') typehandlers.add_type_alias('ns3::SequenceNumber< unsigned short, short >&', 'ns3::SequenceNumber16&') typehandlers.add_type_alias('ns3::SequenceNumber< unsigned int, int >', 'ns3::SequenceNumber32') typehandlers.add_type_alias('ns3::SequenceNumber< unsigned int, int >*', 'ns3::SequenceNumber32*') typehandlers.add_type_alias('ns3::SequenceNumber< unsigned int, int >&', 'ns3::SequenceNumber32&') typehandlers.add_type_alias('ns3::RngSeedManager', 'ns3::SeedManager') typehandlers.add_type_alias('ns3::RngSeedManager*', 'ns3::SeedManager*') typehandlers.add_type_alias('ns3::RngSeedManager&', 'ns3::SeedManager&') module.add_typedef(root_module['ns3::RngSeedManager'], 'SeedManager') typehandlers.add_type_alias('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ns3::GenericPhyRxStartCallback') typehandlers.add_type_alias('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', 'ns3::GenericPhyRxStartCallback*') typehandlers.add_type_alias('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', 'ns3::GenericPhyRxStartCallback&') typehandlers.add_type_alias('ns3::Callback< bool, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ns3::GenericPhyTxStartCallback') typehandlers.add_type_alias('ns3::Callback< bool, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', 'ns3::GenericPhyTxStartCallback*') typehandlers.add_type_alias('ns3::Callback< bool, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', 'ns3::GenericPhyTxStartCallback&') typehandlers.add_type_alias('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ns3::GenericPhyRxEndErrorCallback') typehandlers.add_type_alias('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', 'ns3::GenericPhyRxEndErrorCallback*') typehandlers.add_type_alias('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', 'ns3::GenericPhyRxEndErrorCallback&') typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ns3::GenericPhyTxEndCallback') typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', 'ns3::GenericPhyTxEndCallback*') typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', 'ns3::GenericPhyTxEndCallback&') ## Register a nested module for the namespace FatalImpl nested_module = module.add_cpp_namespace('FatalImpl') register_types_ns3_FatalImpl(nested_module) ## Register a nested module for the namespace addressUtils nested_module = module.add_cpp_namespace('addressUtils') register_types_ns3_addressUtils(nested_module) def register_types_ns3_FatalImpl(module): root_module = module.get_root() def register_types_ns3_addressUtils(module): root_module = module.get_root() def register_methods(root_module): register_Ns3Address_methods(root_module, root_module['ns3::Address']) register_Ns3ApplicationContainer_methods(root_module, root_module['ns3::ApplicationContainer']) register_Ns3AsciiTraceHelper_methods(root_module, root_module['ns3::AsciiTraceHelper']) register_Ns3AsciiTraceHelperForDevice_methods(root_module, root_module['ns3::AsciiTraceHelperForDevice']) register_Ns3AttributeConstructionList_methods(root_module, root_module['ns3::AttributeConstructionList']) register_Ns3AttributeConstructionListItem_methods(root_module, root_module['ns3::AttributeConstructionList::Item']) register_Ns3Buffer_methods(root_module, root_module['ns3::Buffer']) register_Ns3BufferIterator_methods(root_module, root_module['ns3::Buffer::Iterator']) register_Ns3ByteTagIterator_methods(root_module, root_module['ns3::ByteTagIterator']) register_Ns3ByteTagIteratorItem_methods(root_module, root_module['ns3::ByteTagIterator::Item']) register_Ns3ByteTagList_methods(root_module, root_module['ns3::ByteTagList']) register_Ns3ByteTagListIterator_methods(root_module, root_module['ns3::ByteTagList::Iterator']) register_Ns3ByteTagListIteratorItem_methods(root_module, root_module['ns3::ByteTagList::Iterator::Item']) register_Ns3CallbackBase_methods(root_module, root_module['ns3::CallbackBase']) register_Ns3ChannelList_methods(root_module, root_module['ns3::ChannelList']) register_Ns3DataRate_methods(root_module, root_module['ns3::DataRate']) register_Ns3EventId_methods(root_module, root_module['ns3::EventId']) register_Ns3Inet6SocketAddress_methods(root_module, root_module['ns3::Inet6SocketAddress']) register_Ns3InetSocketAddress_methods(root_module, root_module['ns3::InetSocketAddress']) register_Ns3Ipv4Address_methods(root_module, root_module['ns3::Ipv4Address']) register_Ns3Ipv4Mask_methods(root_module, root_module['ns3::Ipv4Mask']) register_Ns3Ipv6Address_methods(root_module, root_module['ns3::Ipv6Address']) register_Ns3Ipv6Prefix_methods(root_module, root_module['ns3::Ipv6Prefix']) register_Ns3Mac48Address_methods(root_module, root_module['ns3::Mac48Address']) register_Ns3Mac64Address_methods(root_module, root_module['ns3::Mac64Address']) register_Ns3NetDeviceContainer_methods(root_module, root_module['ns3::NetDeviceContainer']) register_Ns3NodeContainer_methods(root_module, root_module['ns3::NodeContainer']) register_Ns3NodeList_methods(root_module, root_module['ns3::NodeList']) register_Ns3ObjectBase_methods(root_module, root_module['ns3::ObjectBase']) register_Ns3ObjectDeleter_methods(root_module, root_module['ns3::ObjectDeleter']) register_Ns3ObjectFactory_methods(root_module, root_module['ns3::ObjectFactory']) register_Ns3PacketMetadata_methods(root_module, root_module['ns3::PacketMetadata']) register_Ns3PacketMetadataItem_methods(root_module, root_module['ns3::PacketMetadata::Item']) register_Ns3PacketMetadataItemIterator_methods(root_module, root_module['ns3::PacketMetadata::ItemIterator']) register_Ns3PacketSocketAddress_methods(root_module, root_module['ns3::PacketSocketAddress']) register_Ns3PacketSocketHelper_methods(root_module, root_module['ns3::PacketSocketHelper']) register_Ns3PacketTagIterator_methods(root_module, root_module['ns3::PacketTagIterator']) register_Ns3PacketTagIteratorItem_methods(root_module, root_module['ns3::PacketTagIterator::Item']) register_Ns3PacketTagList_methods(root_module, root_module['ns3::PacketTagList']) register_Ns3PacketTagListTagData_methods(root_module, root_module['ns3::PacketTagList::TagData']) register_Ns3PbbAddressTlvBlock_methods(root_module, root_module['ns3::PbbAddressTlvBlock']) register_Ns3PbbTlvBlock_methods(root_module, root_module['ns3::PbbTlvBlock']) register_Ns3PcapFile_methods(root_module, root_module['ns3::PcapFile']) register_Ns3PcapHelper_methods(root_module, root_module['ns3::PcapHelper']) register_Ns3PcapHelperForDevice_methods(root_module, root_module['ns3::PcapHelperForDevice']) register_Ns3RandomVariable_methods(root_module, root_module['ns3::RandomVariable']) register_Ns3RngSeedManager_methods(root_module, root_module['ns3::RngSeedManager']) register_Ns3SequenceNumber32_methods(root_module, root_module['ns3::SequenceNumber32']) register_Ns3SequenceNumber16_methods(root_module, root_module['ns3::SequenceNumber16']) register_Ns3SequentialVariable_methods(root_module, root_module['ns3::SequentialVariable']) register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >']) register_Ns3Simulator_methods(root_module, root_module['ns3::Simulator']) register_Ns3SystemWallClockMs_methods(root_module, root_module['ns3::SystemWallClockMs']) register_Ns3Tag_methods(root_module, root_module['ns3::Tag']) register_Ns3TagBuffer_methods(root_module, root_module['ns3::TagBuffer']) register_Ns3TriangularVariable_methods(root_module, root_module['ns3::TriangularVariable']) register_Ns3TypeId_methods(root_module, root_module['ns3::TypeId']) register_Ns3TypeIdAttributeInformation_methods(root_module, root_module['ns3::TypeId::AttributeInformation']) register_Ns3TypeIdTraceSourceInformation_methods(root_module, root_module['ns3::TypeId::TraceSourceInformation']) register_Ns3UniformVariable_methods(root_module, root_module['ns3::UniformVariable']) register_Ns3WeibullVariable_methods(root_module, root_module['ns3::WeibullVariable']) register_Ns3ZetaVariable_methods(root_module, root_module['ns3::ZetaVariable']) register_Ns3ZipfVariable_methods(root_module, root_module['ns3::ZipfVariable']) register_Ns3Empty_methods(root_module, root_module['ns3::empty']) register_Ns3Int64x64_t_methods(root_module, root_module['ns3::int64x64_t']) register_Ns3Chunk_methods(root_module, root_module['ns3::Chunk']) register_Ns3ConstantVariable_methods(root_module, root_module['ns3::ConstantVariable']) register_Ns3DeterministicVariable_methods(root_module, root_module['ns3::DeterministicVariable']) register_Ns3EmpiricalVariable_methods(root_module, root_module['ns3::EmpiricalVariable']) register_Ns3ErlangVariable_methods(root_module, root_module['ns3::ErlangVariable']) register_Ns3ExponentialVariable_methods(root_module, root_module['ns3::ExponentialVariable']) register_Ns3FlowIdTag_methods(root_module, root_module['ns3::FlowIdTag']) register_Ns3GammaVariable_methods(root_module, root_module['ns3::GammaVariable']) register_Ns3Header_methods(root_module, root_module['ns3::Header']) register_Ns3IntEmpiricalVariable_methods(root_module, root_module['ns3::IntEmpiricalVariable']) register_Ns3LlcSnapHeader_methods(root_module, root_module['ns3::LlcSnapHeader']) register_Ns3LogNormalVariable_methods(root_module, root_module['ns3::LogNormalVariable']) register_Ns3NormalVariable_methods(root_module, root_module['ns3::NormalVariable']) register_Ns3Object_methods(root_module, root_module['ns3::Object']) register_Ns3ObjectAggregateIterator_methods(root_module, root_module['ns3::Object::AggregateIterator']) register_Ns3PacketBurst_methods(root_module, root_module['ns3::PacketBurst']) register_Ns3ParetoVariable_methods(root_module, root_module['ns3::ParetoVariable']) register_Ns3PcapFileWrapper_methods(root_module, root_module['ns3::PcapFileWrapper']) register_Ns3Queue_methods(root_module, root_module['ns3::Queue']) register_Ns3RadiotapHeader_methods(root_module, root_module['ns3::RadiotapHeader']) register_Ns3RedQueue_methods(root_module, root_module['ns3::RedQueue']) register_Ns3RedQueueStats_methods(root_module, root_module['ns3::RedQueue::Stats']) register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >']) register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >']) register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >']) register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >']) register_Ns3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >']) register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >']) register_Ns3SimpleRefCount__Ns3OutputStreamWrapper_Ns3Empty_Ns3DefaultDeleter__lt__ns3OutputStreamWrapper__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >']) register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >']) register_Ns3SimpleRefCount__Ns3PbbAddressBlock_Ns3Empty_Ns3DefaultDeleter__lt__ns3PbbAddressBlock__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::PbbAddressBlock, ns3::empty, ns3::DefaultDeleter<ns3::PbbAddressBlock> >']) register_Ns3SimpleRefCount__Ns3PbbMessage_Ns3Empty_Ns3DefaultDeleter__lt__ns3PbbMessage__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::PbbMessage, ns3::empty, ns3::DefaultDeleter<ns3::PbbMessage> >']) register_Ns3SimpleRefCount__Ns3PbbPacket_Ns3Header_Ns3DefaultDeleter__lt__ns3PbbPacket__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::PbbPacket, ns3::Header, ns3::DefaultDeleter<ns3::PbbPacket> >']) register_Ns3SimpleRefCount__Ns3PbbTlv_Ns3Empty_Ns3DefaultDeleter__lt__ns3PbbTlv__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::PbbTlv, ns3::empty, ns3::DefaultDeleter<ns3::PbbTlv> >']) register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >']) register_Ns3Socket_methods(root_module, root_module['ns3::Socket']) register_Ns3SocketAddressTag_methods(root_module, root_module['ns3::SocketAddressTag']) register_Ns3SocketFactory_methods(root_module, root_module['ns3::SocketFactory']) register_Ns3SocketIpTtlTag_methods(root_module, root_module['ns3::SocketIpTtlTag']) register_Ns3SocketSetDontFragmentTag_methods(root_module, root_module['ns3::SocketSetDontFragmentTag']) register_Ns3Time_methods(root_module, root_module['ns3::Time']) register_Ns3TraceSourceAccessor_methods(root_module, root_module['ns3::TraceSourceAccessor']) register_Ns3Trailer_methods(root_module, root_module['ns3::Trailer']) register_Ns3Application_methods(root_module, root_module['ns3::Application']) register_Ns3AttributeAccessor_methods(root_module, root_module['ns3::AttributeAccessor']) register_Ns3AttributeChecker_methods(root_module, root_module['ns3::AttributeChecker']) register_Ns3AttributeValue_methods(root_module, root_module['ns3::AttributeValue']) register_Ns3BooleanChecker_methods(root_module, root_module['ns3::BooleanChecker']) register_Ns3BooleanValue_methods(root_module, root_module['ns3::BooleanValue']) register_Ns3CallbackChecker_methods(root_module, root_module['ns3::CallbackChecker']) register_Ns3CallbackImplBase_methods(root_module, root_module['ns3::CallbackImplBase']) register_Ns3CallbackValue_methods(root_module, root_module['ns3::CallbackValue']) register_Ns3Channel_methods(root_module, root_module['ns3::Channel']) register_Ns3DataRateChecker_methods(root_module, root_module['ns3::DataRateChecker']) register_Ns3DataRateValue_methods(root_module, root_module['ns3::DataRateValue']) register_Ns3DropTailQueue_methods(root_module, root_module['ns3::DropTailQueue']) register_Ns3EmptyAttributeValue_methods(root_module, root_module['ns3::EmptyAttributeValue']) register_Ns3ErrorModel_methods(root_module, root_module['ns3::ErrorModel']) register_Ns3EthernetHeader_methods(root_module, root_module['ns3::EthernetHeader']) register_Ns3EthernetTrailer_methods(root_module, root_module['ns3::EthernetTrailer']) register_Ns3EventImpl_methods(root_module, root_module['ns3::EventImpl']) register_Ns3Ipv4AddressChecker_methods(root_module, root_module['ns3::Ipv4AddressChecker']) register_Ns3Ipv4AddressValue_methods(root_module, root_module['ns3::Ipv4AddressValue']) register_Ns3Ipv4MaskChecker_methods(root_module, root_module['ns3::Ipv4MaskChecker']) register_Ns3Ipv4MaskValue_methods(root_module, root_module['ns3::Ipv4MaskValue']) register_Ns3Ipv6AddressChecker_methods(root_module, root_module['ns3::Ipv6AddressChecker']) register_Ns3Ipv6AddressValue_methods(root_module, root_module['ns3::Ipv6AddressValue']) register_Ns3Ipv6PrefixChecker_methods(root_module, root_module['ns3::Ipv6PrefixChecker']) register_Ns3Ipv6PrefixValue_methods(root_module, root_module['ns3::Ipv6PrefixValue']) register_Ns3ListErrorModel_methods(root_module, root_module['ns3::ListErrorModel']) register_Ns3Mac48AddressChecker_methods(root_module, root_module['ns3::Mac48AddressChecker']) register_Ns3Mac48AddressValue_methods(root_module, root_module['ns3::Mac48AddressValue']) register_Ns3NetDevice_methods(root_module, root_module['ns3::NetDevice']) register_Ns3NixVector_methods(root_module, root_module['ns3::NixVector']) register_Ns3Node_methods(root_module, root_module['ns3::Node']) register_Ns3ObjectFactoryChecker_methods(root_module, root_module['ns3::ObjectFactoryChecker']) register_Ns3ObjectFactoryValue_methods(root_module, root_module['ns3::ObjectFactoryValue']) register_Ns3OutputStreamWrapper_methods(root_module, root_module['ns3::OutputStreamWrapper']) register_Ns3Packet_methods(root_module, root_module['ns3::Packet']) register_Ns3PacketSocket_methods(root_module, root_module['ns3::PacketSocket']) register_Ns3PacketSocketFactory_methods(root_module, root_module['ns3::PacketSocketFactory']) register_Ns3PbbAddressBlock_methods(root_module, root_module['ns3::PbbAddressBlock']) register_Ns3PbbAddressBlockIpv4_methods(root_module, root_module['ns3::PbbAddressBlockIpv4']) register_Ns3PbbAddressBlockIpv6_methods(root_module, root_module['ns3::PbbAddressBlockIpv6']) register_Ns3PbbMessage_methods(root_module, root_module['ns3::PbbMessage']) register_Ns3PbbMessageIpv4_methods(root_module, root_module['ns3::PbbMessageIpv4']) register_Ns3PbbMessageIpv6_methods(root_module, root_module['ns3::PbbMessageIpv6']) register_Ns3PbbPacket_methods(root_module, root_module['ns3::PbbPacket']) register_Ns3PbbTlv_methods(root_module, root_module['ns3::PbbTlv']) register_Ns3RandomVariableChecker_methods(root_module, root_module['ns3::RandomVariableChecker']) register_Ns3RandomVariableValue_methods(root_module, root_module['ns3::RandomVariableValue']) register_Ns3RateErrorModel_methods(root_module, root_module['ns3::RateErrorModel']) register_Ns3ReceiveListErrorModel_methods(root_module, root_module['ns3::ReceiveListErrorModel']) register_Ns3SimpleChannel_methods(root_module, root_module['ns3::SimpleChannel']) register_Ns3SimpleNetDevice_methods(root_module, root_module['ns3::SimpleNetDevice']) register_Ns3TimeChecker_methods(root_module, root_module['ns3::TimeChecker']) register_Ns3TimeValue_methods(root_module, root_module['ns3::TimeValue']) register_Ns3TypeIdChecker_methods(root_module, root_module['ns3::TypeIdChecker']) register_Ns3TypeIdValue_methods(root_module, root_module['ns3::TypeIdValue']) register_Ns3AddressChecker_methods(root_module, root_module['ns3::AddressChecker']) register_Ns3AddressValue_methods(root_module, root_module['ns3::AddressValue']) register_Ns3PbbAddressTlv_methods(root_module, root_module['ns3::PbbAddressTlv']) return def register_Ns3Address_methods(root_module, cls): cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## address.h (module 'network'): ns3::Address::Address() [constructor] cls.add_constructor([]) ## address.h (module 'network'): ns3::Address::Address(uint8_t type, uint8_t const * buffer, uint8_t len) [constructor] cls.add_constructor([param('uint8_t', 'type'), param('uint8_t const *', 'buffer'), param('uint8_t', 'len')]) ## address.h (module 'network'): ns3::Address::Address(ns3::Address const & address) [copy constructor] cls.add_constructor([param('ns3::Address const &', 'address')]) ## address.h (module 'network'): bool ns3::Address::CheckCompatible(uint8_t type, uint8_t len) const [member function] cls.add_method('CheckCompatible', 'bool', [param('uint8_t', 'type'), param('uint8_t', 'len')], is_const=True) ## address.h (module 'network'): uint32_t ns3::Address::CopyAllFrom(uint8_t const * buffer, uint8_t len) [member function] cls.add_method('CopyAllFrom', 'uint32_t', [param('uint8_t const *', 'buffer'), param('uint8_t', 'len')]) ## address.h (module 'network'): uint32_t ns3::Address::CopyAllTo(uint8_t * buffer, uint8_t len) const [member function] cls.add_method('CopyAllTo', 'uint32_t', [param('uint8_t *', 'buffer'), param('uint8_t', 'len')], is_const=True) ## address.h (module 'network'): uint32_t ns3::Address::CopyFrom(uint8_t const * buffer, uint8_t len) [member function] cls.add_method('CopyFrom', 'uint32_t', [param('uint8_t const *', 'buffer'), param('uint8_t', 'len')]) ## address.h (module 'network'): uint32_t ns3::Address::CopyTo(uint8_t * buffer) const [member function] cls.add_method('CopyTo', 'uint32_t', [param('uint8_t *', 'buffer')], is_const=True) ## address.h (module 'network'): void ns3::Address::Deserialize(ns3::TagBuffer buffer) [member function] cls.add_method('Deserialize', 'void', [param('ns3::TagBuffer', 'buffer')]) ## address.h (module 'network'): uint8_t ns3::Address::GetLength() const [member function] cls.add_method('GetLength', 'uint8_t', [], is_const=True) ## address.h (module 'network'): uint32_t ns3::Address::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True) ## address.h (module 'network'): bool ns3::Address::IsInvalid() const [member function] cls.add_method('IsInvalid', 'bool', [], is_const=True) ## address.h (module 'network'): bool ns3::Address::IsMatchingType(uint8_t type) const [member function] cls.add_method('IsMatchingType', 'bool', [param('uint8_t', 'type')], is_const=True) ## address.h (module 'network'): static uint8_t ns3::Address::Register() [member function] cls.add_method('Register', 'uint8_t', [], is_static=True) ## address.h (module 'network'): void ns3::Address::Serialize(ns3::TagBuffer buffer) const [member function] cls.add_method('Serialize', 'void', [param('ns3::TagBuffer', 'buffer')], is_const=True) return def register_Ns3ApplicationContainer_methods(root_module, cls): ## application-container.h (module 'network'): ns3::ApplicationContainer::ApplicationContainer(ns3::ApplicationContainer const & arg0) [copy constructor] cls.add_constructor([param('ns3::ApplicationContainer const &', 'arg0')]) ## application-container.h (module 'network'): ns3::ApplicationContainer::ApplicationContainer() [constructor] cls.add_constructor([]) ## application-container.h (module 'network'): ns3::ApplicationContainer::ApplicationContainer(ns3::Ptr<ns3::Application> application) [constructor] cls.add_constructor([param('ns3::Ptr< ns3::Application >', 'application')]) ## application-container.h (module 'network'): ns3::ApplicationContainer::ApplicationContainer(std::string name) [constructor] cls.add_constructor([param('std::string', 'name')]) ## application-container.h (module 'network'): void ns3::ApplicationContainer::Add(ns3::ApplicationContainer other) [member function] cls.add_method('Add', 'void', [param('ns3::ApplicationContainer', 'other')]) ## application-container.h (module 'network'): void ns3::ApplicationContainer::Add(ns3::Ptr<ns3::Application> application) [member function] cls.add_method('Add', 'void', [param('ns3::Ptr< ns3::Application >', 'application')]) ## application-container.h (module 'network'): void ns3::ApplicationContainer::Add(std::string name) [member function] cls.add_method('Add', 'void', [param('std::string', 'name')]) ## application-container.h (module 'network'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Application>*,std::vector<ns3::Ptr<ns3::Application>, std::allocator<ns3::Ptr<ns3::Application> > > > ns3::ApplicationContainer::Begin() const [member function] cls.add_method('Begin', '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Application > const, std::vector< ns3::Ptr< ns3::Application > > >', [], is_const=True) ## application-container.h (module 'network'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Application>*,std::vector<ns3::Ptr<ns3::Application>, std::allocator<ns3::Ptr<ns3::Application> > > > ns3::ApplicationContainer::End() const [member function] cls.add_method('End', '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Application > const, std::vector< ns3::Ptr< ns3::Application > > >', [], is_const=True) ## application-container.h (module 'network'): ns3::Ptr<ns3::Application> ns3::ApplicationContainer::Get(uint32_t i) const [member function] cls.add_method('Get', 'ns3::Ptr< ns3::Application >', [param('uint32_t', 'i')], is_const=True) ## application-container.h (module 'network'): uint32_t ns3::ApplicationContainer::GetN() const [member function] cls.add_method('GetN', 'uint32_t', [], is_const=True) ## application-container.h (module 'network'): void ns3::ApplicationContainer::Start(ns3::Time start) [member function] cls.add_method('Start', 'void', [param('ns3::Time', 'start')]) ## application-container.h (module 'network'): void ns3::ApplicationContainer::Stop(ns3::Time stop) [member function] cls.add_method('Stop', 'void', [param('ns3::Time', 'stop')]) return def register_Ns3AsciiTraceHelper_methods(root_module, cls): ## trace-helper.h (module 'network'): ns3::AsciiTraceHelper::AsciiTraceHelper(ns3::AsciiTraceHelper const & arg0) [copy constructor] cls.add_constructor([param('ns3::AsciiTraceHelper const &', 'arg0')]) ## trace-helper.h (module 'network'): ns3::AsciiTraceHelper::AsciiTraceHelper() [constructor] cls.add_constructor([]) ## trace-helper.h (module 'network'): ns3::Ptr<ns3::OutputStreamWrapper> ns3::AsciiTraceHelper::CreateFileStream(std::string filename, std::_Ios_Openmode filemode=std::ios_base::out) [member function] cls.add_method('CreateFileStream', 'ns3::Ptr< ns3::OutputStreamWrapper >', [param('std::string', 'filename'), param('std::_Ios_Openmode', 'filemode', default_value='std::ios_base::out')]) ## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultDequeueSinkWithContext(ns3::Ptr<ns3::OutputStreamWrapper> file, std::string context, ns3::Ptr<const ns3::Packet> p) [member function] cls.add_method('DefaultDequeueSinkWithContext', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('std::string', 'context'), param('ns3::Ptr< ns3::Packet const >', 'p')], is_static=True) ## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultDequeueSinkWithoutContext(ns3::Ptr<ns3::OutputStreamWrapper> file, ns3::Ptr<const ns3::Packet> p) [member function] cls.add_method('DefaultDequeueSinkWithoutContext', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('ns3::Ptr< ns3::Packet const >', 'p')], is_static=True) ## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultDropSinkWithContext(ns3::Ptr<ns3::OutputStreamWrapper> file, std::string context, ns3::Ptr<const ns3::Packet> p) [member function] cls.add_method('DefaultDropSinkWithContext', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('std::string', 'context'), param('ns3::Ptr< ns3::Packet const >', 'p')], is_static=True) ## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultDropSinkWithoutContext(ns3::Ptr<ns3::OutputStreamWrapper> file, ns3::Ptr<const ns3::Packet> p) [member function] cls.add_method('DefaultDropSinkWithoutContext', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('ns3::Ptr< ns3::Packet const >', 'p')], is_static=True) ## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultEnqueueSinkWithContext(ns3::Ptr<ns3::OutputStreamWrapper> file, std::string context, ns3::Ptr<const ns3::Packet> p) [member function] cls.add_method('DefaultEnqueueSinkWithContext', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('std::string', 'context'), param('ns3::Ptr< ns3::Packet const >', 'p')], is_static=True) ## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultEnqueueSinkWithoutContext(ns3::Ptr<ns3::OutputStreamWrapper> file, ns3::Ptr<const ns3::Packet> p) [member function] cls.add_method('DefaultEnqueueSinkWithoutContext', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('ns3::Ptr< ns3::Packet const >', 'p')], is_static=True) ## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultReceiveSinkWithContext(ns3::Ptr<ns3::OutputStreamWrapper> file, std::string context, ns3::Ptr<const ns3::Packet> p) [member function] cls.add_method('DefaultReceiveSinkWithContext', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('std::string', 'context'), param('ns3::Ptr< ns3::Packet const >', 'p')], is_static=True) ## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultReceiveSinkWithoutContext(ns3::Ptr<ns3::OutputStreamWrapper> file, ns3::Ptr<const ns3::Packet> p) [member function] cls.add_method('DefaultReceiveSinkWithoutContext', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('ns3::Ptr< ns3::Packet const >', 'p')], is_static=True) ## trace-helper.h (module 'network'): std::string ns3::AsciiTraceHelper::GetFilenameFromDevice(std::string prefix, ns3::Ptr<ns3::NetDevice> device, bool useObjectNames=true) [member function] cls.add_method('GetFilenameFromDevice', 'std::string', [param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'device'), param('bool', 'useObjectNames', default_value='true')]) ## trace-helper.h (module 'network'): std::string ns3::AsciiTraceHelper::GetFilenameFromInterfacePair(std::string prefix, ns3::Ptr<ns3::Object> object, uint32_t interface, bool useObjectNames=true) [member function] cls.add_method('GetFilenameFromInterfacePair', 'std::string', [param('std::string', 'prefix'), param('ns3::Ptr< ns3::Object >', 'object'), param('uint32_t', 'interface'), param('bool', 'useObjectNames', default_value='true')]) return def register_Ns3AsciiTraceHelperForDevice_methods(root_module, cls): ## trace-helper.h (module 'network'): ns3::AsciiTraceHelperForDevice::AsciiTraceHelperForDevice(ns3::AsciiTraceHelperForDevice const & arg0) [copy constructor] cls.add_constructor([param('ns3::AsciiTraceHelperForDevice const &', 'arg0')]) ## trace-helper.h (module 'network'): ns3::AsciiTraceHelperForDevice::AsciiTraceHelperForDevice() [constructor] cls.add_constructor([]) ## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(std::string prefix, ns3::Ptr<ns3::NetDevice> nd, bool explicitFilename=false) [member function] cls.add_method('EnableAscii', 'void', [param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'nd'), param('bool', 'explicitFilename', default_value='false')]) ## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(ns3::Ptr<ns3::OutputStreamWrapper> stream, ns3::Ptr<ns3::NetDevice> nd) [member function] cls.add_method('EnableAscii', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('ns3::Ptr< ns3::NetDevice >', 'nd')]) ## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(std::string prefix, std::string ndName, bool explicitFilename=false) [member function] cls.add_method('EnableAscii', 'void', [param('std::string', 'prefix'), param('std::string', 'ndName'), param('bool', 'explicitFilename', default_value='false')]) ## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(ns3::Ptr<ns3::OutputStreamWrapper> stream, std::string ndName) [member function] cls.add_method('EnableAscii', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('std::string', 'ndName')]) ## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(std::string prefix, ns3::NetDeviceContainer d) [member function] cls.add_method('EnableAscii', 'void', [param('std::string', 'prefix'), param('ns3::NetDeviceContainer', 'd')]) ## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(ns3::Ptr<ns3::OutputStreamWrapper> stream, ns3::NetDeviceContainer d) [member function] cls.add_method('EnableAscii', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('ns3::NetDeviceContainer', 'd')]) ## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(std::string prefix, ns3::NodeContainer n) [member function] cls.add_method('EnableAscii', 'void', [param('std::string', 'prefix'), param('ns3::NodeContainer', 'n')]) ## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(ns3::Ptr<ns3::OutputStreamWrapper> stream, ns3::NodeContainer n) [member function] cls.add_method('EnableAscii', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('ns3::NodeContainer', 'n')]) ## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(std::string prefix, uint32_t nodeid, uint32_t deviceid, bool explicitFilename) [member function] cls.add_method('EnableAscii', 'void', [param('std::string', 'prefix'), param('uint32_t', 'nodeid'), param('uint32_t', 'deviceid'), param('bool', 'explicitFilename')]) ## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(ns3::Ptr<ns3::OutputStreamWrapper> stream, uint32_t nodeid, uint32_t deviceid) [member function] cls.add_method('EnableAscii', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('uint32_t', 'nodeid'), param('uint32_t', 'deviceid')]) ## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAsciiAll(std::string prefix) [member function] cls.add_method('EnableAsciiAll', 'void', [param('std::string', 'prefix')]) ## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAsciiAll(ns3::Ptr<ns3::OutputStreamWrapper> stream) [member function] cls.add_method('EnableAsciiAll', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')]) ## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAsciiInternal(ns3::Ptr<ns3::OutputStreamWrapper> stream, std::string prefix, ns3::Ptr<ns3::NetDevice> nd, bool explicitFilename) [member function] cls.add_method('EnableAsciiInternal', 'void', [param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'nd'), param('bool', 'explicitFilename')], is_pure_virtual=True, is_virtual=True) return def register_Ns3AttributeConstructionList_methods(root_module, cls): ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::AttributeConstructionList(ns3::AttributeConstructionList const & arg0) [copy constructor] cls.add_constructor([param('ns3::AttributeConstructionList const &', 'arg0')]) ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::AttributeConstructionList() [constructor] cls.add_constructor([]) ## attribute-construction-list.h (module 'core'): void ns3::AttributeConstructionList::Add(std::string name, ns3::Ptr<ns3::AttributeChecker const> checker, ns3::Ptr<ns3::AttributeValue> value) [member function] cls.add_method('Add', 'void', [param('std::string', 'name'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker'), param('ns3::Ptr< ns3::AttributeValue >', 'value')]) ## attribute-construction-list.h (module 'core'): std::_List_const_iterator<ns3::AttributeConstructionList::Item> ns3::AttributeConstructionList::Begin() const [member function] cls.add_method('Begin', 'std::_List_const_iterator< ns3::AttributeConstructionList::Item >', [], is_const=True) ## attribute-construction-list.h (module 'core'): std::_List_const_iterator<ns3::AttributeConstructionList::Item> ns3::AttributeConstructionList::End() const [member function] cls.add_method('End', 'std::_List_const_iterator< ns3::AttributeConstructionList::Item >', [], is_const=True) ## attribute-construction-list.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeConstructionList::Find(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('Find', 'ns3::Ptr< ns3::AttributeValue >', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True) return def register_Ns3AttributeConstructionListItem_methods(root_module, cls): ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::Item() [constructor] cls.add_constructor([]) ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::Item(ns3::AttributeConstructionList::Item const & arg0) [copy constructor] cls.add_constructor([param('ns3::AttributeConstructionList::Item const &', 'arg0')]) ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::checker [variable] cls.add_instance_attribute('checker', 'ns3::Ptr< ns3::AttributeChecker const >', is_const=False) ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::name [variable] cls.add_instance_attribute('name', 'std::string', is_const=False) ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::value [variable] cls.add_instance_attribute('value', 'ns3::Ptr< ns3::AttributeValue >', is_const=False) return def register_Ns3Buffer_methods(root_module, cls): ## buffer.h (module 'network'): ns3::Buffer::Buffer() [constructor] cls.add_constructor([]) ## buffer.h (module 'network'): ns3::Buffer::Buffer(uint32_t dataSize) [constructor] cls.add_constructor([param('uint32_t', 'dataSize')]) ## buffer.h (module 'network'): ns3::Buffer::Buffer(uint32_t dataSize, bool initialize) [constructor] cls.add_constructor([param('uint32_t', 'dataSize'), param('bool', 'initialize')]) ## buffer.h (module 'network'): ns3::Buffer::Buffer(ns3::Buffer const & o) [copy constructor] cls.add_constructor([param('ns3::Buffer const &', 'o')]) ## buffer.h (module 'network'): bool ns3::Buffer::AddAtEnd(uint32_t end) [member function] cls.add_method('AddAtEnd', 'bool', [param('uint32_t', 'end')]) ## buffer.h (module 'network'): void ns3::Buffer::AddAtEnd(ns3::Buffer const & o) [member function] cls.add_method('AddAtEnd', 'void', [param('ns3::Buffer const &', 'o')]) ## buffer.h (module 'network'): bool ns3::Buffer::AddAtStart(uint32_t start) [member function] cls.add_method('AddAtStart', 'bool', [param('uint32_t', 'start')]) ## buffer.h (module 'network'): ns3::Buffer::Iterator ns3::Buffer::Begin() const [member function] cls.add_method('Begin', 'ns3::Buffer::Iterator', [], is_const=True) ## buffer.h (module 'network'): void ns3::Buffer::CopyData(std::ostream * os, uint32_t size) const [member function] cls.add_method('CopyData', 'void', [param('std::ostream *', 'os'), param('uint32_t', 'size')], is_const=True) ## buffer.h (module 'network'): uint32_t ns3::Buffer::CopyData(uint8_t * buffer, uint32_t size) const [member function] cls.add_method('CopyData', 'uint32_t', [param('uint8_t *', 'buffer'), param('uint32_t', 'size')], is_const=True) ## buffer.h (module 'network'): ns3::Buffer ns3::Buffer::CreateFragment(uint32_t start, uint32_t length) const [member function] cls.add_method('CreateFragment', 'ns3::Buffer', [param('uint32_t', 'start'), param('uint32_t', 'length')], is_const=True) ## buffer.h (module 'network'): ns3::Buffer ns3::Buffer::CreateFullCopy() const [member function] cls.add_method('CreateFullCopy', 'ns3::Buffer', [], is_const=True) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Deserialize(uint8_t const * buffer, uint32_t size) [member function] cls.add_method('Deserialize', 'uint32_t', [param('uint8_t const *', 'buffer'), param('uint32_t', 'size')]) ## buffer.h (module 'network'): ns3::Buffer::Iterator ns3::Buffer::End() const [member function] cls.add_method('End', 'ns3::Buffer::Iterator', [], is_const=True) ## buffer.h (module 'network'): int32_t ns3::Buffer::GetCurrentEndOffset() const [member function] cls.add_method('GetCurrentEndOffset', 'int32_t', [], is_const=True) ## buffer.h (module 'network'): int32_t ns3::Buffer::GetCurrentStartOffset() const [member function] cls.add_method('GetCurrentStartOffset', 'int32_t', [], is_const=True) ## buffer.h (module 'network'): uint32_t ns3::Buffer::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True) ## buffer.h (module 'network'): uint32_t ns3::Buffer::GetSize() const [member function] cls.add_method('GetSize', 'uint32_t', [], is_const=True) ## buffer.h (module 'network'): uint8_t const * ns3::Buffer::PeekData() const [member function] cls.add_method('PeekData', 'uint8_t const *', [], is_const=True) ## buffer.h (module 'network'): void ns3::Buffer::RemoveAtEnd(uint32_t end) [member function] cls.add_method('RemoveAtEnd', 'void', [param('uint32_t', 'end')]) ## buffer.h (module 'network'): void ns3::Buffer::RemoveAtStart(uint32_t start) [member function] cls.add_method('RemoveAtStart', 'void', [param('uint32_t', 'start')]) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Serialize(uint8_t * buffer, uint32_t maxSize) const [member function] cls.add_method('Serialize', 'uint32_t', [param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')], is_const=True) return def register_Ns3BufferIterator_methods(root_module, cls): ## buffer.h (module 'network'): ns3::Buffer::Iterator::Iterator(ns3::Buffer::Iterator const & arg0) [copy constructor] cls.add_constructor([param('ns3::Buffer::Iterator const &', 'arg0')]) ## buffer.h (module 'network'): ns3::Buffer::Iterator::Iterator() [constructor] cls.add_constructor([]) ## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::CalculateIpChecksum(uint16_t size) [member function] cls.add_method('CalculateIpChecksum', 'uint16_t', [param('uint16_t', 'size')]) ## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::CalculateIpChecksum(uint16_t size, uint32_t initialChecksum) [member function] cls.add_method('CalculateIpChecksum', 'uint16_t', [param('uint16_t', 'size'), param('uint32_t', 'initialChecksum')]) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::GetDistanceFrom(ns3::Buffer::Iterator const & o) const [member function] cls.add_method('GetDistanceFrom', 'uint32_t', [param('ns3::Buffer::Iterator const &', 'o')], is_const=True) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::GetSize() const [member function] cls.add_method('GetSize', 'uint32_t', [], is_const=True) ## buffer.h (module 'network'): bool ns3::Buffer::Iterator::IsEnd() const [member function] cls.add_method('IsEnd', 'bool', [], is_const=True) ## buffer.h (module 'network'): bool ns3::Buffer::Iterator::IsStart() const [member function] cls.add_method('IsStart', 'bool', [], is_const=True) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Next() [member function] cls.add_method('Next', 'void', []) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Next(uint32_t delta) [member function] cls.add_method('Next', 'void', [param('uint32_t', 'delta')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev() [member function] cls.add_method('Prev', 'void', []) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev(uint32_t delta) [member function] cls.add_method('Prev', 'void', [param('uint32_t', 'delta')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Read(uint8_t * buffer, uint32_t size) [member function] cls.add_method('Read', 'void', [param('uint8_t *', 'buffer'), param('uint32_t', 'size')]) ## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadLsbtohU16() [member function] cls.add_method('ReadLsbtohU16', 'uint16_t', []) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::ReadLsbtohU32() [member function] cls.add_method('ReadLsbtohU32', 'uint32_t', []) ## buffer.h (module 'network'): uint64_t ns3::Buffer::Iterator::ReadLsbtohU64() [member function] cls.add_method('ReadLsbtohU64', 'uint64_t', []) ## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadNtohU16() [member function] cls.add_method('ReadNtohU16', 'uint16_t', []) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::ReadNtohU32() [member function] cls.add_method('ReadNtohU32', 'uint32_t', []) ## buffer.h (module 'network'): uint64_t ns3::Buffer::Iterator::ReadNtohU64() [member function] cls.add_method('ReadNtohU64', 'uint64_t', []) ## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadU16() [member function] cls.add_method('ReadU16', 'uint16_t', []) ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::ReadU32() [member function] cls.add_method('ReadU32', 'uint32_t', []) ## buffer.h (module 'network'): uint64_t ns3::Buffer::Iterator::ReadU64() [member function] cls.add_method('ReadU64', 'uint64_t', []) ## buffer.h (module 'network'): uint8_t ns3::Buffer::Iterator::ReadU8() [member function] cls.add_method('ReadU8', 'uint8_t', []) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Write(uint8_t const * buffer, uint32_t size) [member function] cls.add_method('Write', 'void', [param('uint8_t const *', 'buffer'), param('uint32_t', 'size')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Write(ns3::Buffer::Iterator start, ns3::Buffer::Iterator end) [member function] cls.add_method('Write', 'void', [param('ns3::Buffer::Iterator', 'start'), param('ns3::Buffer::Iterator', 'end')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtolsbU16(uint16_t data) [member function] cls.add_method('WriteHtolsbU16', 'void', [param('uint16_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtolsbU32(uint32_t data) [member function] cls.add_method('WriteHtolsbU32', 'void', [param('uint32_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtolsbU64(uint64_t data) [member function] cls.add_method('WriteHtolsbU64', 'void', [param('uint64_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtonU16(uint16_t data) [member function] cls.add_method('WriteHtonU16', 'void', [param('uint16_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtonU32(uint32_t data) [member function] cls.add_method('WriteHtonU32', 'void', [param('uint32_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtonU64(uint64_t data) [member function] cls.add_method('WriteHtonU64', 'void', [param('uint64_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU16(uint16_t data) [member function] cls.add_method('WriteU16', 'void', [param('uint16_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU32(uint32_t data) [member function] cls.add_method('WriteU32', 'void', [param('uint32_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU64(uint64_t data) [member function] cls.add_method('WriteU64', 'void', [param('uint64_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU8(uint8_t data) [member function] cls.add_method('WriteU8', 'void', [param('uint8_t', 'data')]) ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU8(uint8_t data, uint32_t len) [member function] cls.add_method('WriteU8', 'void', [param('uint8_t', 'data'), param('uint32_t', 'len')]) return def register_Ns3ByteTagIterator_methods(root_module, cls): ## packet.h (module 'network'): ns3::ByteTagIterator::ByteTagIterator(ns3::ByteTagIterator const & arg0) [copy constructor] cls.add_constructor([param('ns3::ByteTagIterator const &', 'arg0')]) ## packet.h (module 'network'): bool ns3::ByteTagIterator::HasNext() const [member function] cls.add_method('HasNext', 'bool', [], is_const=True) ## packet.h (module 'network'): ns3::ByteTagIterator::Item ns3::ByteTagIterator::Next() [member function] cls.add_method('Next', 'ns3::ByteTagIterator::Item', []) return def register_Ns3ByteTagIteratorItem_methods(root_module, cls): ## packet.h (module 'network'): ns3::ByteTagIterator::Item::Item(ns3::ByteTagIterator::Item const & arg0) [copy constructor] cls.add_constructor([param('ns3::ByteTagIterator::Item const &', 'arg0')]) ## packet.h (module 'network'): uint32_t ns3::ByteTagIterator::Item::GetEnd() const [member function] cls.add_method('GetEnd', 'uint32_t', [], is_const=True) ## packet.h (module 'network'): uint32_t ns3::ByteTagIterator::Item::GetStart() const [member function] cls.add_method('GetStart', 'uint32_t', [], is_const=True) ## packet.h (module 'network'): void ns3::ByteTagIterator::Item::GetTag(ns3::Tag & tag) const [member function] cls.add_method('GetTag', 'void', [param('ns3::Tag &', 'tag')], is_const=True) ## packet.h (module 'network'): ns3::TypeId ns3::ByteTagIterator::Item::GetTypeId() const [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_const=True) return def register_Ns3ByteTagList_methods(root_module, cls): ## byte-tag-list.h (module 'network'): ns3::ByteTagList::ByteTagList() [constructor] cls.add_constructor([]) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::ByteTagList(ns3::ByteTagList const & o) [copy constructor] cls.add_constructor([param('ns3::ByteTagList const &', 'o')]) ## byte-tag-list.h (module 'network'): ns3::TagBuffer ns3::ByteTagList::Add(ns3::TypeId tid, uint32_t bufferSize, int32_t start, int32_t end) [member function] cls.add_method('Add', 'ns3::TagBuffer', [param('ns3::TypeId', 'tid'), param('uint32_t', 'bufferSize'), param('int32_t', 'start'), param('int32_t', 'end')]) ## byte-tag-list.h (module 'network'): void ns3::ByteTagList::Add(ns3::ByteTagList const & o) [member function] cls.add_method('Add', 'void', [param('ns3::ByteTagList const &', 'o')]) ## byte-tag-list.h (module 'network'): void ns3::ByteTagList::AddAtEnd(int32_t adjustment, int32_t appendOffset) [member function] cls.add_method('AddAtEnd', 'void', [param('int32_t', 'adjustment'), param('int32_t', 'appendOffset')]) ## byte-tag-list.h (module 'network'): void ns3::ByteTagList::AddAtStart(int32_t adjustment, int32_t prependOffset) [member function] cls.add_method('AddAtStart', 'void', [param('int32_t', 'adjustment'), param('int32_t', 'prependOffset')]) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator ns3::ByteTagList::Begin(int32_t offsetStart, int32_t offsetEnd) const [member function] cls.add_method('Begin', 'ns3::ByteTagList::Iterator', [param('int32_t', 'offsetStart'), param('int32_t', 'offsetEnd')], is_const=True) ## byte-tag-list.h (module 'network'): void ns3::ByteTagList::RemoveAll() [member function] cls.add_method('RemoveAll', 'void', []) return def register_Ns3ByteTagListIterator_methods(root_module, cls): ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Iterator(ns3::ByteTagList::Iterator const & arg0) [copy constructor] cls.add_constructor([param('ns3::ByteTagList::Iterator const &', 'arg0')]) ## byte-tag-list.h (module 'network'): uint32_t ns3::ByteTagList::Iterator::GetOffsetStart() const [member function] cls.add_method('GetOffsetStart', 'uint32_t', [], is_const=True) ## byte-tag-list.h (module 'network'): bool ns3::ByteTagList::Iterator::HasNext() const [member function] cls.add_method('HasNext', 'bool', [], is_const=True) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item ns3::ByteTagList::Iterator::Next() [member function] cls.add_method('Next', 'ns3::ByteTagList::Iterator::Item', []) return def register_Ns3ByteTagListIteratorItem_methods(root_module, cls): ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::Item(ns3::ByteTagList::Iterator::Item const & arg0) [copy constructor] cls.add_constructor([param('ns3::ByteTagList::Iterator::Item const &', 'arg0')]) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::Item(ns3::TagBuffer buf) [constructor] cls.add_constructor([param('ns3::TagBuffer', 'buf')]) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::buf [variable] cls.add_instance_attribute('buf', 'ns3::TagBuffer', is_const=False) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::end [variable] cls.add_instance_attribute('end', 'int32_t', is_const=False) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::size [variable] cls.add_instance_attribute('size', 'uint32_t', is_const=False) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::start [variable] cls.add_instance_attribute('start', 'int32_t', is_const=False) ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::tid [variable] cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False) return def register_Ns3CallbackBase_methods(root_module, cls): ## callback.h (module 'core'): ns3::CallbackBase::CallbackBase(ns3::CallbackBase const & arg0) [copy constructor] cls.add_constructor([param('ns3::CallbackBase const &', 'arg0')]) ## callback.h (module 'core'): ns3::CallbackBase::CallbackBase() [constructor] cls.add_constructor([]) ## callback.h (module 'core'): ns3::Ptr<ns3::CallbackImplBase> ns3::CallbackBase::GetImpl() const [member function] cls.add_method('GetImpl', 'ns3::Ptr< ns3::CallbackImplBase >', [], is_const=True) ## callback.h (module 'core'): ns3::CallbackBase::CallbackBase(ns3::Ptr<ns3::CallbackImplBase> impl) [constructor] cls.add_constructor([param('ns3::Ptr< ns3::CallbackImplBase >', 'impl')], visibility='protected') ## callback.h (module 'core'): static std::string ns3::CallbackBase::Demangle(std::string const & mangled) [member function] cls.add_method('Demangle', 'std::string', [param('std::string const &', 'mangled')], is_static=True, visibility='protected') return def register_Ns3ChannelList_methods(root_module, cls): ## channel-list.h (module 'network'): ns3::ChannelList::ChannelList() [constructor] cls.add_constructor([]) ## channel-list.h (module 'network'): ns3::ChannelList::ChannelList(ns3::ChannelList const & arg0) [copy constructor] cls.add_constructor([param('ns3::ChannelList const &', 'arg0')]) ## channel-list.h (module 'network'): static uint32_t ns3::ChannelList::Add(ns3::Ptr<ns3::Channel> channel) [member function] cls.add_method('Add', 'uint32_t', [param('ns3::Ptr< ns3::Channel >', 'channel')], is_static=True) ## channel-list.h (module 'network'): static __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Channel>*,std::vector<ns3::Ptr<ns3::Channel>, std::allocator<ns3::Ptr<ns3::Channel> > > > ns3::ChannelList::Begin() [member function] cls.add_method('Begin', '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Channel > const, std::vector< ns3::Ptr< ns3::Channel > > >', [], is_static=True) ## channel-list.h (module 'network'): static __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Channel>*,std::vector<ns3::Ptr<ns3::Channel>, std::allocator<ns3::Ptr<ns3::Channel> > > > ns3::ChannelList::End() [member function] cls.add_method('End', '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Channel > const, std::vector< ns3::Ptr< ns3::Channel > > >', [], is_static=True) ## channel-list.h (module 'network'): static ns3::Ptr<ns3::Channel> ns3::ChannelList::GetChannel(uint32_t n) [member function] cls.add_method('GetChannel', 'ns3::Ptr< ns3::Channel >', [param('uint32_t', 'n')], is_static=True) ## channel-list.h (module 'network'): static uint32_t ns3::ChannelList::GetNChannels() [member function] cls.add_method('GetNChannels', 'uint32_t', [], is_static=True) return def register_Ns3DataRate_methods(root_module, cls): cls.add_output_stream_operator() cls.add_binary_comparison_operator('!=') cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('<=') cls.add_binary_comparison_operator('==') cls.add_binary_comparison_operator('>') cls.add_binary_comparison_operator('>=') ## data-rate.h (module 'network'): ns3::DataRate::DataRate(ns3::DataRate const & arg0) [copy constructor] cls.add_constructor([param('ns3::DataRate const &', 'arg0')]) ## data-rate.h (module 'network'): ns3::DataRate::DataRate() [constructor] cls.add_constructor([]) ## data-rate.h (module 'network'): ns3::DataRate::DataRate(uint64_t bps) [constructor] cls.add_constructor([param('uint64_t', 'bps')]) ## data-rate.h (module 'network'): ns3::DataRate::DataRate(std::string rate) [constructor] cls.add_constructor([param('std::string', 'rate')]) ## data-rate.h (module 'network'): double ns3::DataRate::CalculateTxTime(uint32_t bytes) const [member function] cls.add_method('CalculateTxTime', 'double', [param('uint32_t', 'bytes')], is_const=True) ## data-rate.h (module 'network'): uint64_t ns3::DataRate::GetBitRate() const [member function] cls.add_method('GetBitRate', 'uint64_t', [], is_const=True) return def register_Ns3EventId_methods(root_module, cls): cls.add_binary_comparison_operator('!=') cls.add_binary_comparison_operator('==') ## event-id.h (module 'core'): ns3::EventId::EventId(ns3::EventId const & arg0) [copy constructor] cls.add_constructor([param('ns3::EventId const &', 'arg0')]) ## event-id.h (module 'core'): ns3::EventId::EventId() [constructor] cls.add_constructor([]) ## event-id.h (module 'core'): ns3::EventId::EventId(ns3::Ptr<ns3::EventImpl> const & impl, uint64_t ts, uint32_t context, uint32_t uid) [constructor] cls.add_constructor([param('ns3::Ptr< ns3::EventImpl > const &', 'impl'), param('uint64_t', 'ts'), param('uint32_t', 'context'), param('uint32_t', 'uid')]) ## event-id.h (module 'core'): void ns3::EventId::Cancel() [member function] cls.add_method('Cancel', 'void', []) ## event-id.h (module 'core'): uint32_t ns3::EventId::GetContext() const [member function] cls.add_method('GetContext', 'uint32_t', [], is_const=True) ## event-id.h (module 'core'): uint64_t ns3::EventId::GetTs() const [member function] cls.add_method('GetTs', 'uint64_t', [], is_const=True) ## event-id.h (module 'core'): uint32_t ns3::EventId::GetUid() const [member function] cls.add_method('GetUid', 'uint32_t', [], is_const=True) ## event-id.h (module 'core'): bool ns3::EventId::IsExpired() const [member function] cls.add_method('IsExpired', 'bool', [], is_const=True) ## event-id.h (module 'core'): bool ns3::EventId::IsRunning() const [member function] cls.add_method('IsRunning', 'bool', [], is_const=True) ## event-id.h (module 'core'): ns3::EventImpl * ns3::EventId::PeekEventImpl() const [member function] cls.add_method('PeekEventImpl', 'ns3::EventImpl *', [], is_const=True) return def register_Ns3Inet6SocketAddress_methods(root_module, cls): ## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress::Inet6SocketAddress(ns3::Inet6SocketAddress const & arg0) [copy constructor] cls.add_constructor([param('ns3::Inet6SocketAddress const &', 'arg0')]) ## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress::Inet6SocketAddress(ns3::Ipv6Address ipv6, uint16_t port) [constructor] cls.add_constructor([param('ns3::Ipv6Address', 'ipv6'), param('uint16_t', 'port')]) ## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress::Inet6SocketAddress(ns3::Ipv6Address ipv6) [constructor] cls.add_constructor([param('ns3::Ipv6Address', 'ipv6')]) ## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress::Inet6SocketAddress(uint16_t port) [constructor] cls.add_constructor([param('uint16_t', 'port')]) ## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress::Inet6SocketAddress(char const * ipv6, uint16_t port) [constructor] cls.add_constructor([param('char const *', 'ipv6'), param('uint16_t', 'port')]) ## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress::Inet6SocketAddress(char const * ipv6) [constructor] cls.add_constructor([param('char const *', 'ipv6')]) ## inet6-socket-address.h (module 'network'): static ns3::Inet6SocketAddress ns3::Inet6SocketAddress::ConvertFrom(ns3::Address const & addr) [member function] cls.add_method('ConvertFrom', 'ns3::Inet6SocketAddress', [param('ns3::Address const &', 'addr')], is_static=True) ## inet6-socket-address.h (module 'network'): ns3::Ipv6Address ns3::Inet6SocketAddress::GetIpv6() const [member function] cls.add_method('GetIpv6', 'ns3::Ipv6Address', [], is_const=True) ## inet6-socket-address.h (module 'network'): uint16_t ns3::Inet6SocketAddress::GetPort() const [member function] cls.add_method('GetPort', 'uint16_t', [], is_const=True) ## inet6-socket-address.h (module 'network'): static bool ns3::Inet6SocketAddress::IsMatchingType(ns3::Address const & addr) [member function] cls.add_method('IsMatchingType', 'bool', [param('ns3::Address const &', 'addr')], is_static=True) ## inet6-socket-address.h (module 'network'): void ns3::Inet6SocketAddress::SetIpv6(ns3::Ipv6Address ipv6) [member function] cls.add_method('SetIpv6', 'void', [param('ns3::Ipv6Address', 'ipv6')]) ## inet6-socket-address.h (module 'network'): void ns3::Inet6SocketAddress::SetPort(uint16_t port) [member function] cls.add_method('SetPort', 'void', [param('uint16_t', 'port')]) return def register_Ns3InetSocketAddress_methods(root_module, cls): ## inet-socket-address.h (module 'network'): ns3::InetSocketAddress::InetSocketAddress(ns3::InetSocketAddress const & arg0) [copy constructor] cls.add_constructor([param('ns3::InetSocketAddress const &', 'arg0')]) ## inet-socket-address.h (module 'network'): ns3::InetSocketAddress::InetSocketAddress(ns3::Ipv4Address ipv4, uint16_t port) [constructor] cls.add_constructor([param('ns3::Ipv4Address', 'ipv4'), param('uint16_t', 'port')]) ## inet-socket-address.h (module 'network'): ns3::InetSocketAddress::InetSocketAddress(ns3::Ipv4Address ipv4) [constructor] cls.add_constructor([param('ns3::Ipv4Address', 'ipv4')]) ## inet-socket-address.h (module 'network'): ns3::InetSocketAddress::InetSocketAddress(uint16_t port) [constructor] cls.add_constructor([param('uint16_t', 'port')]) ## inet-socket-address.h (module 'network'): ns3::InetSocketAddress::InetSocketAddress(char const * ipv4, uint16_t port) [constructor] cls.add_constructor([param('char const *', 'ipv4'), param('uint16_t', 'port')]) ## inet-socket-address.h (module 'network'): ns3::InetSocketAddress::InetSocketAddress(char const * ipv4) [constructor] cls.add_constructor([param('char const *', 'ipv4')]) ## inet-socket-address.h (module 'network'): static ns3::InetSocketAddress ns3::InetSocketAddress::ConvertFrom(ns3::Address const & address) [member function] cls.add_method('ConvertFrom', 'ns3::InetSocketAddress', [param('ns3::Address const &', 'address')], is_static=True) ## inet-socket-address.h (module 'network'): ns3::Ipv4Address ns3::InetSocketAddress::GetIpv4() const [member function] cls.add_method('GetIpv4', 'ns3::Ipv4Address', [], is_const=True) ## inet-socket-address.h (module 'network'): uint16_t ns3::InetSocketAddress::GetPort() const [member function] cls.add_method('GetPort', 'uint16_t', [], is_const=True) ## inet-socket-address.h (module 'network'): static bool ns3::InetSocketAddress::IsMatchingType(ns3::Address const & address) [member function] cls.add_method('IsMatchingType', 'bool', [param('ns3::Address const &', 'address')], is_static=True) ## inet-socket-address.h (module 'network'): void ns3::InetSocketAddress::SetIpv4(ns3::Ipv4Address address) [member function] cls.add_method('SetIpv4', 'void', [param('ns3::Ipv4Address', 'address')]) ## inet-socket-address.h (module 'network'): void ns3::InetSocketAddress::SetPort(uint16_t port) [member function] cls.add_method('SetPort', 'void', [param('uint16_t', 'port')]) return def register_Ns3Ipv4Address_methods(root_module, cls): cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(ns3::Ipv4Address const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4Address const &', 'arg0')]) ## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address() [constructor] cls.add_constructor([]) ## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(uint32_t address) [constructor] cls.add_constructor([param('uint32_t', 'address')]) ## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(char const * address) [constructor] cls.add_constructor([param('char const *', 'address')]) ## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4Address::CombineMask(ns3::Ipv4Mask const & mask) const [member function] cls.add_method('CombineMask', 'ns3::Ipv4Address', [param('ns3::Ipv4Mask const &', 'mask')], is_const=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::ConvertFrom(ns3::Address const & address) [member function] cls.add_method('ConvertFrom', 'ns3::Ipv4Address', [param('ns3::Address const &', 'address')], is_static=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::Deserialize(uint8_t const * buf) [member function] cls.add_method('Deserialize', 'ns3::Ipv4Address', [param('uint8_t const *', 'buf')], is_static=True) ## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Address::Get() const [member function] cls.add_method('Get', 'uint32_t', [], is_const=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetAny() [member function] cls.add_method('GetAny', 'ns3::Ipv4Address', [], is_static=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetBroadcast() [member function] cls.add_method('GetBroadcast', 'ns3::Ipv4Address', [], is_static=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetLoopback() [member function] cls.add_method('GetLoopback', 'ns3::Ipv4Address', [], is_static=True) ## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4Address::GetSubnetDirectedBroadcast(ns3::Ipv4Mask const & mask) const [member function] cls.add_method('GetSubnetDirectedBroadcast', 'ns3::Ipv4Address', [param('ns3::Ipv4Mask const &', 'mask')], is_const=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetZero() [member function] cls.add_method('GetZero', 'ns3::Ipv4Address', [], is_static=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsBroadcast() const [member function] cls.add_method('IsBroadcast', 'bool', [], is_const=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsEqual(ns3::Ipv4Address const & other) const [member function] cls.add_method('IsEqual', 'bool', [param('ns3::Ipv4Address const &', 'other')], is_const=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsLocalMulticast() const [member function] cls.add_method('IsLocalMulticast', 'bool', [], is_const=True) ## ipv4-address.h (module 'network'): static bool ns3::Ipv4Address::IsMatchingType(ns3::Address const & address) [member function] cls.add_method('IsMatchingType', 'bool', [param('ns3::Address const &', 'address')], is_static=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsMulticast() const [member function] cls.add_method('IsMulticast', 'bool', [], is_const=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsSubnetDirectedBroadcast(ns3::Ipv4Mask const & mask) const [member function] cls.add_method('IsSubnetDirectedBroadcast', 'bool', [param('ns3::Ipv4Mask const &', 'mask')], is_const=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Serialize(uint8_t * buf) const [member function] cls.add_method('Serialize', 'void', [param('uint8_t *', 'buf')], is_const=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Set(uint32_t address) [member function] cls.add_method('Set', 'void', [param('uint32_t', 'address')]) ## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Set(char const * address) [member function] cls.add_method('Set', 'void', [param('char const *', 'address')]) return def register_Ns3Ipv4Mask_methods(root_module, cls): cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(ns3::Ipv4Mask const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4Mask const &', 'arg0')]) ## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask() [constructor] cls.add_constructor([]) ## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(uint32_t mask) [constructor] cls.add_constructor([param('uint32_t', 'mask')]) ## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(char const * mask) [constructor] cls.add_constructor([param('char const *', 'mask')]) ## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Mask::Get() const [member function] cls.add_method('Get', 'uint32_t', [], is_const=True) ## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Mask::GetInverse() const [member function] cls.add_method('GetInverse', 'uint32_t', [], is_const=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetLoopback() [member function] cls.add_method('GetLoopback', 'ns3::Ipv4Mask', [], is_static=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetOnes() [member function] cls.add_method('GetOnes', 'ns3::Ipv4Mask', [], is_static=True) ## ipv4-address.h (module 'network'): uint16_t ns3::Ipv4Mask::GetPrefixLength() const [member function] cls.add_method('GetPrefixLength', 'uint16_t', [], is_const=True) ## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetZero() [member function] cls.add_method('GetZero', 'ns3::Ipv4Mask', [], is_static=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Mask::IsEqual(ns3::Ipv4Mask other) const [member function] cls.add_method('IsEqual', 'bool', [param('ns3::Ipv4Mask', 'other')], is_const=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4Mask::IsMatch(ns3::Ipv4Address a, ns3::Ipv4Address b) const [member function] cls.add_method('IsMatch', 'bool', [param('ns3::Ipv4Address', 'a'), param('ns3::Ipv4Address', 'b')], is_const=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4Mask::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4Mask::Set(uint32_t mask) [member function] cls.add_method('Set', 'void', [param('uint32_t', 'mask')]) return def register_Ns3Ipv6Address_methods(root_module, cls): cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address() [constructor] cls.add_constructor([]) ## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(char const * address) [constructor] cls.add_constructor([param('char const *', 'address')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(uint8_t * address) [constructor] cls.add_constructor([param('uint8_t *', 'address')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(ns3::Ipv6Address const & addr) [copy constructor] cls.add_constructor([param('ns3::Ipv6Address const &', 'addr')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(ns3::Ipv6Address const * addr) [constructor] cls.add_constructor([param('ns3::Ipv6Address const *', 'addr')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Address ns3::Ipv6Address::CombinePrefix(ns3::Ipv6Prefix const & prefix) [member function] cls.add_method('CombinePrefix', 'ns3::Ipv6Address', [param('ns3::Ipv6Prefix const &', 'prefix')]) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::ConvertFrom(ns3::Address const & address) [member function] cls.add_method('ConvertFrom', 'ns3::Ipv6Address', [param('ns3::Address const &', 'address')], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::Deserialize(uint8_t const * buf) [member function] cls.add_method('Deserialize', 'ns3::Ipv6Address', [param('uint8_t const *', 'buf')], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllHostsMulticast() [member function] cls.add_method('GetAllHostsMulticast', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllNodesMulticast() [member function] cls.add_method('GetAllNodesMulticast', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllRoutersMulticast() [member function] cls.add_method('GetAllRoutersMulticast', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAny() [member function] cls.add_method('GetAny', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6Address::GetBytes(uint8_t * buf) const [member function] cls.add_method('GetBytes', 'void', [param('uint8_t *', 'buf')], is_const=True) ## ipv6-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv6Address::GetIpv4MappedAddress() const [member function] cls.add_method('GetIpv4MappedAddress', 'ns3::Ipv4Address', [], is_const=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetLoopback() [member function] cls.add_method('GetLoopback', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetOnes() [member function] cls.add_method('GetOnes', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetZero() [member function] cls.add_method('GetZero', 'ns3::Ipv6Address', [], is_static=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllHostsMulticast() const [member function] cls.add_method('IsAllHostsMulticast', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllNodesMulticast() const [member function] cls.add_method('IsAllNodesMulticast', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllRoutersMulticast() const [member function] cls.add_method('IsAllRoutersMulticast', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAny() const [member function] cls.add_method('IsAny', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsEqual(ns3::Ipv6Address const & other) const [member function] cls.add_method('IsEqual', 'bool', [param('ns3::Ipv6Address const &', 'other')], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsIpv4MappedAddress() [member function] cls.add_method('IsIpv4MappedAddress', 'bool', []) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsLinkLocal() const [member function] cls.add_method('IsLinkLocal', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsLinkLocalMulticast() const [member function] cls.add_method('IsLinkLocalMulticast', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsLocalhost() const [member function] cls.add_method('IsLocalhost', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): static bool ns3::Ipv6Address::IsMatchingType(ns3::Address const & address) [member function] cls.add_method('IsMatchingType', 'bool', [param('ns3::Address const &', 'address')], is_static=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsMulticast() const [member function] cls.add_method('IsMulticast', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsSolicitedMulticast() const [member function] cls.add_method('IsSolicitedMulticast', 'bool', [], is_const=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredAddress(ns3::Mac48Address addr, ns3::Ipv6Address prefix) [member function] cls.add_method('MakeAutoconfiguredAddress', 'ns3::Ipv6Address', [param('ns3::Mac48Address', 'addr'), param('ns3::Ipv6Address', 'prefix')], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(ns3::Mac48Address mac) [member function] cls.add_method('MakeAutoconfiguredLinkLocalAddress', 'ns3::Ipv6Address', [param('ns3::Mac48Address', 'mac')], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeIpv4MappedAddress(ns3::Ipv4Address addr) [member function] cls.add_method('MakeIpv4MappedAddress', 'ns3::Ipv6Address', [param('ns3::Ipv4Address', 'addr')], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeSolicitedAddress(ns3::Ipv6Address addr) [member function] cls.add_method('MakeSolicitedAddress', 'ns3::Ipv6Address', [param('ns3::Ipv6Address', 'addr')], is_static=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Serialize(uint8_t * buf) const [member function] cls.add_method('Serialize', 'void', [param('uint8_t *', 'buf')], is_const=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Set(char const * address) [member function] cls.add_method('Set', 'void', [param('char const *', 'address')]) ## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Set(uint8_t * address) [member function] cls.add_method('Set', 'void', [param('uint8_t *', 'address')]) return def register_Ns3Ipv6Prefix_methods(root_module, cls): cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix() [constructor] cls.add_constructor([]) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(uint8_t * prefix) [constructor] cls.add_constructor([param('uint8_t *', 'prefix')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(char const * prefix) [constructor] cls.add_constructor([param('char const *', 'prefix')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(uint8_t prefix) [constructor] cls.add_constructor([param('uint8_t', 'prefix')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(ns3::Ipv6Prefix const & prefix) [copy constructor] cls.add_constructor([param('ns3::Ipv6Prefix const &', 'prefix')]) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(ns3::Ipv6Prefix const * prefix) [constructor] cls.add_constructor([param('ns3::Ipv6Prefix const *', 'prefix')]) ## ipv6-address.h (module 'network'): void ns3::Ipv6Prefix::GetBytes(uint8_t * buf) const [member function] cls.add_method('GetBytes', 'void', [param('uint8_t *', 'buf')], is_const=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetLoopback() [member function] cls.add_method('GetLoopback', 'ns3::Ipv6Prefix', [], is_static=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetOnes() [member function] cls.add_method('GetOnes', 'ns3::Ipv6Prefix', [], is_static=True) ## ipv6-address.h (module 'network'): uint8_t ns3::Ipv6Prefix::GetPrefixLength() const [member function] cls.add_method('GetPrefixLength', 'uint8_t', [], is_const=True) ## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetZero() [member function] cls.add_method('GetZero', 'ns3::Ipv6Prefix', [], is_static=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Prefix::IsEqual(ns3::Ipv6Prefix const & other) const [member function] cls.add_method('IsEqual', 'bool', [param('ns3::Ipv6Prefix const &', 'other')], is_const=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6Prefix::IsMatch(ns3::Ipv6Address a, ns3::Ipv6Address b) const [member function] cls.add_method('IsMatch', 'bool', [param('ns3::Ipv6Address', 'a'), param('ns3::Ipv6Address', 'b')], is_const=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6Prefix::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) return def register_Ns3Mac48Address_methods(root_module, cls): cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## mac48-address.h (module 'network'): ns3::Mac48Address::Mac48Address(ns3::Mac48Address const & arg0) [copy constructor] cls.add_constructor([param('ns3::Mac48Address const &', 'arg0')]) ## mac48-address.h (module 'network'): ns3::Mac48Address::Mac48Address() [constructor] cls.add_constructor([]) ## mac48-address.h (module 'network'): ns3::Mac48Address::Mac48Address(char const * str) [constructor] cls.add_constructor([param('char const *', 'str')]) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::Allocate() [member function] cls.add_method('Allocate', 'ns3::Mac48Address', [], is_static=True) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::ConvertFrom(ns3::Address const & address) [member function] cls.add_method('ConvertFrom', 'ns3::Mac48Address', [param('ns3::Address const &', 'address')], is_static=True) ## mac48-address.h (module 'network'): void ns3::Mac48Address::CopyFrom(uint8_t const * buffer) [member function] cls.add_method('CopyFrom', 'void', [param('uint8_t const *', 'buffer')]) ## mac48-address.h (module 'network'): void ns3::Mac48Address::CopyTo(uint8_t * buffer) const [member function] cls.add_method('CopyTo', 'void', [param('uint8_t *', 'buffer')], is_const=True) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetBroadcast() [member function] cls.add_method('GetBroadcast', 'ns3::Mac48Address', [], is_static=True) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticast(ns3::Ipv4Address address) [member function] cls.add_method('GetMulticast', 'ns3::Mac48Address', [param('ns3::Ipv4Address', 'address')], is_static=True) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticast(ns3::Ipv6Address address) [member function] cls.add_method('GetMulticast', 'ns3::Mac48Address', [param('ns3::Ipv6Address', 'address')], is_static=True) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticast6Prefix() [member function] cls.add_method('GetMulticast6Prefix', 'ns3::Mac48Address', [], is_static=True) ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticastPrefix() [member function] cls.add_method('GetMulticastPrefix', 'ns3::Mac48Address', [], is_static=True) ## mac48-address.h (module 'network'): bool ns3::Mac48Address::IsBroadcast() const [member function] cls.add_method('IsBroadcast', 'bool', [], is_const=True) ## mac48-address.h (module 'network'): bool ns3::Mac48Address::IsGroup() const [member function] cls.add_method('IsGroup', 'bool', [], is_const=True) ## mac48-address.h (module 'network'): static bool ns3::Mac48Address::IsMatchingType(ns3::Address const & address) [member function] cls.add_method('IsMatchingType', 'bool', [param('ns3::Address const &', 'address')], is_static=True) return def register_Ns3Mac64Address_methods(root_module, cls): cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## mac64-address.h (module 'network'): ns3::Mac64Address::Mac64Address(ns3::Mac64Address const & arg0) [copy constructor] cls.add_constructor([param('ns3::Mac64Address const &', 'arg0')]) ## mac64-address.h (module 'network'): ns3::Mac64Address::Mac64Address() [constructor] cls.add_constructor([]) ## mac64-address.h (module 'network'): ns3::Mac64Address::Mac64Address(char const * str) [constructor] cls.add_constructor([param('char const *', 'str')]) ## mac64-address.h (module 'network'): static ns3::Mac64Address ns3::Mac64Address::Allocate() [member function] cls.add_method('Allocate', 'ns3::Mac64Address', [], is_static=True) ## mac64-address.h (module 'network'): static ns3::Mac64Address ns3::Mac64Address::ConvertFrom(ns3::Address const & address) [member function] cls.add_method('ConvertFrom', 'ns3::Mac64Address', [param('ns3::Address const &', 'address')], is_static=True) ## mac64-address.h (module 'network'): void ns3::Mac64Address::CopyFrom(uint8_t const * buffer) [member function] cls.add_method('CopyFrom', 'void', [param('uint8_t const *', 'buffer')]) ## mac64-address.h (module 'network'): void ns3::Mac64Address::CopyTo(uint8_t * buffer) const [member function] cls.add_method('CopyTo', 'void', [param('uint8_t *', 'buffer')], is_const=True) ## mac64-address.h (module 'network'): static bool ns3::Mac64Address::IsMatchingType(ns3::Address const & address) [member function] cls.add_method('IsMatchingType', 'bool', [param('ns3::Address const &', 'address')], is_static=True) return def register_Ns3NetDeviceContainer_methods(root_module, cls): ## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer(ns3::NetDeviceContainer const & arg0) [copy constructor] cls.add_constructor([param('ns3::NetDeviceContainer const &', 'arg0')]) ## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer() [constructor] cls.add_constructor([]) ## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer(ns3::Ptr<ns3::NetDevice> dev) [constructor] cls.add_constructor([param('ns3::Ptr< ns3::NetDevice >', 'dev')]) ## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer(std::string devName) [constructor] cls.add_constructor([param('std::string', 'devName')]) ## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer(ns3::NetDeviceContainer const & a, ns3::NetDeviceContainer const & b) [constructor] cls.add_constructor([param('ns3::NetDeviceContainer const &', 'a'), param('ns3::NetDeviceContainer const &', 'b')]) ## net-device-container.h (module 'network'): void ns3::NetDeviceContainer::Add(ns3::NetDeviceContainer other) [member function] cls.add_method('Add', 'void', [param('ns3::NetDeviceContainer', 'other')]) ## net-device-container.h (module 'network'): void ns3::NetDeviceContainer::Add(ns3::Ptr<ns3::NetDevice> device) [member function] cls.add_method('Add', 'void', [param('ns3::Ptr< ns3::NetDevice >', 'device')]) ## net-device-container.h (module 'network'): void ns3::NetDeviceContainer::Add(std::string deviceName) [member function] cls.add_method('Add', 'void', [param('std::string', 'deviceName')]) ## net-device-container.h (module 'network'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::NetDevice>*,std::vector<ns3::Ptr<ns3::NetDevice>, std::allocator<ns3::Ptr<ns3::NetDevice> > > > ns3::NetDeviceContainer::Begin() const [member function] cls.add_method('Begin', '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::NetDevice > const, std::vector< ns3::Ptr< ns3::NetDevice > > >', [], is_const=True) ## net-device-container.h (module 'network'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::NetDevice>*,std::vector<ns3::Ptr<ns3::NetDevice>, std::allocator<ns3::Ptr<ns3::NetDevice> > > > ns3::NetDeviceContainer::End() const [member function] cls.add_method('End', '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::NetDevice > const, std::vector< ns3::Ptr< ns3::NetDevice > > >', [], is_const=True) ## net-device-container.h (module 'network'): ns3::Ptr<ns3::NetDevice> ns3::NetDeviceContainer::Get(uint32_t i) const [member function] cls.add_method('Get', 'ns3::Ptr< ns3::NetDevice >', [param('uint32_t', 'i')], is_const=True) ## net-device-container.h (module 'network'): uint32_t ns3::NetDeviceContainer::GetN() const [member function] cls.add_method('GetN', 'uint32_t', [], is_const=True) return def register_Ns3NodeContainer_methods(root_module, cls): ## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & arg0) [copy constructor] cls.add_constructor([param('ns3::NodeContainer const &', 'arg0')]) ## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer() [constructor] cls.add_constructor([]) ## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::Ptr<ns3::Node> node) [constructor] cls.add_constructor([param('ns3::Ptr< ns3::Node >', 'node')]) ## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(std::string nodeName) [constructor] cls.add_constructor([param('std::string', 'nodeName')]) ## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & a, ns3::NodeContainer const & b) [constructor] cls.add_constructor([param('ns3::NodeContainer const &', 'a'), param('ns3::NodeContainer const &', 'b')]) ## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & a, ns3::NodeContainer const & b, ns3::NodeContainer const & c) [constructor] cls.add_constructor([param('ns3::NodeContainer const &', 'a'), param('ns3::NodeContainer const &', 'b'), param('ns3::NodeContainer const &', 'c')]) ## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & a, ns3::NodeContainer const & b, ns3::NodeContainer const & c, ns3::NodeContainer const & d) [constructor] cls.add_constructor([param('ns3::NodeContainer const &', 'a'), param('ns3::NodeContainer const &', 'b'), param('ns3::NodeContainer const &', 'c'), param('ns3::NodeContainer const &', 'd')]) ## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & a, ns3::NodeContainer const & b, ns3::NodeContainer const & c, ns3::NodeContainer const & d, ns3::NodeContainer const & e) [constructor] cls.add_constructor([param('ns3::NodeContainer const &', 'a'), param('ns3::NodeContainer const &', 'b'), param('ns3::NodeContainer const &', 'c'), param('ns3::NodeContainer const &', 'd'), param('ns3::NodeContainer const &', 'e')]) ## node-container.h (module 'network'): void ns3::NodeContainer::Add(ns3::NodeContainer other) [member function] cls.add_method('Add', 'void', [param('ns3::NodeContainer', 'other')]) ## node-container.h (module 'network'): void ns3::NodeContainer::Add(ns3::Ptr<ns3::Node> node) [member function] cls.add_method('Add', 'void', [param('ns3::Ptr< ns3::Node >', 'node')]) ## node-container.h (module 'network'): void ns3::NodeContainer::Add(std::string nodeName) [member function] cls.add_method('Add', 'void', [param('std::string', 'nodeName')]) ## node-container.h (module 'network'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Node>*,std::vector<ns3::Ptr<ns3::Node>, std::allocator<ns3::Ptr<ns3::Node> > > > ns3::NodeContainer::Begin() const [member function] cls.add_method('Begin', '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Node > const, std::vector< ns3::Ptr< ns3::Node > > >', [], is_const=True) ## node-container.h (module 'network'): void ns3::NodeContainer::Create(uint32_t n) [member function] cls.add_method('Create', 'void', [param('uint32_t', 'n')]) ## node-container.h (module 'network'): void ns3::NodeContainer::Create(uint32_t n, uint32_t systemId) [member function] cls.add_method('Create', 'void', [param('uint32_t', 'n'), param('uint32_t', 'systemId')]) ## node-container.h (module 'network'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Node>*,std::vector<ns3::Ptr<ns3::Node>, std::allocator<ns3::Ptr<ns3::Node> > > > ns3::NodeContainer::End() const [member function] cls.add_method('End', '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Node > const, std::vector< ns3::Ptr< ns3::Node > > >', [], is_const=True) ## node-container.h (module 'network'): ns3::Ptr<ns3::Node> ns3::NodeContainer::Get(uint32_t i) const [member function] cls.add_method('Get', 'ns3::Ptr< ns3::Node >', [param('uint32_t', 'i')], is_const=True) ## node-container.h (module 'network'): static ns3::NodeContainer ns3::NodeContainer::GetGlobal() [member function] cls.add_method('GetGlobal', 'ns3::NodeContainer', [], is_static=True) ## node-container.h (module 'network'): uint32_t ns3::NodeContainer::GetN() const [member function] cls.add_method('GetN', 'uint32_t', [], is_const=True) return def register_Ns3NodeList_methods(root_module, cls): ## node-list.h (module 'network'): ns3::NodeList::NodeList() [constructor] cls.add_constructor([]) ## node-list.h (module 'network'): ns3::NodeList::NodeList(ns3::NodeList const & arg0) [copy constructor] cls.add_constructor([param('ns3::NodeList const &', 'arg0')]) ## node-list.h (module 'network'): static uint32_t ns3::NodeList::Add(ns3::Ptr<ns3::Node> node) [member function] cls.add_method('Add', 'uint32_t', [param('ns3::Ptr< ns3::Node >', 'node')], is_static=True) ## node-list.h (module 'network'): static __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Node>*,std::vector<ns3::Ptr<ns3::Node>, std::allocator<ns3::Ptr<ns3::Node> > > > ns3::NodeList::Begin() [member function] cls.add_method('Begin', '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Node > const, std::vector< ns3::Ptr< ns3::Node > > >', [], is_static=True) ## node-list.h (module 'network'): static __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Node>*,std::vector<ns3::Ptr<ns3::Node>, std::allocator<ns3::Ptr<ns3::Node> > > > ns3::NodeList::End() [member function] cls.add_method('End', '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Node > const, std::vector< ns3::Ptr< ns3::Node > > >', [], is_static=True) ## node-list.h (module 'network'): static uint32_t ns3::NodeList::GetNNodes() [member function] cls.add_method('GetNNodes', 'uint32_t', [], is_static=True) ## node-list.h (module 'network'): static ns3::Ptr<ns3::Node> ns3::NodeList::GetNode(uint32_t n) [member function] cls.add_method('GetNode', 'ns3::Ptr< ns3::Node >', [param('uint32_t', 'n')], is_static=True) return def register_Ns3ObjectBase_methods(root_module, cls): ## object-base.h (module 'core'): ns3::ObjectBase::ObjectBase() [constructor] cls.add_constructor([]) ## object-base.h (module 'core'): ns3::ObjectBase::ObjectBase(ns3::ObjectBase const & arg0) [copy constructor] cls.add_constructor([param('ns3::ObjectBase const &', 'arg0')]) ## object-base.h (module 'core'): void ns3::ObjectBase::GetAttribute(std::string name, ns3::AttributeValue & value) const [member function] cls.add_method('GetAttribute', 'void', [param('std::string', 'name'), param('ns3::AttributeValue &', 'value')], is_const=True) ## object-base.h (module 'core'): bool ns3::ObjectBase::GetAttributeFailSafe(std::string name, ns3::AttributeValue & attribute) const [member function] cls.add_method('GetAttributeFailSafe', 'bool', [param('std::string', 'name'), param('ns3::AttributeValue &', 'attribute')], is_const=True) ## object-base.h (module 'core'): ns3::TypeId ns3::ObjectBase::GetInstanceTypeId() const [member function] cls.add_method('GetInstanceTypeId', 'ns3::TypeId', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## object-base.h (module 'core'): static ns3::TypeId ns3::ObjectBase::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## object-base.h (module 'core'): void ns3::ObjectBase::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function] cls.add_method('SetAttribute', 'void', [param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')]) ## object-base.h (module 'core'): bool ns3::ObjectBase::SetAttributeFailSafe(std::string name, ns3::AttributeValue const & value) [member function] cls.add_method('SetAttributeFailSafe', 'bool', [param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')]) ## object-base.h (module 'core'): bool ns3::ObjectBase::TraceConnect(std::string name, std::string context, ns3::CallbackBase const & cb) [member function] cls.add_method('TraceConnect', 'bool', [param('std::string', 'name'), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')]) ## object-base.h (module 'core'): bool ns3::ObjectBase::TraceConnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function] cls.add_method('TraceConnectWithoutContext', 'bool', [param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')]) ## object-base.h (module 'core'): bool ns3::ObjectBase::TraceDisconnect(std::string name, std::string context, ns3::CallbackBase const & cb) [member function] cls.add_method('TraceDisconnect', 'bool', [param('std::string', 'name'), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')]) ## object-base.h (module 'core'): bool ns3::ObjectBase::TraceDisconnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function] cls.add_method('TraceDisconnectWithoutContext', 'bool', [param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')]) ## object-base.h (module 'core'): void ns3::ObjectBase::ConstructSelf(ns3::AttributeConstructionList const & attributes) [member function] cls.add_method('ConstructSelf', 'void', [param('ns3::AttributeConstructionList const &', 'attributes')], visibility='protected') ## object-base.h (module 'core'): void ns3::ObjectBase::NotifyConstructionCompleted() [member function] cls.add_method('NotifyConstructionCompleted', 'void', [], visibility='protected', is_virtual=True) return def register_Ns3ObjectDeleter_methods(root_module, cls): ## object.h (module 'core'): ns3::ObjectDeleter::ObjectDeleter() [constructor] cls.add_constructor([]) ## object.h (module 'core'): ns3::ObjectDeleter::ObjectDeleter(ns3::ObjectDeleter const & arg0) [copy constructor] cls.add_constructor([param('ns3::ObjectDeleter const &', 'arg0')]) ## object.h (module 'core'): static void ns3::ObjectDeleter::Delete(ns3::Object * object) [member function] cls.add_method('Delete', 'void', [param('ns3::Object *', 'object')], is_static=True) return def register_Ns3ObjectFactory_methods(root_module, cls): cls.add_output_stream_operator() ## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory(ns3::ObjectFactory const & arg0) [copy constructor] cls.add_constructor([param('ns3::ObjectFactory const &', 'arg0')]) ## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory() [constructor] cls.add_constructor([]) ## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory(std::string typeId) [constructor] cls.add_constructor([param('std::string', 'typeId')]) ## object-factory.h (module 'core'): ns3::Ptr<ns3::Object> ns3::ObjectFactory::Create() const [member function] cls.add_method('Create', 'ns3::Ptr< ns3::Object >', [], is_const=True) ## object-factory.h (module 'core'): ns3::TypeId ns3::ObjectFactory::GetTypeId() const [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_const=True) ## object-factory.h (module 'core'): void ns3::ObjectFactory::Set(std::string name, ns3::AttributeValue const & value) [member function] cls.add_method('Set', 'void', [param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')]) ## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(ns3::TypeId tid) [member function] cls.add_method('SetTypeId', 'void', [param('ns3::TypeId', 'tid')]) ## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(char const * tid) [member function] cls.add_method('SetTypeId', 'void', [param('char const *', 'tid')]) ## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(std::string tid) [member function] cls.add_method('SetTypeId', 'void', [param('std::string', 'tid')]) return def register_Ns3PacketMetadata_methods(root_module, cls): ## packet-metadata.h (module 'network'): ns3::PacketMetadata::PacketMetadata(uint64_t uid, uint32_t size) [constructor] cls.add_constructor([param('uint64_t', 'uid'), param('uint32_t', 'size')]) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::PacketMetadata(ns3::PacketMetadata const & o) [copy constructor] cls.add_constructor([param('ns3::PacketMetadata const &', 'o')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddAtEnd(ns3::PacketMetadata const & o) [member function] cls.add_method('AddAtEnd', 'void', [param('ns3::PacketMetadata const &', 'o')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddHeader(ns3::Header const & header, uint32_t size) [member function] cls.add_method('AddHeader', 'void', [param('ns3::Header const &', 'header'), param('uint32_t', 'size')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddPaddingAtEnd(uint32_t end) [member function] cls.add_method('AddPaddingAtEnd', 'void', [param('uint32_t', 'end')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddTrailer(ns3::Trailer const & trailer, uint32_t size) [member function] cls.add_method('AddTrailer', 'void', [param('ns3::Trailer const &', 'trailer'), param('uint32_t', 'size')]) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator ns3::PacketMetadata::BeginItem(ns3::Buffer buffer) const [member function] cls.add_method('BeginItem', 'ns3::PacketMetadata::ItemIterator', [param('ns3::Buffer', 'buffer')], is_const=True) ## packet-metadata.h (module 'network'): ns3::PacketMetadata ns3::PacketMetadata::CreateFragment(uint32_t start, uint32_t end) const [member function] cls.add_method('CreateFragment', 'ns3::PacketMetadata', [param('uint32_t', 'start'), param('uint32_t', 'end')], is_const=True) ## packet-metadata.h (module 'network'): uint32_t ns3::PacketMetadata::Deserialize(uint8_t const * buffer, uint32_t size) [member function] cls.add_method('Deserialize', 'uint32_t', [param('uint8_t const *', 'buffer'), param('uint32_t', 'size')]) ## packet-metadata.h (module 'network'): static void ns3::PacketMetadata::Enable() [member function] cls.add_method('Enable', 'void', [], is_static=True) ## packet-metadata.h (module 'network'): static void ns3::PacketMetadata::EnableChecking() [member function] cls.add_method('EnableChecking', 'void', [], is_static=True) ## packet-metadata.h (module 'network'): uint32_t ns3::PacketMetadata::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True) ## packet-metadata.h (module 'network'): uint64_t ns3::PacketMetadata::GetUid() const [member function] cls.add_method('GetUid', 'uint64_t', [], is_const=True) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveAtEnd(uint32_t end) [member function] cls.add_method('RemoveAtEnd', 'void', [param('uint32_t', 'end')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveAtStart(uint32_t start) [member function] cls.add_method('RemoveAtStart', 'void', [param('uint32_t', 'start')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveHeader(ns3::Header const & header, uint32_t size) [member function] cls.add_method('RemoveHeader', 'void', [param('ns3::Header const &', 'header'), param('uint32_t', 'size')]) ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveTrailer(ns3::Trailer const & trailer, uint32_t size) [member function] cls.add_method('RemoveTrailer', 'void', [param('ns3::Trailer const &', 'trailer'), param('uint32_t', 'size')]) ## packet-metadata.h (module 'network'): uint32_t ns3::PacketMetadata::Serialize(uint8_t * buffer, uint32_t maxSize) const [member function] cls.add_method('Serialize', 'uint32_t', [param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')], is_const=True) return def register_Ns3PacketMetadataItem_methods(root_module, cls): ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::Item() [constructor] cls.add_constructor([]) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::Item(ns3::PacketMetadata::Item const & arg0) [copy constructor] cls.add_constructor([param('ns3::PacketMetadata::Item const &', 'arg0')]) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::current [variable] cls.add_instance_attribute('current', 'ns3::Buffer::Iterator', is_const=False) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::currentSize [variable] cls.add_instance_attribute('currentSize', 'uint32_t', is_const=False) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::currentTrimedFromEnd [variable] cls.add_instance_attribute('currentTrimedFromEnd', 'uint32_t', is_const=False) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::currentTrimedFromStart [variable] cls.add_instance_attribute('currentTrimedFromStart', 'uint32_t', is_const=False) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::isFragment [variable] cls.add_instance_attribute('isFragment', 'bool', is_const=False) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::tid [variable] cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False) return def register_Ns3PacketMetadataItemIterator_methods(root_module, cls): ## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator::ItemIterator(ns3::PacketMetadata::ItemIterator const & arg0) [copy constructor] cls.add_constructor([param('ns3::PacketMetadata::ItemIterator const &', 'arg0')]) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator::ItemIterator(ns3::PacketMetadata const * metadata, ns3::Buffer buffer) [constructor] cls.add_constructor([param('ns3::PacketMetadata const *', 'metadata'), param('ns3::Buffer', 'buffer')]) ## packet-metadata.h (module 'network'): bool ns3::PacketMetadata::ItemIterator::HasNext() const [member function] cls.add_method('HasNext', 'bool', [], is_const=True) ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item ns3::PacketMetadata::ItemIterator::Next() [member function] cls.add_method('Next', 'ns3::PacketMetadata::Item', []) return def register_Ns3PacketSocketAddress_methods(root_module, cls): ## packet-socket-address.h (module 'network'): ns3::PacketSocketAddress::PacketSocketAddress(ns3::PacketSocketAddress const & arg0) [copy constructor] cls.add_constructor([param('ns3::PacketSocketAddress const &', 'arg0')]) ## packet-socket-address.h (module 'network'): ns3::PacketSocketAddress::PacketSocketAddress() [constructor] cls.add_constructor([]) ## packet-socket-address.h (module 'network'): static ns3::PacketSocketAddress ns3::PacketSocketAddress::ConvertFrom(ns3::Address const & address) [member function] cls.add_method('ConvertFrom', 'ns3::PacketSocketAddress', [param('ns3::Address const &', 'address')], is_static=True) ## packet-socket-address.h (module 'network'): ns3::Address ns3::PacketSocketAddress::GetPhysicalAddress() const [member function] cls.add_method('GetPhysicalAddress', 'ns3::Address', [], is_const=True) ## packet-socket-address.h (module 'network'): uint16_t ns3::PacketSocketAddress::GetProtocol() const [member function] cls.add_method('GetProtocol', 'uint16_t', [], is_const=True) ## packet-socket-address.h (module 'network'): uint32_t ns3::PacketSocketAddress::GetSingleDevice() const [member function] cls.add_method('GetSingleDevice', 'uint32_t', [], is_const=True) ## packet-socket-address.h (module 'network'): static bool ns3::PacketSocketAddress::IsMatchingType(ns3::Address const & address) [member function] cls.add_method('IsMatchingType', 'bool', [param('ns3::Address const &', 'address')], is_static=True) ## packet-socket-address.h (module 'network'): bool ns3::PacketSocketAddress::IsSingleDevice() const [member function] cls.add_method('IsSingleDevice', 'bool', [], is_const=True) ## packet-socket-address.h (module 'network'): void ns3::PacketSocketAddress::SetAllDevices() [member function] cls.add_method('SetAllDevices', 'void', []) ## packet-socket-address.h (module 'network'): void ns3::PacketSocketAddress::SetPhysicalAddress(ns3::Address const address) [member function] cls.add_method('SetPhysicalAddress', 'void', [param('ns3::Address const', 'address')]) ## packet-socket-address.h (module 'network'): void ns3::PacketSocketAddress::SetProtocol(uint16_t protocol) [member function] cls.add_method('SetProtocol', 'void', [param('uint16_t', 'protocol')]) ## packet-socket-address.h (module 'network'): void ns3::PacketSocketAddress::SetSingleDevice(uint32_t device) [member function] cls.add_method('SetSingleDevice', 'void', [param('uint32_t', 'device')]) return def register_Ns3PacketSocketHelper_methods(root_module, cls): ## packet-socket-helper.h (module 'network'): ns3::PacketSocketHelper::PacketSocketHelper() [constructor] cls.add_constructor([]) ## packet-socket-helper.h (module 'network'): ns3::PacketSocketHelper::PacketSocketHelper(ns3::PacketSocketHelper const & arg0) [copy constructor] cls.add_constructor([param('ns3::PacketSocketHelper const &', 'arg0')]) ## packet-socket-helper.h (module 'network'): void ns3::PacketSocketHelper::Install(ns3::Ptr<ns3::Node> node) const [member function] cls.add_method('Install', 'void', [param('ns3::Ptr< ns3::Node >', 'node')], is_const=True) ## packet-socket-helper.h (module 'network'): void ns3::PacketSocketHelper::Install(std::string nodeName) const [member function] cls.add_method('Install', 'void', [param('std::string', 'nodeName')], is_const=True) ## packet-socket-helper.h (module 'network'): void ns3::PacketSocketHelper::Install(ns3::NodeContainer c) const [member function] cls.add_method('Install', 'void', [param('ns3::NodeContainer', 'c')], is_const=True) return def register_Ns3PacketTagIterator_methods(root_module, cls): ## packet.h (module 'network'): ns3::PacketTagIterator::PacketTagIterator(ns3::PacketTagIterator const & arg0) [copy constructor] cls.add_constructor([param('ns3::PacketTagIterator const &', 'arg0')]) ## packet.h (module 'network'): bool ns3::PacketTagIterator::HasNext() const [member function] cls.add_method('HasNext', 'bool', [], is_const=True) ## packet.h (module 'network'): ns3::PacketTagIterator::Item ns3::PacketTagIterator::Next() [member function] cls.add_method('Next', 'ns3::PacketTagIterator::Item', []) return def register_Ns3PacketTagIteratorItem_methods(root_module, cls): ## packet.h (module 'network'): ns3::PacketTagIterator::Item::Item(ns3::PacketTagIterator::Item const & arg0) [copy constructor] cls.add_constructor([param('ns3::PacketTagIterator::Item const &', 'arg0')]) ## packet.h (module 'network'): void ns3::PacketTagIterator::Item::GetTag(ns3::Tag & tag) const [member function] cls.add_method('GetTag', 'void', [param('ns3::Tag &', 'tag')], is_const=True) ## packet.h (module 'network'): ns3::TypeId ns3::PacketTagIterator::Item::GetTypeId() const [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_const=True) return def register_Ns3PacketTagList_methods(root_module, cls): ## packet-tag-list.h (module 'network'): ns3::PacketTagList::PacketTagList() [constructor] cls.add_constructor([]) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::PacketTagList(ns3::PacketTagList const & o) [copy constructor] cls.add_constructor([param('ns3::PacketTagList const &', 'o')]) ## packet-tag-list.h (module 'network'): void ns3::PacketTagList::Add(ns3::Tag const & tag) const [member function] cls.add_method('Add', 'void', [param('ns3::Tag const &', 'tag')], is_const=True) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData const * ns3::PacketTagList::Head() const [member function] cls.add_method('Head', 'ns3::PacketTagList::TagData const *', [], is_const=True) ## packet-tag-list.h (module 'network'): bool ns3::PacketTagList::Peek(ns3::Tag & tag) const [member function] cls.add_method('Peek', 'bool', [param('ns3::Tag &', 'tag')], is_const=True) ## packet-tag-list.h (module 'network'): bool ns3::PacketTagList::Remove(ns3::Tag & tag) [member function] cls.add_method('Remove', 'bool', [param('ns3::Tag &', 'tag')]) ## packet-tag-list.h (module 'network'): void ns3::PacketTagList::RemoveAll() [member function] cls.add_method('RemoveAll', 'void', []) return def register_Ns3PacketTagListTagData_methods(root_module, cls): ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::TagData() [constructor] cls.add_constructor([]) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::TagData(ns3::PacketTagList::TagData const & arg0) [copy constructor] cls.add_constructor([param('ns3::PacketTagList::TagData const &', 'arg0')]) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::count [variable] cls.add_instance_attribute('count', 'uint32_t', is_const=False) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::data [variable] cls.add_instance_attribute('data', 'uint8_t [ 20 ]', is_const=False) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::next [variable] cls.add_instance_attribute('next', 'ns3::PacketTagList::TagData *', is_const=False) ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::tid [variable] cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False) return def register_Ns3PbbAddressTlvBlock_methods(root_module, cls): cls.add_binary_comparison_operator('==') cls.add_binary_comparison_operator('!=') ## packetbb.h (module 'network'): ns3::PbbAddressTlvBlock::PbbAddressTlvBlock(ns3::PbbAddressTlvBlock const & arg0) [copy constructor] cls.add_constructor([param('ns3::PbbAddressTlvBlock const &', 'arg0')]) ## packetbb.h (module 'network'): ns3::PbbAddressTlvBlock::PbbAddressTlvBlock() [constructor] cls.add_constructor([]) ## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressTlv> ns3::PbbAddressTlvBlock::Back() const [member function] cls.add_method('Back', 'ns3::Ptr< ns3::PbbAddressTlv >', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressTlvBlock::Begin() [member function] cls.add_method('Begin', 'std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', []) ## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressTlvBlock::Begin() const [member function] cls.add_method('Begin', 'std::_List_const_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', [], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbAddressTlvBlock::Clear() [member function] cls.add_method('Clear', 'void', []) ## packetbb.h (module 'network'): void ns3::PbbAddressTlvBlock::Deserialize(ns3::Buffer::Iterator & start) [member function] cls.add_method('Deserialize', 'void', [param('ns3::Buffer::Iterator &', 'start')]) ## packetbb.h (module 'network'): bool ns3::PbbAddressTlvBlock::Empty() const [member function] cls.add_method('Empty', 'bool', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressTlvBlock::End() [member function] cls.add_method('End', 'std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', []) ## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressTlvBlock::End() const [member function] cls.add_method('End', 'std::_List_const_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressTlvBlock::Erase(std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > position) [member function] cls.add_method('Erase', 'std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', [param('std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', 'position')]) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressTlvBlock::Erase(std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > first, std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > last) [member function] cls.add_method('Erase', 'std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', [param('std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', 'first'), param('std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', 'last')]) ## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressTlv> ns3::PbbAddressTlvBlock::Front() const [member function] cls.add_method('Front', 'ns3::Ptr< ns3::PbbAddressTlv >', [], is_const=True) ## packetbb.h (module 'network'): uint32_t ns3::PbbAddressTlvBlock::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressTlvBlock::Insert(std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > position, ns3::Ptr<ns3::PbbAddressTlv> const tlv) [member function] cls.add_method('Insert', 'std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', [param('std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', 'position'), param('ns3::Ptr< ns3::PbbAddressTlv > const', 'tlv')]) ## packetbb.h (module 'network'): void ns3::PbbAddressTlvBlock::PopBack() [member function] cls.add_method('PopBack', 'void', []) ## packetbb.h (module 'network'): void ns3::PbbAddressTlvBlock::PopFront() [member function] cls.add_method('PopFront', 'void', []) ## packetbb.h (module 'network'): void ns3::PbbAddressTlvBlock::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbAddressTlvBlock::Print(std::ostream & os, int level) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os'), param('int', 'level')], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbAddressTlvBlock::PushBack(ns3::Ptr<ns3::PbbAddressTlv> tlv) [member function] cls.add_method('PushBack', 'void', [param('ns3::Ptr< ns3::PbbAddressTlv >', 'tlv')]) ## packetbb.h (module 'network'): void ns3::PbbAddressTlvBlock::PushFront(ns3::Ptr<ns3::PbbAddressTlv> tlv) [member function] cls.add_method('PushFront', 'void', [param('ns3::Ptr< ns3::PbbAddressTlv >', 'tlv')]) ## packetbb.h (module 'network'): void ns3::PbbAddressTlvBlock::Serialize(ns3::Buffer::Iterator & start) const [member function] cls.add_method('Serialize', 'void', [param('ns3::Buffer::Iterator &', 'start')], is_const=True) ## packetbb.h (module 'network'): int ns3::PbbAddressTlvBlock::Size() const [member function] cls.add_method('Size', 'int', [], is_const=True) return def register_Ns3PbbTlvBlock_methods(root_module, cls): cls.add_binary_comparison_operator('==') cls.add_binary_comparison_operator('!=') ## packetbb.h (module 'network'): ns3::PbbTlvBlock::PbbTlvBlock(ns3::PbbTlvBlock const & arg0) [copy constructor] cls.add_constructor([param('ns3::PbbTlvBlock const &', 'arg0')]) ## packetbb.h (module 'network'): ns3::PbbTlvBlock::PbbTlvBlock() [constructor] cls.add_constructor([]) ## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> ns3::PbbTlvBlock::Back() const [member function] cls.add_method('Back', 'ns3::Ptr< ns3::PbbTlv >', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbTlvBlock::Begin() [member function] cls.add_method('Begin', 'std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', []) ## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbTlvBlock::Begin() const [member function] cls.add_method('Begin', 'std::_List_const_iterator< ns3::Ptr< ns3::PbbTlv > >', [], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbTlvBlock::Clear() [member function] cls.add_method('Clear', 'void', []) ## packetbb.h (module 'network'): void ns3::PbbTlvBlock::Deserialize(ns3::Buffer::Iterator & start) [member function] cls.add_method('Deserialize', 'void', [param('ns3::Buffer::Iterator &', 'start')]) ## packetbb.h (module 'network'): bool ns3::PbbTlvBlock::Empty() const [member function] cls.add_method('Empty', 'bool', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbTlvBlock::End() [member function] cls.add_method('End', 'std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', []) ## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbTlvBlock::End() const [member function] cls.add_method('End', 'std::_List_const_iterator< ns3::Ptr< ns3::PbbTlv > >', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbTlvBlock::Erase(std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > position) [member function] cls.add_method('Erase', 'std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', [param('std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', 'position')]) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbTlvBlock::Erase(std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > first, std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > last) [member function] cls.add_method('Erase', 'std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', [param('std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', 'first'), param('std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', 'last')]) ## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> ns3::PbbTlvBlock::Front() const [member function] cls.add_method('Front', 'ns3::Ptr< ns3::PbbTlv >', [], is_const=True) ## packetbb.h (module 'network'): uint32_t ns3::PbbTlvBlock::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbTlvBlock::Insert(std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > position, ns3::Ptr<ns3::PbbTlv> const tlv) [member function] cls.add_method('Insert', 'std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', [param('std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', 'position'), param('ns3::Ptr< ns3::PbbTlv > const', 'tlv')]) ## packetbb.h (module 'network'): void ns3::PbbTlvBlock::PopBack() [member function] cls.add_method('PopBack', 'void', []) ## packetbb.h (module 'network'): void ns3::PbbTlvBlock::PopFront() [member function] cls.add_method('PopFront', 'void', []) ## packetbb.h (module 'network'): void ns3::PbbTlvBlock::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbTlvBlock::Print(std::ostream & os, int level) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os'), param('int', 'level')], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbTlvBlock::PushBack(ns3::Ptr<ns3::PbbTlv> tlv) [member function] cls.add_method('PushBack', 'void', [param('ns3::Ptr< ns3::PbbTlv >', 'tlv')]) ## packetbb.h (module 'network'): void ns3::PbbTlvBlock::PushFront(ns3::Ptr<ns3::PbbTlv> tlv) [member function] cls.add_method('PushFront', 'void', [param('ns3::Ptr< ns3::PbbTlv >', 'tlv')]) ## packetbb.h (module 'network'): void ns3::PbbTlvBlock::Serialize(ns3::Buffer::Iterator & start) const [member function] cls.add_method('Serialize', 'void', [param('ns3::Buffer::Iterator &', 'start')], is_const=True) ## packetbb.h (module 'network'): int ns3::PbbTlvBlock::Size() const [member function] cls.add_method('Size', 'int', [], is_const=True) return def register_Ns3PcapFile_methods(root_module, cls): ## pcap-file.h (module 'network'): ns3::PcapFile::PcapFile() [constructor] cls.add_constructor([]) ## pcap-file.h (module 'network'): void ns3::PcapFile::Clear() [member function] cls.add_method('Clear', 'void', []) ## pcap-file.h (module 'network'): void ns3::PcapFile::Close() [member function] cls.add_method('Close', 'void', []) ## pcap-file.h (module 'network'): static bool ns3::PcapFile::Diff(std::string const & f1, std::string const & f2, uint32_t & sec, uint32_t & usec, uint32_t snapLen=ns3::PcapFile::SNAPLEN_DEFAULT) [member function] cls.add_method('Diff', 'bool', [param('std::string const &', 'f1'), param('std::string const &', 'f2'), param('uint32_t &', 'sec'), param('uint32_t &', 'usec'), param('uint32_t', 'snapLen', default_value='ns3::PcapFile::SNAPLEN_DEFAULT')], is_static=True) ## pcap-file.h (module 'network'): bool ns3::PcapFile::Eof() const [member function] cls.add_method('Eof', 'bool', [], is_const=True) ## pcap-file.h (module 'network'): bool ns3::PcapFile::Fail() const [member function] cls.add_method('Fail', 'bool', [], is_const=True) ## pcap-file.h (module 'network'): uint32_t ns3::PcapFile::GetDataLinkType() [member function] cls.add_method('GetDataLinkType', 'uint32_t', []) ## pcap-file.h (module 'network'): uint32_t ns3::PcapFile::GetMagic() [member function] cls.add_method('GetMagic', 'uint32_t', []) ## pcap-file.h (module 'network'): uint32_t ns3::PcapFile::GetSigFigs() [member function] cls.add_method('GetSigFigs', 'uint32_t', []) ## pcap-file.h (module 'network'): uint32_t ns3::PcapFile::GetSnapLen() [member function] cls.add_method('GetSnapLen', 'uint32_t', []) ## pcap-file.h (module 'network'): bool ns3::PcapFile::GetSwapMode() [member function] cls.add_method('GetSwapMode', 'bool', []) ## pcap-file.h (module 'network'): int32_t ns3::PcapFile::GetTimeZoneOffset() [member function] cls.add_method('GetTimeZoneOffset', 'int32_t', []) ## pcap-file.h (module 'network'): uint16_t ns3::PcapFile::GetVersionMajor() [member function] cls.add_method('GetVersionMajor', 'uint16_t', []) ## pcap-file.h (module 'network'): uint16_t ns3::PcapFile::GetVersionMinor() [member function] cls.add_method('GetVersionMinor', 'uint16_t', []) ## pcap-file.h (module 'network'): void ns3::PcapFile::Init(uint32_t dataLinkType, uint32_t snapLen=ns3::PcapFile::SNAPLEN_DEFAULT, int32_t timeZoneCorrection=ns3::PcapFile::ZONE_DEFAULT, bool swapMode=false) [member function] cls.add_method('Init', 'void', [param('uint32_t', 'dataLinkType'), param('uint32_t', 'snapLen', default_value='ns3::PcapFile::SNAPLEN_DEFAULT'), param('int32_t', 'timeZoneCorrection', default_value='ns3::PcapFile::ZONE_DEFAULT'), param('bool', 'swapMode', default_value='false')]) ## pcap-file.h (module 'network'): void ns3::PcapFile::Open(std::string const & filename, std::_Ios_Openmode mode) [member function] cls.add_method('Open', 'void', [param('std::string const &', 'filename'), param('std::_Ios_Openmode', 'mode')]) ## pcap-file.h (module 'network'): void ns3::PcapFile::Read(uint8_t * const data, uint32_t maxBytes, uint32_t & tsSec, uint32_t & tsUsec, uint32_t & inclLen, uint32_t & origLen, uint32_t & readLen) [member function] cls.add_method('Read', 'void', [param('uint8_t * const', 'data'), param('uint32_t', 'maxBytes'), param('uint32_t &', 'tsSec'), param('uint32_t &', 'tsUsec'), param('uint32_t &', 'inclLen'), param('uint32_t &', 'origLen'), param('uint32_t &', 'readLen')]) ## pcap-file.h (module 'network'): void ns3::PcapFile::Write(uint32_t tsSec, uint32_t tsUsec, uint8_t const * const data, uint32_t totalLen) [member function] cls.add_method('Write', 'void', [param('uint32_t', 'tsSec'), param('uint32_t', 'tsUsec'), param('uint8_t const * const', 'data'), param('uint32_t', 'totalLen')]) ## pcap-file.h (module 'network'): void ns3::PcapFile::Write(uint32_t tsSec, uint32_t tsUsec, ns3::Ptr<const ns3::Packet> p) [member function] cls.add_method('Write', 'void', [param('uint32_t', 'tsSec'), param('uint32_t', 'tsUsec'), param('ns3::Ptr< ns3::Packet const >', 'p')]) ## pcap-file.h (module 'network'): void ns3::PcapFile::Write(uint32_t tsSec, uint32_t tsUsec, ns3::Header & header, ns3::Ptr<const ns3::Packet> p) [member function] cls.add_method('Write', 'void', [param('uint32_t', 'tsSec'), param('uint32_t', 'tsUsec'), param('ns3::Header &', 'header'), param('ns3::Ptr< ns3::Packet const >', 'p')]) ## pcap-file.h (module 'network'): ns3::PcapFile::SNAPLEN_DEFAULT [variable] cls.add_static_attribute('SNAPLEN_DEFAULT', 'uint32_t const', is_const=True) ## pcap-file.h (module 'network'): ns3::PcapFile::ZONE_DEFAULT [variable] cls.add_static_attribute('ZONE_DEFAULT', 'int32_t const', is_const=True) return def register_Ns3PcapHelper_methods(root_module, cls): ## trace-helper.h (module 'network'): ns3::PcapHelper::PcapHelper(ns3::PcapHelper const & arg0) [copy constructor] cls.add_constructor([param('ns3::PcapHelper const &', 'arg0')]) ## trace-helper.h (module 'network'): ns3::PcapHelper::PcapHelper() [constructor] cls.add_constructor([]) ## trace-helper.h (module 'network'): ns3::Ptr<ns3::PcapFileWrapper> ns3::PcapHelper::CreateFile(std::string filename, std::_Ios_Openmode filemode, uint32_t dataLinkType, uint32_t snapLen=65535, int32_t tzCorrection=0) [member function] cls.add_method('CreateFile', 'ns3::Ptr< ns3::PcapFileWrapper >', [param('std::string', 'filename'), param('std::_Ios_Openmode', 'filemode'), param('uint32_t', 'dataLinkType'), param('uint32_t', 'snapLen', default_value='65535'), param('int32_t', 'tzCorrection', default_value='0')]) ## trace-helper.h (module 'network'): std::string ns3::PcapHelper::GetFilenameFromDevice(std::string prefix, ns3::Ptr<ns3::NetDevice> device, bool useObjectNames=true) [member function] cls.add_method('GetFilenameFromDevice', 'std::string', [param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'device'), param('bool', 'useObjectNames', default_value='true')]) ## trace-helper.h (module 'network'): std::string ns3::PcapHelper::GetFilenameFromInterfacePair(std::string prefix, ns3::Ptr<ns3::Object> object, uint32_t interface, bool useObjectNames=true) [member function] cls.add_method('GetFilenameFromInterfacePair', 'std::string', [param('std::string', 'prefix'), param('ns3::Ptr< ns3::Object >', 'object'), param('uint32_t', 'interface'), param('bool', 'useObjectNames', default_value='true')]) return def register_Ns3PcapHelperForDevice_methods(root_module, cls): ## trace-helper.h (module 'network'): ns3::PcapHelperForDevice::PcapHelperForDevice(ns3::PcapHelperForDevice const & arg0) [copy constructor] cls.add_constructor([param('ns3::PcapHelperForDevice const &', 'arg0')]) ## trace-helper.h (module 'network'): ns3::PcapHelperForDevice::PcapHelperForDevice() [constructor] cls.add_constructor([]) ## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcap(std::string prefix, ns3::Ptr<ns3::NetDevice> nd, bool promiscuous=false, bool explicitFilename=false) [member function] cls.add_method('EnablePcap', 'void', [param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'nd'), param('bool', 'promiscuous', default_value='false'), param('bool', 'explicitFilename', default_value='false')]) ## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcap(std::string prefix, std::string ndName, bool promiscuous=false, bool explicitFilename=false) [member function] cls.add_method('EnablePcap', 'void', [param('std::string', 'prefix'), param('std::string', 'ndName'), param('bool', 'promiscuous', default_value='false'), param('bool', 'explicitFilename', default_value='false')]) ## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcap(std::string prefix, ns3::NetDeviceContainer d, bool promiscuous=false) [member function] cls.add_method('EnablePcap', 'void', [param('std::string', 'prefix'), param('ns3::NetDeviceContainer', 'd'), param('bool', 'promiscuous', default_value='false')]) ## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcap(std::string prefix, ns3::NodeContainer n, bool promiscuous=false) [member function] cls.add_method('EnablePcap', 'void', [param('std::string', 'prefix'), param('ns3::NodeContainer', 'n'), param('bool', 'promiscuous', default_value='false')]) ## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcap(std::string prefix, uint32_t nodeid, uint32_t deviceid, bool promiscuous=false) [member function] cls.add_method('EnablePcap', 'void', [param('std::string', 'prefix'), param('uint32_t', 'nodeid'), param('uint32_t', 'deviceid'), param('bool', 'promiscuous', default_value='false')]) ## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcapAll(std::string prefix, bool promiscuous=false) [member function] cls.add_method('EnablePcapAll', 'void', [param('std::string', 'prefix'), param('bool', 'promiscuous', default_value='false')]) ## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcapInternal(std::string prefix, ns3::Ptr<ns3::NetDevice> nd, bool promiscuous, bool explicitFilename) [member function] cls.add_method('EnablePcapInternal', 'void', [param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'nd'), param('bool', 'promiscuous'), param('bool', 'explicitFilename')], is_pure_virtual=True, is_virtual=True) return def register_Ns3RandomVariable_methods(root_module, cls): cls.add_output_stream_operator() ## random-variable.h (module 'core'): ns3::RandomVariable::RandomVariable() [constructor] cls.add_constructor([]) ## random-variable.h (module 'core'): ns3::RandomVariable::RandomVariable(ns3::RandomVariable const & o) [copy constructor] cls.add_constructor([param('ns3::RandomVariable const &', 'o')]) ## random-variable.h (module 'core'): uint32_t ns3::RandomVariable::GetInteger() const [member function] cls.add_method('GetInteger', 'uint32_t', [], is_const=True) ## random-variable.h (module 'core'): double ns3::RandomVariable::GetValue() const [member function] cls.add_method('GetValue', 'double', [], is_const=True) return def register_Ns3RngSeedManager_methods(root_module, cls): ## rng-seed-manager.h (module 'core'): ns3::RngSeedManager::RngSeedManager() [constructor] cls.add_constructor([]) ## rng-seed-manager.h (module 'core'): ns3::RngSeedManager::RngSeedManager(ns3::RngSeedManager const & arg0) [copy constructor] cls.add_constructor([param('ns3::RngSeedManager const &', 'arg0')]) ## rng-seed-manager.h (module 'core'): static uint64_t ns3::RngSeedManager::GetNextStreamIndex() [member function] cls.add_method('GetNextStreamIndex', 'uint64_t', [], is_static=True) ## rng-seed-manager.h (module 'core'): static uint64_t ns3::RngSeedManager::GetRun() [member function] cls.add_method('GetRun', 'uint64_t', [], is_static=True) ## rng-seed-manager.h (module 'core'): static uint32_t ns3::RngSeedManager::GetSeed() [member function] cls.add_method('GetSeed', 'uint32_t', [], is_static=True) ## rng-seed-manager.h (module 'core'): static void ns3::RngSeedManager::SetRun(uint64_t run) [member function] cls.add_method('SetRun', 'void', [param('uint64_t', 'run')], is_static=True) ## rng-seed-manager.h (module 'core'): static void ns3::RngSeedManager::SetSeed(uint32_t seed) [member function] cls.add_method('SetSeed', 'void', [param('uint32_t', 'seed')], is_static=True) return def register_Ns3SequenceNumber32_methods(root_module, cls): cls.add_binary_comparison_operator('!=') cls.add_binary_numeric_operator('+', root_module['ns3::SequenceNumber32'], root_module['ns3::SequenceNumber32'], param('ns3::SequenceNumber< unsigned int, int > const &', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::SequenceNumber32'], root_module['ns3::SequenceNumber32'], param('int', 'right')) cls.add_inplace_numeric_operator('+=', param('int', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::SequenceNumber32'], root_module['ns3::SequenceNumber32'], param('int', 'right')) cls.add_inplace_numeric_operator('-=', param('int', 'right')) cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('<=') cls.add_binary_comparison_operator('==') cls.add_binary_comparison_operator('>') cls.add_binary_comparison_operator('>=') ## sequence-number.h (module 'network'): ns3::SequenceNumber<unsigned int, int>::SequenceNumber() [constructor] cls.add_constructor([]) ## sequence-number.h (module 'network'): ns3::SequenceNumber<unsigned int, int>::SequenceNumber(unsigned int value) [constructor] cls.add_constructor([param('unsigned int', 'value')]) ## sequence-number.h (module 'network'): ns3::SequenceNumber<unsigned int, int>::SequenceNumber(ns3::SequenceNumber<unsigned int, int> const & value) [copy constructor] cls.add_constructor([param('ns3::SequenceNumber< unsigned int, int > const &', 'value')]) ## sequence-number.h (module 'network'): unsigned int ns3::SequenceNumber<unsigned int, int>::GetValue() const [member function] cls.add_method('GetValue', 'unsigned int', [], is_const=True) return def register_Ns3SequenceNumber16_methods(root_module, cls): cls.add_binary_comparison_operator('!=') cls.add_binary_numeric_operator('+', root_module['ns3::SequenceNumber16'], root_module['ns3::SequenceNumber16'], param('ns3::SequenceNumber< unsigned short, short > const &', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::SequenceNumber16'], root_module['ns3::SequenceNumber16'], param('short int', 'right')) cls.add_inplace_numeric_operator('+=', param('short int', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::SequenceNumber16'], root_module['ns3::SequenceNumber16'], param('short int', 'right')) cls.add_inplace_numeric_operator('-=', param('short int', 'right')) cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('<=') cls.add_binary_comparison_operator('==') cls.add_binary_comparison_operator('>') cls.add_binary_comparison_operator('>=') ## sequence-number.h (module 'network'): ns3::SequenceNumber<unsigned short, short>::SequenceNumber() [constructor] cls.add_constructor([]) ## sequence-number.h (module 'network'): ns3::SequenceNumber<unsigned short, short>::SequenceNumber(short unsigned int value) [constructor] cls.add_constructor([param('short unsigned int', 'value')]) ## sequence-number.h (module 'network'): ns3::SequenceNumber<unsigned short, short>::SequenceNumber(ns3::SequenceNumber<unsigned short, short> const & value) [copy constructor] cls.add_constructor([param('ns3::SequenceNumber< unsigned short, short > const &', 'value')]) ## sequence-number.h (module 'network'): short unsigned int ns3::SequenceNumber<unsigned short, short>::GetValue() const [member function] cls.add_method('GetValue', 'short unsigned int', [], is_const=True) return def register_Ns3SequentialVariable_methods(root_module, cls): ## random-variable.h (module 'core'): ns3::SequentialVariable::SequentialVariable(ns3::SequentialVariable const & arg0) [copy constructor] cls.add_constructor([param('ns3::SequentialVariable const &', 'arg0')]) ## random-variable.h (module 'core'): ns3::SequentialVariable::SequentialVariable(double f, double l, double i=1, uint32_t c=1) [constructor] cls.add_constructor([param('double', 'f'), param('double', 'l'), param('double', 'i', default_value='1'), param('uint32_t', 'c', default_value='1')]) ## random-variable.h (module 'core'): ns3::SequentialVariable::SequentialVariable(double f, double l, ns3::RandomVariable const & i, uint32_t c=1) [constructor] cls.add_constructor([param('double', 'f'), param('double', 'l'), param('ns3::RandomVariable const &', 'i'), param('uint32_t', 'c', default_value='1')]) return def register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::SimpleRefCount(ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3Simulator_methods(root_module, cls): ## simulator.h (module 'core'): ns3::Simulator::Simulator(ns3::Simulator const & arg0) [copy constructor] cls.add_constructor([param('ns3::Simulator const &', 'arg0')]) ## simulator.h (module 'core'): static void ns3::Simulator::Cancel(ns3::EventId const & id) [member function] cls.add_method('Cancel', 'void', [param('ns3::EventId const &', 'id')], is_static=True) ## simulator.h (module 'core'): static void ns3::Simulator::Destroy() [member function] cls.add_method('Destroy', 'void', [], is_static=True) ## simulator.h (module 'core'): static uint32_t ns3::Simulator::GetContext() [member function] cls.add_method('GetContext', 'uint32_t', [], is_static=True) ## simulator.h (module 'core'): static ns3::Time ns3::Simulator::GetDelayLeft(ns3::EventId const & id) [member function] cls.add_method('GetDelayLeft', 'ns3::Time', [param('ns3::EventId const &', 'id')], is_static=True) ## simulator.h (module 'core'): static ns3::Ptr<ns3::SimulatorImpl> ns3::Simulator::GetImplementation() [member function] cls.add_method('GetImplementation', 'ns3::Ptr< ns3::SimulatorImpl >', [], is_static=True) ## simulator.h (module 'core'): static ns3::Time ns3::Simulator::GetMaximumSimulationTime() [member function] cls.add_method('GetMaximumSimulationTime', 'ns3::Time', [], is_static=True) ## simulator.h (module 'core'): static uint32_t ns3::Simulator::GetSystemId() [member function] cls.add_method('GetSystemId', 'uint32_t', [], is_static=True) ## simulator.h (module 'core'): static bool ns3::Simulator::IsExpired(ns3::EventId const & id) [member function] cls.add_method('IsExpired', 'bool', [param('ns3::EventId const &', 'id')], is_static=True) ## simulator.h (module 'core'): static bool ns3::Simulator::IsFinished() [member function] cls.add_method('IsFinished', 'bool', [], is_static=True) ## simulator.h (module 'core'): static ns3::Time ns3::Simulator::Now() [member function] cls.add_method('Now', 'ns3::Time', [], is_static=True) ## simulator.h (module 'core'): static void ns3::Simulator::Remove(ns3::EventId const & id) [member function] cls.add_method('Remove', 'void', [param('ns3::EventId const &', 'id')], is_static=True) ## simulator.h (module 'core'): static void ns3::Simulator::SetImplementation(ns3::Ptr<ns3::SimulatorImpl> impl) [member function] cls.add_method('SetImplementation', 'void', [param('ns3::Ptr< ns3::SimulatorImpl >', 'impl')], is_static=True) ## simulator.h (module 'core'): static void ns3::Simulator::SetScheduler(ns3::ObjectFactory schedulerFactory) [member function] cls.add_method('SetScheduler', 'void', [param('ns3::ObjectFactory', 'schedulerFactory')], is_static=True) ## simulator.h (module 'core'): static void ns3::Simulator::Stop() [member function] cls.add_method('Stop', 'void', [], is_static=True) ## simulator.h (module 'core'): static void ns3::Simulator::Stop(ns3::Time const & time) [member function] cls.add_method('Stop', 'void', [param('ns3::Time const &', 'time')], is_static=True) return def register_Ns3SystemWallClockMs_methods(root_module, cls): ## system-wall-clock-ms.h (module 'core'): ns3::SystemWallClockMs::SystemWallClockMs(ns3::SystemWallClockMs const & arg0) [copy constructor] cls.add_constructor([param('ns3::SystemWallClockMs const &', 'arg0')]) ## system-wall-clock-ms.h (module 'core'): ns3::SystemWallClockMs::SystemWallClockMs() [constructor] cls.add_constructor([]) ## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::End() [member function] cls.add_method('End', 'int64_t', []) ## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::GetElapsedReal() const [member function] cls.add_method('GetElapsedReal', 'int64_t', [], is_const=True) ## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::GetElapsedSystem() const [member function] cls.add_method('GetElapsedSystem', 'int64_t', [], is_const=True) ## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::GetElapsedUser() const [member function] cls.add_method('GetElapsedUser', 'int64_t', [], is_const=True) ## system-wall-clock-ms.h (module 'core'): void ns3::SystemWallClockMs::Start() [member function] cls.add_method('Start', 'void', []) return def register_Ns3Tag_methods(root_module, cls): ## tag.h (module 'network'): ns3::Tag::Tag() [constructor] cls.add_constructor([]) ## tag.h (module 'network'): ns3::Tag::Tag(ns3::Tag const & arg0) [copy constructor] cls.add_constructor([param('ns3::Tag const &', 'arg0')]) ## tag.h (module 'network'): void ns3::Tag::Deserialize(ns3::TagBuffer i) [member function] cls.add_method('Deserialize', 'void', [param('ns3::TagBuffer', 'i')], is_pure_virtual=True, is_virtual=True) ## tag.h (module 'network'): uint32_t ns3::Tag::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## tag.h (module 'network'): static ns3::TypeId ns3::Tag::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## tag.h (module 'network'): void ns3::Tag::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_pure_virtual=True, is_const=True, is_virtual=True) ## tag.h (module 'network'): void ns3::Tag::Serialize(ns3::TagBuffer i) const [member function] cls.add_method('Serialize', 'void', [param('ns3::TagBuffer', 'i')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3TagBuffer_methods(root_module, cls): ## tag-buffer.h (module 'network'): ns3::TagBuffer::TagBuffer(ns3::TagBuffer const & arg0) [copy constructor] cls.add_constructor([param('ns3::TagBuffer const &', 'arg0')]) ## tag-buffer.h (module 'network'): ns3::TagBuffer::TagBuffer(uint8_t * start, uint8_t * end) [constructor] cls.add_constructor([param('uint8_t *', 'start'), param('uint8_t *', 'end')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::CopyFrom(ns3::TagBuffer o) [member function] cls.add_method('CopyFrom', 'void', [param('ns3::TagBuffer', 'o')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::Read(uint8_t * buffer, uint32_t size) [member function] cls.add_method('Read', 'void', [param('uint8_t *', 'buffer'), param('uint32_t', 'size')]) ## tag-buffer.h (module 'network'): double ns3::TagBuffer::ReadDouble() [member function] cls.add_method('ReadDouble', 'double', []) ## tag-buffer.h (module 'network'): uint16_t ns3::TagBuffer::ReadU16() [member function] cls.add_method('ReadU16', 'uint16_t', []) ## tag-buffer.h (module 'network'): uint32_t ns3::TagBuffer::ReadU32() [member function] cls.add_method('ReadU32', 'uint32_t', []) ## tag-buffer.h (module 'network'): uint64_t ns3::TagBuffer::ReadU64() [member function] cls.add_method('ReadU64', 'uint64_t', []) ## tag-buffer.h (module 'network'): uint8_t ns3::TagBuffer::ReadU8() [member function] cls.add_method('ReadU8', 'uint8_t', []) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::TrimAtEnd(uint32_t trim) [member function] cls.add_method('TrimAtEnd', 'void', [param('uint32_t', 'trim')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::Write(uint8_t const * buffer, uint32_t size) [member function] cls.add_method('Write', 'void', [param('uint8_t const *', 'buffer'), param('uint32_t', 'size')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteDouble(double v) [member function] cls.add_method('WriteDouble', 'void', [param('double', 'v')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU16(uint16_t data) [member function] cls.add_method('WriteU16', 'void', [param('uint16_t', 'data')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU32(uint32_t data) [member function] cls.add_method('WriteU32', 'void', [param('uint32_t', 'data')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU64(uint64_t v) [member function] cls.add_method('WriteU64', 'void', [param('uint64_t', 'v')]) ## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU8(uint8_t v) [member function] cls.add_method('WriteU8', 'void', [param('uint8_t', 'v')]) return def register_Ns3TriangularVariable_methods(root_module, cls): ## random-variable.h (module 'core'): ns3::TriangularVariable::TriangularVariable(ns3::TriangularVariable const & arg0) [copy constructor] cls.add_constructor([param('ns3::TriangularVariable const &', 'arg0')]) ## random-variable.h (module 'core'): ns3::TriangularVariable::TriangularVariable() [constructor] cls.add_constructor([]) ## random-variable.h (module 'core'): ns3::TriangularVariable::TriangularVariable(double s, double l, double mean) [constructor] cls.add_constructor([param('double', 's'), param('double', 'l'), param('double', 'mean')]) return def register_Ns3TypeId_methods(root_module, cls): cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('!=') cls.add_output_stream_operator() cls.add_binary_comparison_operator('==') ## type-id.h (module 'core'): ns3::TypeId::TypeId(char const * name) [constructor] cls.add_constructor([param('char const *', 'name')]) ## type-id.h (module 'core'): ns3::TypeId::TypeId() [constructor] cls.add_constructor([]) ## type-id.h (module 'core'): ns3::TypeId::TypeId(ns3::TypeId const & o) [copy constructor] cls.add_constructor([param('ns3::TypeId const &', 'o')]) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, ns3::AttributeValue const & initialValue, ns3::Ptr<ns3::AttributeAccessor const> accessor, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('AddAttribute', 'ns3::TypeId', [param('std::string', 'name'), param('std::string', 'help'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')]) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, uint32_t flags, ns3::AttributeValue const & initialValue, ns3::Ptr<ns3::AttributeAccessor const> accessor, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('AddAttribute', 'ns3::TypeId', [param('std::string', 'name'), param('std::string', 'help'), param('uint32_t', 'flags'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')]) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddTraceSource(std::string name, std::string help, ns3::Ptr<ns3::TraceSourceAccessor const> accessor) [member function] cls.add_method('AddTraceSource', 'ns3::TypeId', [param('std::string', 'name'), param('std::string', 'help'), param('ns3::Ptr< ns3::TraceSourceAccessor const >', 'accessor')]) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation ns3::TypeId::GetAttribute(uint32_t i) const [member function] cls.add_method('GetAttribute', 'ns3::TypeId::AttributeInformation', [param('uint32_t', 'i')], is_const=True) ## type-id.h (module 'core'): std::string ns3::TypeId::GetAttributeFullName(uint32_t i) const [member function] cls.add_method('GetAttributeFullName', 'std::string', [param('uint32_t', 'i')], is_const=True) ## type-id.h (module 'core'): uint32_t ns3::TypeId::GetAttributeN() const [member function] cls.add_method('GetAttributeN', 'uint32_t', [], is_const=True) ## type-id.h (module 'core'): ns3::Callback<ns3::ObjectBase*,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ns3::TypeId::GetConstructor() const [member function] cls.add_method('GetConstructor', 'ns3::Callback< ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', [], is_const=True) ## type-id.h (module 'core'): std::string ns3::TypeId::GetGroupName() const [member function] cls.add_method('GetGroupName', 'std::string', [], is_const=True) ## type-id.h (module 'core'): std::string ns3::TypeId::GetName() const [member function] cls.add_method('GetName', 'std::string', [], is_const=True) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::GetParent() const [member function] cls.add_method('GetParent', 'ns3::TypeId', [], is_const=True) ## type-id.h (module 'core'): static ns3::TypeId ns3::TypeId::GetRegistered(uint32_t i) [member function] cls.add_method('GetRegistered', 'ns3::TypeId', [param('uint32_t', 'i')], is_static=True) ## type-id.h (module 'core'): static uint32_t ns3::TypeId::GetRegisteredN() [member function] cls.add_method('GetRegisteredN', 'uint32_t', [], is_static=True) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation ns3::TypeId::GetTraceSource(uint32_t i) const [member function] cls.add_method('GetTraceSource', 'ns3::TypeId::TraceSourceInformation', [param('uint32_t', 'i')], is_const=True) ## type-id.h (module 'core'): uint32_t ns3::TypeId::GetTraceSourceN() const [member function] cls.add_method('GetTraceSourceN', 'uint32_t', [], is_const=True) ## type-id.h (module 'core'): uint16_t ns3::TypeId::GetUid() const [member function] cls.add_method('GetUid', 'uint16_t', [], is_const=True) ## type-id.h (module 'core'): bool ns3::TypeId::HasConstructor() const [member function] cls.add_method('HasConstructor', 'bool', [], is_const=True) ## type-id.h (module 'core'): bool ns3::TypeId::HasParent() const [member function] cls.add_method('HasParent', 'bool', [], is_const=True) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::HideFromDocumentation() [member function] cls.add_method('HideFromDocumentation', 'ns3::TypeId', []) ## type-id.h (module 'core'): bool ns3::TypeId::IsChildOf(ns3::TypeId other) const [member function] cls.add_method('IsChildOf', 'bool', [param('ns3::TypeId', 'other')], is_const=True) ## type-id.h (module 'core'): bool ns3::TypeId::LookupAttributeByName(std::string name, ns3::TypeId::AttributeInformation * info) const [member function] cls.add_method('LookupAttributeByName', 'bool', [param('std::string', 'name'), param('ns3::TypeId::AttributeInformation *', 'info', transfer_ownership=False)], is_const=True) ## type-id.h (module 'core'): static ns3::TypeId ns3::TypeId::LookupByName(std::string name) [member function] cls.add_method('LookupByName', 'ns3::TypeId', [param('std::string', 'name')], is_static=True) ## type-id.h (module 'core'): ns3::Ptr<ns3::TraceSourceAccessor const> ns3::TypeId::LookupTraceSourceByName(std::string name) const [member function] cls.add_method('LookupTraceSourceByName', 'ns3::Ptr< ns3::TraceSourceAccessor const >', [param('std::string', 'name')], is_const=True) ## type-id.h (module 'core'): bool ns3::TypeId::MustHideFromDocumentation() const [member function] cls.add_method('MustHideFromDocumentation', 'bool', [], is_const=True) ## type-id.h (module 'core'): bool ns3::TypeId::SetAttributeInitialValue(uint32_t i, ns3::Ptr<ns3::AttributeValue const> initialValue) [member function] cls.add_method('SetAttributeInitialValue', 'bool', [param('uint32_t', 'i'), param('ns3::Ptr< ns3::AttributeValue const >', 'initialValue')]) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetGroupName(std::string groupName) [member function] cls.add_method('SetGroupName', 'ns3::TypeId', [param('std::string', 'groupName')]) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetParent(ns3::TypeId tid) [member function] cls.add_method('SetParent', 'ns3::TypeId', [param('ns3::TypeId', 'tid')]) ## type-id.h (module 'core'): void ns3::TypeId::SetUid(uint16_t tid) [member function] cls.add_method('SetUid', 'void', [param('uint16_t', 'tid')]) return def register_Ns3TypeIdAttributeInformation_methods(root_module, cls): ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::AttributeInformation() [constructor] cls.add_constructor([]) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::AttributeInformation(ns3::TypeId::AttributeInformation const & arg0) [copy constructor] cls.add_constructor([param('ns3::TypeId::AttributeInformation const &', 'arg0')]) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::accessor [variable] cls.add_instance_attribute('accessor', 'ns3::Ptr< ns3::AttributeAccessor const >', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::checker [variable] cls.add_instance_attribute('checker', 'ns3::Ptr< ns3::AttributeChecker const >', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::flags [variable] cls.add_instance_attribute('flags', 'uint32_t', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::help [variable] cls.add_instance_attribute('help', 'std::string', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::initialValue [variable] cls.add_instance_attribute('initialValue', 'ns3::Ptr< ns3::AttributeValue const >', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::name [variable] cls.add_instance_attribute('name', 'std::string', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::originalInitialValue [variable] cls.add_instance_attribute('originalInitialValue', 'ns3::Ptr< ns3::AttributeValue const >', is_const=False) return def register_Ns3TypeIdTraceSourceInformation_methods(root_module, cls): ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::TraceSourceInformation() [constructor] cls.add_constructor([]) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::TraceSourceInformation(ns3::TypeId::TraceSourceInformation const & arg0) [copy constructor] cls.add_constructor([param('ns3::TypeId::TraceSourceInformation const &', 'arg0')]) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::accessor [variable] cls.add_instance_attribute('accessor', 'ns3::Ptr< ns3::TraceSourceAccessor const >', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::help [variable] cls.add_instance_attribute('help', 'std::string', is_const=False) ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::name [variable] cls.add_instance_attribute('name', 'std::string', is_const=False) return def register_Ns3UniformVariable_methods(root_module, cls): ## random-variable.h (module 'core'): ns3::UniformVariable::UniformVariable(ns3::UniformVariable const & arg0) [copy constructor] cls.add_constructor([param('ns3::UniformVariable const &', 'arg0')]) ## random-variable.h (module 'core'): ns3::UniformVariable::UniformVariable() [constructor] cls.add_constructor([]) ## random-variable.h (module 'core'): ns3::UniformVariable::UniformVariable(double s, double l) [constructor] cls.add_constructor([param('double', 's'), param('double', 'l')]) ## random-variable.h (module 'core'): uint32_t ns3::UniformVariable::GetInteger(uint32_t s, uint32_t l) [member function] cls.add_method('GetInteger', 'uint32_t', [param('uint32_t', 's'), param('uint32_t', 'l')]) ## random-variable.h (module 'core'): double ns3::UniformVariable::GetValue() const [member function] cls.add_method('GetValue', 'double', [], is_const=True) ## random-variable.h (module 'core'): double ns3::UniformVariable::GetValue(double s, double l) [member function] cls.add_method('GetValue', 'double', [param('double', 's'), param('double', 'l')]) return def register_Ns3WeibullVariable_methods(root_module, cls): ## random-variable.h (module 'core'): ns3::WeibullVariable::WeibullVariable(ns3::WeibullVariable const & arg0) [copy constructor] cls.add_constructor([param('ns3::WeibullVariable const &', 'arg0')]) ## random-variable.h (module 'core'): ns3::WeibullVariable::WeibullVariable() [constructor] cls.add_constructor([]) ## random-variable.h (module 'core'): ns3::WeibullVariable::WeibullVariable(double m) [constructor] cls.add_constructor([param('double', 'm')]) ## random-variable.h (module 'core'): ns3::WeibullVariable::WeibullVariable(double m, double s) [constructor] cls.add_constructor([param('double', 'm'), param('double', 's')]) ## random-variable.h (module 'core'): ns3::WeibullVariable::WeibullVariable(double m, double s, double b) [constructor] cls.add_constructor([param('double', 'm'), param('double', 's'), param('double', 'b')]) return def register_Ns3ZetaVariable_methods(root_module, cls): ## random-variable.h (module 'core'): ns3::ZetaVariable::ZetaVariable(ns3::ZetaVariable const & arg0) [copy constructor] cls.add_constructor([param('ns3::ZetaVariable const &', 'arg0')]) ## random-variable.h (module 'core'): ns3::ZetaVariable::ZetaVariable(double alpha) [constructor] cls.add_constructor([param('double', 'alpha')]) ## random-variable.h (module 'core'): ns3::ZetaVariable::ZetaVariable() [constructor] cls.add_constructor([]) return def register_Ns3ZipfVariable_methods(root_module, cls): ## random-variable.h (module 'core'): ns3::ZipfVariable::ZipfVariable(ns3::ZipfVariable const & arg0) [copy constructor] cls.add_constructor([param('ns3::ZipfVariable const &', 'arg0')]) ## random-variable.h (module 'core'): ns3::ZipfVariable::ZipfVariable(long int N, double alpha) [constructor] cls.add_constructor([param('long int', 'N'), param('double', 'alpha')]) ## random-variable.h (module 'core'): ns3::ZipfVariable::ZipfVariable() [constructor] cls.add_constructor([]) return def register_Ns3Empty_methods(root_module, cls): ## empty.h (module 'core'): ns3::empty::empty() [constructor] cls.add_constructor([]) ## empty.h (module 'core'): ns3::empty::empty(ns3::empty const & arg0) [copy constructor] cls.add_constructor([param('ns3::empty const &', 'arg0')]) return def register_Ns3Int64x64_t_methods(root_module, cls): cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short unsigned int const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned char const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long int const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long int const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('int const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short int const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('signed char const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('double const', 'right')) cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short unsigned int const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned char const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long int const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long int const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('int const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short int const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('signed char const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('double const', 'right')) cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short unsigned int const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned char const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long int const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long int const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('int const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short int const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('signed char const', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('double const', 'right')) cls.add_unary_numeric_operator('-') cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short unsigned int const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned char const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long int const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long int const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('int const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('short int const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('signed char const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('double const', 'right')) cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', 'right')) cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('>') cls.add_binary_comparison_operator('!=') cls.add_inplace_numeric_operator('*=', param('ns3::int64x64_t const &', 'right')) cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', 'right')) cls.add_inplace_numeric_operator('-=', param('ns3::int64x64_t const &', 'right')) cls.add_inplace_numeric_operator('/=', param('ns3::int64x64_t const &', 'right')) cls.add_output_stream_operator() cls.add_binary_comparison_operator('<=') cls.add_binary_comparison_operator('==') cls.add_binary_comparison_operator('>=') ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t() [constructor] cls.add_constructor([]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(double v) [constructor] cls.add_constructor([param('double', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(int v) [constructor] cls.add_constructor([param('int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long int v) [constructor] cls.add_constructor([param('long int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long long int v) [constructor] cls.add_constructor([param('long long int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(unsigned int v) [constructor] cls.add_constructor([param('unsigned int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long unsigned int v) [constructor] cls.add_constructor([param('long unsigned int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long long unsigned int v) [constructor] cls.add_constructor([param('long long unsigned int', 'v')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(int64_t hi, uint64_t lo) [constructor] cls.add_constructor([param('int64_t', 'hi'), param('uint64_t', 'lo')]) ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(ns3::int64x64_t const & o) [copy constructor] cls.add_constructor([param('ns3::int64x64_t const &', 'o')]) ## int64x64-double.h (module 'core'): double ns3::int64x64_t::GetDouble() const [member function] cls.add_method('GetDouble', 'double', [], is_const=True) ## int64x64-double.h (module 'core'): int64_t ns3::int64x64_t::GetHigh() const [member function] cls.add_method('GetHigh', 'int64_t', [], is_const=True) ## int64x64-double.h (module 'core'): uint64_t ns3::int64x64_t::GetLow() const [member function] cls.add_method('GetLow', 'uint64_t', [], is_const=True) ## int64x64-double.h (module 'core'): static ns3::int64x64_t ns3::int64x64_t::Invert(uint64_t v) [member function] cls.add_method('Invert', 'ns3::int64x64_t', [param('uint64_t', 'v')], is_static=True) ## int64x64-double.h (module 'core'): void ns3::int64x64_t::MulByInvert(ns3::int64x64_t const & o) [member function] cls.add_method('MulByInvert', 'void', [param('ns3::int64x64_t const &', 'o')]) return def register_Ns3Chunk_methods(root_module, cls): ## chunk.h (module 'network'): ns3::Chunk::Chunk() [constructor] cls.add_constructor([]) ## chunk.h (module 'network'): ns3::Chunk::Chunk(ns3::Chunk const & arg0) [copy constructor] cls.add_constructor([param('ns3::Chunk const &', 'arg0')]) ## chunk.h (module 'network'): uint32_t ns3::Chunk::Deserialize(ns3::Buffer::Iterator start) [member function] cls.add_method('Deserialize', 'uint32_t', [param('ns3::Buffer::Iterator', 'start')], is_pure_virtual=True, is_virtual=True) ## chunk.h (module 'network'): static ns3::TypeId ns3::Chunk::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## chunk.h (module 'network'): void ns3::Chunk::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3ConstantVariable_methods(root_module, cls): ## random-variable.h (module 'core'): ns3::ConstantVariable::ConstantVariable(ns3::ConstantVariable const & arg0) [copy constructor] cls.add_constructor([param('ns3::ConstantVariable const &', 'arg0')]) ## random-variable.h (module 'core'): ns3::ConstantVariable::ConstantVariable() [constructor] cls.add_constructor([]) ## random-variable.h (module 'core'): ns3::ConstantVariable::ConstantVariable(double c) [constructor] cls.add_constructor([param('double', 'c')]) ## random-variable.h (module 'core'): void ns3::ConstantVariable::SetConstant(double c) [member function] cls.add_method('SetConstant', 'void', [param('double', 'c')]) return def register_Ns3DeterministicVariable_methods(root_module, cls): ## random-variable.h (module 'core'): ns3::DeterministicVariable::DeterministicVariable(ns3::DeterministicVariable const & arg0) [copy constructor] cls.add_constructor([param('ns3::DeterministicVariable const &', 'arg0')]) ## random-variable.h (module 'core'): ns3::DeterministicVariable::DeterministicVariable(double * d, uint32_t c) [constructor] cls.add_constructor([param('double *', 'd'), param('uint32_t', 'c')]) return def register_Ns3EmpiricalVariable_methods(root_module, cls): ## random-variable.h (module 'core'): ns3::EmpiricalVariable::EmpiricalVariable(ns3::EmpiricalVariable const & arg0) [copy constructor] cls.add_constructor([param('ns3::EmpiricalVariable const &', 'arg0')]) ## random-variable.h (module 'core'): ns3::EmpiricalVariable::EmpiricalVariable() [constructor] cls.add_constructor([]) ## random-variable.h (module 'core'): void ns3::EmpiricalVariable::CDF(double v, double c) [member function] cls.add_method('CDF', 'void', [param('double', 'v'), param('double', 'c')]) return def register_Ns3ErlangVariable_methods(root_module, cls): ## random-variable.h (module 'core'): ns3::ErlangVariable::ErlangVariable(ns3::ErlangVariable const & arg0) [copy constructor] cls.add_constructor([param('ns3::ErlangVariable const &', 'arg0')]) ## random-variable.h (module 'core'): ns3::ErlangVariable::ErlangVariable() [constructor] cls.add_constructor([]) ## random-variable.h (module 'core'): ns3::ErlangVariable::ErlangVariable(unsigned int k, double lambda) [constructor] cls.add_constructor([param('unsigned int', 'k'), param('double', 'lambda')]) ## random-variable.h (module 'core'): double ns3::ErlangVariable::GetValue() const [member function] cls.add_method('GetValue', 'double', [], is_const=True) ## random-variable.h (module 'core'): double ns3::ErlangVariable::GetValue(unsigned int k, double lambda) const [member function] cls.add_method('GetValue', 'double', [param('unsigned int', 'k'), param('double', 'lambda')], is_const=True) return def register_Ns3ExponentialVariable_methods(root_module, cls): ## random-variable.h (module 'core'): ns3::ExponentialVariable::ExponentialVariable(ns3::ExponentialVariable const & arg0) [copy constructor] cls.add_constructor([param('ns3::ExponentialVariable const &', 'arg0')]) ## random-variable.h (module 'core'): ns3::ExponentialVariable::ExponentialVariable() [constructor] cls.add_constructor([]) ## random-variable.h (module 'core'): ns3::ExponentialVariable::ExponentialVariable(double m) [constructor] cls.add_constructor([param('double', 'm')]) ## random-variable.h (module 'core'): ns3::ExponentialVariable::ExponentialVariable(double m, double b) [constructor] cls.add_constructor([param('double', 'm'), param('double', 'b')]) return def register_Ns3FlowIdTag_methods(root_module, cls): ## flow-id-tag.h (module 'network'): ns3::FlowIdTag::FlowIdTag(ns3::FlowIdTag const & arg0) [copy constructor] cls.add_constructor([param('ns3::FlowIdTag const &', 'arg0')]) ## flow-id-tag.h (module 'network'): ns3::FlowIdTag::FlowIdTag() [constructor] cls.add_constructor([]) ## flow-id-tag.h (module 'network'): ns3::FlowIdTag::FlowIdTag(uint32_t flowId) [constructor] cls.add_constructor([param('uint32_t', 'flowId')]) ## flow-id-tag.h (module 'network'): static uint32_t ns3::FlowIdTag::AllocateFlowId() [member function] cls.add_method('AllocateFlowId', 'uint32_t', [], is_static=True) ## flow-id-tag.h (module 'network'): void ns3::FlowIdTag::Deserialize(ns3::TagBuffer buf) [member function] cls.add_method('Deserialize', 'void', [param('ns3::TagBuffer', 'buf')], is_virtual=True) ## flow-id-tag.h (module 'network'): uint32_t ns3::FlowIdTag::GetFlowId() const [member function] cls.add_method('GetFlowId', 'uint32_t', [], is_const=True) ## flow-id-tag.h (module 'network'): ns3::TypeId ns3::FlowIdTag::GetInstanceTypeId() const [member function] cls.add_method('GetInstanceTypeId', 'ns3::TypeId', [], is_const=True, is_virtual=True) ## flow-id-tag.h (module 'network'): uint32_t ns3::FlowIdTag::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True, is_virtual=True) ## flow-id-tag.h (module 'network'): static ns3::TypeId ns3::FlowIdTag::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## flow-id-tag.h (module 'network'): void ns3::FlowIdTag::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True, is_virtual=True) ## flow-id-tag.h (module 'network'): void ns3::FlowIdTag::Serialize(ns3::TagBuffer buf) const [member function] cls.add_method('Serialize', 'void', [param('ns3::TagBuffer', 'buf')], is_const=True, is_virtual=True) ## flow-id-tag.h (module 'network'): void ns3::FlowIdTag::SetFlowId(uint32_t flowId) [member function] cls.add_method('SetFlowId', 'void', [param('uint32_t', 'flowId')]) return def register_Ns3GammaVariable_methods(root_module, cls): ## random-variable.h (module 'core'): ns3::GammaVariable::GammaVariable(ns3::GammaVariable const & arg0) [copy constructor] cls.add_constructor([param('ns3::GammaVariable const &', 'arg0')]) ## random-variable.h (module 'core'): ns3::GammaVariable::GammaVariable() [constructor] cls.add_constructor([]) ## random-variable.h (module 'core'): ns3::GammaVariable::GammaVariable(double alpha, double beta) [constructor] cls.add_constructor([param('double', 'alpha'), param('double', 'beta')]) ## random-variable.h (module 'core'): double ns3::GammaVariable::GetValue() const [member function] cls.add_method('GetValue', 'double', [], is_const=True) ## random-variable.h (module 'core'): double ns3::GammaVariable::GetValue(double alpha, double beta) const [member function] cls.add_method('GetValue', 'double', [param('double', 'alpha'), param('double', 'beta')], is_const=True) return def register_Ns3Header_methods(root_module, cls): cls.add_output_stream_operator() ## header.h (module 'network'): ns3::Header::Header() [constructor] cls.add_constructor([]) ## header.h (module 'network'): ns3::Header::Header(ns3::Header const & arg0) [copy constructor] cls.add_constructor([param('ns3::Header const &', 'arg0')]) ## header.h (module 'network'): uint32_t ns3::Header::Deserialize(ns3::Buffer::Iterator start) [member function] cls.add_method('Deserialize', 'uint32_t', [param('ns3::Buffer::Iterator', 'start')], is_pure_virtual=True, is_virtual=True) ## header.h (module 'network'): uint32_t ns3::Header::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## header.h (module 'network'): static ns3::TypeId ns3::Header::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## header.h (module 'network'): void ns3::Header::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_pure_virtual=True, is_const=True, is_virtual=True) ## header.h (module 'network'): void ns3::Header::Serialize(ns3::Buffer::Iterator start) const [member function] cls.add_method('Serialize', 'void', [param('ns3::Buffer::Iterator', 'start')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3IntEmpiricalVariable_methods(root_module, cls): ## random-variable.h (module 'core'): ns3::IntEmpiricalVariable::IntEmpiricalVariable(ns3::IntEmpiricalVariable const & arg0) [copy constructor] cls.add_constructor([param('ns3::IntEmpiricalVariable const &', 'arg0')]) ## random-variable.h (module 'core'): ns3::IntEmpiricalVariable::IntEmpiricalVariable() [constructor] cls.add_constructor([]) return def register_Ns3LlcSnapHeader_methods(root_module, cls): ## llc-snap-header.h (module 'network'): ns3::LlcSnapHeader::LlcSnapHeader(ns3::LlcSnapHeader const & arg0) [copy constructor] cls.add_constructor([param('ns3::LlcSnapHeader const &', 'arg0')]) ## llc-snap-header.h (module 'network'): ns3::LlcSnapHeader::LlcSnapHeader() [constructor] cls.add_constructor([]) ## llc-snap-header.h (module 'network'): uint32_t ns3::LlcSnapHeader::Deserialize(ns3::Buffer::Iterator start) [member function] cls.add_method('Deserialize', 'uint32_t', [param('ns3::Buffer::Iterator', 'start')], is_virtual=True) ## llc-snap-header.h (module 'network'): ns3::TypeId ns3::LlcSnapHeader::GetInstanceTypeId() const [member function] cls.add_method('GetInstanceTypeId', 'ns3::TypeId', [], is_const=True, is_virtual=True) ## llc-snap-header.h (module 'network'): uint32_t ns3::LlcSnapHeader::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True, is_virtual=True) ## llc-snap-header.h (module 'network'): uint16_t ns3::LlcSnapHeader::GetType() [member function] cls.add_method('GetType', 'uint16_t', []) ## llc-snap-header.h (module 'network'): static ns3::TypeId ns3::LlcSnapHeader::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## llc-snap-header.h (module 'network'): void ns3::LlcSnapHeader::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True, is_virtual=True) ## llc-snap-header.h (module 'network'): void ns3::LlcSnapHeader::Serialize(ns3::Buffer::Iterator start) const [member function] cls.add_method('Serialize', 'void', [param('ns3::Buffer::Iterator', 'start')], is_const=True, is_virtual=True) ## llc-snap-header.h (module 'network'): void ns3::LlcSnapHeader::SetType(uint16_t type) [member function] cls.add_method('SetType', 'void', [param('uint16_t', 'type')]) return def register_Ns3LogNormalVariable_methods(root_module, cls): ## random-variable.h (module 'core'): ns3::LogNormalVariable::LogNormalVariable(ns3::LogNormalVariable const & arg0) [copy constructor] cls.add_constructor([param('ns3::LogNormalVariable const &', 'arg0')]) ## random-variable.h (module 'core'): ns3::LogNormalVariable::LogNormalVariable(double mu, double sigma) [constructor] cls.add_constructor([param('double', 'mu'), param('double', 'sigma')]) return def register_Ns3NormalVariable_methods(root_module, cls): ## random-variable.h (module 'core'): ns3::NormalVariable::NormalVariable(ns3::NormalVariable const & arg0) [copy constructor] cls.add_constructor([param('ns3::NormalVariable const &', 'arg0')]) ## random-variable.h (module 'core'): ns3::NormalVariable::NormalVariable() [constructor] cls.add_constructor([]) ## random-variable.h (module 'core'): ns3::NormalVariable::NormalVariable(double m, double v) [constructor] cls.add_constructor([param('double', 'm'), param('double', 'v')]) ## random-variable.h (module 'core'): ns3::NormalVariable::NormalVariable(double m, double v, double b) [constructor] cls.add_constructor([param('double', 'm'), param('double', 'v'), param('double', 'b')]) return def register_Ns3Object_methods(root_module, cls): ## object.h (module 'core'): ns3::Object::Object() [constructor] cls.add_constructor([]) ## object.h (module 'core'): void ns3::Object::AggregateObject(ns3::Ptr<ns3::Object> other) [member function] cls.add_method('AggregateObject', 'void', [param('ns3::Ptr< ns3::Object >', 'other')]) ## object.h (module 'core'): void ns3::Object::Dispose() [member function] cls.add_method('Dispose', 'void', []) ## object.h (module 'core'): ns3::Object::AggregateIterator ns3::Object::GetAggregateIterator() const [member function] cls.add_method('GetAggregateIterator', 'ns3::Object::AggregateIterator', [], is_const=True) ## object.h (module 'core'): ns3::TypeId ns3::Object::GetInstanceTypeId() const [member function] cls.add_method('GetInstanceTypeId', 'ns3::TypeId', [], is_const=True, is_virtual=True) ## object.h (module 'core'): static ns3::TypeId ns3::Object::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## object.h (module 'core'): void ns3::Object::Start() [member function] cls.add_method('Start', 'void', []) ## object.h (module 'core'): ns3::Object::Object(ns3::Object const & o) [copy constructor] cls.add_constructor([param('ns3::Object const &', 'o')], visibility='protected') ## object.h (module 'core'): void ns3::Object::DoDispose() [member function] cls.add_method('DoDispose', 'void', [], visibility='protected', is_virtual=True) ## object.h (module 'core'): void ns3::Object::DoStart() [member function] cls.add_method('DoStart', 'void', [], visibility='protected', is_virtual=True) ## object.h (module 'core'): void ns3::Object::NotifyNewAggregate() [member function] cls.add_method('NotifyNewAggregate', 'void', [], visibility='protected', is_virtual=True) return def register_Ns3ObjectAggregateIterator_methods(root_module, cls): ## object.h (module 'core'): ns3::Object::AggregateIterator::AggregateIterator(ns3::Object::AggregateIterator const & arg0) [copy constructor] cls.add_constructor([param('ns3::Object::AggregateIterator const &', 'arg0')]) ## object.h (module 'core'): ns3::Object::AggregateIterator::AggregateIterator() [constructor] cls.add_constructor([]) ## object.h (module 'core'): bool ns3::Object::AggregateIterator::HasNext() const [member function] cls.add_method('HasNext', 'bool', [], is_const=True) ## object.h (module 'core'): ns3::Ptr<ns3::Object const> ns3::Object::AggregateIterator::Next() [member function] cls.add_method('Next', 'ns3::Ptr< ns3::Object const >', []) return def register_Ns3PacketBurst_methods(root_module, cls): ## packet-burst.h (module 'network'): ns3::PacketBurst::PacketBurst(ns3::PacketBurst const & arg0) [copy constructor] cls.add_constructor([param('ns3::PacketBurst const &', 'arg0')]) ## packet-burst.h (module 'network'): ns3::PacketBurst::PacketBurst() [constructor] cls.add_constructor([]) ## packet-burst.h (module 'network'): void ns3::PacketBurst::AddPacket(ns3::Ptr<ns3::Packet> packet) [member function] cls.add_method('AddPacket', 'void', [param('ns3::Ptr< ns3::Packet >', 'packet')]) ## packet-burst.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::Packet> > ns3::PacketBurst::Begin() const [member function] cls.add_method('Begin', 'std::_List_const_iterator< ns3::Ptr< ns3::Packet > >', [], is_const=True) ## packet-burst.h (module 'network'): ns3::Ptr<ns3::PacketBurst> ns3::PacketBurst::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::PacketBurst >', [], is_const=True) ## packet-burst.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::Packet> > ns3::PacketBurst::End() const [member function] cls.add_method('End', 'std::_List_const_iterator< ns3::Ptr< ns3::Packet > >', [], is_const=True) ## packet-burst.h (module 'network'): uint32_t ns3::PacketBurst::GetNPackets() const [member function] cls.add_method('GetNPackets', 'uint32_t', [], is_const=True) ## packet-burst.h (module 'network'): std::list<ns3::Ptr<ns3::Packet>, std::allocator<ns3::Ptr<ns3::Packet> > > ns3::PacketBurst::GetPackets() const [member function] cls.add_method('GetPackets', 'std::list< ns3::Ptr< ns3::Packet > >', [], is_const=True) ## packet-burst.h (module 'network'): uint32_t ns3::PacketBurst::GetSize() const [member function] cls.add_method('GetSize', 'uint32_t', [], is_const=True) ## packet-burst.h (module 'network'): static ns3::TypeId ns3::PacketBurst::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## packet-burst.h (module 'network'): void ns3::PacketBurst::DoDispose() [member function] cls.add_method('DoDispose', 'void', [], visibility='private', is_virtual=True) return def register_Ns3ParetoVariable_methods(root_module, cls): ## random-variable.h (module 'core'): ns3::ParetoVariable::ParetoVariable(ns3::ParetoVariable const & arg0) [copy constructor] cls.add_constructor([param('ns3::ParetoVariable const &', 'arg0')]) ## random-variable.h (module 'core'): ns3::ParetoVariable::ParetoVariable() [constructor] cls.add_constructor([]) ## random-variable.h (module 'core'): ns3::ParetoVariable::ParetoVariable(double m) [constructor] cls.add_constructor([param('double', 'm')]) ## random-variable.h (module 'core'): ns3::ParetoVariable::ParetoVariable(double m, double s) [constructor] cls.add_constructor([param('double', 'm'), param('double', 's')]) ## random-variable.h (module 'core'): ns3::ParetoVariable::ParetoVariable(double m, double s, double b) [constructor] cls.add_constructor([param('double', 'm'), param('double', 's'), param('double', 'b')]) ## random-variable.h (module 'core'): ns3::ParetoVariable::ParetoVariable(std::pair<double,double> params) [constructor] cls.add_constructor([param('std::pair< double, double >', 'params')]) ## random-variable.h (module 'core'): ns3::ParetoVariable::ParetoVariable(std::pair<double,double> params, double b) [constructor] cls.add_constructor([param('std::pair< double, double >', 'params'), param('double', 'b')]) return def register_Ns3PcapFileWrapper_methods(root_module, cls): ## pcap-file-wrapper.h (module 'network'): static ns3::TypeId ns3::PcapFileWrapper::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## pcap-file-wrapper.h (module 'network'): ns3::PcapFileWrapper::PcapFileWrapper() [constructor] cls.add_constructor([]) ## pcap-file-wrapper.h (module 'network'): bool ns3::PcapFileWrapper::Fail() const [member function] cls.add_method('Fail', 'bool', [], is_const=True) ## pcap-file-wrapper.h (module 'network'): bool ns3::PcapFileWrapper::Eof() const [member function] cls.add_method('Eof', 'bool', [], is_const=True) ## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Clear() [member function] cls.add_method('Clear', 'void', []) ## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Open(std::string const & filename, std::_Ios_Openmode mode) [member function] cls.add_method('Open', 'void', [param('std::string const &', 'filename'), param('std::_Ios_Openmode', 'mode')]) ## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Close() [member function] cls.add_method('Close', 'void', []) ## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Init(uint32_t dataLinkType, uint32_t snapLen=std::numeric_limits<unsigned int>::max(), int32_t tzCorrection=ns3::PcapFile::ZONE_DEFAULT) [member function] cls.add_method('Init', 'void', [param('uint32_t', 'dataLinkType'), param('uint32_t', 'snapLen', default_value='std::numeric_limits<unsigned int>::max()'), param('int32_t', 'tzCorrection', default_value='ns3::PcapFile::ZONE_DEFAULT')]) ## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Write(ns3::Time t, ns3::Ptr<const ns3::Packet> p) [member function] cls.add_method('Write', 'void', [param('ns3::Time', 't'), param('ns3::Ptr< ns3::Packet const >', 'p')]) ## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Write(ns3::Time t, ns3::Header & header, ns3::Ptr<const ns3::Packet> p) [member function] cls.add_method('Write', 'void', [param('ns3::Time', 't'), param('ns3::Header &', 'header'), param('ns3::Ptr< ns3::Packet const >', 'p')]) ## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Write(ns3::Time t, uint8_t const * buffer, uint32_t length) [member function] cls.add_method('Write', 'void', [param('ns3::Time', 't'), param('uint8_t const *', 'buffer'), param('uint32_t', 'length')]) ## pcap-file-wrapper.h (module 'network'): uint32_t ns3::PcapFileWrapper::GetMagic() [member function] cls.add_method('GetMagic', 'uint32_t', []) ## pcap-file-wrapper.h (module 'network'): uint16_t ns3::PcapFileWrapper::GetVersionMajor() [member function] cls.add_method('GetVersionMajor', 'uint16_t', []) ## pcap-file-wrapper.h (module 'network'): uint16_t ns3::PcapFileWrapper::GetVersionMinor() [member function] cls.add_method('GetVersionMinor', 'uint16_t', []) ## pcap-file-wrapper.h (module 'network'): int32_t ns3::PcapFileWrapper::GetTimeZoneOffset() [member function] cls.add_method('GetTimeZoneOffset', 'int32_t', []) ## pcap-file-wrapper.h (module 'network'): uint32_t ns3::PcapFileWrapper::GetSigFigs() [member function] cls.add_method('GetSigFigs', 'uint32_t', []) ## pcap-file-wrapper.h (module 'network'): uint32_t ns3::PcapFileWrapper::GetSnapLen() [member function] cls.add_method('GetSnapLen', 'uint32_t', []) ## pcap-file-wrapper.h (module 'network'): uint32_t ns3::PcapFileWrapper::GetDataLinkType() [member function] cls.add_method('GetDataLinkType', 'uint32_t', []) return def register_Ns3Queue_methods(root_module, cls): ## queue.h (module 'network'): ns3::Queue::Queue(ns3::Queue const & arg0) [copy constructor] cls.add_constructor([param('ns3::Queue const &', 'arg0')]) ## queue.h (module 'network'): ns3::Queue::Queue() [constructor] cls.add_constructor([]) ## queue.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Queue::Dequeue() [member function] cls.add_method('Dequeue', 'ns3::Ptr< ns3::Packet >', []) ## queue.h (module 'network'): void ns3::Queue::DequeueAll() [member function] cls.add_method('DequeueAll', 'void', []) ## queue.h (module 'network'): bool ns3::Queue::Enqueue(ns3::Ptr<ns3::Packet> p) [member function] cls.add_method('Enqueue', 'bool', [param('ns3::Ptr< ns3::Packet >', 'p')]) ## queue.h (module 'network'): uint32_t ns3::Queue::GetNBytes() const [member function] cls.add_method('GetNBytes', 'uint32_t', [], is_const=True) ## queue.h (module 'network'): uint32_t ns3::Queue::GetNPackets() const [member function] cls.add_method('GetNPackets', 'uint32_t', [], is_const=True) ## queue.h (module 'network'): uint32_t ns3::Queue::GetTotalDroppedBytes() const [member function] cls.add_method('GetTotalDroppedBytes', 'uint32_t', [], is_const=True) ## queue.h (module 'network'): uint32_t ns3::Queue::GetTotalDroppedPackets() const [member function] cls.add_method('GetTotalDroppedPackets', 'uint32_t', [], is_const=True) ## queue.h (module 'network'): uint32_t ns3::Queue::GetTotalReceivedBytes() const [member function] cls.add_method('GetTotalReceivedBytes', 'uint32_t', [], is_const=True) ## queue.h (module 'network'): uint32_t ns3::Queue::GetTotalReceivedPackets() const [member function] cls.add_method('GetTotalReceivedPackets', 'uint32_t', [], is_const=True) ## queue.h (module 'network'): static ns3::TypeId ns3::Queue::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## queue.h (module 'network'): bool ns3::Queue::IsEmpty() const [member function] cls.add_method('IsEmpty', 'bool', [], is_const=True) ## queue.h (module 'network'): ns3::Ptr<const ns3::Packet> ns3::Queue::Peek() const [member function] cls.add_method('Peek', 'ns3::Ptr< ns3::Packet const >', [], is_const=True) ## queue.h (module 'network'): void ns3::Queue::ResetStatistics() [member function] cls.add_method('ResetStatistics', 'void', []) ## queue.h (module 'network'): void ns3::Queue::Drop(ns3::Ptr<ns3::Packet> packet) [member function] cls.add_method('Drop', 'void', [param('ns3::Ptr< ns3::Packet >', 'packet')], visibility='protected') ## queue.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Queue::DoDequeue() [member function] cls.add_method('DoDequeue', 'ns3::Ptr< ns3::Packet >', [], is_pure_virtual=True, visibility='private', is_virtual=True) ## queue.h (module 'network'): bool ns3::Queue::DoEnqueue(ns3::Ptr<ns3::Packet> p) [member function] cls.add_method('DoEnqueue', 'bool', [param('ns3::Ptr< ns3::Packet >', 'p')], is_pure_virtual=True, visibility='private', is_virtual=True) ## queue.h (module 'network'): ns3::Ptr<const ns3::Packet> ns3::Queue::DoPeek() const [member function] cls.add_method('DoPeek', 'ns3::Ptr< ns3::Packet const >', [], is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True) return def register_Ns3RadiotapHeader_methods(root_module, cls): ## radiotap-header.h (module 'network'): ns3::RadiotapHeader::RadiotapHeader(ns3::RadiotapHeader const & arg0) [copy constructor] cls.add_constructor([param('ns3::RadiotapHeader const &', 'arg0')]) ## radiotap-header.h (module 'network'): ns3::RadiotapHeader::RadiotapHeader() [constructor] cls.add_constructor([]) ## radiotap-header.h (module 'network'): uint32_t ns3::RadiotapHeader::Deserialize(ns3::Buffer::Iterator start) [member function] cls.add_method('Deserialize', 'uint32_t', [param('ns3::Buffer::Iterator', 'start')], is_virtual=True) ## radiotap-header.h (module 'network'): uint8_t ns3::RadiotapHeader::GetAntennaNoisePower() const [member function] cls.add_method('GetAntennaNoisePower', 'uint8_t', [], is_const=True) ## radiotap-header.h (module 'network'): uint8_t ns3::RadiotapHeader::GetAntennaSignalPower() const [member function] cls.add_method('GetAntennaSignalPower', 'uint8_t', [], is_const=True) ## radiotap-header.h (module 'network'): uint16_t ns3::RadiotapHeader::GetChannelFlags() const [member function] cls.add_method('GetChannelFlags', 'uint16_t', [], is_const=True) ## radiotap-header.h (module 'network'): uint16_t ns3::RadiotapHeader::GetChannelFrequency() const [member function] cls.add_method('GetChannelFrequency', 'uint16_t', [], is_const=True) ## radiotap-header.h (module 'network'): uint8_t ns3::RadiotapHeader::GetFrameFlags() const [member function] cls.add_method('GetFrameFlags', 'uint8_t', [], is_const=True) ## radiotap-header.h (module 'network'): ns3::TypeId ns3::RadiotapHeader::GetInstanceTypeId() const [member function] cls.add_method('GetInstanceTypeId', 'ns3::TypeId', [], is_const=True, is_virtual=True) ## radiotap-header.h (module 'network'): uint8_t ns3::RadiotapHeader::GetRate() const [member function] cls.add_method('GetRate', 'uint8_t', [], is_const=True) ## radiotap-header.h (module 'network'): uint32_t ns3::RadiotapHeader::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True, is_virtual=True) ## radiotap-header.h (module 'network'): uint64_t ns3::RadiotapHeader::GetTsft() const [member function] cls.add_method('GetTsft', 'uint64_t', [], is_const=True) ## radiotap-header.h (module 'network'): static ns3::TypeId ns3::RadiotapHeader::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True, is_virtual=True) ## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::Serialize(ns3::Buffer::Iterator start) const [member function] cls.add_method('Serialize', 'void', [param('ns3::Buffer::Iterator', 'start')], is_const=True, is_virtual=True) ## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::SetAntennaNoisePower(double noise) [member function] cls.add_method('SetAntennaNoisePower', 'void', [param('double', 'noise')]) ## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::SetAntennaSignalPower(double signal) [member function] cls.add_method('SetAntennaSignalPower', 'void', [param('double', 'signal')]) ## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::SetChannelFrequencyAndFlags(uint16_t frequency, uint16_t flags) [member function] cls.add_method('SetChannelFrequencyAndFlags', 'void', [param('uint16_t', 'frequency'), param('uint16_t', 'flags')]) ## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::SetFrameFlags(uint8_t flags) [member function] cls.add_method('SetFrameFlags', 'void', [param('uint8_t', 'flags')]) ## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::SetRate(uint8_t rate) [member function] cls.add_method('SetRate', 'void', [param('uint8_t', 'rate')]) ## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::SetTsft(uint64_t tsft) [member function] cls.add_method('SetTsft', 'void', [param('uint64_t', 'tsft')]) return def register_Ns3RedQueue_methods(root_module, cls): ## red-queue.h (module 'network'): ns3::RedQueue::RedQueue(ns3::RedQueue const & arg0) [copy constructor] cls.add_constructor([param('ns3::RedQueue const &', 'arg0')]) ## red-queue.h (module 'network'): ns3::RedQueue::RedQueue() [constructor] cls.add_constructor([]) ## red-queue.h (module 'network'): ns3::Queue::QueueMode ns3::RedQueue::GetMode() [member function] cls.add_method('GetMode', 'ns3::Queue::QueueMode', []) ## red-queue.h (module 'network'): uint32_t ns3::RedQueue::GetQueueSize() [member function] cls.add_method('GetQueueSize', 'uint32_t', []) ## red-queue.h (module 'network'): ns3::RedQueue::Stats ns3::RedQueue::GetStats() [member function] cls.add_method('GetStats', 'ns3::RedQueue::Stats', []) ## red-queue.h (module 'network'): static ns3::TypeId ns3::RedQueue::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## red-queue.h (module 'network'): void ns3::RedQueue::SetMode(ns3::Queue::QueueMode mode) [member function] cls.add_method('SetMode', 'void', [param('ns3::Queue::QueueMode', 'mode')]) ## red-queue.h (module 'network'): void ns3::RedQueue::SetQueueLimit(uint32_t lim) [member function] cls.add_method('SetQueueLimit', 'void', [param('uint32_t', 'lim')]) ## red-queue.h (module 'network'): void ns3::RedQueue::SetTh(double minTh, double maxTh) [member function] cls.add_method('SetTh', 'void', [param('double', 'minTh'), param('double', 'maxTh')]) ## red-queue.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::RedQueue::DoDequeue() [member function] cls.add_method('DoDequeue', 'ns3::Ptr< ns3::Packet >', [], visibility='private', is_virtual=True) ## red-queue.h (module 'network'): bool ns3::RedQueue::DoEnqueue(ns3::Ptr<ns3::Packet> p) [member function] cls.add_method('DoEnqueue', 'bool', [param('ns3::Ptr< ns3::Packet >', 'p')], visibility='private', is_virtual=True) ## red-queue.h (module 'network'): ns3::Ptr<const ns3::Packet> ns3::RedQueue::DoPeek() const [member function] cls.add_method('DoPeek', 'ns3::Ptr< ns3::Packet const >', [], is_const=True, visibility='private', is_virtual=True) return def register_Ns3RedQueueStats_methods(root_module, cls): ## red-queue.h (module 'network'): ns3::RedQueue::Stats::Stats() [constructor] cls.add_constructor([]) ## red-queue.h (module 'network'): ns3::RedQueue::Stats::Stats(ns3::RedQueue::Stats const & arg0) [copy constructor] cls.add_constructor([param('ns3::RedQueue::Stats const &', 'arg0')]) ## red-queue.h (module 'network'): ns3::RedQueue::Stats::forcedDrop [variable] cls.add_instance_attribute('forcedDrop', 'uint32_t', is_const=False) ## red-queue.h (module 'network'): ns3::RedQueue::Stats::qLimDrop [variable] cls.add_instance_attribute('qLimDrop', 'uint32_t', is_const=False) ## red-queue.h (module 'network'): ns3::RedQueue::Stats::unforcedDrop [variable] cls.add_instance_attribute('unforcedDrop', 'uint32_t', is_const=False) return def register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter< ns3::AttributeAccessor > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter< ns3::AttributeChecker > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter< ns3::AttributeValue > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::SimpleRefCount(ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter< ns3::CallbackImplBase > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >::SimpleRefCount(ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter< ns3::EventImpl > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::SimpleRefCount(ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter< ns3::NixVector > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3OutputStreamWrapper_Ns3Empty_Ns3DefaultDeleter__lt__ns3OutputStreamWrapper__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >::SimpleRefCount(ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter< ns3::OutputStreamWrapper > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >::SimpleRefCount(ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter< ns3::Packet > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3PbbAddressBlock_Ns3Empty_Ns3DefaultDeleter__lt__ns3PbbAddressBlock__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbAddressBlock, ns3::empty, ns3::DefaultDeleter<ns3::PbbAddressBlock> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbAddressBlock, ns3::empty, ns3::DefaultDeleter<ns3::PbbAddressBlock> >::SimpleRefCount(ns3::SimpleRefCount<ns3::PbbAddressBlock, ns3::empty, ns3::DefaultDeleter<ns3::PbbAddressBlock> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::PbbAddressBlock, ns3::empty, ns3::DefaultDeleter< ns3::PbbAddressBlock > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::PbbAddressBlock, ns3::empty, ns3::DefaultDeleter<ns3::PbbAddressBlock> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3PbbMessage_Ns3Empty_Ns3DefaultDeleter__lt__ns3PbbMessage__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbMessage, ns3::empty, ns3::DefaultDeleter<ns3::PbbMessage> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbMessage, ns3::empty, ns3::DefaultDeleter<ns3::PbbMessage> >::SimpleRefCount(ns3::SimpleRefCount<ns3::PbbMessage, ns3::empty, ns3::DefaultDeleter<ns3::PbbMessage> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::PbbMessage, ns3::empty, ns3::DefaultDeleter< ns3::PbbMessage > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::PbbMessage, ns3::empty, ns3::DefaultDeleter<ns3::PbbMessage> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3PbbPacket_Ns3Header_Ns3DefaultDeleter__lt__ns3PbbPacket__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbPacket, ns3::Header, ns3::DefaultDeleter<ns3::PbbPacket> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbPacket, ns3::Header, ns3::DefaultDeleter<ns3::PbbPacket> >::SimpleRefCount(ns3::SimpleRefCount<ns3::PbbPacket, ns3::Header, ns3::DefaultDeleter<ns3::PbbPacket> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::PbbPacket, ns3::Header, ns3::DefaultDeleter< ns3::PbbPacket > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::PbbPacket, ns3::Header, ns3::DefaultDeleter<ns3::PbbPacket> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3PbbTlv_Ns3Empty_Ns3DefaultDeleter__lt__ns3PbbTlv__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbTlv, ns3::empty, ns3::DefaultDeleter<ns3::PbbTlv> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbTlv, ns3::empty, ns3::DefaultDeleter<ns3::PbbTlv> >::SimpleRefCount(ns3::SimpleRefCount<ns3::PbbTlv, ns3::empty, ns3::DefaultDeleter<ns3::PbbTlv> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::PbbTlv, ns3::empty, ns3::DefaultDeleter< ns3::PbbTlv > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::PbbTlv, ns3::empty, ns3::DefaultDeleter<ns3::PbbTlv> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount(ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter< ns3::TraceSourceAccessor > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::Cleanup() [member function] cls.add_method('Cleanup', 'void', [], is_static=True) return def register_Ns3Socket_methods(root_module, cls): ## socket.h (module 'network'): ns3::Socket::Socket(ns3::Socket const & arg0) [copy constructor] cls.add_constructor([param('ns3::Socket const &', 'arg0')]) ## socket.h (module 'network'): ns3::Socket::Socket() [constructor] cls.add_constructor([]) ## socket.h (module 'network'): int ns3::Socket::Bind(ns3::Address const & address) [member function] cls.add_method('Bind', 'int', [param('ns3::Address const &', 'address')], is_pure_virtual=True, is_virtual=True) ## socket.h (module 'network'): int ns3::Socket::Bind() [member function] cls.add_method('Bind', 'int', [], is_pure_virtual=True, is_virtual=True) ## socket.h (module 'network'): int ns3::Socket::Bind6() [member function] cls.add_method('Bind6', 'int', [], is_pure_virtual=True, is_virtual=True) ## socket.h (module 'network'): void ns3::Socket::BindToNetDevice(ns3::Ptr<ns3::NetDevice> netdevice) [member function] cls.add_method('BindToNetDevice', 'void', [param('ns3::Ptr< ns3::NetDevice >', 'netdevice')], is_virtual=True) ## socket.h (module 'network'): int ns3::Socket::Close() [member function] cls.add_method('Close', 'int', [], is_pure_virtual=True, is_virtual=True) ## socket.h (module 'network'): int ns3::Socket::Connect(ns3::Address const & address) [member function] cls.add_method('Connect', 'int', [param('ns3::Address const &', 'address')], is_pure_virtual=True, is_virtual=True) ## socket.h (module 'network'): static ns3::Ptr<ns3::Socket> ns3::Socket::CreateSocket(ns3::Ptr<ns3::Node> node, ns3::TypeId tid) [member function] cls.add_method('CreateSocket', 'ns3::Ptr< ns3::Socket >', [param('ns3::Ptr< ns3::Node >', 'node'), param('ns3::TypeId', 'tid')], is_static=True) ## socket.h (module 'network'): bool ns3::Socket::GetAllowBroadcast() const [member function] cls.add_method('GetAllowBroadcast', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## socket.h (module 'network'): ns3::Ptr<ns3::NetDevice> ns3::Socket::GetBoundNetDevice() [member function] cls.add_method('GetBoundNetDevice', 'ns3::Ptr< ns3::NetDevice >', []) ## socket.h (module 'network'): ns3::Socket::SocketErrno ns3::Socket::GetErrno() const [member function] cls.add_method('GetErrno', 'ns3::Socket::SocketErrno', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## socket.h (module 'network'): ns3::Ptr<ns3::Node> ns3::Socket::GetNode() const [member function] cls.add_method('GetNode', 'ns3::Ptr< ns3::Node >', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## socket.h (module 'network'): uint32_t ns3::Socket::GetRxAvailable() const [member function] cls.add_method('GetRxAvailable', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## socket.h (module 'network'): int ns3::Socket::GetSockName(ns3::Address & address) const [member function] cls.add_method('GetSockName', 'int', [param('ns3::Address &', 'address')], is_pure_virtual=True, is_const=True, is_virtual=True) ## socket.h (module 'network'): ns3::Socket::SocketType ns3::Socket::GetSocketType() const [member function] cls.add_method('GetSocketType', 'ns3::Socket::SocketType', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## socket.h (module 'network'): uint32_t ns3::Socket::GetTxAvailable() const [member function] cls.add_method('GetTxAvailable', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## socket.h (module 'network'): static ns3::TypeId ns3::Socket::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## socket.h (module 'network'): bool ns3::Socket::IsRecvPktInfo() const [member function] cls.add_method('IsRecvPktInfo', 'bool', [], is_const=True) ## socket.h (module 'network'): int ns3::Socket::Listen() [member function] cls.add_method('Listen', 'int', [], is_pure_virtual=True, is_virtual=True) ## socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Socket::Recv(uint32_t maxSize, uint32_t flags) [member function] cls.add_method('Recv', 'ns3::Ptr< ns3::Packet >', [param('uint32_t', 'maxSize'), param('uint32_t', 'flags')], is_pure_virtual=True, is_virtual=True) ## socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Socket::Recv() [member function] cls.add_method('Recv', 'ns3::Ptr< ns3::Packet >', []) ## socket.h (module 'network'): int ns3::Socket::Recv(uint8_t * buf, uint32_t size, uint32_t flags) [member function] cls.add_method('Recv', 'int', [param('uint8_t *', 'buf'), param('uint32_t', 'size'), param('uint32_t', 'flags')]) ## socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Socket::RecvFrom(uint32_t maxSize, uint32_t flags, ns3::Address & fromAddress) [member function] cls.add_method('RecvFrom', 'ns3::Ptr< ns3::Packet >', [param('uint32_t', 'maxSize'), param('uint32_t', 'flags'), param('ns3::Address &', 'fromAddress')], is_pure_virtual=True, is_virtual=True) ## socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Socket::RecvFrom(ns3::Address & fromAddress) [member function] cls.add_method('RecvFrom', 'ns3::Ptr< ns3::Packet >', [param('ns3::Address &', 'fromAddress')]) ## socket.h (module 'network'): int ns3::Socket::RecvFrom(uint8_t * buf, uint32_t size, uint32_t flags, ns3::Address & fromAddress) [member function] cls.add_method('RecvFrom', 'int', [param('uint8_t *', 'buf'), param('uint32_t', 'size'), param('uint32_t', 'flags'), param('ns3::Address &', 'fromAddress')]) ## socket.h (module 'network'): int ns3::Socket::Send(ns3::Ptr<ns3::Packet> p, uint32_t flags) [member function] cls.add_method('Send', 'int', [param('ns3::Ptr< ns3::Packet >', 'p'), param('uint32_t', 'flags')], is_pure_virtual=True, is_virtual=True) ## socket.h (module 'network'): int ns3::Socket::Send(ns3::Ptr<ns3::Packet> p) [member function] cls.add_method('Send', 'int', [param('ns3::Ptr< ns3::Packet >', 'p')]) ## socket.h (module 'network'): int ns3::Socket::Send(uint8_t const * buf, uint32_t size, uint32_t flags) [member function] cls.add_method('Send', 'int', [param('uint8_t const *', 'buf'), param('uint32_t', 'size'), param('uint32_t', 'flags')]) ## socket.h (module 'network'): int ns3::Socket::SendTo(ns3::Ptr<ns3::Packet> p, uint32_t flags, ns3::Address const & toAddress) [member function] cls.add_method('SendTo', 'int', [param('ns3::Ptr< ns3::Packet >', 'p'), param('uint32_t', 'flags'), param('ns3::Address const &', 'toAddress')], is_pure_virtual=True, is_virtual=True) ## socket.h (module 'network'): int ns3::Socket::SendTo(uint8_t const * buf, uint32_t size, uint32_t flags, ns3::Address const & address) [member function] cls.add_method('SendTo', 'int', [param('uint8_t const *', 'buf'), param('uint32_t', 'size'), param('uint32_t', 'flags'), param('ns3::Address const &', 'address')]) ## socket.h (module 'network'): void ns3::Socket::SetAcceptCallback(ns3::Callback<bool, ns3::Ptr<ns3::Socket>, ns3::Address const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> connectionRequest, ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::Address const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> newConnectionCreated) [member function] cls.add_method('SetAcceptCallback', 'void', [param('ns3::Callback< bool, ns3::Ptr< ns3::Socket >, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'connectionRequest'), param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'newConnectionCreated')]) ## socket.h (module 'network'): bool ns3::Socket::SetAllowBroadcast(bool allowBroadcast) [member function] cls.add_method('SetAllowBroadcast', 'bool', [param('bool', 'allowBroadcast')], is_pure_virtual=True, is_virtual=True) ## socket.h (module 'network'): void ns3::Socket::SetCloseCallbacks(ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> normalClose, ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> errorClose) [member function] cls.add_method('SetCloseCallbacks', 'void', [param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'normalClose'), param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'errorClose')]) ## socket.h (module 'network'): void ns3::Socket::SetConnectCallback(ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> connectionSucceeded, ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> connectionFailed) [member function] cls.add_method('SetConnectCallback', 'void', [param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'connectionSucceeded'), param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'connectionFailed')]) ## socket.h (module 'network'): void ns3::Socket::SetDataSentCallback(ns3::Callback<void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> dataSent) [member function] cls.add_method('SetDataSentCallback', 'void', [param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'dataSent')]) ## socket.h (module 'network'): void ns3::Socket::SetRecvCallback(ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> arg0) [member function] cls.add_method('SetRecvCallback', 'void', [param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'arg0')]) ## socket.h (module 'network'): void ns3::Socket::SetRecvPktInfo(bool flag) [member function] cls.add_method('SetRecvPktInfo', 'void', [param('bool', 'flag')]) ## socket.h (module 'network'): void ns3::Socket::SetSendCallback(ns3::Callback<void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> sendCb) [member function] cls.add_method('SetSendCallback', 'void', [param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'sendCb')]) ## socket.h (module 'network'): int ns3::Socket::ShutdownRecv() [member function] cls.add_method('ShutdownRecv', 'int', [], is_pure_virtual=True, is_virtual=True) ## socket.h (module 'network'): int ns3::Socket::ShutdownSend() [member function] cls.add_method('ShutdownSend', 'int', [], is_pure_virtual=True, is_virtual=True) ## socket.h (module 'network'): void ns3::Socket::DoDispose() [member function] cls.add_method('DoDispose', 'void', [], visibility='protected', is_virtual=True) ## socket.h (module 'network'): void ns3::Socket::NotifyConnectionFailed() [member function] cls.add_method('NotifyConnectionFailed', 'void', [], visibility='protected') ## socket.h (module 'network'): bool ns3::Socket::NotifyConnectionRequest(ns3::Address const & from) [member function] cls.add_method('NotifyConnectionRequest', 'bool', [param('ns3::Address const &', 'from')], visibility='protected') ## socket.h (module 'network'): void ns3::Socket::NotifyConnectionSucceeded() [member function] cls.add_method('NotifyConnectionSucceeded', 'void', [], visibility='protected') ## socket.h (module 'network'): void ns3::Socket::NotifyDataRecv() [member function] cls.add_method('NotifyDataRecv', 'void', [], visibility='protected') ## socket.h (module 'network'): void ns3::Socket::NotifyDataSent(uint32_t size) [member function] cls.add_method('NotifyDataSent', 'void', [param('uint32_t', 'size')], visibility='protected') ## socket.h (module 'network'): void ns3::Socket::NotifyErrorClose() [member function] cls.add_method('NotifyErrorClose', 'void', [], visibility='protected') ## socket.h (module 'network'): void ns3::Socket::NotifyNewConnectionCreated(ns3::Ptr<ns3::Socket> socket, ns3::Address const & from) [member function] cls.add_method('NotifyNewConnectionCreated', 'void', [param('ns3::Ptr< ns3::Socket >', 'socket'), param('ns3::Address const &', 'from')], visibility='protected') ## socket.h (module 'network'): void ns3::Socket::NotifyNormalClose() [member function] cls.add_method('NotifyNormalClose', 'void', [], visibility='protected') ## socket.h (module 'network'): void ns3::Socket::NotifySend(uint32_t spaceAvailable) [member function] cls.add_method('NotifySend', 'void', [param('uint32_t', 'spaceAvailable')], visibility='protected') return def register_Ns3SocketAddressTag_methods(root_module, cls): ## socket.h (module 'network'): ns3::SocketAddressTag::SocketAddressTag(ns3::SocketAddressTag const & arg0) [copy constructor] cls.add_constructor([param('ns3::SocketAddressTag const &', 'arg0')]) ## socket.h (module 'network'): ns3::SocketAddressTag::SocketAddressTag() [constructor] cls.add_constructor([]) ## socket.h (module 'network'): void ns3::SocketAddressTag::Deserialize(ns3::TagBuffer i) [member function] cls.add_method('Deserialize', 'void', [param('ns3::TagBuffer', 'i')], is_virtual=True) ## socket.h (module 'network'): ns3::Address ns3::SocketAddressTag::GetAddress() const [member function] cls.add_method('GetAddress', 'ns3::Address', [], is_const=True) ## socket.h (module 'network'): ns3::TypeId ns3::SocketAddressTag::GetInstanceTypeId() const [member function] cls.add_method('GetInstanceTypeId', 'ns3::TypeId', [], is_const=True, is_virtual=True) ## socket.h (module 'network'): uint32_t ns3::SocketAddressTag::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True, is_virtual=True) ## socket.h (module 'network'): static ns3::TypeId ns3::SocketAddressTag::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## socket.h (module 'network'): void ns3::SocketAddressTag::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True, is_virtual=True) ## socket.h (module 'network'): void ns3::SocketAddressTag::Serialize(ns3::TagBuffer i) const [member function] cls.add_method('Serialize', 'void', [param('ns3::TagBuffer', 'i')], is_const=True, is_virtual=True) ## socket.h (module 'network'): void ns3::SocketAddressTag::SetAddress(ns3::Address addr) [member function] cls.add_method('SetAddress', 'void', [param('ns3::Address', 'addr')]) return def register_Ns3SocketFactory_methods(root_module, cls): ## socket-factory.h (module 'network'): ns3::SocketFactory::SocketFactory(ns3::SocketFactory const & arg0) [copy constructor] cls.add_constructor([param('ns3::SocketFactory const &', 'arg0')]) ## socket-factory.h (module 'network'): ns3::SocketFactory::SocketFactory() [constructor] cls.add_constructor([]) ## socket-factory.h (module 'network'): ns3::Ptr<ns3::Socket> ns3::SocketFactory::CreateSocket() [member function] cls.add_method('CreateSocket', 'ns3::Ptr< ns3::Socket >', [], is_pure_virtual=True, is_virtual=True) ## socket-factory.h (module 'network'): static ns3::TypeId ns3::SocketFactory::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) return def register_Ns3SocketIpTtlTag_methods(root_module, cls): ## socket.h (module 'network'): ns3::SocketIpTtlTag::SocketIpTtlTag(ns3::SocketIpTtlTag const & arg0) [copy constructor] cls.add_constructor([param('ns3::SocketIpTtlTag const &', 'arg0')]) ## socket.h (module 'network'): ns3::SocketIpTtlTag::SocketIpTtlTag() [constructor] cls.add_constructor([]) ## socket.h (module 'network'): void ns3::SocketIpTtlTag::Deserialize(ns3::TagBuffer i) [member function] cls.add_method('Deserialize', 'void', [param('ns3::TagBuffer', 'i')], is_virtual=True) ## socket.h (module 'network'): ns3::TypeId ns3::SocketIpTtlTag::GetInstanceTypeId() const [member function] cls.add_method('GetInstanceTypeId', 'ns3::TypeId', [], is_const=True, is_virtual=True) ## socket.h (module 'network'): uint32_t ns3::SocketIpTtlTag::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True, is_virtual=True) ## socket.h (module 'network'): uint8_t ns3::SocketIpTtlTag::GetTtl() const [member function] cls.add_method('GetTtl', 'uint8_t', [], is_const=True) ## socket.h (module 'network'): static ns3::TypeId ns3::SocketIpTtlTag::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## socket.h (module 'network'): void ns3::SocketIpTtlTag::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True, is_virtual=True) ## socket.h (module 'network'): void ns3::SocketIpTtlTag::Serialize(ns3::TagBuffer i) const [member function] cls.add_method('Serialize', 'void', [param('ns3::TagBuffer', 'i')], is_const=True, is_virtual=True) ## socket.h (module 'network'): void ns3::SocketIpTtlTag::SetTtl(uint8_t ttl) [member function] cls.add_method('SetTtl', 'void', [param('uint8_t', 'ttl')]) return def register_Ns3SocketSetDontFragmentTag_methods(root_module, cls): ## socket.h (module 'network'): ns3::SocketSetDontFragmentTag::SocketSetDontFragmentTag(ns3::SocketSetDontFragmentTag const & arg0) [copy constructor] cls.add_constructor([param('ns3::SocketSetDontFragmentTag const &', 'arg0')]) ## socket.h (module 'network'): ns3::SocketSetDontFragmentTag::SocketSetDontFragmentTag() [constructor] cls.add_constructor([]) ## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Deserialize(ns3::TagBuffer i) [member function] cls.add_method('Deserialize', 'void', [param('ns3::TagBuffer', 'i')], is_virtual=True) ## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Disable() [member function] cls.add_method('Disable', 'void', []) ## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Enable() [member function] cls.add_method('Enable', 'void', []) ## socket.h (module 'network'): ns3::TypeId ns3::SocketSetDontFragmentTag::GetInstanceTypeId() const [member function] cls.add_method('GetInstanceTypeId', 'ns3::TypeId', [], is_const=True, is_virtual=True) ## socket.h (module 'network'): uint32_t ns3::SocketSetDontFragmentTag::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True, is_virtual=True) ## socket.h (module 'network'): static ns3::TypeId ns3::SocketSetDontFragmentTag::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## socket.h (module 'network'): bool ns3::SocketSetDontFragmentTag::IsEnabled() const [member function] cls.add_method('IsEnabled', 'bool', [], is_const=True) ## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True, is_virtual=True) ## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Serialize(ns3::TagBuffer i) const [member function] cls.add_method('Serialize', 'void', [param('ns3::TagBuffer', 'i')], is_const=True, is_virtual=True) return def register_Ns3Time_methods(root_module, cls): cls.add_binary_numeric_operator('+', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right')) cls.add_binary_numeric_operator('-', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right')) cls.add_binary_comparison_operator('<') cls.add_binary_comparison_operator('>') cls.add_binary_comparison_operator('!=') cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right')) cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', 'right')) cls.add_output_stream_operator() cls.add_binary_comparison_operator('<=') cls.add_binary_comparison_operator('==') cls.add_binary_comparison_operator('>=') ## nstime.h (module 'core'): ns3::Time::Time() [constructor] cls.add_constructor([]) ## nstime.h (module 'core'): ns3::Time::Time(ns3::Time const & o) [copy constructor] cls.add_constructor([param('ns3::Time const &', 'o')]) ## nstime.h (module 'core'): ns3::Time::Time(double v) [constructor] cls.add_constructor([param('double', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(int v) [constructor] cls.add_constructor([param('int', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(long int v) [constructor] cls.add_constructor([param('long int', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(long long int v) [constructor] cls.add_constructor([param('long long int', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(unsigned int v) [constructor] cls.add_constructor([param('unsigned int', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(long unsigned int v) [constructor] cls.add_constructor([param('long unsigned int', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(long long unsigned int v) [constructor] cls.add_constructor([param('long long unsigned int', 'v')]) ## nstime.h (module 'core'): ns3::Time::Time(std::string const & s) [constructor] cls.add_constructor([param('std::string const &', 's')]) ## nstime.h (module 'core'): ns3::Time::Time(ns3::int64x64_t const & value) [constructor] cls.add_constructor([param('ns3::int64x64_t const &', 'value')]) ## nstime.h (module 'core'): int ns3::Time::Compare(ns3::Time const & o) const [member function] cls.add_method('Compare', 'int', [param('ns3::Time const &', 'o')], is_const=True) ## nstime.h (module 'core'): static ns3::Time ns3::Time::From(ns3::int64x64_t const & from, ns3::Time::Unit timeUnit) [member function] cls.add_method('From', 'ns3::Time', [param('ns3::int64x64_t const &', 'from'), param('ns3::Time::Unit', 'timeUnit')], is_static=True) ## nstime.h (module 'core'): static ns3::Time ns3::Time::From(ns3::int64x64_t const & value) [member function] cls.add_method('From', 'ns3::Time', [param('ns3::int64x64_t const &', 'value')], is_static=True) ## nstime.h (module 'core'): static ns3::Time ns3::Time::FromDouble(double value, ns3::Time::Unit timeUnit) [member function] cls.add_method('FromDouble', 'ns3::Time', [param('double', 'value'), param('ns3::Time::Unit', 'timeUnit')], is_static=True) ## nstime.h (module 'core'): static ns3::Time ns3::Time::FromInteger(uint64_t value, ns3::Time::Unit timeUnit) [member function] cls.add_method('FromInteger', 'ns3::Time', [param('uint64_t', 'value'), param('ns3::Time::Unit', 'timeUnit')], is_static=True) ## nstime.h (module 'core'): double ns3::Time::GetDouble() const [member function] cls.add_method('GetDouble', 'double', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetFemtoSeconds() const [member function] cls.add_method('GetFemtoSeconds', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetInteger() const [member function] cls.add_method('GetInteger', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetMicroSeconds() const [member function] cls.add_method('GetMicroSeconds', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetMilliSeconds() const [member function] cls.add_method('GetMilliSeconds', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetNanoSeconds() const [member function] cls.add_method('GetNanoSeconds', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetPicoSeconds() const [member function] cls.add_method('GetPicoSeconds', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): static ns3::Time::Unit ns3::Time::GetResolution() [member function] cls.add_method('GetResolution', 'ns3::Time::Unit', [], is_static=True) ## nstime.h (module 'core'): double ns3::Time::GetSeconds() const [member function] cls.add_method('GetSeconds', 'double', [], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::GetTimeStep() const [member function] cls.add_method('GetTimeStep', 'int64_t', [], is_const=True) ## nstime.h (module 'core'): bool ns3::Time::IsNegative() const [member function] cls.add_method('IsNegative', 'bool', [], is_const=True) ## nstime.h (module 'core'): bool ns3::Time::IsPositive() const [member function] cls.add_method('IsPositive', 'bool', [], is_const=True) ## nstime.h (module 'core'): bool ns3::Time::IsStrictlyNegative() const [member function] cls.add_method('IsStrictlyNegative', 'bool', [], is_const=True) ## nstime.h (module 'core'): bool ns3::Time::IsStrictlyPositive() const [member function] cls.add_method('IsStrictlyPositive', 'bool', [], is_const=True) ## nstime.h (module 'core'): bool ns3::Time::IsZero() const [member function] cls.add_method('IsZero', 'bool', [], is_const=True) ## nstime.h (module 'core'): static void ns3::Time::SetResolution(ns3::Time::Unit resolution) [member function] cls.add_method('SetResolution', 'void', [param('ns3::Time::Unit', 'resolution')], is_static=True) ## nstime.h (module 'core'): ns3::int64x64_t ns3::Time::To(ns3::Time::Unit timeUnit) const [member function] cls.add_method('To', 'ns3::int64x64_t', [param('ns3::Time::Unit', 'timeUnit')], is_const=True) ## nstime.h (module 'core'): double ns3::Time::ToDouble(ns3::Time::Unit timeUnit) const [member function] cls.add_method('ToDouble', 'double', [param('ns3::Time::Unit', 'timeUnit')], is_const=True) ## nstime.h (module 'core'): int64_t ns3::Time::ToInteger(ns3::Time::Unit timeUnit) const [member function] cls.add_method('ToInteger', 'int64_t', [param('ns3::Time::Unit', 'timeUnit')], is_const=True) return def register_Ns3TraceSourceAccessor_methods(root_module, cls): ## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor::TraceSourceAccessor(ns3::TraceSourceAccessor const & arg0) [copy constructor] cls.add_constructor([param('ns3::TraceSourceAccessor const &', 'arg0')]) ## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor::TraceSourceAccessor() [constructor] cls.add_constructor([]) ## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::Connect(ns3::ObjectBase * obj, std::string context, ns3::CallbackBase const & cb) const [member function] cls.add_method('Connect', 'bool', [param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')], is_pure_virtual=True, is_const=True, is_virtual=True) ## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::ConnectWithoutContext(ns3::ObjectBase * obj, ns3::CallbackBase const & cb) const [member function] cls.add_method('ConnectWithoutContext', 'bool', [param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('ns3::CallbackBase const &', 'cb')], is_pure_virtual=True, is_const=True, is_virtual=True) ## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::Disconnect(ns3::ObjectBase * obj, std::string context, ns3::CallbackBase const & cb) const [member function] cls.add_method('Disconnect', 'bool', [param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')], is_pure_virtual=True, is_const=True, is_virtual=True) ## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::DisconnectWithoutContext(ns3::ObjectBase * obj, ns3::CallbackBase const & cb) const [member function] cls.add_method('DisconnectWithoutContext', 'bool', [param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('ns3::CallbackBase const &', 'cb')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3Trailer_methods(root_module, cls): cls.add_output_stream_operator() ## trailer.h (module 'network'): ns3::Trailer::Trailer() [constructor] cls.add_constructor([]) ## trailer.h (module 'network'): ns3::Trailer::Trailer(ns3::Trailer const & arg0) [copy constructor] cls.add_constructor([param('ns3::Trailer const &', 'arg0')]) ## trailer.h (module 'network'): uint32_t ns3::Trailer::Deserialize(ns3::Buffer::Iterator end) [member function] cls.add_method('Deserialize', 'uint32_t', [param('ns3::Buffer::Iterator', 'end')], is_pure_virtual=True, is_virtual=True) ## trailer.h (module 'network'): uint32_t ns3::Trailer::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## trailer.h (module 'network'): static ns3::TypeId ns3::Trailer::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## trailer.h (module 'network'): void ns3::Trailer::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_pure_virtual=True, is_const=True, is_virtual=True) ## trailer.h (module 'network'): void ns3::Trailer::Serialize(ns3::Buffer::Iterator start) const [member function] cls.add_method('Serialize', 'void', [param('ns3::Buffer::Iterator', 'start')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3Application_methods(root_module, cls): ## application.h (module 'network'): ns3::Application::Application(ns3::Application const & arg0) [copy constructor] cls.add_constructor([param('ns3::Application const &', 'arg0')]) ## application.h (module 'network'): ns3::Application::Application() [constructor] cls.add_constructor([]) ## application.h (module 'network'): ns3::Ptr<ns3::Node> ns3::Application::GetNode() const [member function] cls.add_method('GetNode', 'ns3::Ptr< ns3::Node >', [], is_const=True) ## application.h (module 'network'): static ns3::TypeId ns3::Application::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## application.h (module 'network'): void ns3::Application::SetNode(ns3::Ptr<ns3::Node> node) [member function] cls.add_method('SetNode', 'void', [param('ns3::Ptr< ns3::Node >', 'node')]) ## application.h (module 'network'): void ns3::Application::SetStartTime(ns3::Time start) [member function] cls.add_method('SetStartTime', 'void', [param('ns3::Time', 'start')]) ## application.h (module 'network'): void ns3::Application::SetStopTime(ns3::Time stop) [member function] cls.add_method('SetStopTime', 'void', [param('ns3::Time', 'stop')]) ## application.h (module 'network'): void ns3::Application::DoDispose() [member function] cls.add_method('DoDispose', 'void', [], visibility='protected', is_virtual=True) ## application.h (module 'network'): void ns3::Application::DoStart() [member function] cls.add_method('DoStart', 'void', [], visibility='protected', is_virtual=True) ## application.h (module 'network'): void ns3::Application::StartApplication() [member function] cls.add_method('StartApplication', 'void', [], visibility='private', is_virtual=True) ## application.h (module 'network'): void ns3::Application::StopApplication() [member function] cls.add_method('StopApplication', 'void', [], visibility='private', is_virtual=True) return def register_Ns3AttributeAccessor_methods(root_module, cls): ## attribute.h (module 'core'): ns3::AttributeAccessor::AttributeAccessor(ns3::AttributeAccessor const & arg0) [copy constructor] cls.add_constructor([param('ns3::AttributeAccessor const &', 'arg0')]) ## attribute.h (module 'core'): ns3::AttributeAccessor::AttributeAccessor() [constructor] cls.add_constructor([]) ## attribute.h (module 'core'): bool ns3::AttributeAccessor::Get(ns3::ObjectBase const * object, ns3::AttributeValue & attribute) const [member function] cls.add_method('Get', 'bool', [param('ns3::ObjectBase const *', 'object'), param('ns3::AttributeValue &', 'attribute')], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeAccessor::HasGetter() const [member function] cls.add_method('HasGetter', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeAccessor::HasSetter() const [member function] cls.add_method('HasSetter', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeAccessor::Set(ns3::ObjectBase * object, ns3::AttributeValue const & value) const [member function] cls.add_method('Set', 'bool', [param('ns3::ObjectBase *', 'object', transfer_ownership=False), param('ns3::AttributeValue const &', 'value')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3AttributeChecker_methods(root_module, cls): ## attribute.h (module 'core'): ns3::AttributeChecker::AttributeChecker(ns3::AttributeChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::AttributeChecker const &', 'arg0')]) ## attribute.h (module 'core'): ns3::AttributeChecker::AttributeChecker() [constructor] cls.add_constructor([]) ## attribute.h (module 'core'): bool ns3::AttributeChecker::Check(ns3::AttributeValue const & value) const [member function] cls.add_method('Check', 'bool', [param('ns3::AttributeValue const &', 'value')], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeChecker::Copy(ns3::AttributeValue const & source, ns3::AttributeValue & destination) const [member function] cls.add_method('Copy', 'bool', [param('ns3::AttributeValue const &', 'source'), param('ns3::AttributeValue &', 'destination')], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeChecker::Create() const [member function] cls.add_method('Create', 'ns3::Ptr< ns3::AttributeValue >', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeChecker::CreateValidValue(ns3::AttributeValue const & value) const [member function] cls.add_method('CreateValidValue', 'ns3::Ptr< ns3::AttributeValue >', [param('ns3::AttributeValue const &', 'value')], is_const=True) ## attribute.h (module 'core'): std::string ns3::AttributeChecker::GetUnderlyingTypeInformation() const [member function] cls.add_method('GetUnderlyingTypeInformation', 'std::string', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): std::string ns3::AttributeChecker::GetValueTypeName() const [member function] cls.add_method('GetValueTypeName', 'std::string', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeChecker::HasUnderlyingTypeInformation() const [member function] cls.add_method('HasUnderlyingTypeInformation', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3AttributeValue_methods(root_module, cls): ## attribute.h (module 'core'): ns3::AttributeValue::AttributeValue(ns3::AttributeValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::AttributeValue const &', 'arg0')]) ## attribute.h (module 'core'): ns3::AttributeValue::AttributeValue() [constructor] cls.add_constructor([]) ## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## attribute.h (module 'core'): bool ns3::AttributeValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_pure_virtual=True, is_virtual=True) ## attribute.h (module 'core'): std::string ns3::AttributeValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3BooleanChecker_methods(root_module, cls): ## boolean.h (module 'core'): ns3::BooleanChecker::BooleanChecker() [constructor] cls.add_constructor([]) ## boolean.h (module 'core'): ns3::BooleanChecker::BooleanChecker(ns3::BooleanChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::BooleanChecker const &', 'arg0')]) return def register_Ns3BooleanValue_methods(root_module, cls): cls.add_output_stream_operator() ## boolean.h (module 'core'): ns3::BooleanValue::BooleanValue(ns3::BooleanValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::BooleanValue const &', 'arg0')]) ## boolean.h (module 'core'): ns3::BooleanValue::BooleanValue() [constructor] cls.add_constructor([]) ## boolean.h (module 'core'): ns3::BooleanValue::BooleanValue(bool value) [constructor] cls.add_constructor([param('bool', 'value')]) ## boolean.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::BooleanValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## boolean.h (module 'core'): bool ns3::BooleanValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## boolean.h (module 'core'): bool ns3::BooleanValue::Get() const [member function] cls.add_method('Get', 'bool', [], is_const=True) ## boolean.h (module 'core'): std::string ns3::BooleanValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## boolean.h (module 'core'): void ns3::BooleanValue::Set(bool value) [member function] cls.add_method('Set', 'void', [param('bool', 'value')]) return def register_Ns3CallbackChecker_methods(root_module, cls): ## callback.h (module 'core'): ns3::CallbackChecker::CallbackChecker() [constructor] cls.add_constructor([]) ## callback.h (module 'core'): ns3::CallbackChecker::CallbackChecker(ns3::CallbackChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::CallbackChecker const &', 'arg0')]) return def register_Ns3CallbackImplBase_methods(root_module, cls): ## callback.h (module 'core'): ns3::CallbackImplBase::CallbackImplBase() [constructor] cls.add_constructor([]) ## callback.h (module 'core'): ns3::CallbackImplBase::CallbackImplBase(ns3::CallbackImplBase const & arg0) [copy constructor] cls.add_constructor([param('ns3::CallbackImplBase const &', 'arg0')]) ## callback.h (module 'core'): bool ns3::CallbackImplBase::IsEqual(ns3::Ptr<ns3::CallbackImplBase const> other) const [member function] cls.add_method('IsEqual', 'bool', [param('ns3::Ptr< ns3::CallbackImplBase const >', 'other')], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3CallbackValue_methods(root_module, cls): ## callback.h (module 'core'): ns3::CallbackValue::CallbackValue(ns3::CallbackValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::CallbackValue const &', 'arg0')]) ## callback.h (module 'core'): ns3::CallbackValue::CallbackValue() [constructor] cls.add_constructor([]) ## callback.h (module 'core'): ns3::CallbackValue::CallbackValue(ns3::CallbackBase const & base) [constructor] cls.add_constructor([param('ns3::CallbackBase const &', 'base')]) ## callback.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::CallbackValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## callback.h (module 'core'): bool ns3::CallbackValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## callback.h (module 'core'): std::string ns3::CallbackValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## callback.h (module 'core'): void ns3::CallbackValue::Set(ns3::CallbackBase base) [member function] cls.add_method('Set', 'void', [param('ns3::CallbackBase', 'base')]) return def register_Ns3Channel_methods(root_module, cls): ## channel.h (module 'network'): ns3::Channel::Channel(ns3::Channel const & arg0) [copy constructor] cls.add_constructor([param('ns3::Channel const &', 'arg0')]) ## channel.h (module 'network'): ns3::Channel::Channel() [constructor] cls.add_constructor([]) ## channel.h (module 'network'): ns3::Ptr<ns3::NetDevice> ns3::Channel::GetDevice(uint32_t i) const [member function] cls.add_method('GetDevice', 'ns3::Ptr< ns3::NetDevice >', [param('uint32_t', 'i')], is_pure_virtual=True, is_const=True, is_virtual=True) ## channel.h (module 'network'): uint32_t ns3::Channel::GetId() const [member function] cls.add_method('GetId', 'uint32_t', [], is_const=True) ## channel.h (module 'network'): uint32_t ns3::Channel::GetNDevices() const [member function] cls.add_method('GetNDevices', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## channel.h (module 'network'): static ns3::TypeId ns3::Channel::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) return def register_Ns3DataRateChecker_methods(root_module, cls): ## data-rate.h (module 'network'): ns3::DataRateChecker::DataRateChecker() [constructor] cls.add_constructor([]) ## data-rate.h (module 'network'): ns3::DataRateChecker::DataRateChecker(ns3::DataRateChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::DataRateChecker const &', 'arg0')]) return def register_Ns3DataRateValue_methods(root_module, cls): ## data-rate.h (module 'network'): ns3::DataRateValue::DataRateValue() [constructor] cls.add_constructor([]) ## data-rate.h (module 'network'): ns3::DataRateValue::DataRateValue(ns3::DataRateValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::DataRateValue const &', 'arg0')]) ## data-rate.h (module 'network'): ns3::DataRateValue::DataRateValue(ns3::DataRate const & value) [constructor] cls.add_constructor([param('ns3::DataRate const &', 'value')]) ## data-rate.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::DataRateValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## data-rate.h (module 'network'): bool ns3::DataRateValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## data-rate.h (module 'network'): ns3::DataRate ns3::DataRateValue::Get() const [member function] cls.add_method('Get', 'ns3::DataRate', [], is_const=True) ## data-rate.h (module 'network'): std::string ns3::DataRateValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## data-rate.h (module 'network'): void ns3::DataRateValue::Set(ns3::DataRate const & value) [member function] cls.add_method('Set', 'void', [param('ns3::DataRate const &', 'value')]) return def register_Ns3DropTailQueue_methods(root_module, cls): ## drop-tail-queue.h (module 'network'): ns3::DropTailQueue::DropTailQueue(ns3::DropTailQueue const & arg0) [copy constructor] cls.add_constructor([param('ns3::DropTailQueue const &', 'arg0')]) ## drop-tail-queue.h (module 'network'): ns3::DropTailQueue::DropTailQueue() [constructor] cls.add_constructor([]) ## drop-tail-queue.h (module 'network'): ns3::Queue::QueueMode ns3::DropTailQueue::GetMode() [member function] cls.add_method('GetMode', 'ns3::Queue::QueueMode', []) ## drop-tail-queue.h (module 'network'): static ns3::TypeId ns3::DropTailQueue::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## drop-tail-queue.h (module 'network'): void ns3::DropTailQueue::SetMode(ns3::Queue::QueueMode mode) [member function] cls.add_method('SetMode', 'void', [param('ns3::Queue::QueueMode', 'mode')]) ## drop-tail-queue.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::DropTailQueue::DoDequeue() [member function] cls.add_method('DoDequeue', 'ns3::Ptr< ns3::Packet >', [], visibility='private', is_virtual=True) ## drop-tail-queue.h (module 'network'): bool ns3::DropTailQueue::DoEnqueue(ns3::Ptr<ns3::Packet> p) [member function] cls.add_method('DoEnqueue', 'bool', [param('ns3::Ptr< ns3::Packet >', 'p')], visibility='private', is_virtual=True) ## drop-tail-queue.h (module 'network'): ns3::Ptr<const ns3::Packet> ns3::DropTailQueue::DoPeek() const [member function] cls.add_method('DoPeek', 'ns3::Ptr< ns3::Packet const >', [], is_const=True, visibility='private', is_virtual=True) return def register_Ns3EmptyAttributeValue_methods(root_module, cls): ## attribute.h (module 'core'): ns3::EmptyAttributeValue::EmptyAttributeValue(ns3::EmptyAttributeValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::EmptyAttributeValue const &', 'arg0')]) ## attribute.h (module 'core'): ns3::EmptyAttributeValue::EmptyAttributeValue() [constructor] cls.add_constructor([]) ## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::EmptyAttributeValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, visibility='private', is_virtual=True) ## attribute.h (module 'core'): bool ns3::EmptyAttributeValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], visibility='private', is_virtual=True) ## attribute.h (module 'core'): std::string ns3::EmptyAttributeValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, visibility='private', is_virtual=True) return def register_Ns3ErrorModel_methods(root_module, cls): ## error-model.h (module 'network'): ns3::ErrorModel::ErrorModel(ns3::ErrorModel const & arg0) [copy constructor] cls.add_constructor([param('ns3::ErrorModel const &', 'arg0')]) ## error-model.h (module 'network'): ns3::ErrorModel::ErrorModel() [constructor] cls.add_constructor([]) ## error-model.h (module 'network'): void ns3::ErrorModel::Disable() [member function] cls.add_method('Disable', 'void', []) ## error-model.h (module 'network'): void ns3::ErrorModel::Enable() [member function] cls.add_method('Enable', 'void', []) ## error-model.h (module 'network'): static ns3::TypeId ns3::ErrorModel::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## error-model.h (module 'network'): bool ns3::ErrorModel::IsCorrupt(ns3::Ptr<ns3::Packet> pkt) [member function] cls.add_method('IsCorrupt', 'bool', [param('ns3::Ptr< ns3::Packet >', 'pkt')]) ## error-model.h (module 'network'): bool ns3::ErrorModel::IsEnabled() const [member function] cls.add_method('IsEnabled', 'bool', [], is_const=True) ## error-model.h (module 'network'): void ns3::ErrorModel::Reset() [member function] cls.add_method('Reset', 'void', []) ## error-model.h (module 'network'): bool ns3::ErrorModel::DoCorrupt(ns3::Ptr<ns3::Packet> arg0) [member function] cls.add_method('DoCorrupt', 'bool', [param('ns3::Ptr< ns3::Packet >', 'arg0')], is_pure_virtual=True, visibility='private', is_virtual=True) ## error-model.h (module 'network'): void ns3::ErrorModel::DoReset() [member function] cls.add_method('DoReset', 'void', [], is_pure_virtual=True, visibility='private', is_virtual=True) return def register_Ns3EthernetHeader_methods(root_module, cls): ## ethernet-header.h (module 'network'): ns3::EthernetHeader::EthernetHeader(ns3::EthernetHeader const & arg0) [copy constructor] cls.add_constructor([param('ns3::EthernetHeader const &', 'arg0')]) ## ethernet-header.h (module 'network'): ns3::EthernetHeader::EthernetHeader(bool hasPreamble) [constructor] cls.add_constructor([param('bool', 'hasPreamble')]) ## ethernet-header.h (module 'network'): ns3::EthernetHeader::EthernetHeader() [constructor] cls.add_constructor([]) ## ethernet-header.h (module 'network'): uint32_t ns3::EthernetHeader::Deserialize(ns3::Buffer::Iterator start) [member function] cls.add_method('Deserialize', 'uint32_t', [param('ns3::Buffer::Iterator', 'start')], is_virtual=True) ## ethernet-header.h (module 'network'): ns3::Mac48Address ns3::EthernetHeader::GetDestination() const [member function] cls.add_method('GetDestination', 'ns3::Mac48Address', [], is_const=True) ## ethernet-header.h (module 'network'): uint32_t ns3::EthernetHeader::GetHeaderSize() const [member function] cls.add_method('GetHeaderSize', 'uint32_t', [], is_const=True) ## ethernet-header.h (module 'network'): ns3::TypeId ns3::EthernetHeader::GetInstanceTypeId() const [member function] cls.add_method('GetInstanceTypeId', 'ns3::TypeId', [], is_const=True, is_virtual=True) ## ethernet-header.h (module 'network'): uint16_t ns3::EthernetHeader::GetLengthType() const [member function] cls.add_method('GetLengthType', 'uint16_t', [], is_const=True) ## ethernet-header.h (module 'network'): ns3::ethernet_header_t ns3::EthernetHeader::GetPacketType() const [member function] cls.add_method('GetPacketType', 'ns3::ethernet_header_t', [], is_const=True) ## ethernet-header.h (module 'network'): uint64_t ns3::EthernetHeader::GetPreambleSfd() const [member function] cls.add_method('GetPreambleSfd', 'uint64_t', [], is_const=True) ## ethernet-header.h (module 'network'): uint32_t ns3::EthernetHeader::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True, is_virtual=True) ## ethernet-header.h (module 'network'): ns3::Mac48Address ns3::EthernetHeader::GetSource() const [member function] cls.add_method('GetSource', 'ns3::Mac48Address', [], is_const=True) ## ethernet-header.h (module 'network'): static ns3::TypeId ns3::EthernetHeader::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## ethernet-header.h (module 'network'): void ns3::EthernetHeader::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True, is_virtual=True) ## ethernet-header.h (module 'network'): void ns3::EthernetHeader::Serialize(ns3::Buffer::Iterator start) const [member function] cls.add_method('Serialize', 'void', [param('ns3::Buffer::Iterator', 'start')], is_const=True, is_virtual=True) ## ethernet-header.h (module 'network'): void ns3::EthernetHeader::SetDestination(ns3::Mac48Address destination) [member function] cls.add_method('SetDestination', 'void', [param('ns3::Mac48Address', 'destination')]) ## ethernet-header.h (module 'network'): void ns3::EthernetHeader::SetLengthType(uint16_t size) [member function] cls.add_method('SetLengthType', 'void', [param('uint16_t', 'size')]) ## ethernet-header.h (module 'network'): void ns3::EthernetHeader::SetPreambleSfd(uint64_t preambleSfd) [member function] cls.add_method('SetPreambleSfd', 'void', [param('uint64_t', 'preambleSfd')]) ## ethernet-header.h (module 'network'): void ns3::EthernetHeader::SetSource(ns3::Mac48Address source) [member function] cls.add_method('SetSource', 'void', [param('ns3::Mac48Address', 'source')]) return def register_Ns3EthernetTrailer_methods(root_module, cls): ## ethernet-trailer.h (module 'network'): ns3::EthernetTrailer::EthernetTrailer(ns3::EthernetTrailer const & arg0) [copy constructor] cls.add_constructor([param('ns3::EthernetTrailer const &', 'arg0')]) ## ethernet-trailer.h (module 'network'): ns3::EthernetTrailer::EthernetTrailer() [constructor] cls.add_constructor([]) ## ethernet-trailer.h (module 'network'): void ns3::EthernetTrailer::CalcFcs(ns3::Ptr<const ns3::Packet> p) [member function] cls.add_method('CalcFcs', 'void', [param('ns3::Ptr< ns3::Packet const >', 'p')]) ## ethernet-trailer.h (module 'network'): bool ns3::EthernetTrailer::CheckFcs(ns3::Ptr<const ns3::Packet> p) const [member function] cls.add_method('CheckFcs', 'bool', [param('ns3::Ptr< ns3::Packet const >', 'p')], is_const=True) ## ethernet-trailer.h (module 'network'): uint32_t ns3::EthernetTrailer::Deserialize(ns3::Buffer::Iterator end) [member function] cls.add_method('Deserialize', 'uint32_t', [param('ns3::Buffer::Iterator', 'end')], is_virtual=True) ## ethernet-trailer.h (module 'network'): void ns3::EthernetTrailer::EnableFcs(bool enable) [member function] cls.add_method('EnableFcs', 'void', [param('bool', 'enable')]) ## ethernet-trailer.h (module 'network'): uint32_t ns3::EthernetTrailer::GetFcs() [member function] cls.add_method('GetFcs', 'uint32_t', []) ## ethernet-trailer.h (module 'network'): ns3::TypeId ns3::EthernetTrailer::GetInstanceTypeId() const [member function] cls.add_method('GetInstanceTypeId', 'ns3::TypeId', [], is_const=True, is_virtual=True) ## ethernet-trailer.h (module 'network'): uint32_t ns3::EthernetTrailer::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True, is_virtual=True) ## ethernet-trailer.h (module 'network'): uint32_t ns3::EthernetTrailer::GetTrailerSize() const [member function] cls.add_method('GetTrailerSize', 'uint32_t', [], is_const=True) ## ethernet-trailer.h (module 'network'): static ns3::TypeId ns3::EthernetTrailer::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## ethernet-trailer.h (module 'network'): void ns3::EthernetTrailer::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True, is_virtual=True) ## ethernet-trailer.h (module 'network'): void ns3::EthernetTrailer::Serialize(ns3::Buffer::Iterator end) const [member function] cls.add_method('Serialize', 'void', [param('ns3::Buffer::Iterator', 'end')], is_const=True, is_virtual=True) ## ethernet-trailer.h (module 'network'): void ns3::EthernetTrailer::SetFcs(uint32_t fcs) [member function] cls.add_method('SetFcs', 'void', [param('uint32_t', 'fcs')]) return def register_Ns3EventImpl_methods(root_module, cls): ## event-impl.h (module 'core'): ns3::EventImpl::EventImpl(ns3::EventImpl const & arg0) [copy constructor] cls.add_constructor([param('ns3::EventImpl const &', 'arg0')]) ## event-impl.h (module 'core'): ns3::EventImpl::EventImpl() [constructor] cls.add_constructor([]) ## event-impl.h (module 'core'): void ns3::EventImpl::Cancel() [member function] cls.add_method('Cancel', 'void', []) ## event-impl.h (module 'core'): void ns3::EventImpl::Invoke() [member function] cls.add_method('Invoke', 'void', []) ## event-impl.h (module 'core'): bool ns3::EventImpl::IsCancelled() [member function] cls.add_method('IsCancelled', 'bool', []) ## event-impl.h (module 'core'): void ns3::EventImpl::Notify() [member function] cls.add_method('Notify', 'void', [], is_pure_virtual=True, visibility='protected', is_virtual=True) return def register_Ns3Ipv4AddressChecker_methods(root_module, cls): ## ipv4-address.h (module 'network'): ns3::Ipv4AddressChecker::Ipv4AddressChecker() [constructor] cls.add_constructor([]) ## ipv4-address.h (module 'network'): ns3::Ipv4AddressChecker::Ipv4AddressChecker(ns3::Ipv4AddressChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4AddressChecker const &', 'arg0')]) return def register_Ns3Ipv4AddressValue_methods(root_module, cls): ## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue::Ipv4AddressValue() [constructor] cls.add_constructor([]) ## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue::Ipv4AddressValue(ns3::Ipv4AddressValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4AddressValue const &', 'arg0')]) ## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue::Ipv4AddressValue(ns3::Ipv4Address const & value) [constructor] cls.add_constructor([param('ns3::Ipv4Address const &', 'value')]) ## ipv4-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv4AddressValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4AddressValue::Get() const [member function] cls.add_method('Get', 'ns3::Ipv4Address', [], is_const=True) ## ipv4-address.h (module 'network'): std::string ns3::Ipv4AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4AddressValue::Set(ns3::Ipv4Address const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Ipv4Address const &', 'value')]) return def register_Ns3Ipv4MaskChecker_methods(root_module, cls): ## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker::Ipv4MaskChecker() [constructor] cls.add_constructor([]) ## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker::Ipv4MaskChecker(ns3::Ipv4MaskChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4MaskChecker const &', 'arg0')]) return def register_Ns3Ipv4MaskValue_methods(root_module, cls): ## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue::Ipv4MaskValue() [constructor] cls.add_constructor([]) ## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue::Ipv4MaskValue(ns3::Ipv4MaskValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv4MaskValue const &', 'arg0')]) ## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue::Ipv4MaskValue(ns3::Ipv4Mask const & value) [constructor] cls.add_constructor([param('ns3::Ipv4Mask const &', 'value')]) ## ipv4-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv4MaskValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## ipv4-address.h (module 'network'): bool ns3::Ipv4MaskValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## ipv4-address.h (module 'network'): ns3::Ipv4Mask ns3::Ipv4MaskValue::Get() const [member function] cls.add_method('Get', 'ns3::Ipv4Mask', [], is_const=True) ## ipv4-address.h (module 'network'): std::string ns3::Ipv4MaskValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## ipv4-address.h (module 'network'): void ns3::Ipv4MaskValue::Set(ns3::Ipv4Mask const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Ipv4Mask const &', 'value')]) return def register_Ns3Ipv6AddressChecker_methods(root_module, cls): ## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker::Ipv6AddressChecker() [constructor] cls.add_constructor([]) ## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker::Ipv6AddressChecker(ns3::Ipv6AddressChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv6AddressChecker const &', 'arg0')]) return def register_Ns3Ipv6AddressValue_methods(root_module, cls): ## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue::Ipv6AddressValue() [constructor] cls.add_constructor([]) ## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue::Ipv6AddressValue(ns3::Ipv6AddressValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv6AddressValue const &', 'arg0')]) ## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue::Ipv6AddressValue(ns3::Ipv6Address const & value) [constructor] cls.add_constructor([param('ns3::Ipv6Address const &', 'value')]) ## ipv6-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv6AddressValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## ipv6-address.h (module 'network'): ns3::Ipv6Address ns3::Ipv6AddressValue::Get() const [member function] cls.add_method('Get', 'ns3::Ipv6Address', [], is_const=True) ## ipv6-address.h (module 'network'): std::string ns3::Ipv6AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6AddressValue::Set(ns3::Ipv6Address const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Ipv6Address const &', 'value')]) return def register_Ns3Ipv6PrefixChecker_methods(root_module, cls): ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker::Ipv6PrefixChecker() [constructor] cls.add_constructor([]) ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker::Ipv6PrefixChecker(ns3::Ipv6PrefixChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv6PrefixChecker const &', 'arg0')]) return def register_Ns3Ipv6PrefixValue_methods(root_module, cls): ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue::Ipv6PrefixValue() [constructor] cls.add_constructor([]) ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue::Ipv6PrefixValue(ns3::Ipv6PrefixValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::Ipv6PrefixValue const &', 'arg0')]) ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue::Ipv6PrefixValue(ns3::Ipv6Prefix const & value) [constructor] cls.add_constructor([param('ns3::Ipv6Prefix const &', 'value')]) ## ipv6-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv6PrefixValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## ipv6-address.h (module 'network'): bool ns3::Ipv6PrefixValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix ns3::Ipv6PrefixValue::Get() const [member function] cls.add_method('Get', 'ns3::Ipv6Prefix', [], is_const=True) ## ipv6-address.h (module 'network'): std::string ns3::Ipv6PrefixValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## ipv6-address.h (module 'network'): void ns3::Ipv6PrefixValue::Set(ns3::Ipv6Prefix const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Ipv6Prefix const &', 'value')]) return def register_Ns3ListErrorModel_methods(root_module, cls): ## error-model.h (module 'network'): ns3::ListErrorModel::ListErrorModel(ns3::ListErrorModel const & arg0) [copy constructor] cls.add_constructor([param('ns3::ListErrorModel const &', 'arg0')]) ## error-model.h (module 'network'): ns3::ListErrorModel::ListErrorModel() [constructor] cls.add_constructor([]) ## error-model.h (module 'network'): std::list<unsigned int, std::allocator<unsigned int> > ns3::ListErrorModel::GetList() const [member function] cls.add_method('GetList', 'std::list< unsigned int >', [], is_const=True) ## error-model.h (module 'network'): static ns3::TypeId ns3::ListErrorModel::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## error-model.h (module 'network'): void ns3::ListErrorModel::SetList(std::list<unsigned int, std::allocator<unsigned int> > const & packetlist) [member function] cls.add_method('SetList', 'void', [param('std::list< unsigned int > const &', 'packetlist')]) ## error-model.h (module 'network'): bool ns3::ListErrorModel::DoCorrupt(ns3::Ptr<ns3::Packet> p) [member function] cls.add_method('DoCorrupt', 'bool', [param('ns3::Ptr< ns3::Packet >', 'p')], visibility='private', is_virtual=True) ## error-model.h (module 'network'): void ns3::ListErrorModel::DoReset() [member function] cls.add_method('DoReset', 'void', [], visibility='private', is_virtual=True) return def register_Ns3Mac48AddressChecker_methods(root_module, cls): ## mac48-address.h (module 'network'): ns3::Mac48AddressChecker::Mac48AddressChecker() [constructor] cls.add_constructor([]) ## mac48-address.h (module 'network'): ns3::Mac48AddressChecker::Mac48AddressChecker(ns3::Mac48AddressChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::Mac48AddressChecker const &', 'arg0')]) return def register_Ns3Mac48AddressValue_methods(root_module, cls): ## mac48-address.h (module 'network'): ns3::Mac48AddressValue::Mac48AddressValue() [constructor] cls.add_constructor([]) ## mac48-address.h (module 'network'): ns3::Mac48AddressValue::Mac48AddressValue(ns3::Mac48AddressValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::Mac48AddressValue const &', 'arg0')]) ## mac48-address.h (module 'network'): ns3::Mac48AddressValue::Mac48AddressValue(ns3::Mac48Address const & value) [constructor] cls.add_constructor([param('ns3::Mac48Address const &', 'value')]) ## mac48-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Mac48AddressValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## mac48-address.h (module 'network'): bool ns3::Mac48AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## mac48-address.h (module 'network'): ns3::Mac48Address ns3::Mac48AddressValue::Get() const [member function] cls.add_method('Get', 'ns3::Mac48Address', [], is_const=True) ## mac48-address.h (module 'network'): std::string ns3::Mac48AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## mac48-address.h (module 'network'): void ns3::Mac48AddressValue::Set(ns3::Mac48Address const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Mac48Address const &', 'value')]) return def register_Ns3NetDevice_methods(root_module, cls): ## net-device.h (module 'network'): ns3::NetDevice::NetDevice() [constructor] cls.add_constructor([]) ## net-device.h (module 'network'): ns3::NetDevice::NetDevice(ns3::NetDevice const & arg0) [copy constructor] cls.add_constructor([param('ns3::NetDevice const &', 'arg0')]) ## net-device.h (module 'network'): void ns3::NetDevice::AddLinkChangeCallback(ns3::Callback<void,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function] cls.add_method('AddLinkChangeCallback', 'void', [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetAddress() const [member function] cls.add_method('GetAddress', 'ns3::Address', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetBroadcast() const [member function] cls.add_method('GetBroadcast', 'ns3::Address', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Ptr<ns3::Channel> ns3::NetDevice::GetChannel() const [member function] cls.add_method('GetChannel', 'ns3::Ptr< ns3::Channel >', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): uint32_t ns3::NetDevice::GetIfIndex() const [member function] cls.add_method('GetIfIndex', 'uint32_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): uint16_t ns3::NetDevice::GetMtu() const [member function] cls.add_method('GetMtu', 'uint16_t', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetMulticast(ns3::Ipv4Address multicastGroup) const [member function] cls.add_method('GetMulticast', 'ns3::Address', [param('ns3::Ipv4Address', 'multicastGroup')], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetMulticast(ns3::Ipv6Address addr) const [member function] cls.add_method('GetMulticast', 'ns3::Address', [param('ns3::Ipv6Address', 'addr')], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): ns3::Ptr<ns3::Node> ns3::NetDevice::GetNode() const [member function] cls.add_method('GetNode', 'ns3::Ptr< ns3::Node >', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): static ns3::TypeId ns3::NetDevice::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## net-device.h (module 'network'): bool ns3::NetDevice::IsBridge() const [member function] cls.add_method('IsBridge', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::IsBroadcast() const [member function] cls.add_method('IsBroadcast', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::IsLinkUp() const [member function] cls.add_method('IsLinkUp', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::IsMulticast() const [member function] cls.add_method('IsMulticast', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::IsPointToPoint() const [member function] cls.add_method('IsPointToPoint', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::NeedsArp() const [member function] cls.add_method('NeedsArp', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::Send(ns3::Ptr<ns3::Packet> packet, ns3::Address const & dest, uint16_t protocolNumber) [member function] cls.add_method('Send', 'bool', [param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::SendFrom(ns3::Ptr<ns3::Packet> packet, ns3::Address const & source, ns3::Address const & dest, uint16_t protocolNumber) [member function] cls.add_method('SendFrom', 'bool', [param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'source'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDevice::SetAddress(ns3::Address address) [member function] cls.add_method('SetAddress', 'void', [param('ns3::Address', 'address')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDevice::SetIfIndex(uint32_t const index) [member function] cls.add_method('SetIfIndex', 'void', [param('uint32_t const', 'index')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::SetMtu(uint16_t const mtu) [member function] cls.add_method('SetMtu', 'bool', [param('uint16_t const', 'mtu')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDevice::SetNode(ns3::Ptr<ns3::Node> node) [member function] cls.add_method('SetNode', 'void', [param('ns3::Ptr< ns3::Node >', 'node')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDevice::SetPromiscReceiveCallback(ns3::Callback<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty> cb) [member function] cls.add_method('SetPromiscReceiveCallback', 'void', [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', 'cb')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): void ns3::NetDevice::SetReceiveCallback(ns3::Callback<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> cb) [member function] cls.add_method('SetReceiveCallback', 'void', [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'cb')], is_pure_virtual=True, is_virtual=True) ## net-device.h (module 'network'): bool ns3::NetDevice::SupportsSendFrom() const [member function] cls.add_method('SupportsSendFrom', 'bool', [], is_pure_virtual=True, is_const=True, is_virtual=True) return def register_Ns3NixVector_methods(root_module, cls): cls.add_output_stream_operator() ## nix-vector.h (module 'network'): ns3::NixVector::NixVector() [constructor] cls.add_constructor([]) ## nix-vector.h (module 'network'): ns3::NixVector::NixVector(ns3::NixVector const & o) [copy constructor] cls.add_constructor([param('ns3::NixVector const &', 'o')]) ## nix-vector.h (module 'network'): void ns3::NixVector::AddNeighborIndex(uint32_t newBits, uint32_t numberOfBits) [member function] cls.add_method('AddNeighborIndex', 'void', [param('uint32_t', 'newBits'), param('uint32_t', 'numberOfBits')]) ## nix-vector.h (module 'network'): uint32_t ns3::NixVector::BitCount(uint32_t numberOfNeighbors) const [member function] cls.add_method('BitCount', 'uint32_t', [param('uint32_t', 'numberOfNeighbors')], is_const=True) ## nix-vector.h (module 'network'): ns3::Ptr<ns3::NixVector> ns3::NixVector::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::NixVector >', [], is_const=True) ## nix-vector.h (module 'network'): uint32_t ns3::NixVector::Deserialize(uint32_t const * buffer, uint32_t size) [member function] cls.add_method('Deserialize', 'uint32_t', [param('uint32_t const *', 'buffer'), param('uint32_t', 'size')]) ## nix-vector.h (module 'network'): uint32_t ns3::NixVector::ExtractNeighborIndex(uint32_t numberOfBits) [member function] cls.add_method('ExtractNeighborIndex', 'uint32_t', [param('uint32_t', 'numberOfBits')]) ## nix-vector.h (module 'network'): uint32_t ns3::NixVector::GetRemainingBits() [member function] cls.add_method('GetRemainingBits', 'uint32_t', []) ## nix-vector.h (module 'network'): uint32_t ns3::NixVector::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True) ## nix-vector.h (module 'network'): uint32_t ns3::NixVector::Serialize(uint32_t * buffer, uint32_t maxSize) const [member function] cls.add_method('Serialize', 'uint32_t', [param('uint32_t *', 'buffer'), param('uint32_t', 'maxSize')], is_const=True) return def register_Ns3Node_methods(root_module, cls): ## node.h (module 'network'): ns3::Node::Node(ns3::Node const & arg0) [copy constructor] cls.add_constructor([param('ns3::Node const &', 'arg0')]) ## node.h (module 'network'): ns3::Node::Node() [constructor] cls.add_constructor([]) ## node.h (module 'network'): ns3::Node::Node(uint32_t systemId) [constructor] cls.add_constructor([param('uint32_t', 'systemId')]) ## node.h (module 'network'): uint32_t ns3::Node::AddApplication(ns3::Ptr<ns3::Application> application) [member function] cls.add_method('AddApplication', 'uint32_t', [param('ns3::Ptr< ns3::Application >', 'application')]) ## node.h (module 'network'): uint32_t ns3::Node::AddDevice(ns3::Ptr<ns3::NetDevice> device) [member function] cls.add_method('AddDevice', 'uint32_t', [param('ns3::Ptr< ns3::NetDevice >', 'device')]) ## node.h (module 'network'): static bool ns3::Node::ChecksumEnabled() [member function] cls.add_method('ChecksumEnabled', 'bool', [], is_static=True) ## node.h (module 'network'): ns3::Ptr<ns3::Application> ns3::Node::GetApplication(uint32_t index) const [member function] cls.add_method('GetApplication', 'ns3::Ptr< ns3::Application >', [param('uint32_t', 'index')], is_const=True) ## node.h (module 'network'): ns3::Ptr<ns3::NetDevice> ns3::Node::GetDevice(uint32_t index) const [member function] cls.add_method('GetDevice', 'ns3::Ptr< ns3::NetDevice >', [param('uint32_t', 'index')], is_const=True) ## node.h (module 'network'): uint32_t ns3::Node::GetId() const [member function] cls.add_method('GetId', 'uint32_t', [], is_const=True) ## node.h (module 'network'): uint32_t ns3::Node::GetNApplications() const [member function] cls.add_method('GetNApplications', 'uint32_t', [], is_const=True) ## node.h (module 'network'): uint32_t ns3::Node::GetNDevices() const [member function] cls.add_method('GetNDevices', 'uint32_t', [], is_const=True) ## node.h (module 'network'): uint32_t ns3::Node::GetSystemId() const [member function] cls.add_method('GetSystemId', 'uint32_t', [], is_const=True) ## node.h (module 'network'): static ns3::TypeId ns3::Node::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## node.h (module 'network'): void ns3::Node::RegisterDeviceAdditionListener(ns3::Callback<void,ns3::Ptr<ns3::NetDevice>,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> listener) [member function] cls.add_method('RegisterDeviceAdditionListener', 'void', [param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'listener')]) ## node.h (module 'network'): void ns3::Node::RegisterProtocolHandler(ns3::Callback<void, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty> handler, uint16_t protocolType, ns3::Ptr<ns3::NetDevice> device, bool promiscuous=false) [member function] cls.add_method('RegisterProtocolHandler', 'void', [param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', 'handler'), param('uint16_t', 'protocolType'), param('ns3::Ptr< ns3::NetDevice >', 'device'), param('bool', 'promiscuous', default_value='false')]) ## node.h (module 'network'): void ns3::Node::UnregisterDeviceAdditionListener(ns3::Callback<void,ns3::Ptr<ns3::NetDevice>,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> listener) [member function] cls.add_method('UnregisterDeviceAdditionListener', 'void', [param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'listener')]) ## node.h (module 'network'): void ns3::Node::UnregisterProtocolHandler(ns3::Callback<void, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty> handler) [member function] cls.add_method('UnregisterProtocolHandler', 'void', [param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', 'handler')]) ## node.h (module 'network'): void ns3::Node::DoDispose() [member function] cls.add_method('DoDispose', 'void', [], visibility='protected', is_virtual=True) ## node.h (module 'network'): void ns3::Node::DoStart() [member function] cls.add_method('DoStart', 'void', [], visibility='protected', is_virtual=True) return def register_Ns3ObjectFactoryChecker_methods(root_module, cls): ## object-factory.h (module 'core'): ns3::ObjectFactoryChecker::ObjectFactoryChecker() [constructor] cls.add_constructor([]) ## object-factory.h (module 'core'): ns3::ObjectFactoryChecker::ObjectFactoryChecker(ns3::ObjectFactoryChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::ObjectFactoryChecker const &', 'arg0')]) return def register_Ns3ObjectFactoryValue_methods(root_module, cls): ## object-factory.h (module 'core'): ns3::ObjectFactoryValue::ObjectFactoryValue() [constructor] cls.add_constructor([]) ## object-factory.h (module 'core'): ns3::ObjectFactoryValue::ObjectFactoryValue(ns3::ObjectFactoryValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::ObjectFactoryValue const &', 'arg0')]) ## object-factory.h (module 'core'): ns3::ObjectFactoryValue::ObjectFactoryValue(ns3::ObjectFactory const & value) [constructor] cls.add_constructor([param('ns3::ObjectFactory const &', 'value')]) ## object-factory.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::ObjectFactoryValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## object-factory.h (module 'core'): bool ns3::ObjectFactoryValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## object-factory.h (module 'core'): ns3::ObjectFactory ns3::ObjectFactoryValue::Get() const [member function] cls.add_method('Get', 'ns3::ObjectFactory', [], is_const=True) ## object-factory.h (module 'core'): std::string ns3::ObjectFactoryValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## object-factory.h (module 'core'): void ns3::ObjectFactoryValue::Set(ns3::ObjectFactory const & value) [member function] cls.add_method('Set', 'void', [param('ns3::ObjectFactory const &', 'value')]) return def register_Ns3OutputStreamWrapper_methods(root_module, cls): ## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper::OutputStreamWrapper(ns3::OutputStreamWrapper const & arg0) [copy constructor] cls.add_constructor([param('ns3::OutputStreamWrapper const &', 'arg0')]) ## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper::OutputStreamWrapper(std::string filename, std::_Ios_Openmode filemode) [constructor] cls.add_constructor([param('std::string', 'filename'), param('std::_Ios_Openmode', 'filemode')]) ## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper::OutputStreamWrapper(std::ostream * os) [constructor] cls.add_constructor([param('std::ostream *', 'os')]) ## output-stream-wrapper.h (module 'network'): std::ostream * ns3::OutputStreamWrapper::GetStream() [member function] cls.add_method('GetStream', 'std::ostream *', []) return def register_Ns3Packet_methods(root_module, cls): cls.add_output_stream_operator() ## packet.h (module 'network'): ns3::Packet::Packet() [constructor] cls.add_constructor([]) ## packet.h (module 'network'): ns3::Packet::Packet(ns3::Packet const & o) [copy constructor] cls.add_constructor([param('ns3::Packet const &', 'o')]) ## packet.h (module 'network'): ns3::Packet::Packet(uint32_t size) [constructor] cls.add_constructor([param('uint32_t', 'size')]) ## packet.h (module 'network'): ns3::Packet::Packet(uint8_t const * buffer, uint32_t size, bool magic) [constructor] cls.add_constructor([param('uint8_t const *', 'buffer'), param('uint32_t', 'size'), param('bool', 'magic')]) ## packet.h (module 'network'): ns3::Packet::Packet(uint8_t const * buffer, uint32_t size) [constructor] cls.add_constructor([param('uint8_t const *', 'buffer'), param('uint32_t', 'size')]) ## packet.h (module 'network'): void ns3::Packet::AddAtEnd(ns3::Ptr<const ns3::Packet> packet) [member function] cls.add_method('AddAtEnd', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet')]) ## packet.h (module 'network'): void ns3::Packet::AddByteTag(ns3::Tag const & tag) const [member function] cls.add_method('AddByteTag', 'void', [param('ns3::Tag const &', 'tag')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::AddHeader(ns3::Header const & header) [member function] cls.add_method('AddHeader', 'void', [param('ns3::Header const &', 'header')]) ## packet.h (module 'network'): void ns3::Packet::AddPacketTag(ns3::Tag const & tag) const [member function] cls.add_method('AddPacketTag', 'void', [param('ns3::Tag const &', 'tag')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::AddPaddingAtEnd(uint32_t size) [member function] cls.add_method('AddPaddingAtEnd', 'void', [param('uint32_t', 'size')]) ## packet.h (module 'network'): void ns3::Packet::AddTrailer(ns3::Trailer const & trailer) [member function] cls.add_method('AddTrailer', 'void', [param('ns3::Trailer const &', 'trailer')]) ## packet.h (module 'network'): ns3::PacketMetadata::ItemIterator ns3::Packet::BeginItem() const [member function] cls.add_method('BeginItem', 'ns3::PacketMetadata::ItemIterator', [], is_const=True) ## packet.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Packet::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::Packet >', [], is_const=True) ## packet.h (module 'network'): uint32_t ns3::Packet::CopyData(uint8_t * buffer, uint32_t size) const [member function] cls.add_method('CopyData', 'uint32_t', [param('uint8_t *', 'buffer'), param('uint32_t', 'size')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::CopyData(std::ostream * os, uint32_t size) const [member function] cls.add_method('CopyData', 'void', [param('std::ostream *', 'os'), param('uint32_t', 'size')], is_const=True) ## packet.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Packet::CreateFragment(uint32_t start, uint32_t length) const [member function] cls.add_method('CreateFragment', 'ns3::Ptr< ns3::Packet >', [param('uint32_t', 'start'), param('uint32_t', 'length')], is_const=True) ## packet.h (module 'network'): static void ns3::Packet::EnableChecking() [member function] cls.add_method('EnableChecking', 'void', [], is_static=True) ## packet.h (module 'network'): static void ns3::Packet::EnablePrinting() [member function] cls.add_method('EnablePrinting', 'void', [], is_static=True) ## packet.h (module 'network'): bool ns3::Packet::FindFirstMatchingByteTag(ns3::Tag & tag) const [member function] cls.add_method('FindFirstMatchingByteTag', 'bool', [param('ns3::Tag &', 'tag')], is_const=True) ## packet.h (module 'network'): ns3::ByteTagIterator ns3::Packet::GetByteTagIterator() const [member function] cls.add_method('GetByteTagIterator', 'ns3::ByteTagIterator', [], is_const=True) ## packet.h (module 'network'): ns3::Ptr<ns3::NixVector> ns3::Packet::GetNixVector() const [member function] cls.add_method('GetNixVector', 'ns3::Ptr< ns3::NixVector >', [], is_const=True) ## packet.h (module 'network'): ns3::PacketTagIterator ns3::Packet::GetPacketTagIterator() const [member function] cls.add_method('GetPacketTagIterator', 'ns3::PacketTagIterator', [], is_const=True) ## packet.h (module 'network'): uint32_t ns3::Packet::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True) ## packet.h (module 'network'): uint32_t ns3::Packet::GetSize() const [member function] cls.add_method('GetSize', 'uint32_t', [], is_const=True) ## packet.h (module 'network'): uint64_t ns3::Packet::GetUid() const [member function] cls.add_method('GetUid', 'uint64_t', [], is_const=True) ## packet.h (module 'network'): uint8_t const * ns3::Packet::PeekData() const [member function] cls.add_method('PeekData', 'uint8_t const *', [], deprecated=True, is_const=True) ## packet.h (module 'network'): uint32_t ns3::Packet::PeekHeader(ns3::Header & header) const [member function] cls.add_method('PeekHeader', 'uint32_t', [param('ns3::Header &', 'header')], is_const=True) ## packet.h (module 'network'): bool ns3::Packet::PeekPacketTag(ns3::Tag & tag) const [member function] cls.add_method('PeekPacketTag', 'bool', [param('ns3::Tag &', 'tag')], is_const=True) ## packet.h (module 'network'): uint32_t ns3::Packet::PeekTrailer(ns3::Trailer & trailer) [member function] cls.add_method('PeekTrailer', 'uint32_t', [param('ns3::Trailer &', 'trailer')]) ## packet.h (module 'network'): void ns3::Packet::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::PrintByteTags(std::ostream & os) const [member function] cls.add_method('PrintByteTags', 'void', [param('std::ostream &', 'os')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::PrintPacketTags(std::ostream & os) const [member function] cls.add_method('PrintPacketTags', 'void', [param('std::ostream &', 'os')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::RemoveAllByteTags() [member function] cls.add_method('RemoveAllByteTags', 'void', []) ## packet.h (module 'network'): void ns3::Packet::RemoveAllPacketTags() [member function] cls.add_method('RemoveAllPacketTags', 'void', []) ## packet.h (module 'network'): void ns3::Packet::RemoveAtEnd(uint32_t size) [member function] cls.add_method('RemoveAtEnd', 'void', [param('uint32_t', 'size')]) ## packet.h (module 'network'): void ns3::Packet::RemoveAtStart(uint32_t size) [member function] cls.add_method('RemoveAtStart', 'void', [param('uint32_t', 'size')]) ## packet.h (module 'network'): uint32_t ns3::Packet::RemoveHeader(ns3::Header & header) [member function] cls.add_method('RemoveHeader', 'uint32_t', [param('ns3::Header &', 'header')]) ## packet.h (module 'network'): bool ns3::Packet::RemovePacketTag(ns3::Tag & tag) [member function] cls.add_method('RemovePacketTag', 'bool', [param('ns3::Tag &', 'tag')]) ## packet.h (module 'network'): uint32_t ns3::Packet::RemoveTrailer(ns3::Trailer & trailer) [member function] cls.add_method('RemoveTrailer', 'uint32_t', [param('ns3::Trailer &', 'trailer')]) ## packet.h (module 'network'): uint32_t ns3::Packet::Serialize(uint8_t * buffer, uint32_t maxSize) const [member function] cls.add_method('Serialize', 'uint32_t', [param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')], is_const=True) ## packet.h (module 'network'): void ns3::Packet::SetNixVector(ns3::Ptr<ns3::NixVector> arg0) [member function] cls.add_method('SetNixVector', 'void', [param('ns3::Ptr< ns3::NixVector >', 'arg0')]) return def register_Ns3PacketSocket_methods(root_module, cls): ## packet-socket.h (module 'network'): ns3::PacketSocket::PacketSocket(ns3::PacketSocket const & arg0) [copy constructor] cls.add_constructor([param('ns3::PacketSocket const &', 'arg0')]) ## packet-socket.h (module 'network'): ns3::PacketSocket::PacketSocket() [constructor] cls.add_constructor([]) ## packet-socket.h (module 'network'): int ns3::PacketSocket::Bind() [member function] cls.add_method('Bind', 'int', [], is_virtual=True) ## packet-socket.h (module 'network'): int ns3::PacketSocket::Bind(ns3::Address const & address) [member function] cls.add_method('Bind', 'int', [param('ns3::Address const &', 'address')], is_virtual=True) ## packet-socket.h (module 'network'): int ns3::PacketSocket::Bind6() [member function] cls.add_method('Bind6', 'int', [], is_virtual=True) ## packet-socket.h (module 'network'): int ns3::PacketSocket::Close() [member function] cls.add_method('Close', 'int', [], is_virtual=True) ## packet-socket.h (module 'network'): int ns3::PacketSocket::Connect(ns3::Address const & address) [member function] cls.add_method('Connect', 'int', [param('ns3::Address const &', 'address')], is_virtual=True) ## packet-socket.h (module 'network'): bool ns3::PacketSocket::GetAllowBroadcast() const [member function] cls.add_method('GetAllowBroadcast', 'bool', [], is_const=True, is_virtual=True) ## packet-socket.h (module 'network'): ns3::Socket::SocketErrno ns3::PacketSocket::GetErrno() const [member function] cls.add_method('GetErrno', 'ns3::Socket::SocketErrno', [], is_const=True, is_virtual=True) ## packet-socket.h (module 'network'): ns3::Ptr<ns3::Node> ns3::PacketSocket::GetNode() const [member function] cls.add_method('GetNode', 'ns3::Ptr< ns3::Node >', [], is_const=True, is_virtual=True) ## packet-socket.h (module 'network'): uint32_t ns3::PacketSocket::GetRxAvailable() const [member function] cls.add_method('GetRxAvailable', 'uint32_t', [], is_const=True, is_virtual=True) ## packet-socket.h (module 'network'): int ns3::PacketSocket::GetSockName(ns3::Address & address) const [member function] cls.add_method('GetSockName', 'int', [param('ns3::Address &', 'address')], is_const=True, is_virtual=True) ## packet-socket.h (module 'network'): ns3::Socket::SocketType ns3::PacketSocket::GetSocketType() const [member function] cls.add_method('GetSocketType', 'ns3::Socket::SocketType', [], is_const=True, is_virtual=True) ## packet-socket.h (module 'network'): uint32_t ns3::PacketSocket::GetTxAvailable() const [member function] cls.add_method('GetTxAvailable', 'uint32_t', [], is_const=True, is_virtual=True) ## packet-socket.h (module 'network'): static ns3::TypeId ns3::PacketSocket::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## packet-socket.h (module 'network'): int ns3::PacketSocket::Listen() [member function] cls.add_method('Listen', 'int', [], is_virtual=True) ## packet-socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::PacketSocket::Recv(uint32_t maxSize, uint32_t flags) [member function] cls.add_method('Recv', 'ns3::Ptr< ns3::Packet >', [param('uint32_t', 'maxSize'), param('uint32_t', 'flags')], is_virtual=True) ## packet-socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::PacketSocket::RecvFrom(uint32_t maxSize, uint32_t flags, ns3::Address & fromAddress) [member function] cls.add_method('RecvFrom', 'ns3::Ptr< ns3::Packet >', [param('uint32_t', 'maxSize'), param('uint32_t', 'flags'), param('ns3::Address &', 'fromAddress')], is_virtual=True) ## packet-socket.h (module 'network'): int ns3::PacketSocket::Send(ns3::Ptr<ns3::Packet> p, uint32_t flags) [member function] cls.add_method('Send', 'int', [param('ns3::Ptr< ns3::Packet >', 'p'), param('uint32_t', 'flags')], is_virtual=True) ## packet-socket.h (module 'network'): int ns3::PacketSocket::SendTo(ns3::Ptr<ns3::Packet> p, uint32_t flags, ns3::Address const & toAddress) [member function] cls.add_method('SendTo', 'int', [param('ns3::Ptr< ns3::Packet >', 'p'), param('uint32_t', 'flags'), param('ns3::Address const &', 'toAddress')], is_virtual=True) ## packet-socket.h (module 'network'): bool ns3::PacketSocket::SetAllowBroadcast(bool allowBroadcast) [member function] cls.add_method('SetAllowBroadcast', 'bool', [param('bool', 'allowBroadcast')], is_virtual=True) ## packet-socket.h (module 'network'): void ns3::PacketSocket::SetNode(ns3::Ptr<ns3::Node> node) [member function] cls.add_method('SetNode', 'void', [param('ns3::Ptr< ns3::Node >', 'node')]) ## packet-socket.h (module 'network'): int ns3::PacketSocket::ShutdownRecv() [member function] cls.add_method('ShutdownRecv', 'int', [], is_virtual=True) ## packet-socket.h (module 'network'): int ns3::PacketSocket::ShutdownSend() [member function] cls.add_method('ShutdownSend', 'int', [], is_virtual=True) ## packet-socket.h (module 'network'): void ns3::PacketSocket::DoDispose() [member function] cls.add_method('DoDispose', 'void', [], visibility='private', is_virtual=True) return def register_Ns3PacketSocketFactory_methods(root_module, cls): ## packet-socket-factory.h (module 'network'): ns3::PacketSocketFactory::PacketSocketFactory(ns3::PacketSocketFactory const & arg0) [copy constructor] cls.add_constructor([param('ns3::PacketSocketFactory const &', 'arg0')]) ## packet-socket-factory.h (module 'network'): ns3::PacketSocketFactory::PacketSocketFactory() [constructor] cls.add_constructor([]) ## packet-socket-factory.h (module 'network'): ns3::Ptr<ns3::Socket> ns3::PacketSocketFactory::CreateSocket() [member function] cls.add_method('CreateSocket', 'ns3::Ptr< ns3::Socket >', [], is_virtual=True) ## packet-socket-factory.h (module 'network'): static ns3::TypeId ns3::PacketSocketFactory::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) return def register_Ns3PbbAddressBlock_methods(root_module, cls): cls.add_binary_comparison_operator('==') cls.add_binary_comparison_operator('!=') ## packetbb.h (module 'network'): ns3::PbbAddressBlock::PbbAddressBlock(ns3::PbbAddressBlock const & arg0) [copy constructor] cls.add_constructor([param('ns3::PbbAddressBlock const &', 'arg0')]) ## packetbb.h (module 'network'): ns3::PbbAddressBlock::PbbAddressBlock() [constructor] cls.add_constructor([]) ## packetbb.h (module 'network'): ns3::Address ns3::PbbAddressBlock::AddressBack() const [member function] cls.add_method('AddressBack', 'ns3::Address', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Address> ns3::PbbAddressBlock::AddressBegin() [member function] cls.add_method('AddressBegin', 'std::_List_iterator< ns3::Address >', []) ## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Address> ns3::PbbAddressBlock::AddressBegin() const [member function] cls.add_method('AddressBegin', 'std::_List_const_iterator< ns3::Address >', [], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbAddressBlock::AddressClear() [member function] cls.add_method('AddressClear', 'void', []) ## packetbb.h (module 'network'): bool ns3::PbbAddressBlock::AddressEmpty() const [member function] cls.add_method('AddressEmpty', 'bool', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Address> ns3::PbbAddressBlock::AddressEnd() [member function] cls.add_method('AddressEnd', 'std::_List_iterator< ns3::Address >', []) ## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Address> ns3::PbbAddressBlock::AddressEnd() const [member function] cls.add_method('AddressEnd', 'std::_List_const_iterator< ns3::Address >', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Address> ns3::PbbAddressBlock::AddressErase(std::_List_iterator<ns3::Address> position) [member function] cls.add_method('AddressErase', 'std::_List_iterator< ns3::Address >', [param('std::_List_iterator< ns3::Address >', 'position')]) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Address> ns3::PbbAddressBlock::AddressErase(std::_List_iterator<ns3::Address> first, std::_List_iterator<ns3::Address> last) [member function] cls.add_method('AddressErase', 'std::_List_iterator< ns3::Address >', [param('std::_List_iterator< ns3::Address >', 'first'), param('std::_List_iterator< ns3::Address >', 'last')]) ## packetbb.h (module 'network'): ns3::Address ns3::PbbAddressBlock::AddressFront() const [member function] cls.add_method('AddressFront', 'ns3::Address', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Address> ns3::PbbAddressBlock::AddressInsert(std::_List_iterator<ns3::Address> position, ns3::Address const value) [member function] cls.add_method('AddressInsert', 'std::_List_iterator< ns3::Address >', [param('std::_List_iterator< ns3::Address >', 'position'), param('ns3::Address const', 'value')]) ## packetbb.h (module 'network'): void ns3::PbbAddressBlock::AddressPopBack() [member function] cls.add_method('AddressPopBack', 'void', []) ## packetbb.h (module 'network'): void ns3::PbbAddressBlock::AddressPopFront() [member function] cls.add_method('AddressPopFront', 'void', []) ## packetbb.h (module 'network'): void ns3::PbbAddressBlock::AddressPushBack(ns3::Address address) [member function] cls.add_method('AddressPushBack', 'void', [param('ns3::Address', 'address')]) ## packetbb.h (module 'network'): void ns3::PbbAddressBlock::AddressPushFront(ns3::Address address) [member function] cls.add_method('AddressPushFront', 'void', [param('ns3::Address', 'address')]) ## packetbb.h (module 'network'): int ns3::PbbAddressBlock::AddressSize() const [member function] cls.add_method('AddressSize', 'int', [], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbAddressBlock::Deserialize(ns3::Buffer::Iterator & start) [member function] cls.add_method('Deserialize', 'void', [param('ns3::Buffer::Iterator &', 'start')]) ## packetbb.h (module 'network'): uint32_t ns3::PbbAddressBlock::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True) ## packetbb.h (module 'network'): uint8_t ns3::PbbAddressBlock::PrefixBack() const [member function] cls.add_method('PrefixBack', 'uint8_t', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<unsigned char> ns3::PbbAddressBlock::PrefixBegin() [member function] cls.add_method('PrefixBegin', 'std::_List_iterator< unsigned char >', []) ## packetbb.h (module 'network'): std::_List_const_iterator<unsigned char> ns3::PbbAddressBlock::PrefixBegin() const [member function] cls.add_method('PrefixBegin', 'std::_List_const_iterator< unsigned char >', [], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbAddressBlock::PrefixClear() [member function] cls.add_method('PrefixClear', 'void', []) ## packetbb.h (module 'network'): bool ns3::PbbAddressBlock::PrefixEmpty() const [member function] cls.add_method('PrefixEmpty', 'bool', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<unsigned char> ns3::PbbAddressBlock::PrefixEnd() [member function] cls.add_method('PrefixEnd', 'std::_List_iterator< unsigned char >', []) ## packetbb.h (module 'network'): std::_List_const_iterator<unsigned char> ns3::PbbAddressBlock::PrefixEnd() const [member function] cls.add_method('PrefixEnd', 'std::_List_const_iterator< unsigned char >', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<unsigned char> ns3::PbbAddressBlock::PrefixErase(std::_List_iterator<unsigned char> position) [member function] cls.add_method('PrefixErase', 'std::_List_iterator< unsigned char >', [param('std::_List_iterator< unsigned char >', 'position')]) ## packetbb.h (module 'network'): std::_List_iterator<unsigned char> ns3::PbbAddressBlock::PrefixErase(std::_List_iterator<unsigned char> first, std::_List_iterator<unsigned char> last) [member function] cls.add_method('PrefixErase', 'std::_List_iterator< unsigned char >', [param('std::_List_iterator< unsigned char >', 'first'), param('std::_List_iterator< unsigned char >', 'last')]) ## packetbb.h (module 'network'): uint8_t ns3::PbbAddressBlock::PrefixFront() const [member function] cls.add_method('PrefixFront', 'uint8_t', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<unsigned char> ns3::PbbAddressBlock::PrefixInsert(std::_List_iterator<unsigned char> position, uint8_t const value) [member function] cls.add_method('PrefixInsert', 'std::_List_iterator< unsigned char >', [param('std::_List_iterator< unsigned char >', 'position'), param('uint8_t const', 'value')]) ## packetbb.h (module 'network'): void ns3::PbbAddressBlock::PrefixPopBack() [member function] cls.add_method('PrefixPopBack', 'void', []) ## packetbb.h (module 'network'): void ns3::PbbAddressBlock::PrefixPopFront() [member function] cls.add_method('PrefixPopFront', 'void', []) ## packetbb.h (module 'network'): void ns3::PbbAddressBlock::PrefixPushBack(uint8_t prefix) [member function] cls.add_method('PrefixPushBack', 'void', [param('uint8_t', 'prefix')]) ## packetbb.h (module 'network'): void ns3::PbbAddressBlock::PrefixPushFront(uint8_t prefix) [member function] cls.add_method('PrefixPushFront', 'void', [param('uint8_t', 'prefix')]) ## packetbb.h (module 'network'): int ns3::PbbAddressBlock::PrefixSize() const [member function] cls.add_method('PrefixSize', 'int', [], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbAddressBlock::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbAddressBlock::Print(std::ostream & os, int level) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os'), param('int', 'level')], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbAddressBlock::Serialize(ns3::Buffer::Iterator & start) const [member function] cls.add_method('Serialize', 'void', [param('ns3::Buffer::Iterator &', 'start')], is_const=True) ## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressTlv> ns3::PbbAddressBlock::TlvBack() [member function] cls.add_method('TlvBack', 'ns3::Ptr< ns3::PbbAddressTlv >', []) ## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressTlv> const ns3::PbbAddressBlock::TlvBack() const [member function] cls.add_method('TlvBack', 'ns3::Ptr< ns3::PbbAddressTlv > const', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressBlock::TlvBegin() [member function] cls.add_method('TlvBegin', 'std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', []) ## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressBlock::TlvBegin() const [member function] cls.add_method('TlvBegin', 'std::_List_const_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', [], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbAddressBlock::TlvClear() [member function] cls.add_method('TlvClear', 'void', []) ## packetbb.h (module 'network'): bool ns3::PbbAddressBlock::TlvEmpty() const [member function] cls.add_method('TlvEmpty', 'bool', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressBlock::TlvEnd() [member function] cls.add_method('TlvEnd', 'std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', []) ## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressBlock::TlvEnd() const [member function] cls.add_method('TlvEnd', 'std::_List_const_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressBlock::TlvErase(std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > position) [member function] cls.add_method('TlvErase', 'std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', [param('std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', 'position')]) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressBlock::TlvErase(std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > first, std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > last) [member function] cls.add_method('TlvErase', 'std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', [param('std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', 'first'), param('std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', 'last')]) ## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressTlv> ns3::PbbAddressBlock::TlvFront() [member function] cls.add_method('TlvFront', 'ns3::Ptr< ns3::PbbAddressTlv >', []) ## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressTlv> const ns3::PbbAddressBlock::TlvFront() const [member function] cls.add_method('TlvFront', 'ns3::Ptr< ns3::PbbAddressTlv > const', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressBlock::TlvInsert(std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > position, ns3::Ptr<ns3::PbbTlv> const value) [member function] cls.add_method('TlvInsert', 'std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', [param('std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', 'position'), param('ns3::Ptr< ns3::PbbTlv > const', 'value')]) ## packetbb.h (module 'network'): void ns3::PbbAddressBlock::TlvPopBack() [member function] cls.add_method('TlvPopBack', 'void', []) ## packetbb.h (module 'network'): void ns3::PbbAddressBlock::TlvPopFront() [member function] cls.add_method('TlvPopFront', 'void', []) ## packetbb.h (module 'network'): void ns3::PbbAddressBlock::TlvPushBack(ns3::Ptr<ns3::PbbAddressTlv> address) [member function] cls.add_method('TlvPushBack', 'void', [param('ns3::Ptr< ns3::PbbAddressTlv >', 'address')]) ## packetbb.h (module 'network'): void ns3::PbbAddressBlock::TlvPushFront(ns3::Ptr<ns3::PbbAddressTlv> address) [member function] cls.add_method('TlvPushFront', 'void', [param('ns3::Ptr< ns3::PbbAddressTlv >', 'address')]) ## packetbb.h (module 'network'): int ns3::PbbAddressBlock::TlvSize() const [member function] cls.add_method('TlvSize', 'int', [], is_const=True) ## packetbb.h (module 'network'): ns3::Address ns3::PbbAddressBlock::DeserializeAddress(uint8_t * buffer) const [member function] cls.add_method('DeserializeAddress', 'ns3::Address', [param('uint8_t *', 'buffer')], is_pure_virtual=True, is_const=True, visibility='protected', is_virtual=True) ## packetbb.h (module 'network'): uint8_t ns3::PbbAddressBlock::GetAddressLength() const [member function] cls.add_method('GetAddressLength', 'uint8_t', [], is_pure_virtual=True, is_const=True, visibility='protected', is_virtual=True) ## packetbb.h (module 'network'): void ns3::PbbAddressBlock::PrintAddress(std::ostream & os, std::_List_const_iterator<ns3::Address> iter) const [member function] cls.add_method('PrintAddress', 'void', [param('std::ostream &', 'os'), param('std::_List_const_iterator< ns3::Address >', 'iter')], is_pure_virtual=True, is_const=True, visibility='protected', is_virtual=True) ## packetbb.h (module 'network'): void ns3::PbbAddressBlock::SerializeAddress(uint8_t * buffer, std::_List_const_iterator<ns3::Address> iter) const [member function] cls.add_method('SerializeAddress', 'void', [param('uint8_t *', 'buffer'), param('std::_List_const_iterator< ns3::Address >', 'iter')], is_pure_virtual=True, is_const=True, visibility='protected', is_virtual=True) return def register_Ns3PbbAddressBlockIpv4_methods(root_module, cls): ## packetbb.h (module 'network'): ns3::PbbAddressBlockIpv4::PbbAddressBlockIpv4(ns3::PbbAddressBlockIpv4 const & arg0) [copy constructor] cls.add_constructor([param('ns3::PbbAddressBlockIpv4 const &', 'arg0')]) ## packetbb.h (module 'network'): ns3::PbbAddressBlockIpv4::PbbAddressBlockIpv4() [constructor] cls.add_constructor([]) ## packetbb.h (module 'network'): ns3::Address ns3::PbbAddressBlockIpv4::DeserializeAddress(uint8_t * buffer) const [member function] cls.add_method('DeserializeAddress', 'ns3::Address', [param('uint8_t *', 'buffer')], is_const=True, visibility='protected', is_virtual=True) ## packetbb.h (module 'network'): uint8_t ns3::PbbAddressBlockIpv4::GetAddressLength() const [member function] cls.add_method('GetAddressLength', 'uint8_t', [], is_const=True, visibility='protected', is_virtual=True) ## packetbb.h (module 'network'): void ns3::PbbAddressBlockIpv4::PrintAddress(std::ostream & os, std::_List_const_iterator<ns3::Address> iter) const [member function] cls.add_method('PrintAddress', 'void', [param('std::ostream &', 'os'), param('std::_List_const_iterator< ns3::Address >', 'iter')], is_const=True, visibility='protected', is_virtual=True) ## packetbb.h (module 'network'): void ns3::PbbAddressBlockIpv4::SerializeAddress(uint8_t * buffer, std::_List_const_iterator<ns3::Address> iter) const [member function] cls.add_method('SerializeAddress', 'void', [param('uint8_t *', 'buffer'), param('std::_List_const_iterator< ns3::Address >', 'iter')], is_const=True, visibility='protected', is_virtual=True) return def register_Ns3PbbAddressBlockIpv6_methods(root_module, cls): ## packetbb.h (module 'network'): ns3::PbbAddressBlockIpv6::PbbAddressBlockIpv6(ns3::PbbAddressBlockIpv6 const & arg0) [copy constructor] cls.add_constructor([param('ns3::PbbAddressBlockIpv6 const &', 'arg0')]) ## packetbb.h (module 'network'): ns3::PbbAddressBlockIpv6::PbbAddressBlockIpv6() [constructor] cls.add_constructor([]) ## packetbb.h (module 'network'): ns3::Address ns3::PbbAddressBlockIpv6::DeserializeAddress(uint8_t * buffer) const [member function] cls.add_method('DeserializeAddress', 'ns3::Address', [param('uint8_t *', 'buffer')], is_const=True, visibility='protected', is_virtual=True) ## packetbb.h (module 'network'): uint8_t ns3::PbbAddressBlockIpv6::GetAddressLength() const [member function] cls.add_method('GetAddressLength', 'uint8_t', [], is_const=True, visibility='protected', is_virtual=True) ## packetbb.h (module 'network'): void ns3::PbbAddressBlockIpv6::PrintAddress(std::ostream & os, std::_List_const_iterator<ns3::Address> iter) const [member function] cls.add_method('PrintAddress', 'void', [param('std::ostream &', 'os'), param('std::_List_const_iterator< ns3::Address >', 'iter')], is_const=True, visibility='protected', is_virtual=True) ## packetbb.h (module 'network'): void ns3::PbbAddressBlockIpv6::SerializeAddress(uint8_t * buffer, std::_List_const_iterator<ns3::Address> iter) const [member function] cls.add_method('SerializeAddress', 'void', [param('uint8_t *', 'buffer'), param('std::_List_const_iterator< ns3::Address >', 'iter')], is_const=True, visibility='protected', is_virtual=True) return def register_Ns3PbbMessage_methods(root_module, cls): cls.add_binary_comparison_operator('==') cls.add_binary_comparison_operator('!=') ## packetbb.h (module 'network'): ns3::PbbMessage::PbbMessage(ns3::PbbMessage const & arg0) [copy constructor] cls.add_constructor([param('ns3::PbbMessage const &', 'arg0')]) ## packetbb.h (module 'network'): ns3::PbbMessage::PbbMessage() [constructor] cls.add_constructor([]) ## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressBlock> ns3::PbbMessage::AddressBlockBack() [member function] cls.add_method('AddressBlockBack', 'ns3::Ptr< ns3::PbbAddressBlock >', []) ## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressBlock> const ns3::PbbMessage::AddressBlockBack() const [member function] cls.add_method('AddressBlockBack', 'ns3::Ptr< ns3::PbbAddressBlock > const', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressBlock> > ns3::PbbMessage::AddressBlockBegin() [member function] cls.add_method('AddressBlockBegin', 'std::_List_iterator< ns3::Ptr< ns3::PbbAddressBlock > >', []) ## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbAddressBlock> > ns3::PbbMessage::AddressBlockBegin() const [member function] cls.add_method('AddressBlockBegin', 'std::_List_const_iterator< ns3::Ptr< ns3::PbbAddressBlock > >', [], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbMessage::AddressBlockClear() [member function] cls.add_method('AddressBlockClear', 'void', []) ## packetbb.h (module 'network'): bool ns3::PbbMessage::AddressBlockEmpty() const [member function] cls.add_method('AddressBlockEmpty', 'bool', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressBlock> > ns3::PbbMessage::AddressBlockEnd() [member function] cls.add_method('AddressBlockEnd', 'std::_List_iterator< ns3::Ptr< ns3::PbbAddressBlock > >', []) ## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbAddressBlock> > ns3::PbbMessage::AddressBlockEnd() const [member function] cls.add_method('AddressBlockEnd', 'std::_List_const_iterator< ns3::Ptr< ns3::PbbAddressBlock > >', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressBlock> > ns3::PbbMessage::AddressBlockErase(std::_List_iterator<ns3::Ptr<ns3::PbbAddressBlock> > position) [member function] cls.add_method('AddressBlockErase', 'std::_List_iterator< ns3::Ptr< ns3::PbbAddressBlock > >', [param('std::_List_iterator< ns3::Ptr< ns3::PbbAddressBlock > >', 'position')]) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressBlock> > ns3::PbbMessage::AddressBlockErase(std::_List_iterator<ns3::Ptr<ns3::PbbAddressBlock> > first, std::_List_iterator<ns3::Ptr<ns3::PbbAddressBlock> > last) [member function] cls.add_method('AddressBlockErase', 'std::_List_iterator< ns3::Ptr< ns3::PbbAddressBlock > >', [param('std::_List_iterator< ns3::Ptr< ns3::PbbAddressBlock > >', 'first'), param('std::_List_iterator< ns3::Ptr< ns3::PbbAddressBlock > >', 'last')]) ## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressBlock> ns3::PbbMessage::AddressBlockFront() [member function] cls.add_method('AddressBlockFront', 'ns3::Ptr< ns3::PbbAddressBlock >', []) ## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressBlock> const ns3::PbbMessage::AddressBlockFront() const [member function] cls.add_method('AddressBlockFront', 'ns3::Ptr< ns3::PbbAddressBlock > const', [], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbMessage::AddressBlockPopBack() [member function] cls.add_method('AddressBlockPopBack', 'void', []) ## packetbb.h (module 'network'): void ns3::PbbMessage::AddressBlockPopFront() [member function] cls.add_method('AddressBlockPopFront', 'void', []) ## packetbb.h (module 'network'): void ns3::PbbMessage::AddressBlockPushBack(ns3::Ptr<ns3::PbbAddressBlock> block) [member function] cls.add_method('AddressBlockPushBack', 'void', [param('ns3::Ptr< ns3::PbbAddressBlock >', 'block')]) ## packetbb.h (module 'network'): void ns3::PbbMessage::AddressBlockPushFront(ns3::Ptr<ns3::PbbAddressBlock> block) [member function] cls.add_method('AddressBlockPushFront', 'void', [param('ns3::Ptr< ns3::PbbAddressBlock >', 'block')]) ## packetbb.h (module 'network'): int ns3::PbbMessage::AddressBlockSize() const [member function] cls.add_method('AddressBlockSize', 'int', [], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbMessage::Deserialize(ns3::Buffer::Iterator & start) [member function] cls.add_method('Deserialize', 'void', [param('ns3::Buffer::Iterator &', 'start')]) ## packetbb.h (module 'network'): static ns3::Ptr<ns3::PbbMessage> ns3::PbbMessage::DeserializeMessage(ns3::Buffer::Iterator & start) [member function] cls.add_method('DeserializeMessage', 'ns3::Ptr< ns3::PbbMessage >', [param('ns3::Buffer::Iterator &', 'start')], is_static=True) ## packetbb.h (module 'network'): uint8_t ns3::PbbMessage::GetHopCount() const [member function] cls.add_method('GetHopCount', 'uint8_t', [], is_const=True) ## packetbb.h (module 'network'): uint8_t ns3::PbbMessage::GetHopLimit() const [member function] cls.add_method('GetHopLimit', 'uint8_t', [], is_const=True) ## packetbb.h (module 'network'): ns3::Address ns3::PbbMessage::GetOriginatorAddress() const [member function] cls.add_method('GetOriginatorAddress', 'ns3::Address', [], is_const=True) ## packetbb.h (module 'network'): uint16_t ns3::PbbMessage::GetSequenceNumber() const [member function] cls.add_method('GetSequenceNumber', 'uint16_t', [], is_const=True) ## packetbb.h (module 'network'): uint32_t ns3::PbbMessage::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True) ## packetbb.h (module 'network'): uint8_t ns3::PbbMessage::GetType() const [member function] cls.add_method('GetType', 'uint8_t', [], is_const=True) ## packetbb.h (module 'network'): bool ns3::PbbMessage::HasHopCount() const [member function] cls.add_method('HasHopCount', 'bool', [], is_const=True) ## packetbb.h (module 'network'): bool ns3::PbbMessage::HasHopLimit() const [member function] cls.add_method('HasHopLimit', 'bool', [], is_const=True) ## packetbb.h (module 'network'): bool ns3::PbbMessage::HasOriginatorAddress() const [member function] cls.add_method('HasOriginatorAddress', 'bool', [], is_const=True) ## packetbb.h (module 'network'): bool ns3::PbbMessage::HasSequenceNumber() const [member function] cls.add_method('HasSequenceNumber', 'bool', [], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbMessage::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbMessage::Print(std::ostream & os, int level) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os'), param('int', 'level')], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbMessage::Serialize(ns3::Buffer::Iterator & start) const [member function] cls.add_method('Serialize', 'void', [param('ns3::Buffer::Iterator &', 'start')], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbMessage::SetHopCount(uint8_t hopcount) [member function] cls.add_method('SetHopCount', 'void', [param('uint8_t', 'hopcount')]) ## packetbb.h (module 'network'): void ns3::PbbMessage::SetHopLimit(uint8_t hoplimit) [member function] cls.add_method('SetHopLimit', 'void', [param('uint8_t', 'hoplimit')]) ## packetbb.h (module 'network'): void ns3::PbbMessage::SetOriginatorAddress(ns3::Address address) [member function] cls.add_method('SetOriginatorAddress', 'void', [param('ns3::Address', 'address')]) ## packetbb.h (module 'network'): void ns3::PbbMessage::SetSequenceNumber(uint16_t seqnum) [member function] cls.add_method('SetSequenceNumber', 'void', [param('uint16_t', 'seqnum')]) ## packetbb.h (module 'network'): void ns3::PbbMessage::SetType(uint8_t type) [member function] cls.add_method('SetType', 'void', [param('uint8_t', 'type')]) ## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> ns3::PbbMessage::TlvBack() [member function] cls.add_method('TlvBack', 'ns3::Ptr< ns3::PbbTlv >', []) ## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> const ns3::PbbMessage::TlvBack() const [member function] cls.add_method('TlvBack', 'ns3::Ptr< ns3::PbbTlv > const', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbMessage::TlvBegin() [member function] cls.add_method('TlvBegin', 'std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', []) ## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbMessage::TlvBegin() const [member function] cls.add_method('TlvBegin', 'std::_List_const_iterator< ns3::Ptr< ns3::PbbTlv > >', [], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbMessage::TlvClear() [member function] cls.add_method('TlvClear', 'void', []) ## packetbb.h (module 'network'): bool ns3::PbbMessage::TlvEmpty() const [member function] cls.add_method('TlvEmpty', 'bool', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbMessage::TlvEnd() [member function] cls.add_method('TlvEnd', 'std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', []) ## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbMessage::TlvEnd() const [member function] cls.add_method('TlvEnd', 'std::_List_const_iterator< ns3::Ptr< ns3::PbbTlv > >', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbMessage::TlvErase(std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > position) [member function] cls.add_method('TlvErase', 'std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', [param('std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', 'position')]) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbMessage::TlvErase(std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > first, std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > last) [member function] cls.add_method('TlvErase', 'std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', [param('std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', 'first'), param('std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', 'last')]) ## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> ns3::PbbMessage::TlvFront() [member function] cls.add_method('TlvFront', 'ns3::Ptr< ns3::PbbTlv >', []) ## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> const ns3::PbbMessage::TlvFront() const [member function] cls.add_method('TlvFront', 'ns3::Ptr< ns3::PbbTlv > const', [], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbMessage::TlvPopBack() [member function] cls.add_method('TlvPopBack', 'void', []) ## packetbb.h (module 'network'): void ns3::PbbMessage::TlvPopFront() [member function] cls.add_method('TlvPopFront', 'void', []) ## packetbb.h (module 'network'): void ns3::PbbMessage::TlvPushBack(ns3::Ptr<ns3::PbbTlv> tlv) [member function] cls.add_method('TlvPushBack', 'void', [param('ns3::Ptr< ns3::PbbTlv >', 'tlv')]) ## packetbb.h (module 'network'): void ns3::PbbMessage::TlvPushFront(ns3::Ptr<ns3::PbbTlv> tlv) [member function] cls.add_method('TlvPushFront', 'void', [param('ns3::Ptr< ns3::PbbTlv >', 'tlv')]) ## packetbb.h (module 'network'): int ns3::PbbMessage::TlvSize() const [member function] cls.add_method('TlvSize', 'int', [], is_const=True) ## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressBlock> ns3::PbbMessage::AddressBlockDeserialize(ns3::Buffer::Iterator & start) const [member function] cls.add_method('AddressBlockDeserialize', 'ns3::Ptr< ns3::PbbAddressBlock >', [param('ns3::Buffer::Iterator &', 'start')], is_pure_virtual=True, is_const=True, visibility='protected', is_virtual=True) ## packetbb.h (module 'network'): ns3::Address ns3::PbbMessage::DeserializeOriginatorAddress(ns3::Buffer::Iterator & start) const [member function] cls.add_method('DeserializeOriginatorAddress', 'ns3::Address', [param('ns3::Buffer::Iterator &', 'start')], is_pure_virtual=True, is_const=True, visibility='protected', is_virtual=True) ## packetbb.h (module 'network'): ns3::PbbAddressLength ns3::PbbMessage::GetAddressLength() const [member function] cls.add_method('GetAddressLength', 'ns3::PbbAddressLength', [], is_pure_virtual=True, is_const=True, visibility='protected', is_virtual=True) ## packetbb.h (module 'network'): void ns3::PbbMessage::PrintOriginatorAddress(std::ostream & os) const [member function] cls.add_method('PrintOriginatorAddress', 'void', [param('std::ostream &', 'os')], is_pure_virtual=True, is_const=True, visibility='protected', is_virtual=True) ## packetbb.h (module 'network'): void ns3::PbbMessage::SerializeOriginatorAddress(ns3::Buffer::Iterator & start) const [member function] cls.add_method('SerializeOriginatorAddress', 'void', [param('ns3::Buffer::Iterator &', 'start')], is_pure_virtual=True, is_const=True, visibility='protected', is_virtual=True) return def register_Ns3PbbMessageIpv4_methods(root_module, cls): ## packetbb.h (module 'network'): ns3::PbbMessageIpv4::PbbMessageIpv4(ns3::PbbMessageIpv4 const & arg0) [copy constructor] cls.add_constructor([param('ns3::PbbMessageIpv4 const &', 'arg0')]) ## packetbb.h (module 'network'): ns3::PbbMessageIpv4::PbbMessageIpv4() [constructor] cls.add_constructor([]) ## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressBlock> ns3::PbbMessageIpv4::AddressBlockDeserialize(ns3::Buffer::Iterator & start) const [member function] cls.add_method('AddressBlockDeserialize', 'ns3::Ptr< ns3::PbbAddressBlock >', [param('ns3::Buffer::Iterator &', 'start')], is_const=True, visibility='protected', is_virtual=True) ## packetbb.h (module 'network'): ns3::Address ns3::PbbMessageIpv4::DeserializeOriginatorAddress(ns3::Buffer::Iterator & start) const [member function] cls.add_method('DeserializeOriginatorAddress', 'ns3::Address', [param('ns3::Buffer::Iterator &', 'start')], is_const=True, visibility='protected', is_virtual=True) ## packetbb.h (module 'network'): ns3::PbbAddressLength ns3::PbbMessageIpv4::GetAddressLength() const [member function] cls.add_method('GetAddressLength', 'ns3::PbbAddressLength', [], is_const=True, visibility='protected', is_virtual=True) ## packetbb.h (module 'network'): void ns3::PbbMessageIpv4::PrintOriginatorAddress(std::ostream & os) const [member function] cls.add_method('PrintOriginatorAddress', 'void', [param('std::ostream &', 'os')], is_const=True, visibility='protected', is_virtual=True) ## packetbb.h (module 'network'): void ns3::PbbMessageIpv4::SerializeOriginatorAddress(ns3::Buffer::Iterator & start) const [member function] cls.add_method('SerializeOriginatorAddress', 'void', [param('ns3::Buffer::Iterator &', 'start')], is_const=True, visibility='protected', is_virtual=True) return def register_Ns3PbbMessageIpv6_methods(root_module, cls): ## packetbb.h (module 'network'): ns3::PbbMessageIpv6::PbbMessageIpv6(ns3::PbbMessageIpv6 const & arg0) [copy constructor] cls.add_constructor([param('ns3::PbbMessageIpv6 const &', 'arg0')]) ## packetbb.h (module 'network'): ns3::PbbMessageIpv6::PbbMessageIpv6() [constructor] cls.add_constructor([]) ## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressBlock> ns3::PbbMessageIpv6::AddressBlockDeserialize(ns3::Buffer::Iterator & start) const [member function] cls.add_method('AddressBlockDeserialize', 'ns3::Ptr< ns3::PbbAddressBlock >', [param('ns3::Buffer::Iterator &', 'start')], is_const=True, visibility='protected', is_virtual=True) ## packetbb.h (module 'network'): ns3::Address ns3::PbbMessageIpv6::DeserializeOriginatorAddress(ns3::Buffer::Iterator & start) const [member function] cls.add_method('DeserializeOriginatorAddress', 'ns3::Address', [param('ns3::Buffer::Iterator &', 'start')], is_const=True, visibility='protected', is_virtual=True) ## packetbb.h (module 'network'): ns3::PbbAddressLength ns3::PbbMessageIpv6::GetAddressLength() const [member function] cls.add_method('GetAddressLength', 'ns3::PbbAddressLength', [], is_const=True, visibility='protected', is_virtual=True) ## packetbb.h (module 'network'): void ns3::PbbMessageIpv6::PrintOriginatorAddress(std::ostream & os) const [member function] cls.add_method('PrintOriginatorAddress', 'void', [param('std::ostream &', 'os')], is_const=True, visibility='protected', is_virtual=True) ## packetbb.h (module 'network'): void ns3::PbbMessageIpv6::SerializeOriginatorAddress(ns3::Buffer::Iterator & start) const [member function] cls.add_method('SerializeOriginatorAddress', 'void', [param('ns3::Buffer::Iterator &', 'start')], is_const=True, visibility='protected', is_virtual=True) return def register_Ns3PbbPacket_methods(root_module, cls): cls.add_binary_comparison_operator('==') cls.add_binary_comparison_operator('!=') ## packetbb.h (module 'network'): ns3::PbbPacket::PbbPacket(ns3::PbbPacket const & arg0) [copy constructor] cls.add_constructor([param('ns3::PbbPacket const &', 'arg0')]) ## packetbb.h (module 'network'): ns3::PbbPacket::PbbPacket() [constructor] cls.add_constructor([]) ## packetbb.h (module 'network'): uint32_t ns3::PbbPacket::Deserialize(ns3::Buffer::Iterator start) [member function] cls.add_method('Deserialize', 'uint32_t', [param('ns3::Buffer::Iterator', 'start')], is_virtual=True) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbPacket::Erase(std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > position) [member function] cls.add_method('Erase', 'std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', [param('std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', 'position')]) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbPacket::Erase(std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > first, std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > last) [member function] cls.add_method('Erase', 'std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', [param('std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', 'first'), param('std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', 'last')]) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbMessage> > ns3::PbbPacket::Erase(std::_List_iterator<ns3::Ptr<ns3::PbbMessage> > position) [member function] cls.add_method('Erase', 'std::_List_iterator< ns3::Ptr< ns3::PbbMessage > >', [param('std::_List_iterator< ns3::Ptr< ns3::PbbMessage > >', 'position')]) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbMessage> > ns3::PbbPacket::Erase(std::_List_iterator<ns3::Ptr<ns3::PbbMessage> > first, std::_List_iterator<ns3::Ptr<ns3::PbbMessage> > last) [member function] cls.add_method('Erase', 'std::_List_iterator< ns3::Ptr< ns3::PbbMessage > >', [param('std::_List_iterator< ns3::Ptr< ns3::PbbMessage > >', 'first'), param('std::_List_iterator< ns3::Ptr< ns3::PbbMessage > >', 'last')]) ## packetbb.h (module 'network'): ns3::TypeId ns3::PbbPacket::GetInstanceTypeId() const [member function] cls.add_method('GetInstanceTypeId', 'ns3::TypeId', [], is_const=True, is_virtual=True) ## packetbb.h (module 'network'): uint16_t ns3::PbbPacket::GetSequenceNumber() const [member function] cls.add_method('GetSequenceNumber', 'uint16_t', [], is_const=True) ## packetbb.h (module 'network'): uint32_t ns3::PbbPacket::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True, is_virtual=True) ## packetbb.h (module 'network'): static ns3::TypeId ns3::PbbPacket::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## packetbb.h (module 'network'): uint8_t ns3::PbbPacket::GetVersion() const [member function] cls.add_method('GetVersion', 'uint8_t', [], is_const=True) ## packetbb.h (module 'network'): bool ns3::PbbPacket::HasSequenceNumber() const [member function] cls.add_method('HasSequenceNumber', 'bool', [], is_const=True) ## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbMessage> ns3::PbbPacket::MessageBack() [member function] cls.add_method('MessageBack', 'ns3::Ptr< ns3::PbbMessage >', []) ## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbMessage> const ns3::PbbPacket::MessageBack() const [member function] cls.add_method('MessageBack', 'ns3::Ptr< ns3::PbbMessage > const', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbMessage> > ns3::PbbPacket::MessageBegin() [member function] cls.add_method('MessageBegin', 'std::_List_iterator< ns3::Ptr< ns3::PbbMessage > >', []) ## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbMessage> > ns3::PbbPacket::MessageBegin() const [member function] cls.add_method('MessageBegin', 'std::_List_const_iterator< ns3::Ptr< ns3::PbbMessage > >', [], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbPacket::MessageClear() [member function] cls.add_method('MessageClear', 'void', []) ## packetbb.h (module 'network'): bool ns3::PbbPacket::MessageEmpty() const [member function] cls.add_method('MessageEmpty', 'bool', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbMessage> > ns3::PbbPacket::MessageEnd() [member function] cls.add_method('MessageEnd', 'std::_List_iterator< ns3::Ptr< ns3::PbbMessage > >', []) ## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbMessage> > ns3::PbbPacket::MessageEnd() const [member function] cls.add_method('MessageEnd', 'std::_List_const_iterator< ns3::Ptr< ns3::PbbMessage > >', [], is_const=True) ## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbMessage> ns3::PbbPacket::MessageFront() [member function] cls.add_method('MessageFront', 'ns3::Ptr< ns3::PbbMessage >', []) ## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbMessage> const ns3::PbbPacket::MessageFront() const [member function] cls.add_method('MessageFront', 'ns3::Ptr< ns3::PbbMessage > const', [], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbPacket::MessagePopBack() [member function] cls.add_method('MessagePopBack', 'void', []) ## packetbb.h (module 'network'): void ns3::PbbPacket::MessagePopFront() [member function] cls.add_method('MessagePopFront', 'void', []) ## packetbb.h (module 'network'): void ns3::PbbPacket::MessagePushBack(ns3::Ptr<ns3::PbbMessage> message) [member function] cls.add_method('MessagePushBack', 'void', [param('ns3::Ptr< ns3::PbbMessage >', 'message')]) ## packetbb.h (module 'network'): void ns3::PbbPacket::MessagePushFront(ns3::Ptr<ns3::PbbMessage> message) [member function] cls.add_method('MessagePushFront', 'void', [param('ns3::Ptr< ns3::PbbMessage >', 'message')]) ## packetbb.h (module 'network'): int ns3::PbbPacket::MessageSize() const [member function] cls.add_method('MessageSize', 'int', [], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbPacket::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True, is_virtual=True) ## packetbb.h (module 'network'): void ns3::PbbPacket::Serialize(ns3::Buffer::Iterator start) const [member function] cls.add_method('Serialize', 'void', [param('ns3::Buffer::Iterator', 'start')], is_const=True, is_virtual=True) ## packetbb.h (module 'network'): void ns3::PbbPacket::SetSequenceNumber(uint16_t number) [member function] cls.add_method('SetSequenceNumber', 'void', [param('uint16_t', 'number')]) ## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> ns3::PbbPacket::TlvBack() [member function] cls.add_method('TlvBack', 'ns3::Ptr< ns3::PbbTlv >', []) ## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> const ns3::PbbPacket::TlvBack() const [member function] cls.add_method('TlvBack', 'ns3::Ptr< ns3::PbbTlv > const', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbPacket::TlvBegin() [member function] cls.add_method('TlvBegin', 'std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', []) ## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbPacket::TlvBegin() const [member function] cls.add_method('TlvBegin', 'std::_List_const_iterator< ns3::Ptr< ns3::PbbTlv > >', [], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbPacket::TlvClear() [member function] cls.add_method('TlvClear', 'void', []) ## packetbb.h (module 'network'): bool ns3::PbbPacket::TlvEmpty() const [member function] cls.add_method('TlvEmpty', 'bool', [], is_const=True) ## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbPacket::TlvEnd() [member function] cls.add_method('TlvEnd', 'std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', []) ## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbPacket::TlvEnd() const [member function] cls.add_method('TlvEnd', 'std::_List_const_iterator< ns3::Ptr< ns3::PbbTlv > >', [], is_const=True) ## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> ns3::PbbPacket::TlvFront() [member function] cls.add_method('TlvFront', 'ns3::Ptr< ns3::PbbTlv >', []) ## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> const ns3::PbbPacket::TlvFront() const [member function] cls.add_method('TlvFront', 'ns3::Ptr< ns3::PbbTlv > const', [], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbPacket::TlvPopBack() [member function] cls.add_method('TlvPopBack', 'void', []) ## packetbb.h (module 'network'): void ns3::PbbPacket::TlvPopFront() [member function] cls.add_method('TlvPopFront', 'void', []) ## packetbb.h (module 'network'): void ns3::PbbPacket::TlvPushBack(ns3::Ptr<ns3::PbbTlv> tlv) [member function] cls.add_method('TlvPushBack', 'void', [param('ns3::Ptr< ns3::PbbTlv >', 'tlv')]) ## packetbb.h (module 'network'): void ns3::PbbPacket::TlvPushFront(ns3::Ptr<ns3::PbbTlv> tlv) [member function] cls.add_method('TlvPushFront', 'void', [param('ns3::Ptr< ns3::PbbTlv >', 'tlv')]) ## packetbb.h (module 'network'): int ns3::PbbPacket::TlvSize() const [member function] cls.add_method('TlvSize', 'int', [], is_const=True) return def register_Ns3PbbTlv_methods(root_module, cls): cls.add_binary_comparison_operator('==') cls.add_binary_comparison_operator('!=') ## packetbb.h (module 'network'): ns3::PbbTlv::PbbTlv(ns3::PbbTlv const & arg0) [copy constructor] cls.add_constructor([param('ns3::PbbTlv const &', 'arg0')]) ## packetbb.h (module 'network'): ns3::PbbTlv::PbbTlv() [constructor] cls.add_constructor([]) ## packetbb.h (module 'network'): void ns3::PbbTlv::Deserialize(ns3::Buffer::Iterator & start) [member function] cls.add_method('Deserialize', 'void', [param('ns3::Buffer::Iterator &', 'start')]) ## packetbb.h (module 'network'): uint32_t ns3::PbbTlv::GetSerializedSize() const [member function] cls.add_method('GetSerializedSize', 'uint32_t', [], is_const=True) ## packetbb.h (module 'network'): uint8_t ns3::PbbTlv::GetType() const [member function] cls.add_method('GetType', 'uint8_t', [], is_const=True) ## packetbb.h (module 'network'): uint8_t ns3::PbbTlv::GetTypeExt() const [member function] cls.add_method('GetTypeExt', 'uint8_t', [], is_const=True) ## packetbb.h (module 'network'): ns3::Buffer ns3::PbbTlv::GetValue() const [member function] cls.add_method('GetValue', 'ns3::Buffer', [], is_const=True) ## packetbb.h (module 'network'): bool ns3::PbbTlv::HasTypeExt() const [member function] cls.add_method('HasTypeExt', 'bool', [], is_const=True) ## packetbb.h (module 'network'): bool ns3::PbbTlv::HasValue() const [member function] cls.add_method('HasValue', 'bool', [], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbTlv::Print(std::ostream & os) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os')], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbTlv::Print(std::ostream & os, int level) const [member function] cls.add_method('Print', 'void', [param('std::ostream &', 'os'), param('int', 'level')], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbTlv::Serialize(ns3::Buffer::Iterator & start) const [member function] cls.add_method('Serialize', 'void', [param('ns3::Buffer::Iterator &', 'start')], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbTlv::SetType(uint8_t type) [member function] cls.add_method('SetType', 'void', [param('uint8_t', 'type')]) ## packetbb.h (module 'network'): void ns3::PbbTlv::SetTypeExt(uint8_t type) [member function] cls.add_method('SetTypeExt', 'void', [param('uint8_t', 'type')]) ## packetbb.h (module 'network'): void ns3::PbbTlv::SetValue(ns3::Buffer start) [member function] cls.add_method('SetValue', 'void', [param('ns3::Buffer', 'start')]) ## packetbb.h (module 'network'): void ns3::PbbTlv::SetValue(uint8_t const * buffer, uint32_t size) [member function] cls.add_method('SetValue', 'void', [param('uint8_t const *', 'buffer'), param('uint32_t', 'size')]) ## packetbb.h (module 'network'): uint8_t ns3::PbbTlv::GetIndexStart() const [member function] cls.add_method('GetIndexStart', 'uint8_t', [], is_const=True, visibility='protected') ## packetbb.h (module 'network'): uint8_t ns3::PbbTlv::GetIndexStop() const [member function] cls.add_method('GetIndexStop', 'uint8_t', [], is_const=True, visibility='protected') ## packetbb.h (module 'network'): bool ns3::PbbTlv::HasIndexStart() const [member function] cls.add_method('HasIndexStart', 'bool', [], is_const=True, visibility='protected') ## packetbb.h (module 'network'): bool ns3::PbbTlv::HasIndexStop() const [member function] cls.add_method('HasIndexStop', 'bool', [], is_const=True, visibility='protected') ## packetbb.h (module 'network'): bool ns3::PbbTlv::IsMultivalue() const [member function] cls.add_method('IsMultivalue', 'bool', [], is_const=True, visibility='protected') ## packetbb.h (module 'network'): void ns3::PbbTlv::SetIndexStart(uint8_t index) [member function] cls.add_method('SetIndexStart', 'void', [param('uint8_t', 'index')], visibility='protected') ## packetbb.h (module 'network'): void ns3::PbbTlv::SetIndexStop(uint8_t index) [member function] cls.add_method('SetIndexStop', 'void', [param('uint8_t', 'index')], visibility='protected') ## packetbb.h (module 'network'): void ns3::PbbTlv::SetMultivalue(bool isMultivalue) [member function] cls.add_method('SetMultivalue', 'void', [param('bool', 'isMultivalue')], visibility='protected') return def register_Ns3RandomVariableChecker_methods(root_module, cls): ## random-variable.h (module 'core'): ns3::RandomVariableChecker::RandomVariableChecker() [constructor] cls.add_constructor([]) ## random-variable.h (module 'core'): ns3::RandomVariableChecker::RandomVariableChecker(ns3::RandomVariableChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::RandomVariableChecker const &', 'arg0')]) return def register_Ns3RandomVariableValue_methods(root_module, cls): ## random-variable.h (module 'core'): ns3::RandomVariableValue::RandomVariableValue() [constructor] cls.add_constructor([]) ## random-variable.h (module 'core'): ns3::RandomVariableValue::RandomVariableValue(ns3::RandomVariableValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::RandomVariableValue const &', 'arg0')]) ## random-variable.h (module 'core'): ns3::RandomVariableValue::RandomVariableValue(ns3::RandomVariable const & value) [constructor] cls.add_constructor([param('ns3::RandomVariable const &', 'value')]) ## random-variable.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::RandomVariableValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## random-variable.h (module 'core'): bool ns3::RandomVariableValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## random-variable.h (module 'core'): ns3::RandomVariable ns3::RandomVariableValue::Get() const [member function] cls.add_method('Get', 'ns3::RandomVariable', [], is_const=True) ## random-variable.h (module 'core'): std::string ns3::RandomVariableValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## random-variable.h (module 'core'): void ns3::RandomVariableValue::Set(ns3::RandomVariable const & value) [member function] cls.add_method('Set', 'void', [param('ns3::RandomVariable const &', 'value')]) return def register_Ns3RateErrorModel_methods(root_module, cls): ## error-model.h (module 'network'): ns3::RateErrorModel::RateErrorModel(ns3::RateErrorModel const & arg0) [copy constructor] cls.add_constructor([param('ns3::RateErrorModel const &', 'arg0')]) ## error-model.h (module 'network'): ns3::RateErrorModel::RateErrorModel() [constructor] cls.add_constructor([]) ## error-model.h (module 'network'): double ns3::RateErrorModel::GetRate() const [member function] cls.add_method('GetRate', 'double', [], is_const=True) ## error-model.h (module 'network'): static ns3::TypeId ns3::RateErrorModel::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## error-model.h (module 'network'): ns3::RateErrorModel::ErrorUnit ns3::RateErrorModel::GetUnit() const [member function] cls.add_method('GetUnit', 'ns3::RateErrorModel::ErrorUnit', [], is_const=True) ## error-model.h (module 'network'): void ns3::RateErrorModel::SetRandomVariable(ns3::RandomVariable const & ranvar) [member function] cls.add_method('SetRandomVariable', 'void', [param('ns3::RandomVariable const &', 'ranvar')]) ## error-model.h (module 'network'): void ns3::RateErrorModel::SetRate(double rate) [member function] cls.add_method('SetRate', 'void', [param('double', 'rate')]) ## error-model.h (module 'network'): void ns3::RateErrorModel::SetUnit(ns3::RateErrorModel::ErrorUnit error_unit) [member function] cls.add_method('SetUnit', 'void', [param('ns3::RateErrorModel::ErrorUnit', 'error_unit')]) ## error-model.h (module 'network'): bool ns3::RateErrorModel::DoCorrupt(ns3::Ptr<ns3::Packet> p) [member function] cls.add_method('DoCorrupt', 'bool', [param('ns3::Ptr< ns3::Packet >', 'p')], visibility='private', is_virtual=True) ## error-model.h (module 'network'): bool ns3::RateErrorModel::DoCorruptBit(ns3::Ptr<ns3::Packet> p) [member function] cls.add_method('DoCorruptBit', 'bool', [param('ns3::Ptr< ns3::Packet >', 'p')], visibility='private', is_virtual=True) ## error-model.h (module 'network'): bool ns3::RateErrorModel::DoCorruptByte(ns3::Ptr<ns3::Packet> p) [member function] cls.add_method('DoCorruptByte', 'bool', [param('ns3::Ptr< ns3::Packet >', 'p')], visibility='private', is_virtual=True) ## error-model.h (module 'network'): bool ns3::RateErrorModel::DoCorruptPkt(ns3::Ptr<ns3::Packet> p) [member function] cls.add_method('DoCorruptPkt', 'bool', [param('ns3::Ptr< ns3::Packet >', 'p')], visibility='private', is_virtual=True) ## error-model.h (module 'network'): void ns3::RateErrorModel::DoReset() [member function] cls.add_method('DoReset', 'void', [], visibility='private', is_virtual=True) return def register_Ns3ReceiveListErrorModel_methods(root_module, cls): ## error-model.h (module 'network'): ns3::ReceiveListErrorModel::ReceiveListErrorModel(ns3::ReceiveListErrorModel const & arg0) [copy constructor] cls.add_constructor([param('ns3::ReceiveListErrorModel const &', 'arg0')]) ## error-model.h (module 'network'): ns3::ReceiveListErrorModel::ReceiveListErrorModel() [constructor] cls.add_constructor([]) ## error-model.h (module 'network'): std::list<unsigned int, std::allocator<unsigned int> > ns3::ReceiveListErrorModel::GetList() const [member function] cls.add_method('GetList', 'std::list< unsigned int >', [], is_const=True) ## error-model.h (module 'network'): static ns3::TypeId ns3::ReceiveListErrorModel::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## error-model.h (module 'network'): void ns3::ReceiveListErrorModel::SetList(std::list<unsigned int, std::allocator<unsigned int> > const & packetlist) [member function] cls.add_method('SetList', 'void', [param('std::list< unsigned int > const &', 'packetlist')]) ## error-model.h (module 'network'): bool ns3::ReceiveListErrorModel::DoCorrupt(ns3::Ptr<ns3::Packet> p) [member function] cls.add_method('DoCorrupt', 'bool', [param('ns3::Ptr< ns3::Packet >', 'p')], visibility='private', is_virtual=True) ## error-model.h (module 'network'): void ns3::ReceiveListErrorModel::DoReset() [member function] cls.add_method('DoReset', 'void', [], visibility='private', is_virtual=True) return def register_Ns3SimpleChannel_methods(root_module, cls): ## simple-channel.h (module 'network'): ns3::SimpleChannel::SimpleChannel(ns3::SimpleChannel const & arg0) [copy constructor] cls.add_constructor([param('ns3::SimpleChannel const &', 'arg0')]) ## simple-channel.h (module 'network'): ns3::SimpleChannel::SimpleChannel() [constructor] cls.add_constructor([]) ## simple-channel.h (module 'network'): void ns3::SimpleChannel::Add(ns3::Ptr<ns3::SimpleNetDevice> device) [member function] cls.add_method('Add', 'void', [param('ns3::Ptr< ns3::SimpleNetDevice >', 'device')]) ## simple-channel.h (module 'network'): ns3::Ptr<ns3::NetDevice> ns3::SimpleChannel::GetDevice(uint32_t i) const [member function] cls.add_method('GetDevice', 'ns3::Ptr< ns3::NetDevice >', [param('uint32_t', 'i')], is_const=True, is_virtual=True) ## simple-channel.h (module 'network'): uint32_t ns3::SimpleChannel::GetNDevices() const [member function] cls.add_method('GetNDevices', 'uint32_t', [], is_const=True, is_virtual=True) ## simple-channel.h (module 'network'): static ns3::TypeId ns3::SimpleChannel::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## simple-channel.h (module 'network'): void ns3::SimpleChannel::Send(ns3::Ptr<ns3::Packet> p, uint16_t protocol, ns3::Mac48Address to, ns3::Mac48Address from, ns3::Ptr<ns3::SimpleNetDevice> sender) [member function] cls.add_method('Send', 'void', [param('ns3::Ptr< ns3::Packet >', 'p'), param('uint16_t', 'protocol'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from'), param('ns3::Ptr< ns3::SimpleNetDevice >', 'sender')]) return def register_Ns3SimpleNetDevice_methods(root_module, cls): ## simple-net-device.h (module 'network'): ns3::SimpleNetDevice::SimpleNetDevice(ns3::SimpleNetDevice const & arg0) [copy constructor] cls.add_constructor([param('ns3::SimpleNetDevice const &', 'arg0')]) ## simple-net-device.h (module 'network'): ns3::SimpleNetDevice::SimpleNetDevice() [constructor] cls.add_constructor([]) ## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::AddLinkChangeCallback(ns3::Callback<void,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function] cls.add_method('AddLinkChangeCallback', 'void', [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')], is_virtual=True) ## simple-net-device.h (module 'network'): ns3::Address ns3::SimpleNetDevice::GetAddress() const [member function] cls.add_method('GetAddress', 'ns3::Address', [], is_const=True, is_virtual=True) ## simple-net-device.h (module 'network'): ns3::Address ns3::SimpleNetDevice::GetBroadcast() const [member function] cls.add_method('GetBroadcast', 'ns3::Address', [], is_const=True, is_virtual=True) ## simple-net-device.h (module 'network'): ns3::Ptr<ns3::Channel> ns3::SimpleNetDevice::GetChannel() const [member function] cls.add_method('GetChannel', 'ns3::Ptr< ns3::Channel >', [], is_const=True, is_virtual=True) ## simple-net-device.h (module 'network'): uint32_t ns3::SimpleNetDevice::GetIfIndex() const [member function] cls.add_method('GetIfIndex', 'uint32_t', [], is_const=True, is_virtual=True) ## simple-net-device.h (module 'network'): uint16_t ns3::SimpleNetDevice::GetMtu() const [member function] cls.add_method('GetMtu', 'uint16_t', [], is_const=True, is_virtual=True) ## simple-net-device.h (module 'network'): ns3::Address ns3::SimpleNetDevice::GetMulticast(ns3::Ipv4Address multicastGroup) const [member function] cls.add_method('GetMulticast', 'ns3::Address', [param('ns3::Ipv4Address', 'multicastGroup')], is_const=True, is_virtual=True) ## simple-net-device.h (module 'network'): ns3::Address ns3::SimpleNetDevice::GetMulticast(ns3::Ipv6Address addr) const [member function] cls.add_method('GetMulticast', 'ns3::Address', [param('ns3::Ipv6Address', 'addr')], is_const=True, is_virtual=True) ## simple-net-device.h (module 'network'): ns3::Ptr<ns3::Node> ns3::SimpleNetDevice::GetNode() const [member function] cls.add_method('GetNode', 'ns3::Ptr< ns3::Node >', [], is_const=True, is_virtual=True) ## simple-net-device.h (module 'network'): static ns3::TypeId ns3::SimpleNetDevice::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::IsBridge() const [member function] cls.add_method('IsBridge', 'bool', [], is_const=True, is_virtual=True) ## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::IsBroadcast() const [member function] cls.add_method('IsBroadcast', 'bool', [], is_const=True, is_virtual=True) ## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::IsLinkUp() const [member function] cls.add_method('IsLinkUp', 'bool', [], is_const=True, is_virtual=True) ## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::IsMulticast() const [member function] cls.add_method('IsMulticast', 'bool', [], is_const=True, is_virtual=True) ## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::IsPointToPoint() const [member function] cls.add_method('IsPointToPoint', 'bool', [], is_const=True, is_virtual=True) ## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::NeedsArp() const [member function] cls.add_method('NeedsArp', 'bool', [], is_const=True, is_virtual=True) ## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::Receive(ns3::Ptr<ns3::Packet> packet, uint16_t protocol, ns3::Mac48Address to, ns3::Mac48Address from) [member function] cls.add_method('Receive', 'void', [param('ns3::Ptr< ns3::Packet >', 'packet'), param('uint16_t', 'protocol'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')]) ## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::Send(ns3::Ptr<ns3::Packet> packet, ns3::Address const & dest, uint16_t protocolNumber) [member function] cls.add_method('Send', 'bool', [param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')], is_virtual=True) ## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::SendFrom(ns3::Ptr<ns3::Packet> packet, ns3::Address const & source, ns3::Address const & dest, uint16_t protocolNumber) [member function] cls.add_method('SendFrom', 'bool', [param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'source'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')], is_virtual=True) ## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::SetAddress(ns3::Address address) [member function] cls.add_method('SetAddress', 'void', [param('ns3::Address', 'address')], is_virtual=True) ## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::SetChannel(ns3::Ptr<ns3::SimpleChannel> channel) [member function] cls.add_method('SetChannel', 'void', [param('ns3::Ptr< ns3::SimpleChannel >', 'channel')]) ## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::SetIfIndex(uint32_t const index) [member function] cls.add_method('SetIfIndex', 'void', [param('uint32_t const', 'index')], is_virtual=True) ## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::SetMtu(uint16_t const mtu) [member function] cls.add_method('SetMtu', 'bool', [param('uint16_t const', 'mtu')], is_virtual=True) ## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::SetNode(ns3::Ptr<ns3::Node> node) [member function] cls.add_method('SetNode', 'void', [param('ns3::Ptr< ns3::Node >', 'node')], is_virtual=True) ## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::SetPromiscReceiveCallback(ns3::Callback<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty> cb) [member function] cls.add_method('SetPromiscReceiveCallback', 'void', [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', 'cb')], is_virtual=True) ## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::SetReceiveCallback(ns3::Callback<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> cb) [member function] cls.add_method('SetReceiveCallback', 'void', [param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'cb')], is_virtual=True) ## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::SetReceiveErrorModel(ns3::Ptr<ns3::ErrorModel> em) [member function] cls.add_method('SetReceiveErrorModel', 'void', [param('ns3::Ptr< ns3::ErrorModel >', 'em')]) ## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::SupportsSendFrom() const [member function] cls.add_method('SupportsSendFrom', 'bool', [], is_const=True, is_virtual=True) ## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::DoDispose() [member function] cls.add_method('DoDispose', 'void', [], visibility='protected', is_virtual=True) return def register_Ns3TimeChecker_methods(root_module, cls): ## nstime.h (module 'core'): ns3::TimeChecker::TimeChecker() [constructor] cls.add_constructor([]) ## nstime.h (module 'core'): ns3::TimeChecker::TimeChecker(ns3::TimeChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::TimeChecker const &', 'arg0')]) return def register_Ns3TimeValue_methods(root_module, cls): ## nstime.h (module 'core'): ns3::TimeValue::TimeValue() [constructor] cls.add_constructor([]) ## nstime.h (module 'core'): ns3::TimeValue::TimeValue(ns3::TimeValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::TimeValue const &', 'arg0')]) ## nstime.h (module 'core'): ns3::TimeValue::TimeValue(ns3::Time const & value) [constructor] cls.add_constructor([param('ns3::Time const &', 'value')]) ## nstime.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::TimeValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## nstime.h (module 'core'): bool ns3::TimeValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## nstime.h (module 'core'): ns3::Time ns3::TimeValue::Get() const [member function] cls.add_method('Get', 'ns3::Time', [], is_const=True) ## nstime.h (module 'core'): std::string ns3::TimeValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## nstime.h (module 'core'): void ns3::TimeValue::Set(ns3::Time const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Time const &', 'value')]) return def register_Ns3TypeIdChecker_methods(root_module, cls): ## type-id.h (module 'core'): ns3::TypeIdChecker::TypeIdChecker() [constructor] cls.add_constructor([]) ## type-id.h (module 'core'): ns3::TypeIdChecker::TypeIdChecker(ns3::TypeIdChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::TypeIdChecker const &', 'arg0')]) return def register_Ns3TypeIdValue_methods(root_module, cls): ## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue() [constructor] cls.add_constructor([]) ## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue(ns3::TypeIdValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::TypeIdValue const &', 'arg0')]) ## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue(ns3::TypeId const & value) [constructor] cls.add_constructor([param('ns3::TypeId const &', 'value')]) ## type-id.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::TypeIdValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## type-id.h (module 'core'): bool ns3::TypeIdValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeIdValue::Get() const [member function] cls.add_method('Get', 'ns3::TypeId', [], is_const=True) ## type-id.h (module 'core'): std::string ns3::TypeIdValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## type-id.h (module 'core'): void ns3::TypeIdValue::Set(ns3::TypeId const & value) [member function] cls.add_method('Set', 'void', [param('ns3::TypeId const &', 'value')]) return def register_Ns3AddressChecker_methods(root_module, cls): ## address.h (module 'network'): ns3::AddressChecker::AddressChecker() [constructor] cls.add_constructor([]) ## address.h (module 'network'): ns3::AddressChecker::AddressChecker(ns3::AddressChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::AddressChecker const &', 'arg0')]) return def register_Ns3AddressValue_methods(root_module, cls): ## address.h (module 'network'): ns3::AddressValue::AddressValue() [constructor] cls.add_constructor([]) ## address.h (module 'network'): ns3::AddressValue::AddressValue(ns3::AddressValue const & arg0) [copy constructor] cls.add_constructor([param('ns3::AddressValue const &', 'arg0')]) ## address.h (module 'network'): ns3::AddressValue::AddressValue(ns3::Address const & value) [constructor] cls.add_constructor([param('ns3::Address const &', 'value')]) ## address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::AddressValue::Copy() const [member function] cls.add_method('Copy', 'ns3::Ptr< ns3::AttributeValue >', [], is_const=True, is_virtual=True) ## address.h (module 'network'): bool ns3::AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function] cls.add_method('DeserializeFromString', 'bool', [param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_virtual=True) ## address.h (module 'network'): ns3::Address ns3::AddressValue::Get() const [member function] cls.add_method('Get', 'ns3::Address', [], is_const=True) ## address.h (module 'network'): std::string ns3::AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function] cls.add_method('SerializeToString', 'std::string', [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], is_const=True, is_virtual=True) ## address.h (module 'network'): void ns3::AddressValue::Set(ns3::Address const & value) [member function] cls.add_method('Set', 'void', [param('ns3::Address const &', 'value')]) return def register_Ns3PbbAddressTlv_methods(root_module, cls): ## packetbb.h (module 'network'): ns3::PbbAddressTlv::PbbAddressTlv() [constructor] cls.add_constructor([]) ## packetbb.h (module 'network'): ns3::PbbAddressTlv::PbbAddressTlv(ns3::PbbAddressTlv const & arg0) [copy constructor] cls.add_constructor([param('ns3::PbbAddressTlv const &', 'arg0')]) ## packetbb.h (module 'network'): uint8_t ns3::PbbAddressTlv::GetIndexStart() const [member function] cls.add_method('GetIndexStart', 'uint8_t', [], is_const=True) ## packetbb.h (module 'network'): uint8_t ns3::PbbAddressTlv::GetIndexStop() const [member function] cls.add_method('GetIndexStop', 'uint8_t', [], is_const=True) ## packetbb.h (module 'network'): bool ns3::PbbAddressTlv::HasIndexStart() const [member function] cls.add_method('HasIndexStart', 'bool', [], is_const=True) ## packetbb.h (module 'network'): bool ns3::PbbAddressTlv::HasIndexStop() const [member function] cls.add_method('HasIndexStop', 'bool', [], is_const=True) ## packetbb.h (module 'network'): bool ns3::PbbAddressTlv::IsMultivalue() const [member function] cls.add_method('IsMultivalue', 'bool', [], is_const=True) ## packetbb.h (module 'network'): void ns3::PbbAddressTlv::SetIndexStart(uint8_t index) [member function] cls.add_method('SetIndexStart', 'void', [param('uint8_t', 'index')]) ## packetbb.h (module 'network'): void ns3::PbbAddressTlv::SetIndexStop(uint8_t index) [member function] cls.add_method('SetIndexStop', 'void', [param('uint8_t', 'index')]) ## packetbb.h (module 'network'): void ns3::PbbAddressTlv::SetMultivalue(bool isMultivalue) [member function] cls.add_method('SetMultivalue', 'void', [param('bool', 'isMultivalue')]) return def register_functions(root_module): module = root_module ## address.h (module 'network'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeAddressChecker() [free function] module.add_function('MakeAddressChecker', 'ns3::Ptr< ns3::AttributeChecker const >', []) ## data-rate.h (module 'network'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeDataRateChecker() [free function] module.add_function('MakeDataRateChecker', 'ns3::Ptr< ns3::AttributeChecker const >', []) ## ipv4-address.h (module 'network'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeIpv4AddressChecker() [free function] module.add_function('MakeIpv4AddressChecker', 'ns3::Ptr< ns3::AttributeChecker const >', []) ## ipv4-address.h (module 'network'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeIpv4MaskChecker() [free function] module.add_function('MakeIpv4MaskChecker', 'ns3::Ptr< ns3::AttributeChecker const >', []) ## ipv6-address.h (module 'network'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeIpv6AddressChecker() [free function] module.add_function('MakeIpv6AddressChecker', 'ns3::Ptr< ns3::AttributeChecker const >', []) ## ipv6-address.h (module 'network'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeIpv6PrefixChecker() [free function] module.add_function('MakeIpv6PrefixChecker', 'ns3::Ptr< ns3::AttributeChecker const >', []) ## mac48-address.h (module 'network'): extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeMac48AddressChecker() [free function] module.add_function('MakeMac48AddressChecker', 'ns3::Ptr< ns3::AttributeChecker const >', []) ## address-utils.h (module 'network'): extern void ns3::ReadFrom(ns3::Buffer::Iterator & i, ns3::Address & ad, uint32_t len) [free function] module.add_function('ReadFrom', 'void', [param('ns3::Buffer::Iterator &', 'i'), param('ns3::Address &', 'ad'), param('uint32_t', 'len')]) ## address-utils.h (module 'network'): extern void ns3::ReadFrom(ns3::Buffer::Iterator & i, ns3::Ipv4Address & ad) [free function] module.add_function('ReadFrom', 'void', [param('ns3::Buffer::Iterator &', 'i'), param('ns3::Ipv4Address &', 'ad')]) ## address-utils.h (module 'network'): extern void ns3::ReadFrom(ns3::Buffer::Iterator & i, ns3::Ipv6Address & ad) [free function] module.add_function('ReadFrom', 'void', [param('ns3::Buffer::Iterator &', 'i'), param('ns3::Ipv6Address &', 'ad')]) ## address-utils.h (module 'network'): extern void ns3::ReadFrom(ns3::Buffer::Iterator & i, ns3::Mac48Address & ad) [free function] module.add_function('ReadFrom', 'void', [param('ns3::Buffer::Iterator &', 'i'), param('ns3::Mac48Address &', 'ad')]) ## address-utils.h (module 'network'): extern void ns3::WriteTo(ns3::Buffer::Iterator & i, ns3::Address const & ad) [free function] module.add_function('WriteTo', 'void', [param('ns3::Buffer::Iterator &', 'i'), param('ns3::Address const &', 'ad')]) ## address-utils.h (module 'network'): extern void ns3::WriteTo(ns3::Buffer::Iterator & i, ns3::Ipv4Address ad) [free function] module.add_function('WriteTo', 'void', [param('ns3::Buffer::Iterator &', 'i'), param('ns3::Ipv4Address', 'ad')]) ## address-utils.h (module 'network'): extern void ns3::WriteTo(ns3::Buffer::Iterator & i, ns3::Ipv6Address ad) [free function] module.add_function('WriteTo', 'void', [param('ns3::Buffer::Iterator &', 'i'), param('ns3::Ipv6Address', 'ad')]) ## address-utils.h (module 'network'): extern void ns3::WriteTo(ns3::Buffer::Iterator & i, ns3::Mac48Address ad) [free function] module.add_function('WriteTo', 'void', [param('ns3::Buffer::Iterator &', 'i'), param('ns3::Mac48Address', 'ad')]) register_functions_ns3_FatalImpl(module.get_submodule('FatalImpl'), root_module) register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module) return def register_functions_ns3_FatalImpl(module, root_module): return def register_functions_ns3_addressUtils(module, root_module): ## address-utils.h (module 'network'): extern bool ns3::addressUtils::IsMulticast(ns3::Address const & ad) [free function] module.add_function('IsMulticast', 'bool', [param('ns3::Address const &', 'ad')]) return def main(): out = FileCodeSink(sys.stdout) root_module = module_init() register_types(root_module) register_methods(root_module) register_functions(root_module) root_module.generate(out) if __name__ == '__main__': main()
dtaht/ns-3-dev-old
src/network/bindings/modulegen__gcc_LP64.py
Python
gpl-2.0
507,731
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2013, 2014, 2015 CERN. # # Invenio is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. # # Invenio is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Invenio; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA """Implement registries for formatter.""" import os from flask_registry import ( ModuleAutoDiscoveryRegistry, PkgResourcesDirDiscoveryRegistry, RegistryProxy, ) from invenio.ext.registry import ModuleAutoDiscoverySubRegistry from invenio.utils.datastructures import LazyDict import yaml format_templates_directories = RegistryProxy( 'format_templates_directories', ModuleAutoDiscoveryRegistry, 'format_templates' ) format_templates = RegistryProxy( 'format_templates', PkgResourcesDirDiscoveryRegistry, '.', registry_namespace=format_templates_directories ) output_formats_directories = RegistryProxy( 'output_formats_directories', ModuleAutoDiscoveryRegistry, 'output_formats' ) output_formats_files = RegistryProxy( 'output_formats_files', PkgResourcesDirDiscoveryRegistry, '.', registry_namespace=output_formats_directories ) template_context_functions = RegistryProxy( 'template_context_functions', ModuleAutoDiscoverySubRegistry, 'template_context_functions' ) def create_format_templates_lookup(): """Create format templates.""" out = {} def _register(path, level=1): if level > 4: return normpath = os.path.normpath(path) if os.path.isdir(normpath): for p in os.listdir(normpath): _register(os.path.join(normpath, p), level=level+1) else: parts = normpath.split(os.path.sep) out[os.path.sep.join(parts[-level:])] = normpath for t in reversed(format_templates): _register(t) return out format_templates_lookup = LazyDict(create_format_templates_lookup) def create_output_formats_lookup(): """Create output formats.""" out = {} for f in output_formats_files: of = os.path.basename(f).lower() data = {'names': {}} if of.endswith('.yml'): of = of[:-4] with open(f, 'r') as f: data.update(yaml.load(f) or {}) data['code'] = of else: continue # unknown filetype if of in out: continue out[of] = data return out output_formats = LazyDict(create_output_formats_lookup) export_formats = LazyDict(lambda: dict( (code, of) for code, of in output_formats.items() if of.get('content_type', '') != 'text/html' and of.get('visibility', 0) ))
jirikuncar/invenio-formatter
invenio_formatter/registry.py
Python
gpl-2.0
3,187
# ***************************************************************************** # conduct - CONvenient Construction Tool # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Module authors: # Alexander Lenz <[email protected]> # Georg Brandl <[email protected]> # # ***************************************************************************** import os import sys import time import linecache import traceback import logging from os import path from logging import Logger, Formatter, Handler, DEBUG, INFO, WARNING, ERROR from conduct import colors LOGFMT = '%(asctime)s : %(levelname)-7s : %(name)-25s: %(message)s' DATEFMT = '%H:%M:%S' DATESTAMP_FMT = '%Y-%m-%d' SECONDS_PER_DAY = 60 * 60 * 24 LOGLEVELS = {'debug': DEBUG, 'info': INFO, 'warning': WARNING, 'error': ERROR} INVLOGLEVELS = {value : key for key, value in LOGLEVELS.items()} class ConductLogger(Logger): maxLogNameLength = 0 def __init__(self, *args, **kwargs): Logger.__init__(self, *args, **kwargs) ConductLogger._storeLoggerNameLength(self) def getChild(self, suffix, ownDir=False): child = Logger.getChild(self, suffix) child.setLevel(self.getEffectiveLevel()) if ownDir: for handler in self._collectHandlers(): if isinstance(handler, LogfileHandler): handler = handler.getChild(suffix) child.addHandler(handler) child.propagate = False return child def _collectHandlers(self): result = [] log = self while log is not None: result += log.handlers log = log.parent return result @staticmethod def _storeLoggerNameLength(logObj): # store max logger name length for formatting if len(logObj.name) > ConductLogger.maxLogNameLength: ConductLogger.maxLogNameLength = len(logObj.name) class ConsoleFormatter(Formatter): """ A lightweight formatter for the interactive console, with optional colored output. """ def __init__(self, fmt=None, datefmt=None, colorize=None): Formatter.__init__(self, fmt, datefmt) if colorize: self.colorize = colorize else: self.colorize = lambda c, s: s def formatException(self, exc_info): return traceback.format_exception_only(*exc_info[0:2])[-1] def formatTime(self, record, datefmt=None): return time.strftime(datefmt or DATEFMT, self.converter(record.created)) def format(self, record): record.message = record.getMessage() levelno = record.levelno datefmt = self.colorize('lightgray', '[%(asctime)s] ') namefmt = '%(name)-' + str(ConductLogger.maxLogNameLength) + 's: ' if levelno <= DEBUG: fmtstr = self.colorize('darkgray', '%s%%(message)s' % namefmt) elif levelno <= INFO: fmtstr = '%s%%(message)s' % namefmt elif levelno <= WARNING: fmtstr = self.colorize('fuchsia', '%s%%(levelname)s: %%(message)s' % namefmt) else: # Add exception type to error (if caused by exception) msgPrefix = '' if record.exc_info: msgPrefix = '%s: ' % record.exc_info[0].__name__ fmtstr = self.colorize('red', '%s%%(levelname)s: %s%%(message)s' % (namefmt, msgPrefix)) fmtstr = datefmt + fmtstr if not getattr(record, 'nonl', False): fmtstr += '\n' record.asctime = self.formatTime(record, self.datefmt) s = fmtstr % record.__dict__ # never output more exception info -- the exception message is already # part of the log message because of our special logger behavior # if record.exc_info: # # *not* caching exception text on the record, since it's # # only a short version # s += self.formatException(record.exc_info) return s def format_extended_frame(frame): ret = [] for key, value in frame.f_locals.items(): try: valstr = repr(value)[:256] except Exception: valstr = '<cannot be displayed>' ret.append(' %-20s = %s\n' % (key, valstr)) ret.append('\n') return ret def format_extended_traceback(etype, value, tb): ret = ['Traceback (most recent call last):\n'] while tb is not None: frame = tb.tb_frame filename = frame.f_code.co_filename item = ' File "%s", line %d, in %s\n' % (filename, tb.tb_lineno, frame.f_code.co_name) linecache.checkcache(filename) line = linecache.getline(filename, tb.tb_lineno, frame.f_globals) if line: item = item + ' %s\n' % line.strip() ret.append(item) if filename != '<script>': ret += format_extended_frame(tb.tb_frame) tb = tb.tb_next ret += traceback.format_exception_only(etype, value) return ''.join(ret).rstrip('\n') class LogfileFormatter(Formatter): """ The standard Formatter does not support milliseconds with an explicit datestamp format. It also doesn't show the full traceback for exceptions. """ extended_traceback = True def formatException(self, ei): if self.extended_traceback: s = format_extended_traceback(*ei) else: s = ''.join(traceback.format_exception(ei[0], ei[1], ei[2], sys.maxsize)) if s.endswith('\n'): s = s[:-1] return s def formatTime(self, record, datefmt=None): res = time.strftime(DATEFMT, self.converter(record.created)) res += ',%03d' % record.msecs return res class StreamHandler(Handler): """Reimplemented from logging: remove cruft, remove bare excepts.""" def __init__(self, stream=None): Handler.__init__(self) if stream is None: stream = sys.stderr self.stream = stream def flush(self): self.acquire() try: if self.stream and hasattr(self.stream, 'flush'): self.stream.flush() finally: self.release() def emit(self, record): try: msg = self.format(record) try: self.stream.write('%s\n' % msg) except UnicodeEncodeError: self.stream.write('%s\n' % msg.encode('utf-8')) self.flush() except Exception: self.handleError(record) class LogfileHandler(StreamHandler): """ Logs to log files with a date stamp appended, and rollover on midnight. """ def __init__(self, directory, filenameprefix, dayfmt=DATESTAMP_FMT): self._directory = path.join(directory, filenameprefix) if not path.isdir(self._directory): os.makedirs(self._directory) self._currentsymlink = path.join(self._directory, 'current') self._filenameprefix = filenameprefix self._pathnameprefix = path.join(self._directory, filenameprefix) self._dayfmt = dayfmt # today's logfile name basefn = self._pathnameprefix + '-' + time.strftime(dayfmt) + '.log' self.baseFilename = path.abspath(basefn) self.mode = 'a' StreamHandler.__init__(self, self._open()) # determine time of first midnight from now on t = time.localtime() self.rollover_at = time.mktime((t[0], t[1], t[2], 0, 0, 0, t[6], t[7], t[8])) + SECONDS_PER_DAY self.setFormatter(LogfileFormatter(LOGFMT, DATEFMT)) self.disabled = False def getChild(self, name): return LogfileHandler(self._directory, name) def filter(self, record): return not self.disabled def emit(self, record): try: t = int(time.time()) if t >= self.rollover_at: self.doRollover() if self.stream is None: self.stream = self._open() StreamHandler.emit(self, record) except Exception: self.handleError(record) def enable(self, enabled): if enabled: self.disabled = False self.stream.close() self.stream = self._open() else: self.disabled = True def close(self): self.acquire() try: if self.stream: self.flush() if hasattr(self.stream, 'close'): self.stream.close() StreamHandler.close(self) self.stream = None finally: self.release() def doRollover(self): self.stream.close() self.baseFilename = self._pathnameprefix + '-' + \ time.strftime(self._dayfmt) + '.log' self.stream = self._open() self.rollover_at += SECONDS_PER_DAY def _open(self): # update 'current' symlink upon open try: os.remove(self._currentsymlink) except OSError: # if the symlink does not (yet) exist, OSError is raised. # should happen at most once per installation.... pass if hasattr(os, 'symlink'): os.symlink(path.basename(self.baseFilename), self._currentsymlink) # finally open the new logfile.... return open(self.baseFilename, self.mode) class ColoredConsoleHandler(StreamHandler): """ A handler class that writes colorized records to standard output. """ def __init__(self): StreamHandler.__init__(self, sys.stdout) self.setFormatter(ConsoleFormatter(datefmt=DATEFMT, colorize=colors.colorize)) def emit(self, record): msg = self.format(record) try: self.stream.write(msg) except UnicodeEncodeError: self.stream.write(msg.encode('utf-8')) self.stream.flush()
birkenfeld/conduct
conduct/loggers.py
Python
gpl-2.0
10,769
#!/usr/bin/python # -*- coding: utf-8 -*- ## ## # Author: Peter Manev # # [email protected] # ## ## ## !!! IMPORTANT - LATEST DEV Scapy is needed !!! # REMOVE your current scapy installation !!! # then -> # hg clone http://hg.secdev.org/scapy-com # python setup.py install from scapy.all import * import sys, urllib , os, subprocess, random from itertools import * import Global_Vars class pacifyIpv4Http: def writeIPv4HttpRule(self, sid_id_http, http_method, http_uri_string, \ http_content_all, directory, src_name): ##creating and writing a sid.rules file rule_file = open('%s/%s.rules' % (directory,sid_id_http), 'w+') content_http_uri_string_ready_for_rule = None content_http_uri_string_ready_for_rule = "" if (len(http_uri_string) > 250): content_http_uri_string_array = [http_uri_string[i:i+250] for i in range(0, len(http_uri_string), 250)] for i in content_http_uri_string_array: i = i.replace('|', '|7C|').replace('"', '|22|').replace(';', '|3B|').\ replace(':', '|3A|').replace(' ', '|20|').replace('\\', '|5C|').\ replace('\'', '|27|').replace('\r', '|0d|').replace('\n', '|0a|') content_http_uri_string_ready_for_rule = \ content_http_uri_string_ready_for_rule + \ ("content:\"%s\"; http_raw_uri; " % (i)) else: http_uri_string = http_uri_string.replace('|', '|7C|').\ replace('"', '|22|').replace(';', '|3B|').replace(':', '|3A|').\ replace(' ', '|20|').replace('\\', '|5C|').replace('\'', '|27|').\ replace('\r', '|0d|').replace('\n', '|0a|') content_http_uri_string_ready_for_rule = \ ("content:\"%s\"; http_raw_uri; " % (http_uri_string)) content_all_ready_for_rule = None content_all_ready_for_rule = "" if (len(http_content_all) > 250): content_http_all_array = [http_content_all[i:i+250] for i in range(0, len(http_content_all), 250)] for i in content_http_all_array: i = i.replace('|', '|7C|').replace('"', '|22|').replace(';', '|3B|').\ replace(':', '|3A|').replace(' ', '|20|').replace('\\', '|5C|').\ replace('\'', '|27|').replace('\r', '|0d|').replace('\n', '|0a|') content_all_ready_for_rule = \ content_all_ready_for_rule + \ ("content:\"%s\"; " % (i)) else: http_content_all = http_content_all.replace('|', '|7C|').\ replace('"', '|22|').replace(';', '|3B|').replace(':', '|3A|').\ replace(' ', '|20|').replace('\\', '|5C|').replace('\'', '|27|').\ replace('\r', '|0d|').replace('\n', '|0a|') content_all_ready_for_rule = \ ("content:\"%s\"; " % (http_content_all)) rule_file.write ( \ "alert http any any -> any any (msg:\"HTTP requests tests - sid %s , \ pcap - %s \"; \ content:\"%s\"; http_method; %s %s \ reference:url,%s; sid:%s; rev:1;)" % \ (sid_id_http, sid_id_http, http_method, \ content_http_uri_string_ready_for_rule, \ content_all_ready_for_rule, \ src_name, sid_id_http) ) rule_file.close() def rebuildIPv4HttpSessionExtraTcpSAs(self, packet, results_directory, \ sid_id_http, src_name, repo_name): #We rebuild the http session , however inject some extra SAs session_packets = list() session_packets_fragmented = list() #print packet[TCP][Raw] #print packet[Ether].src ipsrc = packet[IP].src ipdst = packet[IP].dst portsrc = packet[TCP].sport portdst = packet[TCP].dport seq_num = random.randint(1024,(2**32)-1) ack_num = random.randint((2**10),(2**16)) # We make sure ack_num_extra* are never going to be the same numbering # as ack_num ack_num_extra_1 = random.randint((2**22)+1 , (2**32)-1) ack_num_extra_2 = random.randint((2**16)+1,(2**22)-1) syn = Ether(src=packet[Ether].src, dst=packet[Ether].dst, type=0x800 ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="S", sport=portsrc, dport=portdst, \ seq=seq_num) synack_extra_1 = Ether(src=packet[Ether].dst, dst=packet[Ether].src, \ type=0x800 )/IP(src=ipdst, dst=ipsrc)/TCP(flags="SA", sport=portdst, \ dport=portsrc, seq=ack_num_extra_1, ack=syn.seq+1) synack_extra_2 = Ether(src=packet[Ether].dst, dst=packet[Ether].src, \ type=0x800 )/IP(src=ipdst, dst=ipsrc)/TCP(flags="SA", sport=portdst, \ dport=portsrc, seq=ack_num_extra_2, ack=syn.seq+1) synack = Ether(src=packet[Ether].dst, dst=packet[Ether].src, type=0x800 ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="SA", sport=portdst, dport=portsrc, \ seq=ack_num, ack=syn.seq+1) p_frag_synack = fragment(synack, fragsize=1 ) ack = Ether(src=packet[Ether].src, dst=packet[Ether].dst, type=0x800 ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="A", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1) ##This is the actual data packet that will be send, containing the payload p = Ether(src=packet[Ether].src, dst=packet[Ether].dst, type=0x800 ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="PA", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1)/packet[TCP][Raw] ##We need to ACK the packet returnAck = Ether(src=packet[Ether].dst, dst=packet[Ether].src, type=0x800 ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="A", sport=portdst, dport=portsrc, \ seq=p.ack, ack=(p.seq + len(p[Raw]))) ##Now we build the Finshake finAck = Ether(src=packet[Ether].src, dst=packet[Ether].dst, type=0x800 ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="FA", sport=portsrc, dport=portdst, \ seq=returnAck.ack, ack=returnAck.seq) finalAck = Ether(src=packet[Ether].dst, dst=packet[Ether].src, type=0x800 ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="A", sport=portdst, dport=portsrc, \ seq=finAck.ack, ack=finAck.seq+1) ## # Here we start ordering the stream so that we have 3 SAs. The extra ones are # BEFORE the real one. For the purpose of thoroughness we also # add cases where the real SA arrives fragmented. ## #write the session - normal session_packets.append(syn) session_packets.append(synack_extra_1) session_packets.append(synack_extra_2) session_packets.append(synack) session_packets.append(ack) session_packets.append(p) session_packets.append(returnAck) session_packets.append(finAck) session_packets.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Tcp_Extra_SAs_before_Real_SA-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Regular'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets) session_packets[:] = [] #empty the list #write the session but with an ordered fragmented real SA session_packets_fragmented.append(syn) session_packets_fragmented.append(synack_extra_1) session_packets_fragmented.append(synack_extra_2) for p_fragment in p_frag_synack: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(ack) session_packets_fragmented.append(p) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Tcp_Extra_SAs_before_Fragmented_Real_SA_Ordered-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Regular'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_fragmented.append(syn) session_packets_fragmented.append(synack_extra_1) session_packets_fragmented.append(synack_extra_2) for p_fragment in reversed(p_frag_synack): session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(ack) session_packets_fragmented.append(p) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Tcp_Extra_SAs_before_Fragmented_Real_SA_Reversed-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Regular'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_fragmented.append(syn) session_packets_fragmented.append(synack_extra_1) session_packets_fragmented.append(synack_extra_2) random.shuffle(p_frag_synack) #shuffle JUST the fragments in the session for p_fragment in p_frag_synack: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(ack) session_packets_fragmented.append(p) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Tcp_Extra_SAs_before_Fragmented_Real_SA_Mixed-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Regular'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list ## # Here we start ordering the stream so that we have 3 SAs. The extra ones are # AFTER the real one. For the purpose of thoroughness we also # add cases where the real SA arrives fragmented. ## #write the session - normal session_packets.append(syn) session_packets.append(synack) session_packets.append(synack_extra_1) session_packets.append(synack_extra_2) session_packets.append(ack) session_packets.append(p) session_packets.append(returnAck) session_packets.append(finAck) session_packets.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Tcp_Extra_SAs_after_Real_SA-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Regular'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets) session_packets[:] = [] #empty the list #write the session but with an ordered fragmented real SA session_packets_fragmented.append(syn) for p_fragment in p_frag_synack: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(synack_extra_1) session_packets_fragmented.append(synack_extra_2) session_packets_fragmented.append(ack) session_packets_fragmented.append(p) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Tcp_Extra_SAs_after_Fragmented_Real_SA_Ordered-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Regular'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_fragmented.append(syn) for p_fragment in reversed(p_frag_synack): session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(synack_extra_1) session_packets_fragmented.append(synack_extra_2) session_packets_fragmented.append(ack) session_packets_fragmented.append(p) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Tcp_Extra_SAs_after_Fragmented_Real_SA_Reversed-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Regular'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_fragmented.append(syn) random.shuffle(p_frag_synack) #shuffle JUST the fragments in the session for p_fragment in p_frag_synack: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(synack_extra_1) session_packets_fragmented.append(synack_extra_2) session_packets_fragmented.append(ack) session_packets_fragmented.append(p) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Tcp_Extra_SAs_after_Fragmented_Real_SA_Mixed-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Regular'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list ## # Here we start ordering the stream so that we have 3 SAs. The extra ones are # BEFORE and AFTER the real one. For the purpose of thoroughness we also # add cases where the real SA arrives fragmented. ## #write the session - normal session_packets.append(syn) session_packets.append(synack_extra_1) session_packets.append(synack) session_packets.append(synack_extra_2) session_packets.append(ack) session_packets.append(p) session_packets.append(returnAck) session_packets.append(finAck) session_packets.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Tcp_Extra_SAs_before_and_after_Real_SA-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Regular'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets) session_packets[:] = [] #empty the list #write the session but with an ordered fragmented real SA session_packets_fragmented.append(syn) session_packets_fragmented.append(synack_extra_1) for p_fragment in p_frag_synack: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(synack_extra_2) session_packets_fragmented.append(ack) session_packets_fragmented.append(p) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Tcp_Extra_SAs_before_and_after_Fragmented_Real_SA_Ordered-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Regular'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_fragmented.append(syn) session_packets_fragmented.append(synack_extra_1) for p_fragment in reversed(p_frag_synack): session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(synack_extra_2) session_packets_fragmented.append(ack) session_packets_fragmented.append(p) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Tcp_Extra_SAs_before_and_after_Fragmented_Real_SA_Reversed-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Regular'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_fragmented.append(syn) session_packets_fragmented.append(synack_extra_1) random.shuffle(p_frag_synack) #shuffle JUST the fragments in the session for p_fragment in p_frag_synack: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(synack_extra_2) session_packets_fragmented.append(ack) session_packets_fragmented.append(p) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Tcp_Extra_SAs_before_and_after_Fragmented_Real_SA_Mixed-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Regular'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list def rebuildIPv4HttpSession(self, packet, results_directory, sid_id_http, \ src_name, repo_name): session_packets = list() session_packets_fragmented = list() #print packet[TCP][Raw] #print packet[Ether].src ipsrc = packet[IP].src ipdst = packet[IP].dst portsrc = packet[TCP].sport portdst = packet[TCP].dport seq_num = random.randint(1024,(2**32)-1) ack_num = random.randint(1024,(2**32)-1) syn = Ether(src=packet[Ether].src, dst=packet[Ether].dst, type=0x800 ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="S", sport=portsrc, dport=portdst, \ seq=seq_num) synack = Ether(src=packet[Ether].dst, dst=packet[Ether].src, type=0x800 ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="SA", sport=portdst, dport=portsrc, \ seq=ack_num, ack=syn.seq+1) ack = Ether(src=packet[Ether].src, dst=packet[Ether].dst, type=0x800 ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="A", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1) ##This is the actual data packet that will be send, containing the payload p = Ether(src=packet[Ether].src, dst=packet[Ether].dst, type=0x800 ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="PA", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1)/packet[TCP][Raw] ##This is the actual data packet that will be sent containing the payload #- fragmented p_frag = fragment(p, fragsize=10 ) ##We need to ACK the packet returnAck = Ether(src=packet[Ether].dst, dst=packet[Ether].src, type=0x800 ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="A", sport=portdst, dport=portsrc, \ seq=p.ack, ack=(p.seq + len(p[Raw]))) ##Now we build the Finshake finAck = Ether(src=packet[Ether].src, dst=packet[Ether].dst, type=0x800 ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="FA", sport=portsrc, dport=portdst, \ seq=returnAck.ack, ack=returnAck.seq) finalAck = Ether(src=packet[Ether].dst, dst=packet[Ether].src, type=0x800 ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="A", sport=portdst, dport=portsrc, \ seq=finAck.ack, ack=finAck.seq+1) #write the session - normal session_packets.append(syn) session_packets.append(synack) session_packets.append(ack) session_packets.append(p) session_packets.append(returnAck) session_packets.append(finAck) session_packets.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Regular'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets) session_packets[:] = [] #empty the list #write the session but with an ordered fragmented payload session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in p_frag: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Ordered-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Regular'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in reversed(p_frag): session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Reversed-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Regular'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) random.shuffle(p_frag) #shuffle JUST the fragments in the session for p_fragment in p_frag: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Mixed-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Regular'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list def rebuildIPv4HttpSessionDot1Q(self, packet, results_directory, \ sid_id_http, src_name, repo_name): #Dot1Q VLAN tags session_packets = list() session_packets_fragmented = list() ipsrc = packet[IP].src ipdst = packet[IP].dst portsrc = packet[TCP].sport portdst = packet[TCP].dport seq_num = random.randint(1024,(2**32)-1) ack_num = random.randint(1024,(2**32)-1) syn = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="S", sport=portsrc, dport=portdst, \ seq=seq_num) syn.tags = Dot1Q(vlan=1111) synack = Ether(src=packet[Ether].dst, dst=packet[Ether].src ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="SA", sport=portdst, dport=portsrc, \ seq=ack_num, ack=syn.seq+1) synack.tags = Dot1Q(vlan=1111) ack = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="A", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1) ack.tags = Dot1Q(vlan=1111) ##This is the actual data packet that will be send, containing the payload p = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="PA", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1)/packet[TCP][Raw] p.tags = Dot1Q(vlan=1111) ##This is the actual data packet that will be sent containing the payload #- fragmented p_frag = fragment(p, fragsize=10 ) ## This is the same original data packet - but no VLAN tags p_Dot1Q_untagged = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="PA", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1)/packet[TCP][Raw] p_frag_Dot1Q_untagged = fragment(p_Dot1Q_untagged, fragsize=10) # Dot1Q wrong VLAN tag - we change the VLAN tag in the data packet # Everything else is the same and stays the same p_Dot1Q_tagged_wrong = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="PA", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1)/packet[TCP][Raw] p_Dot1Q_tagged_wrong.tags = Dot1Q(vlan=3333) ##This is the actual data packet that will be sent containing the payload #- fragmented. p_frag_Dot1Q_tagged_wrong = fragment(p_Dot1Q_tagged_wrong, fragsize=10 ) ##This is the data packet. Fromt this data packet we will edit and tweek # the VLAN tags for one or more fragments of the same data packet ! p_Dot1Q_data_frag = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="PA", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1)/packet[TCP][Raw] p_Dot1Q_data_frag.tags = Dot1Q(vlan=1111) # We fragment the data packet, then we will play around with the fragments # VLAN tags p_frag_Dot1Q_data_frag_wrong = fragment(p_Dot1Q_data_frag, fragsize=10 ) p_frag_Dot1Q_data_frag_wrong[3].tags = Dot1Q(vlan=3333) # We fragment the data packet , but we make one fragment untagged. # VLAN tag missing p_frag_Dot1Q_data_frag_missing = fragment(p_Dot1Q_data_frag, fragsize=10 ) p_frag_Dot1Q_data_frag_missing[3].tags = Untagged() # We fragment the data packet , but we make ONLY one fragment tagged # with the correct VLAN tag p_frag_Dot1Q_data_frag_one_tagged = fragment(p_Dot1Q_data_frag, fragsize=10 ) for frag in p_frag_Dot1Q_data_frag_one_tagged: frag.tags = Untagged() p_frag_Dot1Q_data_frag_one_tagged[3].tags = Dot1Q(vlan=1111) #We need to ACK the packet returnAck = Ether(src=packet[Ether].dst, dst=packet[Ether].src ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="A", sport=portdst, dport=portsrc, \ seq=p.ack, ack=(p.seq + len(p[Raw]))) returnAck.tags = Dot1Q(vlan=1111) ##Now we build the Finshake finAck = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="FA", sport=portsrc, dport=portdst, \ seq=returnAck.ack, ack=returnAck.seq) finAck.tags = Dot1Q(vlan=1111) finalAck = Ether(src=packet[Ether].dst, dst=packet[Ether].src ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="A", sport=portdst, dport=portsrc, \ seq=finAck.ack, ack=finAck.seq+1) finalAck.tags = Dot1Q(vlan=1111) #write the session - normal session_packets.append(syn) session_packets.append(synack) session_packets.append(ack) session_packets.append(p) session_packets.append(returnAck) session_packets.append(finAck) session_packets.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Dot1Q-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets) session_packets[:] = [] #empty the list #write the session but with an ordered fragmented payload session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in p_frag: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Ordered_Dot1Q-%s-tp-01.pcap"\ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in reversed(p_frag): session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Reversed_Dot1Q-%s-tp-01.pcap"\ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) random.shuffle(p_frag) #shuffle JUST the fragments in the session for p_fragment in p_frag: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Mixed_Dot1Q-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list ## # Here we start with the wrong Dot1Q VLAN tags in the data packet # and the creation of the pcaps designed for not alerting # due to changed (fake/hopped) VLAN tag in the same flow ## #write the session - normal session_packets.append(syn) session_packets.append(synack) session_packets.append(ack) session_packets.append(p_Dot1Q_tagged_wrong) session_packets.append(returnAck) session_packets.append(finAck) session_packets.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Dot1Q_tagged_wrong-%s-tp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets) session_packets[:] = [] #empty the list #write the session but with an ordered fragmented payload session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in p_frag_Dot1Q_tagged_wrong: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Ordered_Dot1Q_tagged_wrong-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in reversed(p_frag_Dot1Q_tagged_wrong): session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Reversed_Dot1Q_tagged_wrong-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) random.shuffle(p_frag_Dot1Q_tagged_wrong) #shuffle JUST the fragments in the session for p_fragment in p_frag_Dot1Q_tagged_wrong: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Mixed_Dot1Q_tagged_wrong-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list ## # Here we start with the missing Dot1Q VLAN tag in the data packet # and the creation of the pcaps designed for not alerting # due to missing VLAN tag in the same flow. ## #write the session - normal session_packets.append(syn) session_packets.append(synack) session_packets.append(ack) session_packets.append(p_Dot1Q_untagged) session_packets.append(returnAck) session_packets.append(finAck) session_packets.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Dot1Q_data_tag_missing-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets) session_packets[:] = [] #empty the list #write the session but with an ordered fragmented payload session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in p_frag_Dot1Q_untagged: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Ordered_Dot1Q_data_tag_missing-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in reversed(p_frag_Dot1Q_untagged): session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Reversed_Dot1Q_data_tag_missing-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) random.shuffle(p_frag_Dot1Q_untagged) #shuffle JUST the fragments in the session for p_fragment in p_frag_Dot1Q_untagged: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Mixed_Dot1Q_data_tag_missing-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list def rebuildIPv4HttpSessionDot1QWrongTagInFragments(self, packet, \ results_directory, sid_id_http, src_name, repo_name): #Dot1Q VLAN tags #Here we will change the VLAN tags on one or more frgaments #of the data packet session_packets = list() session_packets_fragmented = list() ipsrc = packet[IP].src ipdst = packet[IP].dst portsrc = packet[TCP].sport portdst = packet[TCP].dport seq_num = random.randint(1024,(2**32)-1) ack_num = random.randint(1024,(2**32)-1) syn = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="S", sport=portsrc, dport=portdst, \ seq=seq_num) syn.tags = Dot1Q(vlan=1111) synack = Ether(src=packet[Ether].dst, dst=packet[Ether].src ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="SA", sport=portdst, dport=portsrc, \ seq=ack_num, ack=syn.seq+1) synack.tags = Dot1Q(vlan=1111) ack = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="A", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1) ack.tags = Dot1Q(vlan=1111) ##This is the actual data packet that will be send, containing the payload p = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="PA", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1)/packet[TCP][Raw] p.tags = Dot1Q(vlan=1111) ##This is the actual data packet that will be sent containing the payload #- fragmented p_frag = fragment(p, fragsize=10 ) ##This is the data packet. Fromt this data packet we will edit and tweek # the VLAN tags for one or more fragments of the same data packet ! p_Dot1Q_data_frag = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="PA", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1)/packet[TCP][Raw] p_Dot1Q_data_frag.tags = Dot1Q(vlan=1111) # We fragment the data packet, then we will play around with the fragments # VLAN tags - one fragment has the wrong VLAN tag p_frag_Dot1Q_data_frag_wrong = fragment(p_Dot1Q_data_frag, fragsize=10 ) p_frag_Dot1Q_data_frag_wrong[3].tags = Dot1Q(vlan=3333) # We fragment the data packet , but we make one fragment untagged. # VLAN tag missing p_frag_Dot1Q_data_frag_missing = fragment(p_Dot1Q_data_frag, fragsize=10 ) p_frag_Dot1Q_data_frag_missing[3].tags = Untagged() # We fragment the data packet , but we make ONLY one fragment tagged # with the correct VLAN tag p_frag_Dot1Q_data_frag_one_tagged = fragment(p_Dot1Q_data_frag, fragsize=10 ) for frag in p_frag_Dot1Q_data_frag_one_tagged: frag.tags = Untagged() p_frag_Dot1Q_data_frag_one_tagged[3].tags = Dot1Q(vlan=1111) #We need to ACK the packet returnAck = Ether(src=packet[Ether].dst, dst=packet[Ether].src ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="A", sport=portdst, dport=portsrc, \ seq=p.ack, ack=(p.seq + len(p[Raw]))) returnAck.tags = Dot1Q(vlan=1111) ##Now we build the Finshake finAck = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="FA", sport=portsrc, dport=portdst, \ seq=returnAck.ack, ack=returnAck.seq) finAck.tags = Dot1Q(vlan=1111) finalAck = Ether(src=packet[Ether].dst, dst=packet[Ether].src ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="A", sport=portdst, dport=portsrc, \ seq=finAck.ack, ack=finAck.seq+1) finalAck.tags = Dot1Q(vlan=1111) ## # Here we start with chnaging the Dot1Q VLAN tags in the FRAGMENTS # of the data packetand the creation of the pcaps designed for not alerting # due to missing VLAN tag in the fragments of data in the same flow. ## ## one fragment from the data packet has a missing VLAN tag #write the session but with an ordered fragmented payload session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in p_frag_Dot1Q_data_frag_missing: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Ordered_Dot1Q_data_tag_missing_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in reversed(p_frag_Dot1Q_data_frag_missing): session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Reversed_Dot1Q_data_tag_missing_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) random.shuffle(p_frag_Dot1Q_data_frag_missing) #shuffle JUST the fragments in the session for p_fragment in p_frag_Dot1Q_data_frag_missing: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Mixed_Dot1Q_data_tag_missing_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list ## one frgament from the data packet has the wrong VLAN tag #write the session but with an ordered fragmented payload session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in p_frag_Dot1Q_data_frag_wrong: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Ordered_Dot1Q_data_tag_wrong_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in reversed(p_frag_Dot1Q_data_frag_wrong): session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Reversed_Dot1Q_data_tag_wrong_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) random.shuffle(p_frag_Dot1Q_data_frag_wrong) #shuffle JUST the fragments in the session for p_fragment in p_frag_Dot1Q_data_frag_wrong: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Mixed_Dot1Q_data_tag_wrong_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list ## all frgaments from the data packet have no VLAN tags BUT one #write the session but with an ordered fragmented payload session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in p_frag_Dot1Q_data_frag_one_tagged: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Ordered_Dot1Q_data_tag_one_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in reversed(p_frag_Dot1Q_data_frag_one_tagged): session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Reversed_Dot1Q_data_tag_one_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) random.shuffle(p_frag_Dot1Q_data_frag_one_tagged) #shuffle JUST the fragments in the session for p_fragment in p_frag_Dot1Q_data_frag_one_tagged: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Mixed_Dot1Q_data_tag_one_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list def rebuildIPv4HttpSessionQinQ(self, packet, results_directory, \ sid_id_http, src_name, repo_name): #Dot1Q double tags (vlans) = QinQ session_packets = list() session_packets_fragmented = list() ipsrc = packet[IP].src ipdst = packet[IP].dst portsrc = packet[TCP].sport portdst = packet[TCP].dport seq_num = random.randint(1024,(2**32)-1) ack_num = random.randint(1024,(2**32)-1) syn = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="S", sport=portsrc, dport=portdst, \ seq=seq_num) syn.tags = Dot1AD(vlan=666)/Dot1Q(vlan=4094) syn.tags[Dot1Q].tpid = 0x88a8 synack = Ether(src=packet[Ether].dst, dst=packet[Ether].src ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="SA", sport=portdst, dport=portsrc, \ seq=ack_num, ack=syn.seq+1) synack.tags = Dot1AD(vlan=666)/Dot1Q(vlan=4094) synack.tags[Dot1Q].tpid = 0x88a8 ack = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="A", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1) ack.tags = Dot1AD(vlan=666)/Dot1Q(vlan=4094) ack.tags[Dot1Q].tpid = 0x88a8 ##This is the actual data packet that will be send, containing the payload p = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="PA", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1)/packet[TCP][Raw] p.tags = Dot1AD(vlan=666)/Dot1Q(vlan=4094) p.tags[Dot1Q].tpid = 0x88a8 ##This is the actual data packet that will be sent containing the payload #- fragmented p_frag = fragment(p, fragsize=10 ) ## This is the same original data packet - but no VLAN tags p_QinQ_untagged = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="PA", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1)/packet[TCP][Raw] p_frag_QinQ_untagged = fragment(p_QinQ_untagged, fragsize=10) # QinQ reversed - we reverse/switch the VLAN tags in the data packet # Everything else is the same and stays the same p_QinQ_tag_reversed = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="PA", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1)/packet[TCP][Raw] p_QinQ_tag_reversed.tags = Dot1AD(vlan=4094)/Dot1Q(vlan=666) p_QinQ_tag_reversed.tags[Dot1Q].tpid = 0x88a8 ##This is the actual data packet that will be sent containing the payload #- fragmented, QinQ reversed/siwtched tags p_frag_QinQ_tag_reversed = fragment(p_QinQ_tag_reversed, fragsize=10 ) ##We need to ACK the packet returnAck = Ether(src=packet[Ether].dst, dst=packet[Ether].src ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="A", sport=portdst, dport=portsrc, \ seq=p.ack, ack=(p.seq + len(p[Raw]))) returnAck.tags = Dot1AD(vlan=666)/Dot1Q(vlan=4094) returnAck.tags[Dot1Q].tpid = 0x88a8 ##Now we build the Finshake finAck = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="FA", sport=portsrc, dport=portdst, \ seq=returnAck.ack, ack=returnAck.seq) finAck.tags = Dot1AD(vlan=666)/Dot1Q(vlan=4094) finAck.tags[Dot1Q].tpid = 0x88a8 finalAck = Ether(src=packet[Ether].dst, dst=packet[Ether].src ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="A", sport=portdst, dport=portsrc, \ seq=finAck.ack, ack=finAck.seq+1) finalAck.tags = Dot1AD(vlan=666)/Dot1Q(vlan=4094) finalAck.tags[Dot1Q].tpid = 0x88a8 #write the session - normal session_packets.append(syn) session_packets.append(synack) session_packets.append(ack) session_packets.append(p) session_packets.append(returnAck) session_packets.append(finAck) session_packets.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_QinQ-%s-tp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets) session_packets[:] = [] #empty the list #write the session but with an ordered fragmented payload session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in p_frag: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Ordered_QinQ-%s-tp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in reversed(p_frag): session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Reversed_QinQ-%s-tp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) random.shuffle(p_frag) #shuffle JUST the fragments in the session for p_fragment in p_frag: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Mixed_QinQ-%s-tp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list ## # Here we start with the reversed QinQ VLAN tags # and the creation of the pcaps designed for not alerting # due to switched (fake) VLAN tags in the same flow ## #write the session - normal session_packets.append(syn) session_packets.append(synack) session_packets.append(ack) session_packets.append(p_QinQ_tag_reversed) session_packets.append(returnAck) session_packets.append(finAck) session_packets.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_QinQ_tags_reversed-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets) session_packets[:] = [] #empty the list #write the session but with an ordered fragmented payload session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in p_frag_QinQ_tag_reversed: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Ordered_QinQ_tags_reversed-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in reversed(p_frag_QinQ_tag_reversed): session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Reversed_QinQ_tags_reversed-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) random.shuffle(p_frag_QinQ_tag_reversed) #shuffle JUST the fragments in the session for p_fragment in p_frag_QinQ_tag_reversed: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Mixed_QinQ_tags_reversed-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list ## # Here we start with the missing Dot1Q VLAN tag in the data packet # and the creation of the pcaps designed for not alerting # due to missing VLAN tag in the same flow ## #write the session - normal session_packets.append(syn) session_packets.append(synack) session_packets.append(ack) session_packets.append(p_QinQ_untagged) session_packets.append(returnAck) session_packets.append(finAck) session_packets.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_QinQ_data_tag_missing-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets) session_packets[:] = [] #empty the list #write the session but with an ordered fragmented payload session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in p_frag_QinQ_untagged: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Ordered_QinQ_data_tag_missing-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in reversed(p_frag_QinQ_untagged): session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Reversed_QinQ_data_tag_missing-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) random.shuffle(p_frag_QinQ_untagged) #shuffle JUST the fragments in the session for p_fragment in p_frag_QinQ_untagged: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Mixed_QinQ_data_tag_missing-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list def rebuildIPv4HttpSessionQinQWrongTagInFragments(self, packet, \ results_directory, sid_id_http, src_name, repo_name): #QinQ VLAN tags - double tags #Here we will change the VLAN tags on one or more frgaments #of the QinQ data packet session_packets = list() session_packets_fragmented = list() ipsrc = packet[IP].src ipdst = packet[IP].dst portsrc = packet[TCP].sport portdst = packet[TCP].dport seq_num = random.randint(1024,(2**32)-1) ack_num = random.randint(1024,(2**32)-1) syn = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="S", sport=portsrc, dport=portdst, \ seq=seq_num) syn.tags = Dot1AD(vlan=666)/Dot1Q(vlan=4094) syn.tags[Dot1Q].tpid = 0x88a8 synack = Ether(src=packet[Ether].dst, dst=packet[Ether].src ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="SA", sport=portdst, dport=portsrc, \ seq=ack_num, ack=syn.seq+1) synack.tags = Dot1AD(vlan=666)/Dot1Q(vlan=4094) synack.tags[Dot1Q].tpid = 0x88a8 ack = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="A", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1) ack.tags = Dot1AD(vlan=666)/Dot1Q(vlan=4094) ack.tags[Dot1Q].tpid = 0x88a8 ##This is the actual data packet that will be send, containing the payload p = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="PA", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1)/packet[TCP][Raw] p.tags = Dot1AD(vlan=666)/Dot1Q(vlan=4094) p.tags[Dot1Q].tpid = 0x88a8 ##This is the data packet. Fromt this data packet we will edit and tweek # the VLAN tags (QinQ) for one or more fragments of the same data packet ! p_QinQ_data_frag = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="PA", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1)/packet[TCP][Raw] p_QinQ_data_frag.tags = Dot1AD(vlan=666)/Dot1Q(vlan=4094) p_QinQ_data_frag.tags[Dot1Q].tpid = 0x88a8 ## We fragment the data packet, then we will play around with the fragments # VLAN tags in QinQ # Here we change the VLAN tag of the inner Dot1Q layer p_frag_QinQ_data_frag_wrong_dot1q = fragment(p_QinQ_data_frag, fragsize=10 ) p_frag_QinQ_data_frag_wrong_dot1q[3].tags = Dot1AD(vlan=666)/Dot1Q(vlan=777) p_frag_QinQ_data_frag_wrong_dot1q[3].tags[Dot1Q].tpid = 0x88a8 ## We fragment the data packet, then we will play around with the fragments # VLAN tags in QinQ # Here we change the VLAN tag of the outer 802.1AD layer p_frag_QinQ_data_frag_wrong_dot1ad = fragment(p_QinQ_data_frag, fragsize=10 ) p_frag_QinQ_data_frag_wrong_dot1ad[3].tags = Dot1AD(vlan=777)/Dot1Q(vlan=4094) p_frag_QinQ_data_frag_wrong_dot1ad[3].tags[Dot1Q].tpid = 0x88a8 ## We fragment the data packet and make one fragment with both tags # having the wrong VLAN IDs p_frag_QinQ_data_frag_wrong_both = fragment(p_QinQ_data_frag, fragsize=10 ) p_frag_QinQ_data_frag_wrong_both[3].tags = Dot1AD(vlan=444)/Dot1Q(vlan=555) p_frag_QinQ_data_frag_wrong_both[3].tags[Dot1Q].tpid = 0x88a8 ## We fragment the data packet , but we make one fragment untagged. # VLAN tags missing p_frag_QinQ_data_frag_missing_tags = fragment(p_QinQ_data_frag, fragsize=10 ) p_frag_QinQ_data_frag_missing_tags[3].tags = Untagged() ## We fragment the data packet , but we make one fragment with reversed # VLAN tags p_frag_QinQ_data_frag_reversed_tags = fragment(p_QinQ_data_frag, fragsize=10 ) p_frag_QinQ_data_frag_reversed_tags[3].tags = \ Dot1AD(vlan=4094)/Dot1Q(vlan=666) p_frag_QinQ_data_frag_reversed_tags[3].tags[Dot1Q].tpid = 0x88a8 ## We fragment the data packet , but we make ONLY one fragment QinQ tagged # with the correct VLAN tags p_frag_QinQ_data_frag_one_tagged = fragment(p_QinQ_data_frag, fragsize=10 ) for frag in p_frag_QinQ_data_frag_one_tagged: frag.tags = Untagged() p_frag_QinQ_data_frag_one_tagged[3].tags = Dot1AD(vlan=666)/Dot1Q(vlan=4094) p_frag_QinQ_data_frag_one_tagged[3].tags[Dot1Q].tpid = 0x88a8 ##We need to ACK the packet returnAck = Ether(src=packet[Ether].dst, dst=packet[Ether].src ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="A", sport=portdst, dport=portsrc, \ seq=p.ack, ack=(p.seq + len(p[Raw]))) returnAck.tags = Dot1AD(vlan=666)/Dot1Q(vlan=4094) returnAck.tags[Dot1Q].tpid = 0x88a8 ##Now we build the Finshake finAck = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="FA", sport=portsrc, dport=portdst, \ seq=returnAck.ack, ack=returnAck.seq) finAck.tags = Dot1AD(vlan=666)/Dot1Q(vlan=4094) finAck.tags[Dot1Q].tpid = 0x88a8 finalAck = Ether(src=packet[Ether].dst, dst=packet[Ether].src ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="A", sport=portdst, dport=portsrc, \ seq=finAck.ack, ack=finAck.seq+1) finalAck.tags = Dot1AD(vlan=666)/Dot1Q(vlan=4094) finalAck.tags[Dot1Q].tpid = 0x88a8 ## # Here we start with chnaging the QinQ VLAN tags in the FRAGMENTS # of the data packetand the creation of the pcaps designed for not alerting # due to missing/reversed/nonexisting VLAN tags in the fragments of # data in the same flow. ## ## one fragment from the data packet has a wrong VLAN tag - dot1Q tag. # The other tag (dot1AD- S-VLAN/Carrier VLAN) is correct # write the session but with an ordered fragmented payload session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in p_frag_QinQ_data_frag_wrong_dot1q: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Ordered_QinQ_data_frag_wrong_dot1q_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in reversed(p_frag_QinQ_data_frag_wrong_dot1q): session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Reversed_QinQ_data_frag_wrong_dot1q_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) random.shuffle(p_frag_QinQ_data_frag_wrong_dot1q) #shuffle JUST the fragments in the session for p_fragment in p_frag_QinQ_data_frag_wrong_dot1q: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Mixed_QinQ_data_frag_wrong_dot1q_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list ## one fragment from the data packet has a wrong VLAN tag - dot1AD tag # -> S-VLAN/Carrier VLAN. The other tag (dot1q) is correct # write the session but with an ordered fragmented payload session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in p_frag_QinQ_data_frag_wrong_dot1ad: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Ordered_QinQ_data_frag_wrong_dot1ad_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in reversed(p_frag_QinQ_data_frag_wrong_dot1ad): session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Reversed_QinQ_data_frag_wrong_dot1ad_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) random.shuffle(p_frag_QinQ_data_frag_wrong_dot1ad) #shuffle JUST the fragments in the session for p_fragment in p_frag_QinQ_data_frag_wrong_dot1ad: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Mixed_QinQ_data_frag_wrong_dot1ad_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list ## one frgament from the data packet has both VLAN tag IDs wrong #write the session but with an ordered fragmented payload session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in p_frag_QinQ_data_frag_wrong_both: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Ordered_QinQ_data_frag_wrong_tags_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in reversed(p_frag_QinQ_data_frag_wrong_both): session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Reversed_QinQ_data_frag_wrong_tags_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) random.shuffle(p_frag_QinQ_data_frag_wrong_both) #shuffle JUST the fragments in the session for p_fragment in p_frag_QinQ_data_frag_wrong_both: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Mixed_QinQ_data_frag_wrong_tags_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list ## one fragment of the data packet has NO VLAN tags #write the session but with an ordered fragmented payload session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in p_frag_QinQ_data_frag_missing_tags: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Ordered_QinQ_data_frag_missing_tags_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in reversed(p_frag_QinQ_data_frag_missing_tags): session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Reversed_QinQ_data_frag_missing_tags_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) random.shuffle(p_frag_QinQ_data_frag_missing_tags) #shuffle JUST the fragments in the session for p_fragment in p_frag_QinQ_data_frag_missing_tags: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Mixed_QinQ_data_frag_missing_tags_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list ## one fragment of the data packet has both VLAN tags switched/reversed # write the session but with an ordered fragmented payload session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in p_frag_QinQ_data_frag_reversed_tags: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Ordered_QinQ_data_frag_reversed_tags_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in reversed(p_frag_QinQ_data_frag_reversed_tags): session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Reversed_QinQ_data_frag_reversed_tags_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) random.shuffle(p_frag_QinQ_data_frag_reversed_tags) #shuffle JUST the fragments in the session for p_fragment in p_frag_QinQ_data_frag_reversed_tags: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Mixed_QinQ_data_frag_reversed_tags_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list ## one fragment of the data packet has both VLAN tags correct. # The rest do not. # write the session but with an ordered fragmented payload session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in p_frag_QinQ_data_frag_one_tagged: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Ordered_QinQ_data_frag_one_tagged_fragments-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) for p_fragment in reversed(p_frag_QinQ_data_frag_one_tagged): session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Reversed_QinQ_data_frag_one_tagged_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_fragmented.append(syn) session_packets_fragmented.append(synack) session_packets_fragmented.append(ack) random.shuffle(p_frag_QinQ_data_frag_one_tagged) #shuffle JUST the fragments in the session for p_fragment in p_frag_QinQ_data_frag_one_tagged: session_packets_fragmented.append(p_fragment) session_packets_fragmented.append(returnAck) session_packets_fragmented.append(finAck) session_packets_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Fragmented_Mixed_QinQ_data_frag_one_tagged_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_fragmented) session_packets_fragmented[:] = [] #empty the list def rebuildIPv4HttpSeqOverSpill(self, packet, results_directory, \ sid_id_http, src_name, repo_name): #rebuild session with overspilling seq numbers # seq = 4294967294, 4294967295, 0, 1,....(as per RFC) #seq overspill re-writing session_packets_seq_overspill = list() session_packets_seq_overspill_fragmented = list() ipsrc = packet[IP].src ipdst = packet[IP].dst portsrc = packet[TCP].sport portdst = packet[TCP].dport #maximum seq=4294967295 seq_num = 4294967294 ack_num = random.randint(1024,(2**32)-1) syn = Ether(src=packet[Ether].src, dst=packet[Ether].dst, type=0x800 ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="S", sport=portsrc, dport=portdst, \ seq=seq_num) synack = Ether(src=packet[Ether].dst, dst=packet[Ether].src, type=0x800 ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="SA", sport=portdst, dport=portsrc, \ seq=ack_num, ack=syn.seq+1) ack = Ether(src=packet[Ether].src, dst=packet[Ether].dst, type=0x800 ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="A", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1) ##This is the actual data packet that will be send, containing the payload p = Ether(src=packet[Ether].src, dst=packet[Ether].dst, type=0x800 ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="PA", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1)/packet[TCP][Raw] ##This is the actual data packet that will be sent containing the payload #- fragmented p_frag = fragment(p, fragsize=10 ) ##We need to ACK the packet #here we go to "ack=(len(p[Raw]) -1 )" !! - "the overspill" returnAck = Ether(src=packet[Ether].dst, dst=packet[Ether].src, type=0x800 ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="A", sport=portdst, dport=portsrc, \ seq=p.ack, ack=(len(p[Raw]) -1 )) ##Now we build the Finshake finAck = Ether(src=packet[Ether].src, dst=packet[Ether].dst, type=0x800 ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="FA", sport=portsrc, dport=portdst, \ seq=returnAck.ack, ack=returnAck.seq) finalAck = Ether(src=packet[Ether].dst, dst=packet[Ether].src, type=0x800 ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="A", sport=portdst, dport=portsrc, \ seq=finAck.ack, ack=finAck.seq+1) #write the session - normal session_packets_seq_overspill.append(syn) session_packets_seq_overspill.append(synack) session_packets_seq_overspill.append(ack) session_packets_seq_overspill.append(p) session_packets_seq_overspill.append(returnAck) session_packets_seq_overspill.append(finAck) session_packets_seq_overspill.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Regular'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill) session_packets_seq_overspill[:] = [] #empty the list #write the fragmented packets - ordered session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in p_frag: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Ordered-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Regular'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in reversed(p_frag): session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Reversed-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Regular'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write mix the fragmented packets #shuffle/unsort/unorder/mix JUST the fragmented packets session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) random.shuffle(p_frag) #shuffle JUST the fragments in the session for p_fragment in p_frag: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Mixed-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Regular'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list def rebuildIPv4HttpSeqOverSpillDot1Q(self, packet, results_directory, \ sid_id_http, src_name, repo_name): #Dot1Q - VLAN tags cases. #rebuild session with overspilling seq numbers # seq = 4294967294, 4294967295, 0, 1,....(as per RFC) #seq overspill re-writing session_packets_seq_overspill = list() session_packets_seq_overspill_fragmented = list() ipsrc = packet[IP].src ipdst = packet[IP].dst portsrc = packet[TCP].sport portdst = packet[TCP].dport #maximum seq=4294967295 seq_num = 4294967294 ack_num = random.randint(1024,(2**32)-1) syn = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="S", sport=portsrc, dport=portdst, \ seq=seq_num) syn.tags = Dot1Q(vlan=1155) synack = Ether(src=packet[Ether].dst, dst=packet[Ether].src ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="SA", sport=portdst, dport=portsrc, \ seq=ack_num, ack=syn.seq+1) synack.tags = Dot1Q(vlan=1155) ack = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="A", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1) ack.tags = Dot1Q(vlan=1155) ##This is the actual data packet that will be send, containing the payload p = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="PA", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1)/packet[TCP][Raw] p.tags = Dot1Q(vlan=1155) ##This is the actual data packet that will be sent containing the payload #- fragmented p_frag = fragment(p, fragsize=10 ) ## This is the same original data packet - but no VLAN tags p_Dot1Q_untagged = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="PA", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1)/packet[TCP][Raw] p_frag_Dot1Q_untagged = fragment(p_Dot1Q_untagged, fragsize=10) # Dot1Q wrong VLAN tag - we change the VLAN tag in the data packet # Everything else is the same and stays the same p_Dot1Q_tagged_wrong = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="PA", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1)/packet[TCP][Raw] p_Dot1Q_tagged_wrong.tags = Dot1Q(vlan=3355) ##This is the actual data packet that will be sent containing the payload #- fragmented, QinQ reversed/siwtched tags p_frag_Dot1Q_tagged_wrong = fragment(p_Dot1Q_tagged_wrong, fragsize=10 ) ##We need to ACK the packet #here we go to "ack=(len(p[Raw]) -1 )" !! - "the overspill" returnAck = Ether(src=packet[Ether].dst, dst=packet[Ether].src, type=0x800 ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="A", sport=portdst, dport=portsrc, \ seq=p.ack, ack=(len(p[Raw]) -1 )) returnAck.tags = Dot1Q(vlan=1155) ##Now we build the Finshake finAck = Ether(src=packet[Ether].src, dst=packet[Ether].dst, type=0x800 ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="FA", sport=portsrc, dport=portdst, \ seq=returnAck.ack, ack=returnAck.seq) finAck.tags = Dot1Q(vlan=1155) finalAck = Ether(src=packet[Ether].dst, dst=packet[Ether].src ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="A", sport=portdst, dport=portsrc, \ seq=finAck.ack, ack=finAck.seq+1) finalAck.tags = Dot1Q(vlan=1155) #write the session - normal session_packets_seq_overspill.append(syn) session_packets_seq_overspill.append(synack) session_packets_seq_overspill.append(ack) session_packets_seq_overspill.append(p) session_packets_seq_overspill.append(returnAck) session_packets_seq_overspill.append(finAck) session_packets_seq_overspill.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Dot1Q-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill) session_packets_seq_overspill[:] = [] #empty the list #write the fragmented packets - ordered session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in p_frag: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Ordered_Dot1Q-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in reversed(p_frag): session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Reversed_Dot1Q-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write mix the fragmented packets #shuffle/unsort/unorder/mix JUST the fragmented packets session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) random.shuffle(p_frag) #shuffle JUST the fragments in the session for p_fragment in p_frag: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Mixed_Dot1Q-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list ## # Here we start with the wrong Dot1Q VLAN tags in the data packet # and the creation of the pcaps designed for not alerting # due to changed (fake/hopped) VLAN tag in the same flow ## #write the session - normal session_packets_seq_overspill.append(syn) session_packets_seq_overspill.append(synack) session_packets_seq_overspill.append(ack) session_packets_seq_overspill.append(p_Dot1Q_tagged_wrong) session_packets_seq_overspill.append(returnAck) session_packets_seq_overspill.append(finAck) session_packets_seq_overspill.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Dot1Q_tagged_wrong-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill) session_packets_seq_overspill[:] = [] #empty the list #write the fragmented packets - ordered session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in p_frag_Dot1Q_tagged_wrong: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Ordered_Dot1Q_tagged_wrong-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in reversed(p_frag_Dot1Q_tagged_wrong): session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Reversed_Dot1Q_tagged_wrong-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write mix the fragmented packets #shuffle/unsort/unorder/mix JUST the fragmented packets session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) random.shuffle(p_frag_Dot1Q_tagged_wrong) #shuffle JUST the fragments in the session for p_fragment in p_frag_Dot1Q_tagged_wrong: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Mixed_Dot1Q_tagged_wrong-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list ## # Here we start with the missing Dot1Q VLAN tag in the data packet # and the creation of the pcaps designed for not alerting # due to missing VLAN tag in the same flow ## #write the session - normal session_packets_seq_overspill.append(syn) session_packets_seq_overspill.append(synack) session_packets_seq_overspill.append(ack) session_packets_seq_overspill.append(p_Dot1Q_untagged) session_packets_seq_overspill.append(returnAck) session_packets_seq_overspill.append(finAck) session_packets_seq_overspill.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Dot1Q_data_tag_missing-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill) session_packets_seq_overspill[:] = [] #empty the list #write the fragmented packets - ordered session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in p_frag_Dot1Q_untagged: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Ordered_Dot1Q_data_tag_missing-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in reversed(p_frag_Dot1Q_untagged): session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Reversed_Dot1Q_data_tag_missing-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write mix the fragmented packets #shuffle/unsort/unorder/mix JUST the fragmented packets session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) random.shuffle(p_frag_Dot1Q_untagged) #shuffle JUST the fragments in the session for p_fragment in p_frag_Dot1Q_untagged: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Mixed_Dot1Q_data_tag_missing-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list def rebuildIPv4HttpSeqOverSpillDot1QWrongTagInFragments(self, packet, \ results_directory, sid_id_http, src_name, repo_name): #Dot1Q - VLAN tags cases. #rebuild session with overspilling seq numbers # seq = 4294967294, 4294967295, 0, 1,....(as per RFC) #seq overspill re-writing session_packets_seq_overspill = list() session_packets_seq_overspill_fragmented = list() ipsrc = packet[IP].src ipdst = packet[IP].dst portsrc = packet[TCP].sport portdst = packet[TCP].dport #maximum seq=4294967295 seq_num = 4294967294 ack_num = random.randint(1024,(2**32)-1) syn = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="S", sport=portsrc, dport=portdst, \ seq=seq_num) syn.tags = Dot1Q(vlan=1155) synack = Ether(src=packet[Ether].dst, dst=packet[Ether].src ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="SA", sport=portdst, dport=portsrc, \ seq=ack_num, ack=syn.seq+1) synack.tags = Dot1Q(vlan=1155) ack = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="A", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1) ack.tags = Dot1Q(vlan=1155) ##This is the actual data packet that will be send, containing the payload p = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="PA", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1)/packet[TCP][Raw] p.tags = Dot1Q(vlan=1155) ##This is the actual data packet that will be sent containing the payload #- fragmented p_frag = fragment(p, fragsize=10 ) ##This is the data packet. Fromt this data packet we will edit and tweek # the VLAN tags for one or more fragments of the same data packet ! p_Dot1Q_data_frag = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="PA", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1)/packet[TCP][Raw] p_Dot1Q_data_frag.tags = Dot1Q(vlan=1155) # We fragment the data packet, then we will play around with the fragments # VLAN tags - one fragment has the wrong VLAN tag p_frag_Dot1Q_data_frag_wrong = fragment(p_Dot1Q_data_frag, fragsize=10 ) p_frag_Dot1Q_data_frag_wrong[3].tags = Dot1Q(vlan=3333) # We fragment the data packet , but we make one fragment untagged. # VLAN tag missing p_frag_Dot1Q_data_frag_missing = fragment(p_Dot1Q_data_frag, fragsize=10 ) p_frag_Dot1Q_data_frag_missing[3].tags = Untagged() # We fragment the data packet , but we make ONLY one fragment tagged # with the correct VLAN tag p_frag_Dot1Q_data_frag_one_tagged = fragment(p_Dot1Q_data_frag, fragsize=10 ) for frag in p_frag_Dot1Q_data_frag_one_tagged: frag.tags = Untagged() p_frag_Dot1Q_data_frag_one_tagged[3].tags = Dot1Q(vlan=1155) ##We need to ACK the packet #here we go to "ack=(len(p[Raw]) -1 )" !! - "the overspill" returnAck = Ether(src=packet[Ether].dst, dst=packet[Ether].src, type=0x800 ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="A", sport=portdst, dport=portsrc, \ seq=p.ack, ack=(len(p[Raw]) -1 )) returnAck.tags = Dot1Q(vlan=1155) ##Now we build the Finshake finAck = Ether(src=packet[Ether].src, dst=packet[Ether].dst, type=0x800 ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="FA", sport=portsrc, dport=portdst, \ seq=returnAck.ack, ack=returnAck.seq) finAck.tags = Dot1Q(vlan=1155) finalAck = Ether(src=packet[Ether].dst, dst=packet[Ether].src ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="A", sport=portdst, dport=portsrc, \ seq=finAck.ack, ack=finAck.seq+1) finalAck.tags = Dot1Q(vlan=1155) ## # Here we start with chnaging the Dot1Q VLAN tags in the FRAGMENTS # of the data packetand the creation of the pcaps designed for not alerting # due to missing VLAN tag in the fragments of data in the same flow. ## ## one fragment from the data packet has a missing VLAN tag #write the session but with an ordered fragmented payload session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in p_frag_Dot1Q_data_frag_missing: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Ordered_Dot1Q_data_tag_missing_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in reversed(p_frag_Dot1Q_data_frag_missing): session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Reversed_Dot1Q_data_tag_missing_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) random.shuffle(p_frag_Dot1Q_data_frag_missing) #shuffle JUST the fragments in the session for p_fragment in p_frag_Dot1Q_data_frag_missing: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Mixed_Dot1Q_data_tag_missing_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list ## one frgament from the data packet has the wrong VLAN tag #write the session but with an ordered fragmented payload session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in p_frag_Dot1Q_data_frag_wrong: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Ordered_Dot1Q_data_tag_wrong_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in reversed(p_frag_Dot1Q_data_frag_wrong): session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Reversed_Dot1Q_data_tag_wrong_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) random.shuffle(p_frag_Dot1Q_data_frag_wrong) #shuffle JUST the fragments in the session for p_fragment in p_frag_Dot1Q_data_frag_wrong: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Mixed_Dot1Q_data_tag_wrong_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list ## all frgaments from the data packet have no VLAN tags BUT one #write the session but with an ordered fragmented payload session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in p_frag_Dot1Q_data_frag_one_tagged: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Ordered_Dot1Q_data_tag_one_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in reversed(p_frag_Dot1Q_data_frag_one_tagged): session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Reversed_Dot1Q_data_tag_one_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) random.shuffle(p_frag_Dot1Q_data_frag_one_tagged) #shuffle JUST the fragments in the session for p_fragment in p_frag_Dot1Q_data_frag_one_tagged: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Mixed_Dot1Q_data_tag_one_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list def rebuildIPv4HttpSeqOverSpillQinQ(self, packet, results_directory, \ sid_id_http, src_name, repo_name): #QinQ - double VLAN tag cases. #rebuild session with overspilling seq numbers # seq = 4294967294, 4294967295, 0, 1,....(as per RFC) #seq overspill re-writing session_packets_seq_overspill = list() session_packets_seq_overspill_fragmented = list() ipsrc = packet[IP].src ipdst = packet[IP].dst portsrc = packet[TCP].sport portdst = packet[TCP].dport #maximum seq=4294967295 seq_num = 4294967294 ack_num = random.randint(1024,(2**32)-1) syn = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="S", sport=portsrc, dport=portdst, \ seq=seq_num) syn.tags = Dot1AD(vlan=777)/Dot1Q(vlan=4000) syn.tags[Dot1Q].tpid = 0x88a8 synack = Ether(src=packet[Ether].dst, dst=packet[Ether].src ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="SA", sport=portdst, dport=portsrc, \ seq=ack_num, ack=syn.seq+1) synack.tags = Dot1AD(vlan=777)/Dot1Q(vlan=4000) synack.tags[Dot1Q].tpid = 0x88a8 ack = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="A", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1) ack.tags = Dot1AD(vlan=777)/Dot1Q(vlan=4000) ack.tags[Dot1Q].tpid = 0x88a8 ##This is the actual data packet that will be send, containing the payload p = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="PA", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1)/packet[TCP][Raw] p.tags = Dot1AD(vlan=777)/Dot1Q(vlan=4000) p.tags[Dot1Q].tpid = 0x88a8 ##This is the actual data packet that will be sent containing the payload #- fragmented p_frag = fragment(p, fragsize=10 ) ## This is the same original data packet - but no VLAN tags p_QinQ_untagged = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="PA", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1)/packet[TCP][Raw] p_frag_QinQ_untagged = fragment(p_QinQ_untagged, fragsize=10) # Dot1Q wrong VLAN tag - we change the VLAN tag in the data packet # Everything else is the same and stays the same p_QinQ_tag_reversed = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="PA", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1)/packet[TCP][Raw] p_QinQ_tag_reversed.tags = Dot1AD(vlan=4000)/Dot1Q(vlan=777) p_QinQ_tag_reversed.tags[Dot1Q].tpid = 0x88a8 ##This is the actual data packet that will be sent containing the payload #- fragmented, QinQ reversed/siwtched tags p_frag_QinQ_tag_reversed = fragment(p_QinQ_tag_reversed, fragsize=10 ) ## ONLY Dot1Q VLAN tag - present in the fragments (QinQ expected) p_QinQ_tag_only_dot1q = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="PA", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1)/packet[TCP][Raw] p_QinQ_tag_only_dot1q.tags = Dot1Q(vlan=1234) #The actual fragmentation - only one VLAN tag - QinQ expected p_frag_QinQ_tag_only_dot1q = fragment(p_QinQ_tag_only_dot1q, fragsize=10 ) ##We need to ACK the packet #here we go to "ack=(len(p[Raw]) -1 )" !! - "the overspill" returnAck = Ether(src=packet[Ether].dst, dst=packet[Ether].src, type=0x800 ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="A", sport=portdst, dport=portsrc, \ seq=p.ack, ack=(len(p[Raw]) -1 )) returnAck.tags = Dot1AD(vlan=777)/Dot1Q(vlan=4000) returnAck.tags[Dot1Q].tpid = 0x88a8 ##Now we build the Finshake finAck = Ether(src=packet[Ether].src, dst=packet[Ether].dst, type=0x800 ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="FA", sport=portsrc, dport=portdst, \ seq=returnAck.ack, ack=returnAck.seq) finAck.tags = Dot1AD(vlan=777)/Dot1Q(vlan=4000) finAck.tags[Dot1Q].tpid = 0x88a8 finalAck = Ether(src=packet[Ether].dst, dst=packet[Ether].src ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="A", sport=portdst, dport=portsrc, \ seq=finAck.ack, ack=finAck.seq+1) finalAck.tags = Dot1AD(vlan=777)/Dot1Q(vlan=4000) finalAck.tags[Dot1Q].tpid = 0x88a8 #write the session - normal session_packets_seq_overspill.append(syn) session_packets_seq_overspill.append(synack) session_packets_seq_overspill.append(ack) session_packets_seq_overspill.append(p) session_packets_seq_overspill.append(returnAck) session_packets_seq_overspill.append(finAck) session_packets_seq_overspill.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_QinQ-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill) session_packets_seq_overspill[:] = [] #empty the list #write the fragmented packets - ordered session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in p_frag: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Ordered_QinQ-%s-tp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in reversed(p_frag): session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Reversed_QinQ-%s-tp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write mix the fragmented packets #shuffle/unsort/unorder/mix JUST the fragmented packets session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) random.shuffle(p_frag) #shuffle JUST the fragments in the session for p_fragment in p_frag: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Mixed_QinQ-%s-tp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list ## # Here we start with the revrsed/switched QinQ VLAN tags in the data packet # and the creation of the pcaps designed for not alerting # due to changed (fake/hopped) VLAN tag in the same flow ## #write the session - normal session_packets_seq_overspill.append(syn) session_packets_seq_overspill.append(synack) session_packets_seq_overspill.append(ack) session_packets_seq_overspill.append(p_QinQ_tag_reversed) session_packets_seq_overspill.append(returnAck) session_packets_seq_overspill.append(finAck) session_packets_seq_overspill.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_QinQ_tags_reversed-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill) session_packets_seq_overspill[:] = [] #empty the list #write the fragmented packets - ordered session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in p_frag_QinQ_tag_reversed: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Ordered_QinQ_tags_reversed-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in reversed(p_frag_QinQ_tag_reversed): session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Reversed_QinQ_tags_reversed-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write mix the fragmented packets #shuffle/unsort/unorder/mix JUST the fragmented packets session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) random.shuffle(p_frag_QinQ_tag_reversed) #shuffle JUST the fragments in the session for p_fragment in p_frag_QinQ_tag_reversed: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Mixed_QinQ_tags_reversed-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list ## # Here we start with the missing QinQ VLAN tag in the data packet # and the creation of the pcaps designed for not alerting # due to missing VLAN tag in the same flow ## #write the session - normal session_packets_seq_overspill.append(syn) session_packets_seq_overspill.append(synack) session_packets_seq_overspill.append(ack) session_packets_seq_overspill.append(p_QinQ_untagged) session_packets_seq_overspill.append(returnAck) session_packets_seq_overspill.append(finAck) session_packets_seq_overspill.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_QinQ_data_tag_missing-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill) session_packets_seq_overspill[:] = [] #empty the list #write the fragmented packets - ordered session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in p_frag_QinQ_untagged: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Ordered_QinQ_data_tag_missing-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name) , session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in reversed(p_frag_QinQ_untagged): session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Reversed_QinQ_data_tag_missing-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write mix the fragmented packets #shuffle/unsort/unorder/mix JUST the fragmented packets session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) random.shuffle(p_frag_QinQ_untagged) #shuffle JUST the fragments in the session for p_fragment in p_frag_QinQ_untagged: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Mixed_QinQ_data_tag_missing-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list ## # Here we start with only one VLAN tag found in the data packet # QinQ VLAN tags expected ## #write the session - normal session_packets_seq_overspill.append(syn) session_packets_seq_overspill.append(synack) session_packets_seq_overspill.append(ack) session_packets_seq_overspill.append(p_QinQ_tag_only_dot1q) session_packets_seq_overspill.append(returnAck) session_packets_seq_overspill.append(finAck) session_packets_seq_overspill.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_QinQ_data_tag_only_dot1q-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill) session_packets_seq_overspill[:] = [] #empty the list #write the fragmented packets - ordered session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in p_frag_QinQ_tag_only_dot1q: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Ordered_QinQ_data_tag_only_dotq-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in reversed(p_frag_QinQ_tag_only_dot1q): session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Reversed_QinQ_data_tag_only_dot1q-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write mix the fragmented packets #shuffle/unsort/unorder/mix JUST the fragmented packets session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) random.shuffle(p_frag_QinQ_tag_only_dot1q) #shuffle JUST the fragments in the session for p_fragment in p_frag_QinQ_tag_only_dot1q: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Mixed_QinQ_data_tag_only_dot1q-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list def rebuildIPv4HttpSeqOverSpillQinQWrongTagInFragments(self, packet, \ results_directory, sid_id_http, src_name, repo_name): #QinQ - double VLAN tag cases. #rebuild session with overspilling seq numbers # seq = 4294967294, 4294967295, 0, 1,....(as per RFC) #seq overspill re-writing session_packets_seq_overspill = list() session_packets_seq_overspill_fragmented = list() ipsrc = packet[IP].src ipdst = packet[IP].dst portsrc = packet[TCP].sport portdst = packet[TCP].dport #maximum seq=4294967295 seq_num = 4294967294 ack_num = random.randint(1024,(2**32)-1) syn = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="S", sport=portsrc, dport=portdst, \ seq=seq_num) syn.tags = Dot1AD(vlan=777)/Dot1Q(vlan=4000) syn.tags[Dot1Q].tpid = 0x88a8 synack = Ether(src=packet[Ether].dst, dst=packet[Ether].src ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="SA", sport=portdst, dport=portsrc, \ seq=ack_num, ack=syn.seq+1) synack.tags = Dot1AD(vlan=777)/Dot1Q(vlan=4000) synack.tags[Dot1Q].tpid = 0x88a8 ack = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="A", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1) ack.tags = Dot1AD(vlan=777)/Dot1Q(vlan=4000) ack.tags[Dot1Q].tpid = 0x88a8 ##This is the actual data packet that will be send, containing the payload p = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="PA", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1)/packet[TCP][Raw] p.tags = Dot1AD(vlan=777)/Dot1Q(vlan=4000) p.tags[Dot1Q].tpid = 0x88a8 ##This is the data packet. Fromt this data packet we will edit and tweek # the VLAN tags (QinQ) for one or more fragments of the same data packet ! p_QinQ_data_frag = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="PA", sport=portsrc, dport=portdst, \ seq=syn.seq+1, ack=synack.seq+1)/packet[TCP][Raw] p_QinQ_data_frag.tags = Dot1AD(vlan=777)/Dot1Q(vlan=4000) p_QinQ_data_frag.tags[Dot1Q].tpid = 0x88a8 ## We fragment the data packet, then we will play around with the fragments # VLAN tags in QinQ # Here we change the VLAN tag of the outer 802.1AD layer p_frag_QinQ_data_frag_wrong_dot1ad = fragment(p_QinQ_data_frag, fragsize=10 ) p_frag_QinQ_data_frag_wrong_dot1ad[3].tags = Dot1AD(vlan=777)/Dot1Q(vlan=888) p_frag_QinQ_data_frag_wrong_dot1ad[3].tags[Dot1Q].tpid = 0x88a8 ## We fragment the data packet, then we will play around with the fragments # VLAN tags in QinQ # Here we change the VLAN tag of the inner Dot1Q layer p_frag_QinQ_data_frag_wrong_dot1q = fragment(p_QinQ_data_frag, fragsize=10 ) p_frag_QinQ_data_frag_wrong_dot1q[3].tags = Dot1AD(vlan=333)/Dot1Q(vlan=4000) p_frag_QinQ_data_frag_wrong_dot1q[3].tags[Dot1Q].tpid = 0x88a8 ## We fragment the data packet, then we will play around with the fragments # VLAN tags in QinQ # Here we make one fragmanet tagged only with one VLAN p_frag_QinQ_data_frag_only_dot1q = fragment(p_QinQ_data_frag, fragsize=10 ) p_frag_QinQ_data_frag_only_dot1q[3].tags = Dot1Q(vlan=1234) ## We fragment the data packet and make one fragment with both tags # having the wrong VLAN IDs p_frag_QinQ_data_frag_wrong_both = fragment(p_QinQ_data_frag, fragsize=10 ) p_frag_QinQ_data_frag_wrong_both[3].tags = Dot1AD(vlan=444)/Dot1Q(vlan=555) p_frag_QinQ_data_frag_wrong_both[3].tags[Dot1Q].tpid = 0x88a8 ## We fragment the data packet , but we make one fragment untagged. # VLAN tags missing p_frag_QinQ_data_frag_missing_tags = fragment(p_QinQ_data_frag, fragsize=10 ) p_frag_QinQ_data_frag_missing_tags[3].tags = Untagged() ## We fragment the data packet , but we make one fragment with reversed # VLAN tags p_frag_QinQ_data_frag_reversed_tags = fragment(p_QinQ_data_frag, fragsize=10 ) p_frag_QinQ_data_frag_reversed_tags[3].tags = \ Dot1AD(vlan=4000)/Dot1Q(vlan=777) p_frag_QinQ_data_frag_reversed_tags[3].tags[Dot1Q].tpid = 0x88a8 ## We fragment the data packet , but we make ONLY one fragment QinQ tagged # with the correct VLAN tags p_frag_QinQ_data_frag_one_tagged = fragment(p_QinQ_data_frag, fragsize=10 ) for frag in p_frag_QinQ_data_frag_one_tagged: frag.tags = Untagged() p_frag_QinQ_data_frag_one_tagged[3].tags = Dot1AD(vlan=777)/Dot1Q(vlan=4000) p_frag_QinQ_data_frag_one_tagged[3].tags[Dot1Q].tpid = 0x88a8 ##We need to ACK the packet #here we go to "ack=(len(p[Raw]) -1 )" !! - "the overspill" returnAck = Ether(src=packet[Ether].dst, dst=packet[Ether].src, type=0x800 ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="A", sport=portdst, dport=portsrc, \ seq=p.ack, ack=(len(p[Raw]) -1 )) returnAck.tags = Dot1AD(vlan=777)/Dot1Q(vlan=4000) returnAck.tags[Dot1Q].tpid = 0x88a8 ##Now we build the Finshake finAck = Ether(src=packet[Ether].src, dst=packet[Ether].dst, type=0x800 ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="FA", sport=portsrc, dport=portdst, \ seq=returnAck.ack, ack=returnAck.seq) finAck.tags = Dot1AD(vlan=777)/Dot1Q(vlan=4000) finAck.tags[Dot1Q].tpid = 0x88a8 finalAck = Ether(src=packet[Ether].dst, dst=packet[Ether].src ) \ /IP(src=ipdst, dst=ipsrc)/TCP(flags="A", sport=portdst, dport=portsrc, \ seq=finAck.ack, ack=finAck.seq+1) finalAck.tags = Dot1AD(vlan=777)/Dot1Q(vlan=4000) finalAck.tags[Dot1Q].tpid = 0x88a8 ## # Here we start with chnaging the QinQ VLAN tags in the FRAGMENTS # of the data packet and the creation of the pcaps designed for not alerting # due to missing/reversed/nonexisting VLAN tags in the fragments of # data in the same flow. ## ## one fragment from the data packet has a wrong VLAN tag - dot1Q tag. # The other tag (dot1AD- S-VLAN/Carrier VLAN) is correct # write the session but with an ordered fragmented payload session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in p_frag_QinQ_data_frag_wrong_dot1q: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Ordered_QinQ_data_frag_wrong_dot1q_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in reversed(p_frag_QinQ_data_frag_wrong_dot1q): session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Reversed_QinQ_data_frag_wrong_dot1q_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) random.shuffle(p_frag_QinQ_data_frag_wrong_dot1q) #shuffle JUST the fragments in the session for p_fragment in p_frag_QinQ_data_frag_wrong_dot1q: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Mixed_QinQ_data_frag_wrong_dot1q_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list ## one fragment from the data packet has a wrong VLAN tag - dot1AD tag # -> S-VLAN/Carrier VLAN. The other tag (dot1q) is correct # write the session but with an ordered fragmented payload session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in p_frag_QinQ_data_frag_wrong_dot1ad: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Ordered_QinQ_data_frag_wrong_dot1ad_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in reversed(p_frag_QinQ_data_frag_wrong_dot1ad): session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Reversed_QinQ_data_frag_wrong_dot1ad_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) random.shuffle(p_frag_QinQ_data_frag_wrong_dot1ad) #shuffle JUST the fragments in the session for p_fragment in p_frag_QinQ_data_frag_wrong_dot1ad: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Mixed_QinQ_data_frag_wrong_dot1ad_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list ## We make one frgament with only one VLAN tag (not double) # write the session but with an ordered fragmented payload session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in p_frag_QinQ_data_frag_only_dot1q: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Ordered_QinQ_data_frag_only_dot1q_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in reversed(p_frag_QinQ_data_frag_only_dot1q): session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Reversed_QinQ_data_frag_only_dot1q_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) random.shuffle(p_frag_QinQ_data_frag_only_dot1q) #shuffle JUST the fragments in the session for p_fragment in p_frag_QinQ_data_frag_only_dot1q: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Mixed_QinQ_data_frag_only_dot1q_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list ## one frgament from the data packet has both VLAN tag IDs wrong #write the session but with an ordered fragmented payload session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in p_frag_QinQ_data_frag_wrong_both: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Ordered_QinQ_data_frag_wrong_tags_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in reversed(p_frag_QinQ_data_frag_wrong_both): session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Reversed_QinQ_data_frag_wrong_tags_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) random.shuffle(p_frag_QinQ_data_frag_wrong_both) #shuffle JUST the fragments in the session for p_fragment in p_frag_QinQ_data_frag_wrong_both: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Mixed_QinQ_data_frag_wrong_tags_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list ## one fragment of the data packet has NO VLAN tags #write the session but with an ordered fragmented payload session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in p_frag_QinQ_data_frag_missing_tags: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Ordered_QinQ_data_frag_missing_tags_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in reversed(p_frag_QinQ_data_frag_missing_tags): session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Reversed_QinQ_data_frag_missing_tags_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) random.shuffle(p_frag_QinQ_data_frag_missing_tags) #shuffle JUST the fragments in the session for p_fragment in p_frag_QinQ_data_frag_missing_tags: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Mixed_QinQ_data_frag_missing_tags_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list ## one fragment of the data packet has both VLAN tags switched/reversed # write the session but with an ordered fragmented payload session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in p_frag_QinQ_data_frag_reversed_tags: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Ordered_QinQ_data_frag_reversed_tags_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in reversed(p_frag_QinQ_data_frag_reversed_tags): session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Reversed_QinQ_data_frag_reversed_tags_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) random.shuffle(p_frag_QinQ_data_frag_reversed_tags) #shuffle JUST the fragments in the session for p_fragment in p_frag_QinQ_data_frag_reversed_tags: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Mixed_QinQ_data_frag_reversed_tags_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list ## one fragment of the data packet has both VLAN tags correct. # The rest do not. # write the session but with an ordered fragmented payload session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in p_frag_QinQ_data_frag_one_tagged: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Ordered_QinQ_data_frag_only_one_tagged_in_fragments-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session with reverse fragments order session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) for p_fragment in reversed(p_frag_QinQ_data_frag_one_tagged): session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Reversed_QinQ_data_frag_only_one_tagged_in_fragments-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list #write the session but with unordered/unsorted/mixed JUST fragmented #payload packets session_packets_seq_overspill_fragmented.append(syn) session_packets_seq_overspill_fragmented.append(synack) session_packets_seq_overspill_fragmented.append(ack) random.shuffle(p_frag_QinQ_data_frag_one_tagged) #shuffle JUST the fragments in the session for p_fragment in p_frag_QinQ_data_frag_one_tagged: session_packets_seq_overspill_fragmented.append(p_fragment) session_packets_seq_overspill_fragmented.append(returnAck) session_packets_seq_overspill_fragmented.append(finAck) session_packets_seq_overspill_fragmented.append(finalAck) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Session_Seq_Overspill_Fragmented_Mixed_QinQ_data_frag_only_one_tagged_in_fragments-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), session_packets_seq_overspill_fragmented) session_packets_seq_overspill_fragmented[:] = [] #empty the list def midstreamIPv4Http(self, fragit, results_directory, sid_id_http, \ src_name, repo_name): #forcing correct recalculation of the checksum del fragit[IP].chksum del fragit[TCP].chksum fragit_done = fragment(fragit, fragsize=10 ) #write the ordered fragmented payload packet and write wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Ordered-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Midstream', 'Regular'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), fragit_done) #reverse the fragments !!! #permanent change to the list of fragments fragit_done.reverse() #write the reversed fragmented payload packet and write wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Reversed-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Midstream', 'Regular'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), fragit_done) #shuffle(unorder/mix) the fragmented payload packet and write random.shuffle(fragit_done) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Mixed-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Midstream', 'Regular'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), fragit_done) def midstreamIPv4HttpDot1Q(self, fragit, results_directory, sid_id_http, \ src_name, repo_name): #Using VLAN Tag - Dot1Q #forcing correct recalculation of the checksum del fragit[IP].chksum del fragit[TCP].chksum fragit[Ether].tags=Dot1Q(vlan=2222) #one midstream packet in Dot1Q wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Dot1Q-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Midstream', 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), fragit) fragit_done = fragment(fragit, fragsize=10 ) #write the ordered fragmented payload packet and write wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Ordered_Dot1Q-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Midstream', 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), fragit_done) #reverse the fragments !!! #permanent change to the list of fragments fragit_done.reverse() #write the reversed fragmented payload packet and write wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Reversed_Dot1Q-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Midstream', 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), fragit_done) #shuffle(unorder/mix) the fragmented payload packet and write random.shuffle(fragit_done) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Mixed_Dot1Q-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Midstream', 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), fragit_done) def midstreamIPv4HttpDot1QWrongTagInFragments(self, fragit, results_directory, \ sid_id_http, src_name, repo_name): # Wrongly tagged fragments # Using VLAN Tag - Dot1Q #forcing correct recalculation of the checksum del fragit[IP].chksum del fragit[TCP].chksum fragit[Ether].tags = Dot1Q(vlan=2222) ## # one fragment has the wrong VLAN ID tag ## fragit_done_wrong_dot1q_tag = fragment(fragit, fragsize=10 ) fragit_done_wrong_dot1q_tag[3].tags = Dot1Q(vlan=2299) #write the ordered fragmented payload packet and write wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Ordered_Dot1Q_data_tag_wrong_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), fragit_done_wrong_dot1q_tag) #reverse the fragments !!! #permanent change to the list of fragments fragit_done_wrong_dot1q_tag.reverse() #write the reversed fragmented payload packet and write wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Reversed_Dot1Q_data_tag_wrong_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), fragit_done_wrong_dot1q_tag) #shuffle(unorder/mix) the fragmented payload packet and write random.shuffle(fragit_done_wrong_dot1q_tag) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Mixed_Dot1Q_data_tag_wrong_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), fragit_done_wrong_dot1q_tag) ## # one fragment has no VLAN ID tag ## fragit_done_no_dot1q_tag = fragment(fragit, fragsize=10 ) fragit_done_no_dot1q_tag[3].tags = Untagged() #write the ordered fragmented payload packet and write wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Ordered_Dot1Q_data_tag_none_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), fragit_done_no_dot1q_tag) #reverse the fragments !!! #permanent change to the list of fragments fragit_done_no_dot1q_tag.reverse() #write the reversed fragmented payload packet and write wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Reversed_Dot1Q_data_tag_none_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), fragit_done_no_dot1q_tag) #shuffle(unorder/mix) the fragmented payload packet and write random.shuffle(fragit_done_no_dot1q_tag) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Mixed_Dot1Q_data_tag_none_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'Dot1Q'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), fragit_done_no_dot1q_tag) def midstreamIPv4HttpQinQ(self, fragit, results_directory, sid_id_http, \ src_name, repo_name): #Using DOUBLE VLAN Tagging - QinQ #Forcing correct recalculation of the checksum del fragit[IP].chksum del fragit[TCP].chksum fragit.tags = Dot1AD(vlan=3333)/Dot1Q(vlan=1) fragit.tags[Dot1Q].tpid = 0x88a8 #one midstream packet in QinQ wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_QinQ-%s-tp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), fragit) fragit_done = fragment(fragit, fragsize=10 ) #write the ordered fragmented payload packet and write wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Ordered_QinQ-%s-tp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), fragit_done) #reverse the fragments !!! #permanent change to the list of fragments fragit_done.reverse() #write the reversed fragmented payload packet and write wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Reversed_QinQ-%s-tp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), fragit_done) #shuffle(unorder/mix) the fragmented payload packet and write random.shuffle(fragit_done) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Mixed_QinQ-%s-tp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), fragit_done) def midstreamIPv4HttpQinQWrongTagInFragments(self, fragit, \ results_directory, sid_id_http, src_name, repo_name): #Wrongly tagged fragments #Using DOUBLE VLAN Tagging - QinQ #forcing correct recalculation of the checksum del fragit[IP].chksum del fragit[TCP].chksum fragit.tags = Dot1AD(vlan=3333)/Dot1Q(vlan=1) fragit.tags[Dot1Q].tpid = 0x88a8 ## # We fragment the data packet, we change the VLAN tag of # the outer 802.1AD layer ## p_frag_QinQ_data_frag_wrong_dot1ad = fragment(fragit, fragsize=10 ) p_frag_QinQ_data_frag_wrong_dot1ad[3].tags = Dot1AD(vlan=3333)/Dot1Q(vlan=777) p_frag_QinQ_data_frag_wrong_dot1ad[3].tags[Dot1Q].tpid = 0x88a8 ## # We fragment the data packet, we change the VLAN tag of # the inner Dot1Q layer ## p_frag_QinQ_data_frag_wrong_dot1q = fragment(fragit, fragsize=10 ) p_frag_QinQ_data_frag_wrong_dot1q[3].tags = Dot1AD(vlan=777)/Dot1Q(vlan=1) p_frag_QinQ_data_frag_wrong_dot1q[3].tags[Dot1Q].tpid = 0x88a8 ## # We fragment the data packet, we make one fragmanet tagged only # with one VLAN ## p_frag_QinQ_data_frag_only_dot1q = fragment(fragit, fragsize=10 ) p_frag_QinQ_data_frag_only_dot1q[3].tags = Dot1Q(vlan=2345) ## # We fragment the data packet and make one fragment with both tags # having the wrong VLAN IDs ## p_frag_QinQ_data_frag_wrong_both = fragment(fragit, fragsize=10 ) p_frag_QinQ_data_frag_wrong_both[3].tags = Dot1AD(vlan=111)/Dot1Q(vlan=222) p_frag_QinQ_data_frag_wrong_both[3].tags[Dot1Q].tpid = 0x88a8 ## # We fragment the data packet , but we make one fragment untagged. # VLAN tags missing ## p_frag_QinQ_data_frag_missing_tags = fragment(fragit, fragsize=10 ) p_frag_QinQ_data_frag_missing_tags[3].tags = Untagged() ## # We fragment the data packet , but we make one fragment with reversed # VLAN tags ## p_frag_QinQ_data_frag_reversed_tags = fragment(fragit, fragsize=10 ) p_frag_QinQ_data_frag_reversed_tags[3].tags = Dot1AD(vlan=1)/Dot1Q(vlan=3333) p_frag_QinQ_data_frag_reversed_tags[3].tags[Dot1Q].tpid = 0x88a8 ## # We fragment the data packet, we change the VLAN tag of # the outer 802.1AD layer ## #write the ordered fragmented payload packet and write wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Ordered_QinQ_data_frag_wrong_dot1ad_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), p_frag_QinQ_data_frag_wrong_dot1ad) #reverse the fragments !!! #permanent change to the list of fragments p_frag_QinQ_data_frag_wrong_dot1ad.reverse() #write the reversed fragmented payload packet and write wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Reversed_QinQ_data_frag_wrong_dot1ad_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), p_frag_QinQ_data_frag_wrong_dot1ad) #shuffle(unorder/mix) the fragmented payload packet and write random.shuffle(p_frag_QinQ_data_frag_wrong_dot1ad) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Mixed_QinQ_data_frag_wrong_dot1ad_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), p_frag_QinQ_data_frag_wrong_dot1ad) ## # We fragment the data packet, we change the VLAN tag of # the inner Dot1Q layer ## #write the ordered fragmented payload packet and write wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Ordered_QinQ_data_frag_wrong_dot1q_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), p_frag_QinQ_data_frag_wrong_dot1q) #reverse the fragments !!! #permanent change to the list of fragments p_frag_QinQ_data_frag_wrong_dot1q.reverse() #write the reversed fragmented payload packet and write wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Reversed_QinQ_data_frag_wrong_dot1q_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), p_frag_QinQ_data_frag_wrong_dot1q) #shuffle(unorder/mix) the fragmented payload packet and write random.shuffle(p_frag_QinQ_data_frag_wrong_dot1q) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Mixed_QinQ_data_frag_wrong_dot1q_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), p_frag_QinQ_data_frag_wrong_dot1q) ## # We fragment the data packet, we make one fragmanet tagged only # with one VLAN ## #write the ordered fragmented payload packet and write wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Ordered_QinQ_data_frag_only_dot1q_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), p_frag_QinQ_data_frag_only_dot1q) #reverse the fragments !!! #permanent change to the list of fragments p_frag_QinQ_data_frag_only_dot1q.reverse() #write the reversed fragmented payload packet and write wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Reversed_QinQ_data_frag_only_dot1q_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), p_frag_QinQ_data_frag_only_dot1q) #shuffle(unorder/mix) the fragmented payload packet and write random.shuffle(p_frag_QinQ_data_frag_only_dot1q) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Mixed_QinQ_data_frag_only_dot1q_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), p_frag_QinQ_data_frag_only_dot1q) ## # We fragment the data packet and make one fragment with both tags # having the wrong VLAN IDs ## #write the ordered fragmented payload packet and write wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Ordered_QinQ_data_frag_wrong_tags_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), p_frag_QinQ_data_frag_wrong_both) #reverse the fragments !!! #permanent change to the list of fragments p_frag_QinQ_data_frag_wrong_both.reverse() #write the reversed fragmented payload packet and write wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Reversed_QinQ_data_frag_wrong_tags_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), p_frag_QinQ_data_frag_wrong_both) #shuffle(unorder/mix) the fragmented payload packet and write random.shuffle(p_frag_QinQ_data_frag_wrong_both) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Mixed_QinQ_data_frag_wrong_tags_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), p_frag_QinQ_data_frag_wrong_both) ## # We fragment the data packet , but we make one fragment untagged. # VLAN tags missing ## #write the ordered fragmented payload packet and write wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Ordered_QinQ_data_frag_missing_tags_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), p_frag_QinQ_data_frag_missing_tags) #reverse the fragments !!! #permanent change to the list of fragments p_frag_QinQ_data_frag_missing_tags.reverse() #write the reversed fragmented payload packet and write wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Reversed_QinQ_data_frag_missing_tags_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), p_frag_QinQ_data_frag_missing_tags) #shuffle(unorder/mix) the fragmented payload packet and write random.shuffle(p_frag_QinQ_data_frag_missing_tags) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Mixed_QinQ_data_frag_missing_tags_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), p_frag_QinQ_data_frag_missing_tags) ## # We fragment the data packet , but we make one fragment with reversed # VLAN tags ## #write the ordered fragmented payload packet and write wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Ordered_QinQ_data_frag_reversed_tags_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), p_frag_QinQ_data_frag_reversed_tags) #reverse the fragments !!! #permanent change to the list of fragments p_frag_QinQ_data_frag_reversed_tags.reverse() #write the reversed fragmented payload packet and write wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Reversed_QinQ_data_frag_reversed_tags_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), p_frag_QinQ_data_frag_reversed_tags) #shuffle(unorder/mix) the fragmented payload packet and write random.shuffle(p_frag_QinQ_data_frag_reversed_tags) wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream_Fragmented_Mixed_QinQ_data_frag_reversed_tags_in_fragment-%s-fp-00.pcap" \ % (os.path.join(results_directory, 'Midstream', 'QinQ'), sid_id_http, self.incrementPcapId("byOne") \ , src_name, repo_name), p_frag_QinQ_data_frag_reversed_tags) def reconstructIPv4HttpPacket(self, packet): # here we make the original HTTP packet into a just TCP packet if packet.haslayer(IPv6): ipsrc = "1.1.1.1" ipdst = "9.9.9.9" else: ipsrc = packet[IP].src ipdst = packet[IP].dst p = Ether(src=packet[Ether].src, dst=packet[Ether].dst ) \ /IP(src=ipsrc, dst=ipdst)/TCP(flags="PA", sport=packet[TCP].sport, \ dport=packet[TCP].dport, seq=packet.seq, ack=packet.ack)/packet[TCP][Raw] return p def incrementPcapId(self, action): if action == "byOne": Global_Vars.pcap_id = Global_Vars.pcap_id+1 return '{0:03}'.format(Global_Vars.pcap_id) elif action == "clear": Global_Vars.pcap_id = 000 return '{0:03}'.format(Global_Vars.pcap_id) else: sys.exit("Invalid argument for function incrementPcapId()") def httpReWrite(self, scapy_load, FN, pcap_id, results_directory, \ source_name, sid_id_http, url_method, url_str, content_all, repository_name): # writing the http request packet to pcap # in regression script format # 2002031-001-sandnet-public-tp-01.pcap - example ## 001 - starts here ## ipv4_ready = self.reconstructIPv4HttpPacket(scapy_load[FN]) if Global_Vars.yaml_options['Protocols']['HTTP']['WriteRule']: self.writeIPv4HttpRule(sid_id_http, url_method, url_str, content_all, \ os.path.join(results_directory, 'Rules'), source_name) if Global_Vars.yaml_options['Protocols']['HTTP']['Midstream']['Midstream']: wrpcap("%s/%s-%s-%s_IPv4_HTTP_Midstream-%s-tp-01.pcap" \ % (os.path.join(results_directory, 'Midstream', 'Regular'), sid_id_http, self.incrementPcapId("byOne"), \ source_name, repository_name) , ipv4_ready) self.midstreamIPv4Http(ipv4_ready, results_directory, sid_id_http, \ source_name, repository_name) self.writeIPv4HttpRule(sid_id_http, url_method, url_str, content_all, \ os.path.join(results_directory, 'Midstream', 'Regular'), source_name) if Global_Vars.yaml_options['Protocols']['HTTP']['Midstream']['Dot1Q']: self.midstreamIPv4HttpDot1Q(ipv4_ready, results_directory, sid_id_http, \ source_name, repository_name) self.midstreamIPv4HttpDot1QWrongTagInFragments(ipv4_ready, \ results_directory, sid_id_http, source_name, repository_name) self.writeIPv4HttpRule(sid_id_http, url_method, url_str, content_all, \ os.path.join(results_directory, 'Midstream', 'Dot1Q'), source_name) if Global_Vars.yaml_options['Protocols']['HTTP']['Midstream']['QinQ']: self.midstreamIPv4HttpQinQ(ipv4_ready, results_directory, \ sid_id_http, source_name, repository_name) self.midstreamIPv4HttpQinQWrongTagInFragments(ipv4_ready, \ results_directory, sid_id_http, source_name, repository_name) self.writeIPv4HttpRule(sid_id_http, url_method, url_str, content_all, \ os.path.join(results_directory, 'Midstream', 'QinQ'), source_name) if Global_Vars.yaml_options['Protocols']['HTTP']['Session']['Session']: self.rebuildIPv4HttpSession(ipv4_ready, results_directory, sid_id_http, \ source_name, repository_name) self.writeIPv4HttpRule(sid_id_http, url_method, url_str, content_all, \ os.path.join(results_directory, 'Regular'), source_name) if Global_Vars.yaml_options['Protocols']['HTTP']['Session']['ExtraTcpSA']: self.rebuildIPv4HttpSessionExtraTcpSAs(ipv4_ready, results_directory, \ sid_id_http, source_name, repository_name) self.writeIPv4HttpRule(sid_id_http, url_method, url_str, content_all, \ os.path.join(results_directory, 'Regular'), source_name) if Global_Vars.yaml_options['Protocols']['HTTP']['Session']['Dot1Q']: self.rebuildIPv4HttpSessionDot1Q(ipv4_ready, results_directory, \ sid_id_http, source_name, repository_name) self.rebuildIPv4HttpSessionDot1QWrongTagInFragments(ipv4_ready, \ results_directory, sid_id_http, source_name, repository_name) self.writeIPv4HttpRule(sid_id_http, url_method, url_str, content_all, \ os.path.join(results_directory, 'Dot1Q'), source_name) if Global_Vars.yaml_options['Protocols']['HTTP']['Session']['QinQ']: self.rebuildIPv4HttpSessionQinQ(ipv4_ready, results_directory, \ sid_id_http, source_name, repository_name) self.rebuildIPv4HttpSessionQinQWrongTagInFragments(ipv4_ready, \ results_directory, sid_id_http, source_name, repository_name) self.writeIPv4HttpRule(sid_id_http, url_method, url_str, content_all, \ os.path.join(results_directory,'QinQ'), source_name) if Global_Vars.yaml_options['Protocols']['HTTP']['Session']['SeqOverspill']: self.rebuildIPv4HttpSeqOverSpill(ipv4_ready, results_directory, \ sid_id_http, source_name, repository_name) self.writeIPv4HttpRule(sid_id_http, url_method, url_str, content_all, \ os.path.join(results_directory, 'Regular'), source_name) if Global_Vars.yaml_options['Protocols']['HTTP']['Session']['Dot1Q']: self.rebuildIPv4HttpSeqOverSpillDot1Q(ipv4_ready, results_directory, \ sid_id_http, source_name, repository_name) self.rebuildIPv4HttpSeqOverSpillDot1QWrongTagInFragments(ipv4_ready, \ results_directory, sid_id_http, source_name, repository_name) self.writeIPv4HttpRule(sid_id_http, url_method, url_str, content_all, \ os.path.join(results_directory, 'Dot1Q'), source_name) if Global_Vars.yaml_options['Protocols']['HTTP']['Session']['QinQ']: self.rebuildIPv4HttpSeqOverSpillQinQ(ipv4_ready, \ results_directory, sid_id_http, source_name, repository_name) self.rebuildIPv4HttpSeqOverSpillQinQWrongTagInFragments(ipv4_ready, \ results_directory, sid_id_http, source_name, repository_name) self.writeIPv4HttpRule(sid_id_http, url_method, url_str, content_all, \ os.path.join(results_directory,'QinQ'), source_name) def __init__(self, scapy_load, FN, pcap_id, results_directory, source_name, \ sid_id_http, url_method, url_str, content_all, repository_name): self.scapy_load_to_pass = scapy_load self.FN_to_pass = FN self.pcap_id_to_pass = pcap_id self.results_directory_to_pass = results_directory self.source_name_to_pass = source_name self.sid_id_http_to_pass = sid_id_http self.url_method_to_pass = url_method self.url_str_to_pass = url_str self.content_all_to_pass = content_all self.repository_name_to_pass = repository_name # if HTTP over IPv4 is enabled in yaml if Global_Vars.yaml_options['Protocols']['HTTP']['IPv4']: self.httpReWrite( \ self.scapy_load_to_pass, self.FN_to_pass, self.pcap_id_to_pass, \ self.results_directory_to_pass, self.source_name_to_pass, \ self.sid_id_http_to_pass, self.url_method_to_pass, \ self.url_str_to_pass, self.content_all_to_pass, \ self.repository_name_to_pass )
pevma/PtP
ProtoIPv4/IPv4_HTTP.py
Python
gpl-2.0
182,209
# Copyright (C) 2013 Adam Stokes <[email protected]> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. from sos.plugins import Plugin, UbuntuPlugin class Maas(Plugin, UbuntuPlugin): """Ubuntu Metal-As-A-Service """ plugin_name = 'maas' profiles = ('sysmgmt',) option_list = [ ('profile-name', 'The name with which you will later refer to this remote', '', False), ('url', 'The URL of the remote API', '', False), ('credentials', 'The credentials, also known as the API key', '', False) ] def _has_login_options(self): return self.get_option("url") and self.get_option("credentials") \ and self.get_option("profile-name") def _remote_api_login(self): ret = self.call_ext_prog("maas login %s %s %s" % ( self.get_option("profile-name"), self.get_option("url"), self.get_option("credentials"))) return ret['status'] == 0 def setup(self): self.add_copy_spec([ "/etc/squid-deb-proxy", "/etc/maas", "/var/lib/maas/dhcp*", "/var/log/apache2*", "/var/log/maas*", "/var/log/upstart/maas-*", ]) self.add_cmd_output([ "apt-cache policy maas-*", "apt-cache policy python-django-*", ]) if self.is_installed("maas-region-controller"): self.add_cmd_output([ "maas-region-admin dumpdata", ]) if self._has_login_options(): if self._remote_api_login(): self.add_cmd_output("maas %s commissioning-results list" % self.get_option("profile-name")) else: self._log_error( "Cannot login into MAAS remote API with provided creds.") # vim: set et ts=4 sw=4 :
pierg75/pier-sosreport
sos/plugins/maas.py
Python
gpl-2.0
2,550
# -*- coding: utf-8 -*- # # This file is part of kwalitee # Copyright (C) 2014, 2015 CERN. # # kwalitee is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. # # kwalitee is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with kwalitee; if not, write to the Free Software Foundation, # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # # In applying this licence, CERN does not waive the privileges and immunities # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. """Prepare release news from git log. Prepares release news from git log messages, breaking release news into (1) sections (e.g. Security fixes, detected from commit labels) and (2) modules (e.g. search, detected from commit log headlines). """ from __future__ import absolute_import, print_function, unicode_literals import itertools import re import sys import textwrap from collections import OrderedDict from flask import current_app from flask_script import Manager from .check import _git_commits, _pygit2_commits manager = Manager(usage=__doc__) def analyse_body_paragraph(body_paragraph, labels=None): """Analyse commit body paragraph and return (label, message). >>> analyse_body_paragraph('* BETTER Foo and bar.', >>> ... {'BETTER': 'Improvements'}) ('BETTER', 'Foo and bar.') >>> analyse_body_paragraph('* Foo and bar.') (None, 'Foo and bar.') >>> analyse_body_paragraph('Foo and bar.') (None, None) """ # try to find leading label first: for label, dummy in labels: if body_paragraph.startswith('* ' + label): return (label, body_paragraph[len(label) + 3:].replace('\n ', ' ')) # no conformed leading label found; do we have leading asterisk? if body_paragraph.startswith('* '): return (None, body_paragraph[2:].replace('\n ', ' ')) # no leading asterisk found; ignore this paragraph silently: return (None, None) def remove_ticket_directives(message): """Remove ticket directives like "(closes #123). >>> remove_ticket_directives('(closes #123)') '(#123)' >>> remove_ticket_directives('(foo #123)') '(foo #123)' """ if message: message = re.sub(r'closes #', '#', message) message = re.sub(r'addresses #', '#', message) message = re.sub(r'references #', '#', message) return message def amended_commits(commits): """Return those git commit sha1s that have been amended later.""" # which SHA1 are declared as amended later? amended_sha1s = [] for message in commits.values(): amended_sha1s.extend(re.findall(r'AMENDS\s([0-f]+)', message)) return amended_sha1s def enrich_git_log_dict(messages, labels): """Enrich git log with related information on tickets.""" for commit_sha1, message in messages.items(): # detect module and ticket numbers for each commit: component = None title = message.split('\n')[0] try: component, title = title.split(":", 1) component = component.strip() except ValueError: pass # noqa paragraphs = [analyse_body_paragraph(p, labels) for p in message.split('\n\n')] yield { 'sha1': commit_sha1, 'component': component, 'title': title.strip(), 'tickets': re.findall(r'\s(#\d+)', message), 'paragraphs': [ (label, remove_ticket_directives(message)) for label, message in paragraphs ], } @manager.option('repository', default='.', nargs='?', help='repository path') @manager.option('commit', metavar='<sha or branch>', nargs='?', default='HEAD', help='an integer for the accumulator') @manager.option('-c', '--components', default=False, action="store_true", help='group components', dest='group_components') def release(commit='HEAD', repository='.', group_components=False): """Generate release notes.""" from ..kwalitee import get_options from ..hooks import _read_local_kwalitee_configuration options = get_options(current_app.config) options.update(_read_local_kwalitee_configuration(directory=repository)) try: sha = 'oid' commits = _pygit2_commits(commit, repository) except ImportError: try: sha = 'hexsha' commits = _git_commits(commit, repository) except ImportError: print('To use this feature, please install pygit2. GitPython will ' 'also work but is not recommended (python <= 2.7 only).', file=sys.stderr) return 2 messages = OrderedDict([(getattr(c, sha), c.message) for c in commits]) for commit_sha1 in amended_commits(messages): if commit_sha1 in messages: del messages[commit_sha1] full_messages = list( enrich_git_log_dict(messages, options.get('commit_msg_labels')) ) indent = ' ' if group_components else '' wrapper = textwrap.TextWrapper( width=70, initial_indent=indent + '- ', subsequent_indent=indent + ' ', ) for label, section in options.get('commit_msg_labels'): if section is None: continue bullets = [] for commit in full_messages: bullets += [ {'text': bullet, 'component': commit['component']} for lbl, bullet in commit['paragraphs'] if lbl == label and bullet is not None ] if len(bullets) > 0: print(section) print('-' * len(section)) print() if group_components: def key(cmt): return cmt['component'] for component, bullets in itertools.groupby( sorted(bullets, key=key), key): bullets = list(bullets) if len(bullets) > 0: print('+ {}'.format(component)) print() for bullet in bullets: print(wrapper.fill(bullet['text'])) print() else: for bullet in bullets: print(wrapper.fill(bullet['text'])) print() return 0
greut/invenio-kwalitee
kwalitee/cli/prepare.py
Python
gpl-2.0
6,883
# -*- coding: utf-8 -*- import logging from operator import methodcaller from typing import List from django.core.exceptions import ObjectDoesNotExist from kobo.django.xmlrpc.decorators import user_passes_test from tcms.issuetracker.models import Issue from tcms.management.models import TCMSEnvValue, TestTag from tcms.testcases.models import TestCase from tcms.testruns.models import TestCaseRun, TestRun from tcms.xmlrpc.decorators import log_call from tcms.xmlrpc.utils import distinct_count, pre_process_estimated_time, pre_process_ids __all__ = ( "add_cases", "add_tag", "create", "env_value", "filter", "filter_count", "get", "get_issues", "get_change_history", "get_completion_report", "get_env_values", "get_tags", "get_test_case_runs", "get_test_cases", "get_test_plan", "link_env_value", "remove_cases", "remove_tag", "unlink_env_value", "update", ) __xmlrpc_namespace__ = "TestRun" logger = logging.getLogger(__name__) @log_call(namespace=__xmlrpc_namespace__) @user_passes_test(methodcaller("has_perm", "testruns.add_testcaserun")) def add_cases(request, run_ids, case_ids): """Add one or more cases to the selected test runs. :param run_ids: give one or more run IDs. It could be an integer, a string containing comma separated IDs, or a list of int each of them is a run ID. :type run_ids: int, str or list :param case_ids: give one or more case IDs. It could be an integer, a string containing comma separated IDs, or a list of int each of them is a case ID. :type case_ids: int, str or list :return: a list which is empty on success or a list of mappings with failure codes if a failure occured. :rtype: list Example:: # Add case id 10 to run 1 TestRun.add_cases(1, 10) # Add case ids list [10, 20] to run list [1, 2] TestRun.add_cases([1, 2], [10, 20]) # Add case ids list '10, 20' to run list '1, 2' with String TestRun.add_cases('1, 2', '10, 20') """ trs = TestRun.objects.filter(run_id__in=pre_process_ids(run_ids)) tcs = TestCase.objects.filter(case_id__in=pre_process_ids(case_ids)) for tr in trs.iterator(): for tc in tcs.iterator(): tr.add_case_run(case=tc) @log_call(namespace=__xmlrpc_namespace__) @user_passes_test(methodcaller("has_perm", "testruns.delete_testcaserun")) def remove_cases(request, run_ids, case_ids): """Remove one or more cases from the selected test runs. :param run_ids: give one or more run IDs. It could be an integer, a string containing comma separated IDs, or a list of int each of them is a run ID. :type run_ids: int, str or list :param case_ids: give one or more case IDs. It could be an integer, a string containing comma separated IDs, or a list of int each of them is a case ID. :type case_ids: int, str or list :return: a list which is empty on success or a list of mappings with failure codes if a failure occured. :rtype: list Example:: # Remove case 10 from run 1 TestRun.remove_cases(1, 10) # Remove case ids list [10, 20] from run list [1, 2] TestRun.remove_cases([1, 2], [10, 20]) # Remove case ids list '10, 20' from run list '1, 2' with String TestRun.remove_cases('1, 2', '10, 20') """ trs = TestRun.objects.filter(run_id__in=pre_process_ids(run_ids)) for tr in trs.iterator(): crs = TestCaseRun.objects.filter(run=tr, case__in=pre_process_ids(case_ids)) crs.delete() @log_call(namespace=__xmlrpc_namespace__) @user_passes_test(methodcaller("has_perm", "testruns.add_testruntag")) def add_tag(request, run_ids, tags): """Add one or more tags to the selected test runs. :param run_ids: give one or more run IDs. It could be an integer, a string containing comma separated IDs, or a list of int each of them is a run ID. :type run_ids: int, str or list :param tags: tag name or a list of tag names to remove. :type tags: str or list :return: a list which is empty on success or a list of mappings with failure codes if a failure occured. :rtype: list Example:: # Add tag 'foobar' to run 1 TestPlan.add_tag(1, 'foobar') # Add tag list ['foo', 'bar'] to run list [1, 2] TestPlan.add_tag([1, 2], ['foo', 'bar']) # Add tag list ['foo', 'bar'] to run list [1, 2] with String TestPlan.add_tag('1, 2', 'foo, bar') """ trs = TestRun.objects.filter(pk__in=pre_process_ids(value=run_ids)) tags: List[str] = TestTag.string_to_list(tags) for tag in tags: t, _ = TestTag.objects.get_or_create(name=tag) tr: TestRun for tr in trs.iterator(): tr.add_tag(tag=t) @log_call(namespace=__xmlrpc_namespace__) @user_passes_test(methodcaller("has_perm", "testruns.add_testrun")) def create(request, values): """Creates a new Test Run object and stores it in the database. :param dict values: a mapping containing these data to create a test run. * plan: (int) **Required** ID of test plan * build: (int)/(str) **Required** ID of Build * manager: (int) **Required** ID of run manager * summary: (str) **Required** * product: (int) **Required** ID of product * product_version: (int) **Required** ID of product version * default_tester: (int) optional ID of run default tester * plan_text_version: (int) optional * estimated_time: (str) optional, could be in format ``2h30m30s``, which is recommended or ``HH:MM:SS``. * notes: (str) optional * status: (int) optional 0:RUNNING 1:STOPPED (default 0) * case: list or (str) optional list of case ids to add to the run * tag: list or (str) optional list of tag to add to the run :return: a mapping representing newly created :class:`TestRun`. :rtype: dict .. versionchanged:: 4.5 Argument ``errata_id`` is removed. Example:: values = { 'build': 2, 'manager': 1, 'plan': 1, 'product': 1, 'product_version': 2, 'summary': 'Testing XML-RPC for TCMS', } TestRun.create(values) """ from datetime import datetime from tcms.core import forms from tcms.testruns.forms import XMLRPCNewRunForm if not values.get("product"): raise ValueError("Value of product is required") # TODO: XMLRPC only accept HH:MM:SS rather than DdHhMm if values.get("estimated_time"): values["estimated_time"] = pre_process_estimated_time(values.get("estimated_time")) if values.get("case"): values["case"] = pre_process_ids(value=values["case"]) form = XMLRPCNewRunForm(values) form.populate(product_id=values["product"]) if form.is_valid(): tr = TestRun.objects.create( product_version=form.cleaned_data["product_version"], plan_text_version=form.cleaned_data["plan_text_version"], stop_date=form.cleaned_data["status"] and datetime.now() or None, summary=form.cleaned_data["summary"], notes=form.cleaned_data["notes"], estimated_time=form.cleaned_data["estimated_time"], plan=form.cleaned_data["plan"], build=form.cleaned_data["build"], manager=form.cleaned_data["manager"], default_tester=form.cleaned_data["default_tester"], ) if form.cleaned_data["case"]: for c in form.cleaned_data["case"]: tr.add_case_run(case=c) del c if form.cleaned_data["tag"]: tags = form.cleaned_data["tag"] tags = [c.strip() for c in tags.split(",") if c] for tag in tags: t, c = TestTag.objects.get_or_create(name=tag) tr.add_tag(tag=t) del tag, t, c else: raise ValueError(forms.errors_to_list(form)) return tr.serialize() def __env_value_operation(request, action: str, run_ids, env_value_ids): trs = TestRun.objects.filter(pk__in=pre_process_ids(value=run_ids)) evs = TCMSEnvValue.objects.filter(pk__in=pre_process_ids(value=env_value_ids)) for tr in trs.iterator(): for ev in evs.iterator(): try: func = getattr(tr, action + "_env_value") func(env_value=ev) except ObjectDoesNotExist: logger.debug( "User %s wants to remove property value %r from test run %r, " "however this test run does not have that value.", request.user, ev, tr, ) @log_call(namespace=__xmlrpc_namespace__) @user_passes_test(methodcaller("has_perm", "testruns.change_tcmsenvrunvaluemap")) def env_value(request, action, run_ids, env_value_ids): """ Add or remove env values to the given runs, function is same as link_env_value or unlink_env_value :param str action: what action to do, ``add`` or ``remove``. :param run_ids: give one or more run IDs. It could be an integer, a string containing comma separated IDs, or a list of int each of them is a run ID. :type run_ids: int, str or list :param env_value_ids: give one or more environment value IDs. It could be an integer, a string containing comma separated IDs, or a list of int each of them is a environment value ID. :type env_value_ids: int, str or list :return: a list which is empty on success or a list of mappings with failure codes if a failure occured. :rtype: list Example:: # Add env value 20 to run id 8 TestRun.env_value('add', 8, 20) """ __env_value_operation(request, action, run_ids, env_value_ids) @log_call(namespace=__xmlrpc_namespace__) def filter(request, values={}): """Performs a search and returns the resulting list of test runs. :param dict values: a mapping containing these criteria. * build: ForeignKey: TestBuild * cc: ForeignKey: Auth.User * env_value: ForeignKey: Environment Value * default_tester: ForeignKey: Auth.User * run_id: (int) * manager: ForeignKey: Auth.User * notes: (str) * plan: ForeignKey: TestPlan * summary: (str) * tag: ForeignKey: Tag * product_version: ForeignKey: Version :return: list of mappings of found :class:`TestRun`. :rtype: list Example:: # Get all of runs contain 'TCMS' in summary TestRun.filter({'summary__icontain': 'TCMS'}) # Get all of runs managed by xkuang TestRun.filter({'manager__username': 'xkuang'}) # Get all of runs the manager name starts with x TestRun.filter({'manager__username__startswith': 'x'}) # Get runs contain the case ID 1, 2, 3 TestRun.filter({'case_run__case__case_id__in': [1, 2, 3]}) """ return TestRun.to_xmlrpc(values) @log_call(namespace=__xmlrpc_namespace__) def filter_count(request, values={}): """Performs a search and returns the resulting count of runs. :param dict values: a mapping containing criteria. See also :meth:`TestRun.filter <tcms.xmlrpc.api.testrun.filter>`. :return: total matching runs. :rtype: int .. seealso:: See examples of :meth:`TestRun.filter <tcms.xmlrpc.api.testrun.filter>`. """ return distinct_count(TestRun, values) @log_call(namespace=__xmlrpc_namespace__) def get(request, run_id): """Used to load an existing test run from the database. :param int run_id: test run ID. :return: a mapping representing found :class:`TestRun`. :rtype: dict Example:: TestRun.get(1) """ try: tr = TestRun.objects.get(run_id=run_id) except TestRun.DoesNotExist as error: return error response = tr.serialize() # get the xmlrpc tags tag_ids = tr.tag.values_list("id", flat=True) query = {"id__in": tag_ids} tags = TestTag.to_xmlrpc(query) # cut 'id' attribute off, only leave 'name' here tags_without_id = [tag["name"] for tag in tags] # replace tag_id list in the serialize return data response["tag"] = tags_without_id return response @log_call(namespace=__xmlrpc_namespace__) def get_issues(request, run_ids): """Get the list of issues attached to this run. :param run_ids: give one or more run IDs. It could be an integer, a string containing comma separated IDs, or a list of int each of them is a run ID. :type run_ids: int, str or list :return: a list of mappings of :class:`Issue <tcms.issuetracker.models.Issue>`. :rtype: list[dict] Example:: # Get issues belonging to ID 12345 TestRun.get_issues(1) # Get issues belonging to run ids list [1, 2] TestRun.get_issues([1, 2]) # Get issues belonging to run ids list 1 and 2 with string TestRun.get_issues('1, 2') """ query = {"case_run__run__in": pre_process_ids(run_ids)} return Issue.to_xmlrpc(query) @log_call(namespace=__xmlrpc_namespace__) def get_change_history(request, run_id): """Get the list of changes to the fields of this run. :param int run_id: run ID. :return: list of mapping with changed fields and their details. :rtype: list .. warning:: NOT IMPLEMENTED - History is different than before. """ raise NotImplementedError("Not implemented RPC method") # pragma: no cover @log_call(namespace=__xmlrpc_namespace__) def get_completion_report(request, run_ids): """Get a report of the current status of the selected runs combined. :param run_ids: give one or more run IDs. It could be an integer, a string containing comma separated IDs, or a list of int each of them is a run ID. :type run_ids: int, str or list :return: A mapping containing counts and percentages of the combined totals of case-runs in the run. Counts only the most recently statused case-run for a given build and environment. :rtype: dict .. warning:: NOT IMPLEMENTED """ raise NotImplementedError("Not implemented RPC method") # pragma: no cover @log_call(namespace=__xmlrpc_namespace__) def get_env_values(request, run_id): """Get the list of env values to this run. :param int run_id: run ID. :return: a list of mappings representing found :class:`TCMSEnvValue`. :rtype: List[dict] Example:: TestRun.get_env_values(8) """ from tcms.management.models import TCMSEnvValue # FIXME: return [] if run_id is None or "" query = {"testrun__pk": run_id} return TCMSEnvValue.to_xmlrpc(query) @log_call(namespace=__xmlrpc_namespace__) def get_tags(request, run_id): """Get the list of tags attached to this run. :param int run_id: run ID. :return: a mapping representing found :class:`TestTag`. :rtype: dict Example:: TestRun.get_tags(1) """ tr = TestRun.objects.get(run_id=run_id) tag_ids = tr.tag.values_list("id", flat=True) query = {"id__in": tag_ids} return TestTag.to_xmlrpc(query) @log_call(namespace=__xmlrpc_namespace__) def get_test_case_runs(request, run_id): """Get the list of cases that this run is linked to. :param int run_id: run ID. :return: a list of mappings of found :class:`TestCaseRun`. :rtype: list[dict] Example:: # Get all of case runs TestRun.get_test_case_runs(1) """ return TestCaseRun.to_xmlrpc({"run__run_id": run_id}) @log_call(namespace=__xmlrpc_namespace__) def get_test_cases(request, run_id): """Get the list of cases that this run is linked to. :param int run_id: run ID. :return: a list of mappings of found :class:`TestCase`. :rtype: list[dict] Example:: TestRun.get_test_cases(1) """ tcs_serializer = TestCase.to_xmlrpc(query={"case_run__run_id": run_id}) qs = TestCaseRun.objects.filter(run_id=run_id).values("case", "pk", "case_run_status__name") extra_info = {row["case"]: row for row in qs.iterator()} for case in tcs_serializer: info = extra_info[case["case_id"]] case["case_run_id"] = info["pk"] case["case_run_status"] = info["case_run_status__name"] return tcs_serializer @log_call(namespace=__xmlrpc_namespace__) def get_test_plan(request, run_id): """Get the plan that this run is associated with. :param int run_id: run ID. :return: a mapping of found :class:`TestPlan`. :rtype: dict Example:: TestRun.get_test_plan(1) """ return TestRun.objects.select_related("plan").get(run_id=run_id).plan.serialize() @log_call(namespace=__xmlrpc_namespace__) @user_passes_test(methodcaller("has_perm", "testruns.delete_testruntag")) def remove_tag(request, run_ids, tags): """Remove a tag from a run. :param run_ids: give one or more run IDs. It could be an integer, a string containing comma separated IDs, or a list of int each of them is a run ID. :type run_ids: int, str or list :param tags: tag name or a list of tag names to remove. :type tags: str or list :return: a list which is empty on success. :rtype: list Example:: # Remove tag 'foo' from run 1 TestRun.remove_tag(1, 'foo') # Remove tag 'foo' and 'bar' from run list [1, 2] TestRun.remove_tag([1, 2], ['foo', 'bar']) # Remove tag 'foo' and 'bar' from run list '1, 2' with String TestRun.remove_tag('1, 2', 'foo, bar') """ trs = TestRun.objects.filter(run_id__in=pre_process_ids(value=run_ids)) tgs = TestTag.objects.filter(name__in=TestTag.string_to_list(tags)) tr: TestRun for tr in trs.iterator(): for tg in tgs.iterator(): tr.remove_tag(tag=tg) @log_call(namespace=__xmlrpc_namespace__) @user_passes_test(methodcaller("has_perm", "testruns.change_testrun")) def update(request, run_ids, values): """Updates the fields of the selected test run. :param run_ids: give one or more run IDs. It could be an integer, a string containing comma separated IDs, or a list of int each of them is a run ID. :type run_ids: int, str or list :param dict values: a mapping containing these data to update specified runs. * plan: (int) TestPlan.plan_id * product: (int) Product.id * build: (int) Build.id * manager: (int) Auth.User.id * default_tester: Intege Auth.User.id * summary: (str) * estimated_time: (TimeDelta) in format ``2h30m30s`` which is recommended or ``HH:MM:SS``. * product_version: (int) * plan_text_version: (int) * notes: (str) * status: (int) 0:RUNNING 1:FINISHED :return: list of mappings of the updated test runs. :rtype: list[dict] .. versionchanged:: 4.5 Argument ``errata_id`` is removed. Example:: # Update status to finished for run 1 and 2 TestRun.update([1, 2], {'status': 1}) """ from datetime import datetime from tcms.core import forms from tcms.testruns.forms import XMLRPCUpdateRunForm if values.get("product_version") and not values.get("product"): raise ValueError('Field "product" is required by product_version') if values.get("estimated_time"): values["estimated_time"] = pre_process_estimated_time(values.get("estimated_time")) form = XMLRPCUpdateRunForm(values) if values.get("product_version"): form.populate(product_id=values["product"]) if form.is_valid(): trs = TestRun.objects.filter(pk__in=pre_process_ids(value=run_ids)) _values = dict() if form.cleaned_data["plan"]: _values["plan"] = form.cleaned_data["plan"] if form.cleaned_data["build"]: _values["build"] = form.cleaned_data["build"] if form.cleaned_data["manager"]: _values["manager"] = form.cleaned_data["manager"] if "default_tester" in values: default_tester = form.cleaned_data["default_tester"] if values.get("default_tester") and default_tester: _values["default_tester"] = default_tester else: _values["default_tester"] = None if form.cleaned_data["summary"]: _values["summary"] = form.cleaned_data["summary"] if values.get("estimated_time") is not None: _values["estimated_time"] = form.cleaned_data["estimated_time"] if form.cleaned_data["product_version"]: _values["product_version"] = form.cleaned_data["product_version"] if "notes" in values: if values["notes"] in (None, ""): _values["notes"] = values["notes"] if form.cleaned_data["notes"]: _values["notes"] = form.cleaned_data["notes"] if form.cleaned_data["plan_text_version"]: _values["plan_text_version"] = form.cleaned_data["plan_text_version"] if isinstance(form.cleaned_data["status"], int): if form.cleaned_data["status"]: _values["stop_date"] = datetime.now() else: _values["stop_date"] = None trs.update(**_values) else: raise ValueError(forms.errors_to_list(form)) query = {"pk__in": trs.values_list("pk", flat=True)} return TestRun.to_xmlrpc(query) @log_call(namespace=__xmlrpc_namespace__) @user_passes_test(methodcaller("has_perm", "testruns.add_tcmsenvrunvaluemap")) def link_env_value(request, run_ids, env_value_ids): """Link env values to the given runs. :param run_ids: give one or more run IDs. It could be an integer, a string containing comma separated IDs, or a list of int each of them is a run ID. :type run_ids: int, str or list :param env_value_ids: give one or more environment value IDs. It could be an integer, a string containing comma separated IDs, or a list of int each of them is a environment value ID. :type env_value_ids: int, str or list :return: a list which is empty on success or a list of mappings with failure codes if a failure occured. :rtype: list Example:: # Add env value 1 to run id 2 TestRun.link_env_value(2, 1) """ return __env_value_operation(request, "add", run_ids, env_value_ids) @log_call(namespace=__xmlrpc_namespace__) @user_passes_test(methodcaller("has_perm", "testruns.delete_tcmsenvrunvaluemap")) def unlink_env_value(request, run_ids, env_value_ids): """Unlink env values to the given runs. :param run_ids: give one or more run IDs. It could be an integer, a string containing comma separated IDs, or a list of int each of them is a run ID. :type run_ids: int, str or list :param env_value_ids: give one or more environment value IDs. It could be an integer, a string containing comma separated IDs, or a list of int each of them is a environment value ID. :type env_value_ids: int, str or list :return: a list which is empty on success or a list of mappings with failure codes if a failure occured. :rtype: list Example:: # Unlink env value 1 to run id 2 TestRun.unlink_env_value(2, 1) """ return __env_value_operation(request, "remove", run_ids, env_value_ids)
Nitrate/Nitrate
src/tcms/xmlrpc/api/testrun.py
Python
gpl-2.0
23,617
# # Copyright 2013 Red Hat, Inc. # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301 USA. # import virtconv.formats as formats import virtconv.vmcfg as vmcfg import virtconv.diskcfg as diskcfg import virtconv.netdevcfg as netdevcfg from virtinst import virtimage from xml.sax.saxutils import escape import re import logging ide_letters = list("abcdefghijklmnopqrstuvwxyz") pv_boot_template = \ """ <boot type="xen"> <guest> <arch>%(arch)s</arch> <features> <pae/> </features> </guest> <os> <loader>pygrub</loader> </os> %(disks)s </boot>""" hvm_boot_template = \ """ <boot type="hvm"> <guest> <arch>%(arch)s</arch> </guest> <os> <loader dev="hd"/> </os> %(disks)s </boot>""" image_template = \ """<image> <name>%(name)s</name> <label>%(name)s</label> <description>%(description)s</description> <domain> %(boot_template)s <devices> <vcpu>%(nr_vcpus)s</vcpu> <memory>%(memory)s</memory> %(interface)s <graphics/> </devices> </domain> <storage> %(storage)s </storage> </image> """ def export_os_params(vm): """ Export OS-specific parameters. """ from virtinst import osdict os = osdict.lookup_os(vm.os_variant) def get_os_val(key, default): val = None if os: val = os.to_dict().get(key) if val is None: val = default return val acpi = "" if vm.noacpi is False and get_os_val("acpi", True): acpi = "<acpi />" apic = "" if vm.noapic is False and get_os_val("apic", False): apic = "<apic />" return acpi, apic def export_disks(vm): """ Export code for the disks. Slightly tricky for two reasons. We can't handle duplicate disks: some vmx files define SCSI/IDE devices that point to the same storage, and Xen isn't happy about that. We just ignore any entries that have duplicate paths. Since there is no SCSI support in rombios, and the SCSI emulation is troublesome with Solaris, we forcibly switch the disks to IDE, and expect the guest OS to cope (which at least Linux does admirably). Note that we even go beyond hdd: above that work if the domU has PV drivers. """ paths = [] disks = {} for (bus, instance), disk in sorted(vm.disks.iteritems()): if disk.path and disk.path in paths: continue if bus == "scsi": instance = 0 while disks.get(("ide", instance)): instance += 1 disks[("ide", instance)] = disk if disk.path: paths += [disk.path] diskout = [] storage = [] for (bus, instance), disk in sorted(disks.iteritems()): # virt-image XML cannot handle an empty CD device if not disk.path: continue path = disk.path drive_nr = ide_letters[int(instance) % 26] disk_prefix = "xvd" if vm.type == vmcfg.VM_TYPE_HVM: if bus == "ide": disk_prefix = "hd" else: disk_prefix = "sd" # FIXME: needs updating for later Xen enhancements; need to # implement capabilities checking for max disks etc. diskout.append(""" <drive disk="%s" target="%s%s"/>\n""" % (path, disk_prefix, drive_nr)) typ = "raw" if disk.format in diskcfg.qemu_formats: typ = diskcfg.qemu_formats[disk.format] elif disk.typ == diskcfg.DISK_TYPE_ISO: typ = "iso" storage.append( """ <disk file="%s" use="system" format="%s"/>\n""" % (path, typ)) return storage, diskout class virtimage_parser(formats.parser): """ Support for virt-install's image format (see virt-image man page). """ name = "virt-image" suffix = ".virt-image.xml" can_import = True can_export = True can_identify = True @staticmethod def identify_file(input_file): """ Return True if the given file is of this format. """ try: f = file(input_file, "r") output = f.read() f.close() virtimage.parse(output, input_file) except RuntimeError: return False return True @staticmethod def import_file(input_file): """ Import a configuration file. Raises if the file couldn't be opened, or parsing otherwise failed. """ vm = vmcfg.vm() try: f = file(input_file, "r") output = f.read() f.close() logging.debug("Importing virt-image XML:\n%s", output) config = virtimage.parse(output, input_file) except Exception, e: raise ValueError(_("Couldn't import file '%s': %s") % (input_file, e)) domain = config.domain boot = domain.boots[0] if not config.name: raise ValueError(_("No Name defined in '%s'") % input_file) vm.name = config.name vm.arch = boot.arch vm.memory = int(config.domain.memory / 1024) if config.descr: vm.description = config.descr vm.nr_vcpus = config.domain.vcpu bus = "ide" nr_disk = 0 for d in boot.drives: disk = d.disk format_mappings = { virtimage.Disk.FORMAT_RAW: diskcfg.DISK_FORMAT_RAW, virtimage.Disk.FORMAT_VMDK: diskcfg.DISK_FORMAT_VMDK, virtimage.Disk.FORMAT_QCOW: diskcfg.DISK_FORMAT_QCOW, virtimage.Disk.FORMAT_QCOW2: diskcfg.DISK_FORMAT_QCOW2, virtimage.Disk.FORMAT_VDI: diskcfg.DISK_FORMAT_VDI, } fmt = None if disk.format in format_mappings: fmt = format_mappings[disk.format] else: raise ValueError(_("Unknown disk format '%s'"), disk.format) devid = (bus, nr_disk) vm.disks[devid] = diskcfg.disk(bus=bus, typ=diskcfg.DISK_TYPE_DISK) vm.disks[devid].format = fmt vm.disks[devid].path = disk.file nr_disk = nr_disk + 1 nics = domain.interface nic_idx = 0 while nic_idx in range(0, nics): # XXX Eventually need to add support for mac addresses if given vm.netdevs[nic_idx] = netdevcfg.netdev( typ=netdevcfg.NETDEV_TYPE_UNKNOWN) nic_idx = nic_idx + 1 vm.validate() return vm @staticmethod def export(vm): """ Export a configuration file as a string. @vm vm configuration instance Raises ValueError if configuration is not suitable. """ if not vm.memory: raise ValueError(_("VM must have a memory setting")) # xend wants the name to match r'^[A-Za-z0-9_\-\.\:\/\+]+$', and # the schema agrees. vmname = re.sub(r'[^A-Za-z0-9_\-\.:\/\+]+', '_', vm.name) # Hmm. Any interface is a good interface? interface = None if len(vm.netdevs): interface = " <interface/>" acpi, apic = export_os_params(vm) if vm.type == vmcfg.VM_TYPE_PV: boot_template = pv_boot_template else: boot_template = hvm_boot_template (storage, disks) = export_disks(vm) boot_xml = boot_template % { "disks" : "".join(disks).strip("\n"), "arch" : vm.arch, "acpi" : acpi, "apic" : apic, } out = image_template % { "boot_template": boot_xml, "name" : vmname, "description" : escape(vm.description), "nr_vcpus" : vm.nr_vcpus, # Mb to Kb "memory" : int(vm.memory) * 1024, "interface" : interface, "storage" : "".join(storage).strip("\n"), } return out formats.register_parser(virtimage_parser)
giuseppe/virt-manager
virtconv/parsers/virtimage.py
Python
gpl-2.0
8,776
# -*- coding: utf-8 -*- # # This file is part of Zenodo. # Copyright (C) 2016 CERN. # # Zenodo is free software; you can redistribute it # and/or modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. # # Zenodo is distributed in the hope that it will be # useful, but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Zenodo; if not, write to the # Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307, USA. # # In applying this license, CERN does not # waive the privileges and immunities granted to it by virtue of its status # as an Intergovernmental Organization or submit itself to any jurisdiction. """Zenodo JSON schema.""" from __future__ import absolute_import, print_function, unicode_literals from flask_babelex import lazy_gettext as _ from invenio_pidrelations.serializers.utils import serialize_relations from invenio_pidstore.models import PersistentIdentifier from marshmallow import Schema, ValidationError, fields, missing, \ validates_schema from werkzeug.routing import BuildError from zenodo.modules.records.utils import is_deposit from zenodo.modules.stats.utils import get_record_stats from ...models import AccessRight, ObjectType from . import common class StrictKeysSchema(Schema): """Ensure only valid keys exists.""" @validates_schema(pass_original=True) def check_unknown_fields(self, data, original_data): """Check for unknown keys.""" for key in original_data: if key not in self.fields: raise ValidationError('Unknown field name {}'.format(key)) class ResourceTypeSchema(StrictKeysSchema): """Resource type schema.""" type = fields.Str( required=True, error_messages=dict( required=_('Type must be specified.') ), ) subtype = fields.Str() openaire_subtype = fields.Str() title = fields.Method('get_title', dump_only=True) def get_title(self, obj): """Get title.""" obj = ObjectType.get_by_dict(obj) return obj['title']['en'] if obj else missing @validates_schema def validate_data(self, data): """Validate resource type.""" obj = ObjectType.get_by_dict(data) if obj is None: raise ValidationError(_('Invalid resource type.')) def dump_openaire_type(self, obj): """Get OpenAIRE subtype.""" acc = obj.get('access_right') if acc: return AccessRight.as_category(acc) return missing class JournalSchemaV1(StrictKeysSchema): """Schema for a journal.""" issue = fields.Str() pages = fields.Str() title = fields.Str() volume = fields.Str() year = fields.Str() class MeetingSchemaV1(StrictKeysSchema): """Schema for a meeting.""" title = fields.Str() acronym = fields.Str() dates = fields.Str() place = fields.Str() url = fields.Str() session = fields.Str() session_part = fields.Str() class ImprintSchemaV1(StrictKeysSchema): """Schema for imprint.""" publisher = fields.Str() place = fields.Str() isbn = fields.Str() class PartOfSchemaV1(StrictKeysSchema): """Schema for imprint.""" pages = fields.Str() title = fields.Str() class ThesisSchemaV1(StrictKeysSchema): """Schema for thesis.""" university = fields.Str() supervisors = fields.Nested(common.PersonSchemaV1, many=True) class FunderSchemaV1(StrictKeysSchema): """Schema for a funder.""" doi = fields.Str() name = fields.Str(dump_only=True) acronyms = fields.List(fields.Str(), dump_only=True) links = fields.Method('get_funder_url', dump_only=True) def get_funder_url(self, obj): """Get grant url.""" return dict(self=common.api_link_for('funder', id=obj['doi'])) class GrantSchemaV1(StrictKeysSchema): """Schema for a grant.""" title = fields.Str(dump_only=True) code = fields.Str() program = fields.Str(dump_only=True) acronym = fields.Str(dump_only=True) funder = fields.Nested(FunderSchemaV1) links = fields.Method('get_grant_url', dump_only=True) def get_grant_url(self, obj): """Get grant url.""" return dict(self=common.api_link_for('grant', id=obj['internal_id'])) class CommunitiesSchemaV1(StrictKeysSchema): """Schema for communities.""" id = fields.Function(lambda x: x) class ActionSchemaV1(StrictKeysSchema): """Schema for a actions.""" prereserve_doi = fields.Str(load_only=True) class FilesSchema(Schema): """Files metadata schema.""" type = fields.String() checksum = fields.String() size = fields.Integer() bucket = fields.String() key = fields.String() links = fields.Method('get_links') def get_links(self, obj): """Get links.""" return { 'self': common.api_link_for( 'object', bucket=obj['bucket'], key=obj['key']) } class OwnerSchema(StrictKeysSchema): """Schema for owners. Allows us to later introduce more properties for an owner. """ id = fields.Function(lambda x: x) class LicenseSchemaV1(StrictKeysSchema): """Schema for license. Allows us to later introduce more properties for an owner. """ id = fields.Str(attribute='id') class MetadataSchemaV1(common.CommonMetadataSchemaV1): """Schema for a record.""" resource_type = fields.Nested(ResourceTypeSchema) access_right_category = fields.Method( 'dump_access_right_category', dump_only=True) license = fields.Nested(LicenseSchemaV1) communities = fields.Nested(CommunitiesSchemaV1, many=True) grants = fields.Nested(GrantSchemaV1, many=True) journal = fields.Nested(JournalSchemaV1) meeting = fields.Nested(MeetingSchemaV1) imprint = fields.Nested(ImprintSchemaV1) part_of = fields.Nested(PartOfSchemaV1) thesis = fields.Nested(ThesisSchemaV1) relations = fields.Method('dump_relations') def dump_access_right_category(self, obj): """Get access right category.""" acc = obj.get('access_right') if acc: return AccessRight.as_category(acc) return missing def dump_relations(self, obj): """Dump the relations to a dictionary.""" if 'relations' in obj: return obj['relations'] if is_deposit(obj): pid = self.context['pid'] return serialize_relations(pid) else: pid = self.context['pid'] return serialize_relations(pid) class RecordSchemaV1(common.CommonRecordSchemaV1): """Schema for records v1 in JSON.""" files = fields.Nested( FilesSchema, many=True, dump_only=True, attribute='files') metadata = fields.Nested(MetadataSchemaV1) owners = fields.List( fields.Integer, attribute='metadata.owners', dump_only=True) revision = fields.Integer(dump_only=True) updated = fields.Str(dump_only=True) stats = fields.Method('dump_stats') def dump_stats(self, obj): """Dump the stats to a dictionary.""" if '_stats' in obj.get('metadata', {}): return obj['metadata'].get('_stats', {}) else: pid = self.context.get('pid') if isinstance(pid, PersistentIdentifier): return get_record_stats(pid.object_uuid, False) else: return None class DepositSchemaV1(RecordSchemaV1): """Deposit schema. Same as the Record schema except for some few extra additions. """ files = None owners = fields.Nested( OwnerSchema, dump_only=True, attribute='metadata._deposit.owners', many=True) status = fields.Str(dump_only=True, attribute='metadata._deposit.status') recid = fields.Str(dump_only=True, attribute='metadata.recid')
slint/zenodo
zenodo/modules/records/serializers/schemas/json.py
Python
gpl-2.0
8,136
import logging from django.core.management.base import BaseCommand from payment.postfinance_connector import ISO2022Parser log = logging.getLogger('tq') class Command(BaseCommand): help = '(re)parse ISO 20022 files, ignoring duplicates' def add_arguments(self, parser): parser.add_argument( '--dry-run', action='store_true', dest='dry_run', default=False, help='dry run', ) parser.add_argument( '--reparse', action='store_true', dest='reparse', default=False, help='parse file also if already processed', ) def handle(self, *args, **options): log.info('run management command: {}'.format(__file__)) parser = ISO2022Parser() count = parser.parse(reparse=options['reparse'], dry_run=options['dry_run']) log.info('found and parsed {} new transactions'.format(count))
gitsimon/tq_website
payment/management/commands/parse_iso_20022_files.py
Python
gpl-2.0
967
from __future__ import division from __future__ import print_function from __future__ import absolute_import from __future__ import unicode_literals import os import xml.etree.ElementTree from xml.etree.cElementTree import ElementTree, Element, SubElement from xml.etree.cElementTree import fromstring, tostring import fs_uae_launcher.fsui as fsui from ..Config import Config from ..Settings import Settings from ..I18N import _, ngettext class XMLControl(fsui.TextArea): def __init__(self, parent): fsui.TextArea.__init__(self, parent, horizontal_scroll=True) self.path = "" def connect_game(self, info): tree = self.get_tree() root = tree.getroot() if not root.tag == "config": return game_node = self.find_or_create_node(root, "game") game_node.set("uuid", info["uuid"]) game_name_node = self.find_or_create_node(game_node, "name") game_name_node.text = info["name"] self.set_tree(tree) def find_or_create_node(self, element, name): node = element.find(name) if node is None: node = SubElement(element, name) return node def set_path(self, path): if not os.path.exists(path): path = "" self.path = path if path: self.load_xml(path) else: self.set_text("") def get_tree(self): text = self.get_text().strip() try: root = fromstring(text.encode("UTF-8")) except Exception: # FIXME: show message import traceback traceback.print_exc() return tree = ElementTree(root) indent_tree(root) return tree def set_tree(self, tree): data = tostring(tree.getroot(), encoding="UTF-8").decode("UTF-8") std_decl = "<?xml version='1.0' encoding='UTF-8'?>" if data.startswith(std_decl): data = data[len(std_decl):].strip() self.set_text(data) def load_xml(self, path): with open(path, "rb") as f: data = f.read() self.set_text(data) def save(self): if not self.path: print("no path to save XML to") return self.save_xml(self.path) def save_xml(self, path): self.get_tree().write(self.path) def indent_tree(elem, level=0): i = "\n" + level*" " if len(elem): if not elem.text or not elem.text.strip(): elem.text = i + " " if not elem.tail or not elem.tail.strip(): elem.tail = i for elem in elem: indent_tree(elem, level+1) if not elem.tail or not elem.tail.strip(): elem.tail = i else: if level and (not elem.tail or not elem.tail.strip()): elem.tail = i
cnvogelg/fs-uae-gles
launcher/fs_uae_launcher/editor/XMLControl.py
Python
gpl-2.0
2,828
#!/usr/bin/python from ABE_ADCDACPi import ADCDACPi import time import math """ ================================================ ABElectronics ADCDAC Pi 2-Channel ADC, 2-Channel DAC | DAC sine wave generator demo Version 1.0 Created 17/05/2014 Version 1.1 16/11/2014 updated code and functions to PEP8 format run with: python demo-dacsinewave.py ================================================ # this demo uses the set_dac_raw method to generate a sine wave from a # predefined set of values """ adcdac = ADCDACPi(1) # create an instance of the ADCDAC Pi with a DAC gain set to 1 DACLookup_FullSine_12Bit = \ [2048, 2073, 2098, 2123, 2148, 2174, 2199, 2224, 2249, 2274, 2299, 2324, 2349, 2373, 2398, 2423, 2448, 2472, 2497, 2521, 2546, 2570, 2594, 2618, 2643, 2667, 2690, 2714, 2738, 2762, 2785, 2808, 2832, 2855, 2878, 2901, 2924, 2946, 2969, 2991, 3013, 3036, 3057, 3079, 3101, 3122, 3144, 3165, 3186, 3207, 3227, 3248, 3268, 3288, 3308, 3328, 3347, 3367, 3386, 3405, 3423, 3442, 3460, 3478, 3496, 3514, 3531, 3548, 3565, 3582, 3599, 3615, 3631, 3647, 3663, 3678, 3693, 3708, 3722, 3737, 3751, 3765, 3778, 3792, 3805, 3817, 3830, 3842, 3854, 3866, 3877, 3888, 3899, 3910, 3920, 3930, 3940, 3950, 3959, 3968, 3976, 3985, 3993, 4000, 4008, 4015, 4022, 4028, 4035, 4041, 4046, 4052, 4057, 4061, 4066, 4070, 4074, 4077, 4081, 4084, 4086, 4088, 4090, 4092, 4094, 4095, 4095, 4095, 4095, 4095, 4095, 4095, 4094, 4092, 4090, 4088, 4086, 4084, 4081, 4077, 4074, 4070, 4066, 4061, 4057, 4052, 4046, 4041, 4035, 4028, 4022, 4015, 4008, 4000, 3993, 3985, 3976, 3968, 3959, 3950, 3940, 3930, 3920, 3910, 3899, 3888, 3877, 3866, 3854, 3842, 3830, 3817, 3805, 3792, 3778, 3765, 3751, 3737, 3722, 3708, 3693, 3678, 3663, 3647, 3631, 3615, 3599, 3582, 3565, 3548, 3531, 3514, 3496, 3478, 3460, 3442, 3423, 3405, 3386, 3367, 3347, 3328, 3308, 3288, 3268, 3248, 3227, 3207, 3186, 3165, 3144, 3122, 3101, 3079, 3057, 3036, 3013, 2991, 2969, 2946, 2924, 2901, 2878, 2855, 2832, 2808, 2785, 2762, 2738, 2714, 2690, 2667, 2643, 2618, 2594, 2570, 2546, 2521, 2497, 2472, 2448, 2423, 2398, 2373, 2349, 2324, 2299, 2274, 2249, 2224, 2199, 2174, 2148, 2123, 2098, 2073, 2048, 2023, 1998, 1973, 1948, 1922, 1897, 1872, 1847, 1822, 1797, 1772, 1747, 1723, 1698, 1673, 1648, 1624, 1599, 1575, 1550, 1526, 1502, 1478, 1453, 1429, 1406, 1382, 1358, 1334, 1311, 1288, 1264, 1241, 1218, 1195, 1172, 1150, 1127, 1105, 1083, 1060, 1039, 1017, 995, 974, 952, 931, 910, 889, 869, 848, 828, 808, 788, 768, 749, 729, 710, 691, 673, 654, 636, 618, 600, 582, 565, 548, 531, 514, 497, 481, 465, 449, 433, 418, 403, 388, 374, 359, 345, 331, 318, 304, 291, 279, 266, 254, 242, 230, 219, 208, 197, 186, 176, 166, 156, 146, 137, 128, 120, 111, 103, 96, 88, 81, 74, 68, 61, 55, 50, 44, 39, 35, 30, 26, 22, 19, 15, 12, 10, 8, 6, 4, 2, 1, 1, 0, 0, 0, 1, 1, 2, 4, 6, 8, 10, 12, 15, 19, 22, 26, 30, 35, 39, 44, 50, 55, 61, 68, 74, 81, 88, 96, 103, 111, 120, 128, 137, 146, 156, 166, 176, 186, 197, 208, 219, 230, 242, 254, 266, 279, 291, 304, 318, 331, 345, 359, 374, 388, 403, 418, 433, 449, 465, 481, 497, 514, 531, 548, 565, 582, 600, 618, 636, 654, 673, 691, 710, 729, 749, 768, 788, 808, 828, 848, 869, 889, 910, 931, 952, 974, 995, 1017, 1039, 1060, 1083, 1105, 1127, 1150, 1172, 1195, 1218, 1241, 1264, 1288, 1311, 1334, 1358, 1382, 1406, 1429, 1453, 1478, 1502, 1526, 1550, 1575, 1599, 1624, 1648, 1673, 1698, 1723, 1747, 1772, 1797, 1822, 1847, 1872, 1897, 1922, 1948, 1973, 1998, 2023] while True: for val in DACLookup_FullSine_12Bit: adcdac.set_dac_raw(1, val)
moeskerv/ABElectronics_Python_Libraries
ADCDACPi/demo-dacsinewave.py
Python
gpl-2.0
3,862
#=============================================================================== # # Sanity.py # # This file is part of ANNarchy. # # Copyright (C) 2013-2016 Julien Vitay <[email protected]>, # Helge Uelo Dinkelbach <[email protected]> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # ANNarchy is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # #=============================================================================== import re from ANNarchy.core import Global from ANNarchy.core.PopulationView import PopulationView from ANNarchy.models.Synapses import DefaultSpikingSynapse, DefaultRateCodedSynapse # No variable can have these names reserved_variables = [ 't', 'dt', 't_pre', 't_post', 't_last', 'last_spike', 'rk_post', 'rk_pre', 'i', 'j', 'active', 'refractory', 'size', ] def check_structure(populations, projections): """ Checks the structure before compilation to display more useful error messages. """ from ANNarchy.extensions.convolution.Transpose import Transpose # Check variable names _check_reserved_names(populations, projections) # Check that projections are created before compile for proj in projections: if isinstance(proj, Transpose): continue if not proj._connection_method: Global._error('The projection between populations', proj.pre.id, 'and', proj.post.id, 'has not been connected.', ' Call a connector method before compiling the network.') # Check if the storage formats are valid for the selected paradigm _check_storage_formats(projections) # Check that synapses access existing variables in the pre or post neurons _check_prepost(populations, projections) # Check locality of variable is respected _check_locality(populations, projections) def check_experimental_features(populations, projections): """ The idea behind this method, is to check if new experimental features are used. This should help also the user to be aware of changes. """ # CPU-related formats if Global.config['paradigm'] == "openmp": for proj in projections: if proj._storage_format == "csr" and proj._storage_order == "pre_to_post": Global._warning("Compressed sparse row (CSR) and pre_to_post ordering representation is an experimental feature, we greatly appreciate bug reports.") break for proj in projections: if proj._storage_format == "bsr": Global._warning("Blocked sparse row (BSR) representation is an experimental feature, we greatly appreciate bug reports.") break for proj in projections: if proj._storage_format == "coo": Global._warning("Coordinate (COO) representation is an experimental feature, we greatly appreciate bug reports.") break for proj in projections: if proj._storage_format == "ellr": Global._warning("ELLPACK-R (ELLR) representation is an experimental feature, we greatly appreciate bug reports.") break for proj in projections: if proj._storage_format == "ell": Global._warning("ELLPACK (ELL) representation is an experimental feature, we greatly appreciate bug reports.") break for proj in projections: if proj._storage_format == "hyb": Global._warning("Hybrid (ELL + COO) representation is an experimental feature, we greatly appreciate bug reports.") break # GPU-related formats elif Global.config['paradigm'] == "cuda": for pop in populations: if pop.neuron_type.description['type'] == "spike": Global._warning('Spiking neurons on GPUs is an experimental feature. We greatly appreciate bug reports.') break for proj in projections: if proj._storage_format == "ellr": Global._warning("ELLPACK-R (ELLR) representation is an experimental feature, we greatly appreciate bug reports.") break for proj in projections: if proj._storage_format == "bsr": Global._warning("Blocked sparse row (BSR) representation is an experimental feature, we greatly appreciate bug reports.") break for proj in projections: if proj._storage_format == "coo": Global._warning("Coordinate (COO) representation is an experimental feature, we greatly appreciate bug reports.") break for proj in projections: if proj._storage_format == "hyb": Global._warning("Hybrid (ELL + COO) representation is an experimental feature, we greatly appreciate bug reports.") break else: pass def _check_reserved_names(populations, projections): """ Checks no reserved variable names is redefined """ # Check populations for pop in populations: # Reserved variable names for term in reserved_variables: if term in pop.attributes: Global._print(pop.neuron_type.parameters) Global._print(pop.neuron_type.equations) Global._error(term + ' is a reserved variable name') # Check projections for proj in projections: # Reserved variable names for term in reserved_variables: if term in proj.attributes: Global._print(proj.synapse_type.parameters) Global._print(proj.synapse_type.equations) Global._error(term + ' is a reserved variable name') def _check_storage_formats(projections): """ ANNarchy 4.7 introduced a set of sparse matrix formats. Some of them are not implemented for all paradigms or might not support specific optimizations. """ for proj in projections: # Most of the sparse matrix formats are not trivially invertable and therefore we can not implement # spiking models with them if proj.synapse_type.type == "spike" and proj._storage_format in ["ell", "ellr", "coo", "hyb"]: raise Global.ANNarchyException("Using 'storage_format="+ proj._storage_format + "' is not allowed for spiking synapses.", True) # For some of the sparse matrix formats we don't implemented plasticity yet. if proj.synapse_type.type == "spike" and proj._storage_format in ["dense"] and not isinstance(proj.synapse_type, DefaultSpikingSynapse): raise Global.ANNarchyException("Using 'storage_format="+ proj._storage_format + "' is only allowed for default spiking synapses yet.", True) # For some of the sparse matrix formats we don't implemented plasticity yet. if proj.synapse_type.type == "rate" and proj._storage_format in ["coo", "hyb"] and not isinstance(proj.synapse_type, DefaultRateCodedSynapse): raise Global.ANNarchyException("Using 'storage_format="+ proj._storage_format + "' is only allowed for default rate-coded synapses yet.", True) # OpenMP disabled? if proj._storage_format in ["bsr"] and Global.config["num_threads"]>1: raise Global.ANNarchyException("Using 'storage_format="+ proj._storage_format + "' is not available for OpenMP yet.", True) # Single weight optimization available? if proj._has_single_weight() and proj._storage_format in ["dense"]: raise Global.ANNarchyException("Using 'storage_format="+ proj._storage_format + "' is not allowed for single weight projections.", True) # Slicing available? if isinstance(proj.post, PopulationView) and proj._storage_format in ["dense"]: raise Global.ANNarchyException("Using 'storage_format="+ proj._storage_format + "' is not allowed for PopulationViews as target.", True) # In some cases we don't allow the usage of non-unifom delay if (proj.max_delay > 1 and proj.uniform_delay == -1): if Global._check_paradigm("cuda"): raise Global.ANNarchyException("Using non-uniform delays is not available for CUDA devices.", True) else: if proj._storage_format == "ellr": raise Global.ANNarchyException("Using 'storage_format="+ proj._storage_format + "' is and non-uniform delays is not implemented.", True) if Global._check_paradigm("cuda") and proj._storage_format == "lil": proj._storage_format = "csr" Global._info("LIL-type projections are not available for GPU devices ... default to CSR") if Global._check_paradigm("cuda") and proj._storage_format == "ell": Global._info("We would recommend to use ELLPACK-R (format=ellr) on GPUs.") def _check_prepost(populations, projections): """ Checks that when a synapse uses pre.x r post.x, the variable x exists in the corresponding neuron """ for proj in projections: for dep in proj.synapse_type.description['dependencies']['pre']: if dep.startswith('sum('): target = re.findall(r'\(([\s\w]+)\)', dep)[0].strip() if not target in proj.pre.targets: Global._print(proj.synapse_type.equations) Global._error('The pre-synaptic population ' + proj.pre.name + ' receives no projection with the type ' + target) continue if not dep in proj.pre.attributes: Global._print(proj.synapse_type.equations) Global._error('The pre-synaptic population ' + proj.pre.name + ' has no variable called ' + dep) for dep in proj.synapse_type.description['dependencies']['post']: if dep.startswith('sum('): target = re.findall(r'\(([\s\w]+)\)', dep)[0].strip() if not target in proj.post.targets: Global._print(proj.synapse_type.equations) Global._error('The post-synaptic population ' + proj.post.name + ' receives no projection with the type ' + target) continue if not dep in proj.post.attributes: Global._print(proj.synapse_type.equations) Global._error('The post-synaptic population ' + proj.post.name + ' has no variable called ' + dep) def _check_locality(populations, projections): """ Checks that a global variable does not depend on local ones. """ for proj in projections: for var in proj.synapse_type.description['variables']: if var['locality'] == 'global': # cannot depend on local or semiglobal variables # Inside the equation for v in var['dependencies']: if _get_locality(v, proj.synapse_type.description) in ['local', 'semiglobal']: Global._print(var['eq']) Global._error('The global variable', var['name'], 'cannot depend on a synapse-specific/post-synaptic one:', v) # As pre/post dependencies deps = var['prepost_dependencies'] if len(deps['pre']) > 0 or len(deps['post']) > 0 : Global._print(proj.synapse_type.equations) Global._error('The global variable', var['name'], 'cannot depend on pre- or post-synaptic variables.') if var['locality'] == 'semiglobal': # cannot depend on pre-synaptic variables # Inside the equation for v in var['dependencies']: if _get_locality(v, proj.synapse_type.description) == 'local': Global._print(var['eq']) Global._error('The postsynaptic variable', var['name'], 'cannot depend on a synapse-specific one:', v) # As pre/post dependencies deps = var['prepost_dependencies'] if len(deps['pre']) > 0 : Global._print(proj.synapse_type.equations) Global._error('The postsynaptic variable', var['name'], 'cannot depend on pre-synaptic ones (e.g. pre.r).') def _get_locality(name, description): "Returns the locality of an attribute based on its name" for var in description['variables'] + description['parameters']: if var['name'] == name: return var['locality'] return 'local'
vitay/ANNarchy
ANNarchy/generator/Sanity.py
Python
gpl-2.0
13,045
# The following has been generated automatically from src/core/qgsmaplayer.h QgsMapLayer.LayerType = QgsMapLayerType # monkey patching scoped based enum QgsMapLayer.VectorLayer = QgsMapLayerType.VectorLayer QgsMapLayer.VectorLayer.__doc__ = "" QgsMapLayer.RasterLayer = QgsMapLayerType.RasterLayer QgsMapLayer.RasterLayer.__doc__ = "" QgsMapLayer.PluginLayer = QgsMapLayerType.PluginLayer QgsMapLayer.PluginLayer.__doc__ = "" QgsMapLayer.MeshLayer = QgsMapLayerType.MeshLayer QgsMapLayer.MeshLayer.__doc__ = "Added in 3.2" QgsMapLayer.VectorTileLayer = QgsMapLayerType.VectorTileLayer QgsMapLayer.VectorTileLayer.__doc__ = "Added in 3.14" QgsMapLayer.AnnotationLayer = QgsMapLayerType.AnnotationLayer QgsMapLayer.AnnotationLayer.__doc__ = "Contains freeform, georeferenced annotations. Added in QGIS 3.16" QgsMapLayerType.__doc__ = 'Types of layers that can be added to a map\n\n.. versionadded:: 3.8\n\n' + '* ``VectorLayer``: ' + QgsMapLayerType.VectorLayer.__doc__ + '\n' + '* ``RasterLayer``: ' + QgsMapLayerType.RasterLayer.__doc__ + '\n' + '* ``PluginLayer``: ' + QgsMapLayerType.PluginLayer.__doc__ + '\n' + '* ``MeshLayer``: ' + QgsMapLayerType.MeshLayer.__doc__ + '\n' + '* ``VectorTileLayer``: ' + QgsMapLayerType.VectorTileLayer.__doc__ + '\n' + '* ``AnnotationLayer``: ' + QgsMapLayerType.AnnotationLayer.__doc__ # -- QgsMapLayer.LayerFlag.baseClass = QgsMapLayer QgsMapLayer.LayerFlags.baseClass = QgsMapLayer LayerFlags = QgsMapLayer # dirty hack since SIP seems to introduce the flags in module QgsMapLayer.StyleCategory.baseClass = QgsMapLayer QgsMapLayer.StyleCategories.baseClass = QgsMapLayer StyleCategories = QgsMapLayer # dirty hack since SIP seems to introduce the flags in module
rldhont/Quantum-GIS
python/core/auto_additions/qgsmaplayer.py
Python
gpl-2.0
1,706
#! /usr/bin/env python # $Id: setup.py,v 1.2 2002/01/08 07:13:21 jgg Exp $ from distutils.core import setup, Extension from distutils.sysconfig import parse_makefile from DistUtilsExtra.command import * import glob, os, string # The apt_pkg module files = map(lambda source: "python/"+source, string.split(parse_makefile("python/makefile")["APT_PKG_SRC"])) apt_pkg = Extension("apt_pkg", files, libraries=["apt-pkg"]); # The apt_inst module files = map(lambda source: "python/"+source, string.split(parse_makefile("python/makefile")["APT_INST_SRC"])) apt_inst = Extension("apt_inst", files, libraries=["apt-pkg","apt-inst"]); # Replace the leading _ that is used in the templates for translation templates = [] if not os.path.exists("build/data/templates/"): os.makedirs("build/data/templates") for template in glob.glob('data/templates/*.info.in'): source = open(template, "r") build = open(os.path.join("build", template[:-3]), "w") lines = source.readlines() for line in lines: build.write(line.lstrip("_")) source.close() build.close() setup(name="python-apt", version="0.6.17", description="Python bindings for APT", author="APT Development Team", author_email="[email protected]", ext_modules=[apt_pkg,apt_inst], packages=['apt', 'aptsources'], data_files = [('share/python-apt/templates', glob.glob('build/data/templates/*.info')), ('share/python-apt/templates', glob.glob('data/templates/*.mirrors'))], cmdclass = { "build" : build_extra.build_extra, "build_i18n" : build_i18n.build_i18n }, license = 'GNU GPL', platforms = 'posix' )
zsjohny/python-apt
setup.py
Python
gpl-2.0
1,759
#!/usr/bin/env python """ Script to fetch test status info from sqlit data base. Before use this script, avocado We must be lanuch with '--journal' option. """ import os import sys import sqlite3 import argparse from avocado.core import data_dir from dateutil import parser as dateparser def colour_result(result): """Colour result in the test status info""" colours_map = {"PASS": "\033[92mPASS\033[00m", "ERROR": "\033[93mERROR\033[00m", "FAIL": "\033[91mFAIL\033[00m"} return colours_map.get(result) or result def summarise_records(records): """Summarise test records and print it in cyan""" num_row = len(records[0]) rows = tuple([("row%s" % x) for x in xrange(num_row)]) records_summary = {} for rows in records: records_summary[rows[1]] = records_summary.get(rows[1], 0) + 1 records_summary[rows[4]] = records_summary.get(rows[4], 0) + 1 res = ", ".join("%s=%r" % ( key, val) for (key, val) in records_summary.iteritems()) print "\033[96mSummary: \n" + res + "\033[00m" def get_total_seconds(td): """ Alias for get total_seconds in python2.6 """ if hasattr(td, 'total_seconds'): return td.total_seconds() return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 1e6) / 1e6 def fetch_data(db_file=".journal.sqlite"): """ Fetch tests status info from journal database""" records = [] con = sqlite3.connect(db_file) try: cur = con.cursor() cur.execute("select tag, time, action, status from test_journal") while True: # First record contation start info, second contain end info # merged start info and end info into one record. data = cur.fetchmany(2) if not data: break tag = data[0][0] result = "N/A" status = "Running" end_time = None end_str = None elapsed = None start_time = dateparser.parse(data[0][1]) start_str = start_time.strftime("%Y-%m-%d %X") if len(data) > 1: status = "Finshed" result = data[1][3] end_time = dateparser.parse(data[1][1]) time_delta = end_time - start_time elapsed = get_total_seconds(time_delta) end_str = end_time.strftime("%Y-%m-%d %X") record = (tag, status, start_str, end_str, result, elapsed) records.append(record) finally: con.close() return records def print_data(records, skip_timestamp=False): """ Print formated tests status info""" if not records: return if not skip_timestamp: print "%-40s %-15s %-15s %-15s %-10s %-10s" % ( "CaseName", "Status", "StartTime", "EndTime", "Result", "TimeElapsed") else: print "%-40s %-15s %-10s" % ("CaseName", "Status", "Result") for row in records: if not skip_timestamp: print "%s %s %s %s %s %s" % ( row[0], row[1], row[2], row[3], colour_result(row[4]), row[5]) else: print "%s %s %s" % (row[0], row[1], colour_result(row[4])) summarise_records(records) if __name__ == "__main__": default_results_dir = os.path.join(data_dir.get_logs_dir(), 'latest') parser = argparse.ArgumentParser(description="Avocado journal dump tool") parser.add_argument( '-d', '--test-results-dir', action='store', default=default_results_dir, dest='results_dir', help="avocado test results dir, Default: %s" % default_results_dir) parser.add_argument( '-s', '--skip-timestamp', action='store_true', default=False, dest='skip_timestamp', help="skip timestamp output (leaving status and result enabled)") parser.add_argument( '-v', '--version', action='version', version='%(prog)s 1.0') arguments = parser.parse_args() db_file = os.path.join(arguments.results_dir, '.journal.sqlite') if not os.path.isfile(db_file): print "`.journal.sqlite` DB not found in results directory, " print "Please start avocado with option '--journal'." parser.print_help() sys.exit(1) data = fetch_data(db_file) print_data(data, arguments.skip_timestamp)
CongLi/avocado-vt
scripts/scan_results.py
Python
gpl-2.0
4,423
# Purpose: dxf engine for R2007/AC1021 # Created: 12.03.2011 # Copyright (C) , Manfred Moitzi # License: MIT License from __future__ import unicode_literals __author__ = "mozman <[email protected]>" from .headervars import VARMAP from ..ac1018 import AC1018Factory class AC1021Factory(AC1018Factory): HEADERVARS = dict(VARMAP)
lautr3k/RepRap-iTopie
odmt/ezdxf/ac1021/__init__.py
Python
gpl-3.0
330
#!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2006-2010 (ita) # Ralf Habacker, 2006 (rh) # Yinon Ehrlich, 2009 """ clang/llvm detection. """ import os, sys from waflib import Configure, Options, Utils from waflib.Tools import ccroot, ar from waflib.Configure import conf @conf def find_clang(conf): """ Find the program clang, and if present, try to detect its version number """ cc = conf.find_program(['clang', 'cc'], var='CC') cc = conf.cmd_to_list(cc) conf.get_cc_version(cc, gcc=True) conf.env.CC_NAME = 'clang' conf.env.CC = cc @conf def clang_common_flags(conf): """ Common flags for clang on nearly all platforms """ v = conf.env v['CC_SRC_F'] = [] v['CC_TGT_F'] = ['-c', '-o'] # linker if not v['LINK_CC']: v['LINK_CC'] = v['CC'] v['CCLNK_SRC_F'] = [] v['CCLNK_TGT_F'] = ['-o'] v['CPPPATH_ST'] = '-I%s' v['DEFINES_ST'] = '-D%s' v['LIB_ST'] = '-l%s' # template for adding libs v['LIBPATH_ST'] = '-L%s' # template for adding libpaths v['STLIB_ST'] = '-l%s' v['STLIBPATH_ST'] = '-L%s' v['RPATH_ST'] = '-Wl,-rpath,%s' v['SONAME_ST'] = '-Wl,-h,%s' v['SHLIB_MARKER'] = '-Wl,-Bdynamic' v['STLIB_MARKER'] = '-Wl,-Bstatic' # program v['cprogram_PATTERN'] = '%s' # shared librar v['CFLAGS_cshlib'] = ['-fPIC'] v['LINKFLAGS_cshlib'] = ['-shared'] v['cshlib_PATTERN'] = 'lib%s.so' # static lib v['LINKFLAGS_cstlib'] = ['-Wl,-Bstatic'] v['cstlib_PATTERN'] = 'lib%s.a' # osx stuff v['LINKFLAGS_MACBUNDLE'] = ['-bundle', '-undefined', 'dynamic_lookup'] v['CFLAGS_MACBUNDLE'] = ['-fPIC'] v['macbundle_PATTERN'] = '%s.bundle' @conf def clang_modifier_win32(conf): """Configuration flags for executing clang on Windows""" v = conf.env v['cprogram_PATTERN'] = '%s.exe' v['cshlib_PATTERN'] = '%s.dll' v['implib_PATTERN'] = 'lib%s.dll.a' v['IMPLIB_ST'] = '-Wl,--out-implib,%s' v['CFLAGS_cshlib'] = [] v.append_value('CFLAGS_cshlib', ['-DDLL_EXPORT']) # TODO adding nonstandard defines like this DLL_EXPORT is not a good idea # Auto-import is enabled by default even without this option, # but enabling it explicitly has the nice effect of suppressing the rather boring, debug-level messages # that the linker emits otherwise. v.append_value('LINKFLAGS', ['-Wl,--enable-auto-import']) @conf def clang_modifier_cygwin(conf): """Configuration flags for executing clang on Cygwin""" clang_modifier_win32(conf) v = conf.env v['cshlib_PATTERN'] = 'cyg%s.dll' v.append_value('LINKFLAGS_cshlib', ['-Wl,--enable-auto-image-base']) v['CFLAGS_cshlib'] = [] @conf def clang_modifier_darwin(conf): """Configuration flags for executing clang on MacOS""" v = conf.env v['CFLAGS_cshlib'] = ['-fPIC', '-compatibility_version', '1', '-current_version', '1'] v['LINKFLAGS_cshlib'] = ['-dynamiclib'] v['cshlib_PATTERN'] = 'lib%s.dylib' v['FRAMEWORKPATH_ST'] = '-F%s' v['FRAMEWORK_ST'] = ['-framework'] v['ARCH_ST'] = ['-arch'] v['LINKFLAGS_cstlib'] = [] v['SHLIB_MARKER'] = [] v['STLIB_MARKER'] = [] v['SONAME_ST'] = [] @conf def clang_modifier_aix(conf): """Configuration flags for executing clang on AIX""" v = conf.env v['LINKFLAGS_cprogram'] = ['-Wl,-brtl'] v['LINKFLAGS_cshlib'] = ['-shared','-Wl,-brtl,-bexpfull'] v['SHLIB_MARKER'] = [] @conf def clang_modifier_hpux(conf): v = conf.env v['SHLIB_MARKER'] = [] v['CFLAGS_cshlib'] = ['-fPIC','-DPIC'] v['cshlib_PATTERN'] = 'lib%s.sl' @conf def clang_modifier_platform(conf): """Execute platform-specific functions based on *clang_modifier_+NAME*""" # * set configurations specific for a platform. # * the destination platform is detected automatically by looking at the macros the compiler predefines, # and if it's not recognised, it fallbacks to sys.platform. clang_modifier_func = getattr(conf, 'clang_modifier_' + conf.env.DEST_OS, None) if clang_modifier_func: clang_modifier_func() def configure(conf): """ Configuration for clang """ conf.find_clang() conf.find_ar() conf.clang_common_flags() conf.clang_modifier_platform() conf.cc_load_tools() conf.cc_add_flags() conf.link_add_flags()
Gnomescroll/Gnomescroll
server/waflib/Tools/clang.py
Python
gpl-3.0
4,637
import math import wx import eos.db import gui.mainFrame from gui import globalEvents as GE from gui.fitCommands.calc.cargo.remove import CalcRemoveCargoCommand from gui.fitCommands.helpers import CargoInfo, InternalCommandHistory from service.market import Market class GuiRemoveCargosCommand(wx.Command): def __init__(self, fitID, itemIDs): wx.Command.__init__(self, True, 'Remove Cargos') self.internalHistory = InternalCommandHistory() self.fitID = fitID self.itemIDs = itemIDs def Do(self): sMkt = Market.getInstance() results = [] for itemID in self.itemIDs: cmd = CalcRemoveCargoCommand( fitID=self.fitID, cargoInfo=CargoInfo(itemID=itemID, amount=math.inf)) results.append(self.internalHistory.submit(cmd)) sMkt.storeRecentlyUsed(itemID) success = any(results) eos.db.commit() wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitIDs=(self.fitID,))) return success def Undo(self): success = self.internalHistory.undoAll() eos.db.commit() wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitIDs=(self.fitID,))) return success
DarkFenX/Pyfa
gui/fitCommands/gui/cargo/remove.py
Python
gpl-3.0
1,273
""" This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. """ import sys import urllib.parse import pycurl from io import StringIO,BytesIO import re import random import subprocess from subprocess import check_output from bs4 import BeautifulSoup import os.path from subprocess import check_output from player_functions import send_notification,ccurl try: import libtorrent as lt from stream import ThreadServer,TorrentThread,get_torrent_info except: notify_txt = 'python3 bindings for libtorrent are broken\nTorrent Streaming feature will be disabled' send_notification(notify_txt) import shutil try: from headlessBrowser import BrowseUrl except: from headlessBrowser_webkit import BrowseUrl def cloudfare(url,quality,nyaa_c): web = BrowseUrl(url,quality,nyaa_c) class Nyaa(): def __init__(self,tmp): self.hdr = 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:45.0) Gecko/20100101 Firefox/45.0' self.tmp_dir = tmp self.cookie_file = os.path.join(tmp,'nyaa.txt') if not os.path.exists(self.cookie_file): f = open(self.cookie_file,'w') f.close() def getOptions(self): criteria = ['Date','Seeders','Leechers','Downloads','History','LocalStreaming'] return criteria def ccurlN(self,url): content = ccurl(url+'#-b#'+self.cookie_file) #print(content) if 'checking_browser' in content: if os.path.exists(self.cookie_file): os.remove(self.cookie_file) cloudfare(url,'',self.cookie_file) content = ccurl(url+'#-b#'+self.cookie_file) return content def process_page(self,url): content = self.ccurlN(url) soup = BeautifulSoup(content,'lxml') #print(soup.prettify()) unit_element = soup.findAll('td',{'colspan':'2'}) #print(unit_element[0]) s = [] for i in unit_element: try: element = i.findAll('a') for index in element: et = index['href'] if '#comment' not in et: elem = index j = elem['title'] try: k = elem['href'].split('/')[-1] except: k = 'Download Not Available' break td = i.findNext('td', {'class':'text-center'}) sz = td.findNext('td', {'class':'text-center'}) dt = sz.findNext('td', {'class':'text-center'}) se = dt.findNext('td', {'class':'text-center'}) le = se.findNext('td', {'class':'text-center'}) down = le.findNext('td', {'class':'text-center'}) try: tmp = j.replace('_',' ')+' id='+k+'|Size='+sz.text+'|Seeds='+se.text+'|Leechers='+le.text+'|Total Downloads='+down.text except: tmp = 'Not Available' print(tmp) s.append(tmp) except Exception as e: print(e,'--98---') return s def search(self,name): strname = str(name) print(strname) url = "https://nyaa.si/?f=0&c=1_2&s=seeders&o=desc&q="+str(strname) m = self.process_page(url) return m def getCompleteList(self,opt,genre_num,ui,tmp_dir,hist_folder): global tmp_working_dir instr = "Press . or > for next page -1" tmp_working_dir = tmp_dir if opt == 'Date': url = 'https://nyaa.si/?c=1_2' elif opt == 'Seeders': url = 'https://nyaa.si/?c=1_2&s=seeders&o=desc' elif opt == 'Leechers': url = 'https://nyaa.si/?c=1_2&s=leechers&o=desc' elif opt == 'Downloads': url = 'https://nyaa.si/?c=1_2&s=downloads&o=desc' print(opt,url) m = self.process_page(url) m.append(instr) return m def getEpnList(self,name,opt,depth_list,extra_info,siteName,category): if extra_info == '-1': arr = [] return (arr,'Instructions','No.jpg',False,depth_list) else: print(extra_info) name_id = (re.search('id=[^|]*',extra_info).group()).split('=')[1] url = "https://nyaa.si/download/" + name_id + '.torrent' print(url) summary = "" torrent_dest = os.path.join(siteName,name+'.torrent') if not os.path.exists(torrent_dest): ccurl(url+'#'+'-o'+'#'+torrent_dest,self.cookie_file) info = lt.torrent_info(torrent_dest) file_arr = [] for f in info.files(): file_path = f.path file_path = os.path.basename(file_path) file_arr.append(file_path) record_history = True return (file_arr,'Summary Not Available','No.jpg',record_history,depth_list) def getNextPage(self,opt,pgn,genre_num,name): if opt == 'Date': url = 'https://nyaa.si/?c=1_2' elif opt == 'Seeders': url = 'https://nyaa.si/?c=1_2&s=seeders&o=desc' elif opt == 'Leechers': url = 'https://nyaa.si/?c=1_2&s=leechers&o=desc' elif opt == 'Downloads': url = 'https://nyaa.si/?c=1_2&s=downloads&o=desc' elif opt == 'Search': url = "https://nyaa.si/?f=0&c=1_2&s=seeders&o=desc&q="+str(name) url = url + '&p='+str(pgn) print(url) m = self.process_page(url) return m
abhishek-archlinux/AnimeWatch
AnimeWatch-PyQt5/Plugins/Nyaa.py
Python
gpl-3.0
5,173
#!/usr/bin/env python # encoding: utf-8 """ Waf tool for ChibiOS build """ from waflib import Errors, Logs, Task, Utils from waflib.TaskGen import after_method, before_method, feature import os import shutil import sys import re import pickle _dynamic_env_data = {} def _load_dynamic_env_data(bld): bldnode = bld.bldnode.make_node('modules/ChibiOS') tmp_str = bldnode.find_node('include_dirs').read() tmp_str = tmp_str.replace(';\n','') tmp_str = tmp_str.replace('-I','') #remove existing -I flags # split, coping with separator idirs = re.split('; ', tmp_str) # create unique list, coping with relative paths idirs2 = [] for d in idirs: if d.startswith('../'): # relative paths from the make build are relative to BUILDROOT d = os.path.join(bld.env.BUILDROOT, d) d = os.path.normpath(d) if not d in idirs2: idirs2.append(d) _dynamic_env_data['include_dirs'] = idirs2 @feature('ch_ap_library', 'ch_ap_program') @before_method('process_source') def ch_dynamic_env(self): # The generated files from configuration possibly don't exist if it's just # a list command (TODO: figure out a better way to address that). if self.bld.cmd == 'list': return if not _dynamic_env_data: _load_dynamic_env_data(self.bld) self.use += ' ch' self.env.append_value('INCLUDES', _dynamic_env_data['include_dirs']) class upload_fw(Task.Task): color='BLUE' always_run = True def run(self): upload_tools = self.env.get_flat('UPLOAD_TOOLS') src = self.inputs[0] return self.exec_command("python '{}/px_uploader.py' '{}'".format(upload_tools, src)) def exec_command(self, cmd, **kw): kw['stdout'] = sys.stdout return super(upload_fw, self).exec_command(cmd, **kw) def keyword(self): return "Uploading" class set_default_parameters(Task.Task): color='CYAN' always_run = True def keyword(self): return "apj_tool" def run(self): rel_default_parameters = self.env.get_flat('DEFAULT_PARAMETERS') abs_default_parameters = os.path.join(self.env.SRCROOT, rel_default_parameters) apj_tool = self.env.APJ_TOOL sys.path.append(os.path.dirname(apj_tool)) from apj_tool import embedded_defaults defaults = embedded_defaults(self.inputs[0].abspath()) if not defaults.find(): print("Error: Param defaults support not found in firmware") sys.exit(1) defaults.set_file(abs_default_parameters) defaults.save() class generate_bin(Task.Task): color='CYAN' run_str="${OBJCOPY} -O binary ${SRC} ${TGT}" always_run = True def keyword(self): return "Generating" def __str__(self): return self.outputs[0].path_from(self.generator.bld.bldnode) class generate_apj(Task.Task): '''generate an apj firmware file''' color='CYAN' always_run = True def keyword(self): return "apj_gen" def run(self): import json, time, base64, zlib img = open(self.inputs[0].abspath(),'rb').read() d = { "board_id": int(self.env.APJ_BOARD_ID), "magic": "APJFWv1", "description": "Firmware for a %s board" % self.env.APJ_BOARD_TYPE, "image": base64.b64encode(zlib.compress(img,9)).decode('utf-8'), "build_time": int(time.time()), "summary": self.env.BOARD, "version": "0.1", "image_size": len(img), "git_identity": self.generator.bld.git_head_hash(short=True), "board_revision": 0 } apj_file = self.outputs[0].abspath() f = open(apj_file, "w") f.write(json.dumps(d, indent=4)) f.close() class build_abin(Task.Task): '''build an abin file for skyviper firmware upload via web UI''' color='CYAN' run_str='${TOOLS_SCRIPTS}/make_abin.sh ${SRC}.bin ${SRC}.abin' always_run = True def keyword(self): return "Generating" def __str__(self): return self.outputs[0].path_from(self.generator.bld.bldnode) class build_intel_hex(Task.Task): '''build an intel hex file for upload with DFU''' color='CYAN' run_str='${TOOLS_SCRIPTS}/make_intel_hex.py ${SRC} ${FLASH_RESERVE_START_KB}' always_run = True def keyword(self): return "Generating" def __str__(self): return self.outputs[0].path_from(self.generator.bld.bldnode) @feature('ch_ap_program') @after_method('process_source') def chibios_firmware(self): self.link_task.always_run = True link_output = self.link_task.outputs[0] bin_target = self.bld.bldnode.find_or_declare('bin/' + link_output.change_ext('.bin').name) apj_target = self.bld.bldnode.find_or_declare('bin/' + link_output.change_ext('.apj').name) generate_bin_task = self.create_task('generate_bin', src=link_output, tgt=bin_target) generate_bin_task.set_run_after(self.link_task) generate_apj_task = self.create_task('generate_apj', src=bin_target, tgt=apj_target) generate_apj_task.set_run_after(generate_bin_task) if self.env.BUILD_ABIN: abin_target = self.bld.bldnode.find_or_declare('bin/' + link_output.change_ext('.abin').name) abin_task = self.create_task('build_abin', src=link_output, tgt=abin_target) abin_task.set_run_after(generate_apj_task) bootloader_bin = self.bld.srcnode.make_node("Tools/bootloaders/%s_bl.bin" % self.env.BOARD) if os.path.exists(bootloader_bin.abspath()) and self.bld.env.HAVE_INTEL_HEX: hex_target = self.bld.bldnode.find_or_declare('bin/' + link_output.change_ext('.hex').name) hex_task = self.create_task('build_intel_hex', src=[bin_target, bootloader_bin], tgt=hex_target) hex_task.set_run_after(generate_bin_task) if self.env.DEFAULT_PARAMETERS: default_params_task = self.create_task('set_default_parameters', src=link_output) default_params_task.set_run_after(self.link_task) generate_bin_task.set_run_after(default_params_task) if self.bld.options.upload: _upload_task = self.create_task('upload_fw', src=apj_target) _upload_task.set_run_after(generate_apj_task) def setup_can_build(cfg): '''enable CAN build. By doing this here we can auto-enable CAN in the build based on the presence of CAN pins in hwdef.dat''' env = cfg.env env.AP_LIBRARIES += [ 'AP_UAVCAN', 'modules/uavcan/libuavcan/src/**/*.cpp', 'modules/uavcan/libuavcan_drivers/stm32/driver/src/*.cpp' ] env.CFLAGS += ['-DUAVCAN_STM32_CHIBIOS=1', '-DUAVCAN_STM32_NUM_IFACES=2'] env.CXXFLAGS += [ '-Wno-error=cast-align', '-DUAVCAN_STM32_CHIBIOS=1', '-DUAVCAN_STM32_NUM_IFACES=2' ] env.DEFINES += [ 'UAVCAN_CPP_VERSION=UAVCAN_CPP03', 'UAVCAN_NO_ASSERTIONS=1', 'UAVCAN_NULLPTR=nullptr' ] env.INCLUDES += [ cfg.srcnode.find_dir('modules/uavcan/libuavcan/include').abspath(), cfg.srcnode.find_dir('modules/uavcan/libuavcan_drivers/stm32/driver/include').abspath() ] cfg.get_board().with_uavcan = True def load_env_vars(env): '''optionally load extra environment variables from env.py in the build directory''' print("Checking for env.py") env_py = os.path.join(env.BUILDROOT, 'env.py') if not os.path.exists(env_py): print("No env.py found") return e = pickle.load(open(env_py, 'rb')) for k in e.keys(): v = e[k] if k == 'ROMFS_FILES': env.ROMFS_FILES += v continue if k in env: if isinstance(env[k], dict): a = v.split('=') env[k][a[0]] = '='.join(a[1:]) print("env updated %s=%s" % (k, v)) elif isinstance(env[k], list): env[k].append(v) print("env appended %s=%s" % (k, v)) else: env[k] = v print("env added %s=%s" % (k, v)) else: env[k] = v print("env set %s=%s" % (k, v)) def configure(cfg): cfg.find_program('make', var='MAKE') #cfg.objcopy = cfg.find_program('%s-%s'%(cfg.env.TOOLCHAIN,'objcopy'), var='OBJCOPY', mandatory=True) cfg.find_program('arm-none-eabi-objcopy', var='OBJCOPY') env = cfg.env bldnode = cfg.bldnode.make_node(cfg.variant) def srcpath(path): return cfg.srcnode.make_node(path).abspath() def bldpath(path): return bldnode.make_node(path).abspath() env.AP_PROGRAM_FEATURES += ['ch_ap_program'] kw = env.AP_LIBRARIES_OBJECTS_KW kw['features'] = Utils.to_list(kw.get('features', [])) + ['ch_ap_library'] env.CH_ROOT = srcpath('modules/ChibiOS') env.AP_HAL_ROOT = srcpath('libraries/AP_HAL_ChibiOS') env.BUILDDIR = bldpath('modules/ChibiOS') env.BUILDROOT = bldpath('') env.SRCROOT = srcpath('') env.PT_DIR = srcpath('Tools/ardupilotwaf/chibios/image') env.UPLOAD_TOOLS = srcpath('Tools/ardupilotwaf') env.CHIBIOS_SCRIPTS = srcpath('libraries/AP_HAL_ChibiOS/hwdef/scripts') env.TOOLS_SCRIPTS = srcpath('Tools/scripts') env.APJ_TOOL = srcpath('Tools/scripts/apj_tool.py') env.SERIAL_PORT = srcpath('/dev/serial/by-id/*_STLink*') # relative paths to pass to make, relative to directory that make is run from env.CH_ROOT_REL = os.path.relpath(env.CH_ROOT, env.BUILDROOT) env.AP_HAL_REL = os.path.relpath(env.AP_HAL_ROOT, env.BUILDROOT) env.BUILDDIR_REL = os.path.relpath(env.BUILDDIR, env.BUILDROOT) mk_custom = srcpath('libraries/AP_HAL_ChibiOS/hwdef/%s/chibios_board.mk' % env.BOARD) mk_common = srcpath('libraries/AP_HAL_ChibiOS/hwdef/common/chibios_board.mk') # see if there is a board specific make file if os.path.exists(mk_custom): env.BOARD_MK = mk_custom else: env.BOARD_MK = mk_common if cfg.options.default_parameters: cfg.msg('Default parameters', cfg.options.default_parameters, color='YELLOW') env.DEFAULT_PARAMETERS = srcpath(cfg.options.default_parameters) # we need to run chibios_hwdef.py at configure stage to generate the ldscript.ld # that is needed by the remaining configure checks import subprocess if env.BOOTLOADER: env.HWDEF = srcpath('libraries/AP_HAL_ChibiOS/hwdef/%s/hwdef-bl.dat' % env.BOARD) env.BOOTLOADER_OPTION="--bootloader" else: env.HWDEF = srcpath('libraries/AP_HAL_ChibiOS/hwdef/%s/hwdef.dat' % env.BOARD) env.BOOTLOADER_OPTION="" hwdef_script = srcpath('libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py') hwdef_out = env.BUILDROOT if not os.path.exists(hwdef_out): os.mkdir(hwdef_out) try: cmd = "python '{0}' -D '{1}' '{2}' {3}".format(hwdef_script, hwdef_out, env.HWDEF, env.BOOTLOADER_OPTION) ret = subprocess.call(cmd, shell=True) except Exception: cfg.fatal("Failed to process hwdef.dat") if ret != 0: cfg.fatal("Failed to process hwdef.dat ret=%d" % ret) load_env_vars(cfg.env) if env.HAL_WITH_UAVCAN: setup_can_build(cfg) def pre_build(bld): '''pre-build hook to change dynamic sources''' load_env_vars(bld.env) if bld.env.HAL_WITH_UAVCAN: bld.get_board().with_uavcan = True def build(bld): bld( # build hwdef.h from hwdef.dat. This is needed after a waf clean source=bld.path.ant_glob(bld.env.HWDEF), rule="python '${AP_HAL_ROOT}/hwdef/scripts/chibios_hwdef.py' -D '${BUILDROOT}' '%s' %s" % (bld.env.HWDEF, bld.env.BOOTLOADER_OPTION), group='dynamic_sources', target=[bld.bldnode.find_or_declare('hwdef.h'), bld.bldnode.find_or_declare('ldscript.ld')] ) bld( # create the file modules/ChibiOS/include_dirs rule="touch Makefile && BUILDDIR=${BUILDDIR_REL} CHIBIOS=${CH_ROOT_REL} AP_HAL=${AP_HAL_REL} ${CHIBIOS_BUILD_FLAGS} ${CHIBIOS_BOARD_NAME} ${MAKE} pass -f '${BOARD_MK}'", group='dynamic_sources', target=bld.bldnode.find_or_declare('modules/ChibiOS/include_dirs') ) common_src = [bld.bldnode.find_or_declare('hwdef.h'), bld.bldnode.find_or_declare('modules/ChibiOS/include_dirs')] common_src += bld.path.ant_glob('libraries/AP_HAL_ChibiOS/hwdef/common/*.[ch]') common_src += bld.path.ant_glob('libraries/AP_HAL_ChibiOS/hwdef/common/*.mk') common_src += bld.path.ant_glob('modules/ChibiOS/os/hal/**/*.[ch]') common_src += bld.path.ant_glob('modules/ChibiOS/os/hal/**/*.mk') if bld.env.ROMFS_FILES: common_src += [bld.bldnode.find_or_declare('ap_romfs_embedded.h')] ch_task = bld( # build libch.a from ChibiOS sources and hwdef.h rule="BUILDDIR='${BUILDDIR_REL}' CHIBIOS='${CH_ROOT_REL}' AP_HAL=${AP_HAL_REL} ${CHIBIOS_BUILD_FLAGS} ${CHIBIOS_BOARD_NAME} '${MAKE}' lib -f '${BOARD_MK}'", group='dynamic_sources', source=common_src, target=bld.bldnode.find_or_declare('modules/ChibiOS/libch.a') ) ch_task.name = "ChibiOS_lib" bld.env.LIB += ['ch'] bld.env.LIBPATH += ['modules/ChibiOS/'] wraplist = ['strerror_r', 'fclose', 'freopen', 'fread'] for w in wraplist: bld.env.LINKFLAGS += ['-Wl,--wrap,%s' % w]
yonahbox/ardupilot
Tools/ardupilotwaf/chibios.py
Python
gpl-3.0
13,403
#!/usr/bin/python import sys,os from email.Utils import COMMASPACE, formatdate from email.MIMEMultipart import MIMEMultipart from email.MIMEText import MIMEText from email.MIMEImage import MIMEImage from email.MIMEImage import MIMEImage from email.MIMEBase import MIMEBase from email import Encoders import smtplib import XmlDict function=sys.argv[1] user=sys.argv[2] filename=sys.argv[3] conf = XmlDict.loadXml("global.xml") for option in conf["menu"]["option"]: if ((option["type"].lower()==function.lower()) and (option["name"]==user)): option_selected = option msg = MIMEMultipart() msg['Subject'] = conf["subject"] msg['From'] = conf["source"] msg['To'] = COMMASPACE.join([option_selected["config"]]) msg['Date'] = formatdate(localtime=True) text = "Your scanner happely delivered this pdf to your mailbox.\n" msg.attach( MIMEText(text) ) part = MIMEBase('application', "pdf") part.set_payload( open(filename,"rb").read() ) Encoders.encode_base64(part) part.add_header('Content-Disposition', 'attachment; filename="%s"' % os.path.basename(filename) ) msg.attach(part) mailer = smtplib.SMTP(conf["smtp"]) #mailer.connect() mailer.sendmail(conf["source"],option_selected["config"] , msg.as_string()) mailer.close()
fcauwe/brother-scan
sendfile.py
Python
gpl-3.0
1,234
# This file is part of Indico. # Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN). # # Indico is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 3 of the # License, or (at your option) any later version. # # Indico is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Indico; if not, see <http://www.gnu.org/licenses/>. """ Just for backwards-compatibility """ from indico.util.contextManager import *
belokop/indico_bare
indico/MaKaC/common/contextManager.py
Python
gpl-3.0
811
from elan import * #Set_Location_And_Weather_By_Country_City.py Configurator.Start() Configurator.Wait() sleep(3) Configurator.media.Click() Configurator.interfacetemplates.Click() for i in range(100): try: Configurator.ComboBox.Select(0,1) break except: sleep(2) print("Try again") Configurator.apply.Click() Configurator.CloseAndClean()
kenshay/ImageScript
ProgramData/SystemFiles/Python/Lib/site-packages/elan/onHoldScripts/1_SetIRTemplatesToManual.py
Python
gpl-3.0
383
# =================================================================== # # Copyright (c) 2015, Legrandin <[email protected]> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with the # distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # =================================================================== from Cryptodome.Util.py3compat import bord from Cryptodome.Util._raw_api import (load_pycryptodome_raw_lib, VoidPointer, SmartPointer, create_string_buffer, get_raw_buffer, c_size_t, c_uint8_ptr) from Cryptodome.Hash.keccak import _raw_keccak_lib class SHAKE256_XOF(object): """A SHAKE256 hash object. Do not instantiate directly. Use the :func:`new` function. :ivar oid: ASN.1 Object ID :vartype oid: string """ # ASN.1 Object ID oid = "2.16.840.1.101.3.4.2.12" def __init__(self, data=None): state = VoidPointer() result = _raw_keccak_lib.keccak_init(state.address_of(), c_size_t(64), 0x1F) if result: raise ValueError("Error %d while instantiating SHAKE256" % result) self._state = SmartPointer(state.get(), _raw_keccak_lib.keccak_destroy) self._is_squeezing = False if data: self.update(data) def update(self, data): """Continue hashing of a message by consuming the next chunk of data. Args: data (byte string/byte array/memoryview): The next chunk of the message being hashed. """ if self._is_squeezing: raise TypeError("You cannot call 'update' after the first 'read'") result = _raw_keccak_lib.keccak_absorb(self._state.get(), c_uint8_ptr(data), c_size_t(len(data))) if result: raise ValueError("Error %d while updating SHAKE256 state" % result) return self def read(self, length): """ Compute the next piece of XOF output. .. note:: You cannot use :meth:`update` anymore after the first call to :meth:`read`. Args: length (integer): the amount of bytes this method must return :return: the next piece of XOF output (of the given length) :rtype: byte string """ self._is_squeezing = True bfr = create_string_buffer(length) result = _raw_keccak_lib.keccak_squeeze(self._state.get(), bfr, c_size_t(length)) if result: raise ValueError("Error %d while extracting from SHAKE256" % result) return get_raw_buffer(bfr) def new(self, data=None): return type(self)(data=data) def new(data=None): """Return a fresh instance of a SHAKE256 object. Args: data (byte string/byte array/memoryview): The very first chunk of the message to hash. It is equivalent to an early call to :meth:`update`. Optional. :Return: A :class:`SHAKE256_XOF` object """ return SHAKE256_XOF(data=data)
hclivess/Stallion
nuitka/Cryptodome/Hash/SHAKE256.py
Python
gpl-3.0
4,663
# Copyright (C) 2011-2014 by the Free Software Foundation, Inc. # # This file is part of GNU Mailman. # # GNU Mailman is free software: you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) # any later version. # # GNU Mailman is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # more details. # # You should have received a copy of the GNU General Public License along with # GNU Mailman. If not, see <http://www.gnu.org/licenses/>. """Testing i18n template search and interpolation.""" from __future__ import absolute_import, print_function, unicode_literals __metaclass__ = type __all__ = [ ] import os import shutil import tempfile import unittest from pkg_resources import resource_filename from zope.component import getUtility from mailman.app.lifecycle import create_list from mailman.config import config from mailman.interfaces.languages import ILanguageManager from mailman.testing.layers import ConfigLayer from mailman.utilities.i18n import TemplateNotFoundError, find, make, search class TestSearchOrder(unittest.TestCase): """Test internal search order for language templates.""" layer = ConfigLayer def setUp(self): self.var_dir = tempfile.mkdtemp() config.push('no template dir', """\ [mailman] default_language: fr [paths.testing] var_dir: {0} """.format(self.var_dir)) language_manager = getUtility(ILanguageManager) language_manager.add('de', 'utf-8', 'German') language_manager.add('it', 'utf-8', 'Italian') self.mlist = create_list('[email protected]') self.mlist.preferred_language = 'de' def tearDown(self): config.pop('no template dir') shutil.rmtree(self.var_dir) def _stripped_search_order(self, template_file, mailing_list=None, language=None): # Return the search path order for a given template, possibly using # the mailing list and the language as context. Note that this only # returns the search path, and does not check for whether the paths # exist or not. # # Replace the tempdir prefix with a placeholder for more readable and # reproducible tests. Essentially the paths below are rooted at # $var_dir, except those files that live within Mailman's source # tree. The former will use /v/ as the root and the latter will use # /m/ as the root. in_tree = os.path.dirname(resource_filename('mailman', 'templates')) raw_search_order = search(template_file, mailing_list, language) for path in raw_search_order: if path.startswith(self.var_dir): path = '/v' + path[len(self.var_dir):] elif path.startswith(in_tree): path = '/m' + path[len(in_tree):] else: # This will cause tests to fail, so keep the full bogus # pathname for better debugging. pass yield path def test_fully_specified_search_order(self): search_order = self._stripped_search_order('foo.txt', self.mlist, 'it') # For convenience. def nexteq(path): self.assertEqual(next(search_order), path) # 1: Use the given language argument nexteq('/v/templates/lists/[email protected]/it/foo.txt') nexteq('/v/templates/domains/example.com/it/foo.txt') nexteq('/v/templates/site/it/foo.txt') # 2: Use mlist.preferred_language nexteq('/v/templates/lists/[email protected]/de/foo.txt') nexteq('/v/templates/domains/example.com/de/foo.txt') nexteq('/v/templates/site/de/foo.txt') # 3: Use the site's default language nexteq('/v/templates/lists/[email protected]/fr/foo.txt') nexteq('/v/templates/domains/example.com/fr/foo.txt') nexteq('/v/templates/site/fr/foo.txt') # 4: English nexteq('/v/templates/lists/[email protected]/en/foo.txt') nexteq('/v/templates/domains/example.com/en/foo.txt') nexteq('/v/templates/site/en/foo.txt') # 5: After all the site-admin override paths have been searched, the # Mailman in-tree paths are searched. Note that Mailman only ships # one set of English templates. nexteq('/m/templates/en/foo.txt') def test_no_language_argument_search_order(self): search_order = self._stripped_search_order('foo.txt', self.mlist) # For convenience. def nexteq(path): self.assertEqual(next(search_order), path) # 1: Use mlist.preferred_language nexteq('/v/templates/lists/[email protected]/de/foo.txt') nexteq('/v/templates/domains/example.com/de/foo.txt') nexteq('/v/templates/site/de/foo.txt') # 2: Use the site's default language nexteq('/v/templates/lists/[email protected]/fr/foo.txt') nexteq('/v/templates/domains/example.com/fr/foo.txt') nexteq('/v/templates/site/fr/foo.txt') # 3: English nexteq('/v/templates/lists/[email protected]/en/foo.txt') nexteq('/v/templates/domains/example.com/en/foo.txt') nexteq('/v/templates/site/en/foo.txt') # 4: After all the site-admin override paths have been searched, the # Mailman in-tree paths are searched. Note that Mailman only ships # one set of English templates. nexteq('/m/templates/en/foo.txt') def test_no_mailing_list_argument_search_order(self): search_order = self._stripped_search_order('foo.txt', language='it') # For convenience. def nexteq(path): self.assertEqual(next(search_order), path) # 1: Use the given language argument nexteq('/v/templates/site/it/foo.txt') # 2: Use the site's default language nexteq('/v/templates/site/fr/foo.txt') # 3: English nexteq('/v/templates/site/en/foo.txt') # 4: After all the site-admin override paths have been searched, the # Mailman in-tree paths are searched. Note that Mailman only ships # one set of English templates. nexteq('/m/templates/en/foo.txt') def test_no_optional_arguments_search_order(self): search_order = self._stripped_search_order('foo.txt') # For convenience. def nexteq(path): self.assertEqual(next(search_order), path) # 1: Use the site's default language nexteq('/v/templates/site/fr/foo.txt') # 2: English nexteq('/v/templates/site/en/foo.txt') # 3: After all the site-admin override paths have been searched, the # Mailman in-tree paths are searched. Note that Mailman only ships # one set of English templates. nexteq('/m/templates/en/foo.txt') class TestFind(unittest.TestCase): """Test template search.""" layer = ConfigLayer def setUp(self): self.var_dir = tempfile.mkdtemp() config.push('template config', """\ [paths.testing] var_dir: {0} """.format(self.var_dir)) # The following MUST happen AFTER the push() above since pushing a new # config also clears out the language manager. getUtility(ILanguageManager).add('xx', 'utf-8', 'Xlandia') self.mlist = create_list('[email protected]') self.mlist.preferred_language = 'xx' self.fp = None # Populate the template directories with a few fake templates. def write(text, path): os.makedirs(os.path.dirname(path)) with open(path, 'w') as fp: fp.write(text) self.xxsite = os.path.join( self.var_dir, 'templates', 'site', 'xx', 'site.txt') write('Site template', self.xxsite) self.xxdomain = os.path.join( self.var_dir, 'templates', 'domains', 'example.com', 'xx', 'domain.txt') write('Domain template', self.xxdomain) self.xxlist = os.path.join( self.var_dir, 'templates', 'lists', '[email protected]', 'xx', 'list.txt') write('List template', self.xxlist) def tearDown(self): if self.fp is not None: self.fp.close() config.pop('template config') shutil.rmtree(self.var_dir) def test_find_site_template(self): filename, self.fp = find('site.txt', language='xx') self.assertEqual(filename, self.xxsite) self.assertEqual(self.fp.read(), 'Site template') def test_find_domain_template(self): filename, self.fp = find('domain.txt', self.mlist) self.assertEqual(filename, self.xxdomain) self.assertEqual(self.fp.read(), 'Domain template') def test_find_list_template(self): filename, self.fp = find('list.txt', self.mlist) self.assertEqual(filename, self.xxlist) self.assertEqual(self.fp.read(), 'List template') def test_template_not_found(self): with self.assertRaises(TemplateNotFoundError) as cm: find('missing.txt', self.mlist) self.assertEqual(cm.exception.template_file, 'missing.txt') class TestMake(unittest.TestCase): """Test template interpolation.""" layer = ConfigLayer def setUp(self): self.var_dir = tempfile.mkdtemp() config.push('template config', """\ [paths.testing] var_dir: {0} """.format(self.var_dir)) # The following MUST happen AFTER the push() above since pushing a new # config also clears out the language manager. getUtility(ILanguageManager).add('xx', 'utf-8', 'Xlandia') self.mlist = create_list('[email protected]') self.mlist.preferred_language = 'xx' # Populate the template directories with a few fake templates. path = os.path.join(self.var_dir, 'templates', 'site', 'xx') os.makedirs(path) with open(os.path.join(path, 'nosub.txt'), 'w') as fp: print("""\ This is a global template. It has no substitutions. It will be wrapped. """, file=fp) with open(os.path.join(path, 'subs.txt'), 'w') as fp: print("""\ This is a $kind template. It has $howmany substitutions. It will be wrapped. """, file=fp) with open(os.path.join(path, 'nowrap.txt'), 'w') as fp: print("""\ This is a $kind template. It has $howmany substitutions. It will not be wrapped. """, file=fp) def tearDown(self): config.pop('template config') shutil.rmtree(self.var_dir) def test_no_substitutions(self): self.assertEqual(make('nosub.txt', self.mlist), """\ This is a global template. It has no substitutions. It will be wrapped.""") def test_substitutions(self): self.assertEqual(make('subs.txt', self.mlist, kind='very nice', howmany='a few'), """\ This is a very nice template. It has a few substitutions. It will be wrapped.""") def test_substitutions_no_wrap(self): self.assertEqual(make('nowrap.txt', self.mlist, wrap=False, kind='very nice', howmany='a few'), """\ This is a very nice template. It has a few substitutions. It will not be wrapped. """)
trevor/mailman3
src/mailman/utilities/tests/test_templates.py
Python
gpl-3.0
11,539
#------------------------------------------------------------------------------- # Name: /faraday/deviceconfiguration.py # Purpose: Configure the Faraday radio by manipulating relevant INI files # and providing a Flask server to kick off programming with via # proxy. # # Author: Brent Salmi / Bryce Salmi # # Created: 7/2/2017 # Licence: GPLv3 #------------------------------------------------------------------------------- import time import os import sys import json import ConfigParser import base64 import argparse import requests from flask import Flask from flask import request from faraday.proxyio import faradaybasicproxyio from faraday.proxyio import faradaycommands from faraday.proxyio import deviceconfig from classes import helper # Global Filenames configTruthFile = "deviceconfiguration.sample.ini" configFile = "deviceconfiguration.ini" faradayTruthFile = "faraday_config.sample.ini" faradayFile = "faraday_config.ini" # Start logging after importing modules faradayHelper = helper.Helper("DeviceConfiguration") logger = faradayHelper.getLogger() # Create configuration paths deviceConfigPath = os.path.join(faradayHelper.path, configFile) faradayConfigPath = os.path.join(faradayHelper.path, faradayFile) deviceConfigurationConfig = ConfigParser.RawConfigParser() deviceConfigurationConfig.read(deviceConfigPath) # Command line input parser = argparse.ArgumentParser(description='Device Configuration application provides a Flask server to program Faraday radios via an API') parser.add_argument('--init-config', dest='init', action='store_true', help='Initialize Device Configuration configuration file') parser.add_argument('--init-faraday-config', dest='initfaraday', action='store_true', help='Initialize Faraday configuration file') parser.add_argument('--start', action='store_true', help='Start Device Configuration server') parser.add_argument('--faradayconfig', action='store_true', help='Display Faraday configuration file contents') # Faraday Configuration parser.add_argument('--callsign', help='Set Faraday radio callsign') parser.add_argument('--nodeid', type=int, help='Set Faraday radio nodeid', default=1) parser.add_argument('--redledtxon', action='store_true', help='Set Faraday radio RED LED during RF transmissions ON') parser.add_argument('--redledtxoff', action='store_true', help='Set Faraday radio RED LED during RF transmissions OFF') parser.add_argument('--greenledrxon', action='store_true', help='Set Faraday radio GREEN LED during RF reception ON') parser.add_argument('--greenledrxoff', action='store_true', help='Set Faraday radio GREEN LED during RF reception OFF') parser.add_argument('--unitconfigured', action='store_true', help='Set Faraday radio configured bit ON') parser.add_argument('--unitunconfigured', action='store_true', help='Set Faraday radio configured bit OFF') parser.add_argument('--gpiop3on', type=int, help='Set Faraday radio GPIO port 3 bits on, specify bit to turn ON') parser.add_argument('--gpiop3off', type=int, help='Set Faraday radio GPIO port 3 bits on, specify bit to turn OFF') parser.add_argument('--gpiop3clear', action='store_true', help='Reset Faraday radio GPIO port 3 bits to OFF') parser.add_argument('--gpiop4on', type=int, help='Set Faraday radio GPIO port 4 bits on, specify bit to turn ON') parser.add_argument('--gpiop4off', type=int, help='Set Faraday radio GPIO port 4 bits on, specify bit to turn OFF') parser.add_argument('--gpiop4clear', action='store_true', help='Reset Faraday radio GPIO port 4 bits to OFF') parser.add_argument('--gpiop5on', type=int, help='Set Faraday radio GPIO port 5 bits on, specify bit to turn ON') parser.add_argument('--gpiop5off', type=int, help='Set Faraday radio GPIO port 5 bits on, specify bit to turn OFF') parser.add_argument('--gpiop5clear', action='store_true', help='Reset Faraday radio GPIO port 5 bits to OFF') parser.add_argument('--gpiop5', type=int, help='Set Faraday radio fgpio_p5') parser.add_argument('--bootfrequency', type=float, help='Set Faraday radio boot frequency', default=914.5) parser.add_argument('--bootrfpower', type=int, help='Set Faraday radio boot RF power', default=20) parser.add_argument('--latitude', type=float, help='Set Faraday radio default latitude. Format \"ddmm.mmmm\"') parser.add_argument('--longitude', type=float, help='Set Faraday radio default longitude. Format \"dddmm.mmmm\"') parser.add_argument('--latitudedir', help='Set Faraday radio default latitude direction (N/S)') parser.add_argument('--longitudedir', help='Set Faraday radio default longitude direction (E/W)') parser.add_argument('--altitude', type=float, help='Set Faraday radio default altitude in meters. Maximum of 17999.99 Meters') # Purposely do not allow editing of GPS altitude units parser.add_argument('--gpsbooton', action='store_true', help='Set Faraday radio GPS boot power ON') parser.add_argument('--gpsbootoff', action='store_true', help='Set Faraday radio GPS boot power OFF') parser.add_argument('--gpsenabled', action='store_true', help='Set Faraday radio GPS use ON') parser.add_argument('--gpsdisabled', action='store_true', help='Set Faraday radio GPS use OFF') parser.add_argument('--uarttelemetryenabled', action='store_true', help='Set Faraday radio UART Telemetry ON') parser.add_argument('--uarttelemetrydisabled', action='store_true', help='Set Faraday radio UART Telemetry OFF') parser.add_argument('--rftelemetryenabled', action='store_true', help='Set Faraday radio RF Telemetry ON') parser.add_argument('--rftelemetrydisabled', action='store_true', help='Set Faraday radio RF Telemetry OFF') parser.add_argument('--uartinterval', type=int, help='Set Faraday radio UART telemetry interval in seconds', default=5) parser.add_argument('--rfinterval', type=int, help='Set Faraday radio RF telemetry interval in seconds', default=3) # Parse the arguments args = parser.parse_args() def proxyConfig(host, port): r = requests.get("http://{0}:{1}/config".format(host, port)) return r.json() def initializeDeviceConfigurationConfig(): ''' Initialize device configuration configuration file from deviceconfiguration.sample.ini :return: None, exits program ''' faradayHelper.initializeConfig(configTruthFile, configFile) sys.exit(0) def initializeFaradayConfig(): ''' Initialize Faraday radio configuration file from faraday_config.sample.ini :return: None, exits program ''' faradayHelper.initializeConfig(faradayTruthFile, faradayFile) sys.exit(0) def programFaraday(deviceConfigurationConfigPath): ''' Programs Faraday by generating a HTTP POST query that Proxy uses to send data to the CC430 FLASH memory. :param deviceConfigurationConfigPath: Path to deviceconfiguration.ini file :return: None ''' config = ConfigParser.RawConfigParser() config.read(deviceConfigPath) # Variables local_device_callsign = config.get("DEVICES", "CALLSIGN") local_device_node_id = config.get("DEVICES", "NODEID") local_device_callsign = str(local_device_callsign).upper() hostname = config.get("PROXY", "HOST") port = config.get("PROXY", "PORT") cmdPort = config.get("PROXY", "CMDPORT") # Send POST data to Proxy to configure unit try: r = requests.post('http://{0}:{1}'.format(hostname, port), params={'callsign': str(local_device_callsign), 'nodeid': int(local_device_node_id), 'port': cmdPort}) logger.info(r.url) logger.info("Sent Programming Request") except requests.exceptions.RequestException as e: # Some error occurred logger.error(e) logger.error(r.text) def displayConfig(faradayConfigPath): ''' Prints out the Faraday Configuration file :param faradayConfigPath: path to faraday configuration file :return: None ''' with open(faradayConfigPath, 'r') as configFile: print configFile.read() sys.exit(0) def eightBitListToInt(list): ''' Turn an eight bit list of integers into an integer :param list: list to convert to an integer :return: integer ''' if len(list) == 8: return int(''.join(str(e) for e in list), 2) def configureDeviceConfiguration(args, faradayConfigPath): ''' Configure device configuration configuration file from command line :param args: argparse arguments :return: None ''' config = ConfigParser.RawConfigParser() config.read(deviceConfigPath) fconfig = ConfigParser.RawConfigParser() fconfig.read(faradayConfigPath) # Obtain proxy configuration # TODO: Not hardcode proxyConfiguration = proxyConfig("127.0.0.1", 8000) #Only works for UNIT0 at this time config.set('DEVICES', 'CALLSIGN', proxyConfiguration["UNIT0"].get("callsign")) config.set('DEVICES', 'NODEID', proxyConfiguration["UNIT0"].get("nodeid")) # Faraday radio configuration if args.callsign is not None: fconfig.set('BASIC', 'CALLSIGN', args.callsign) if args.nodeid is not None: fconfig.set('BASIC', 'ID', args.nodeid) # Obtain configboot bitmask options if args.redledtxon: fconfig.set('BASIC', 'REDLEDTX', 1) if args.redledtxoff: fconfig.set('BASIC', 'REDLEDTX', 0) if args.greenledrxon: fconfig.set('BASIC', 'GREENLEDRX', 1) if args.greenledrxoff: fconfig.set('BASIC', 'GREENLEDRX', 0) if args.unitconfigured: fconfig.set('BASIC', 'UNITCONFIGURED', 1) if args.unitunconfigured: fconfig.set('BASIC', 'UNITCONFIGURED', 0) # Create configuration boot bitmask integer bootmask = [0] * 8 redledtx = fconfig.get('BASIC', 'REDLEDTX') greenledrx = fconfig.get('BASIC', 'GREENLEDRX') unitconfigured = fconfig.get('BASIC', 'UNITCONFIGURED') bootmask[5] = greenledrx bootmask[6] = redledtx bootmask[7] = unitconfigured configbootbitmask = eightBitListToInt(bootmask) fconfig.set('BASIC', 'CONFIGBOOTBITMASK', configbootbitmask) # Detect and set GPIO P3 settings, create bitmask if args.gpiop3on >= 0 and args.gpiop3on <= 7: if args.gpiop3on is not None: fconfig.set('BASIC', 'GPIO_P3_' + str(args.gpiop3on), 1) if args.gpiop3off >= 0 and args.gpiop3off <= 7: if args.gpiop3off is not None: fconfig.set('BASIC', 'GPIO_P3_' + str(args.gpiop3off), 0) gpiomask = [0] * 8 if not args.gpiop3clear: gpio0 = fconfig.get('BASIC', 'GPIO_P3_0') gpio1 = fconfig.get('BASIC', 'GPIO_P3_1') gpio2 = fconfig.get('BASIC', 'GPIO_P3_2') gpio3 = fconfig.get('BASIC', 'GPIO_P3_3') gpio4 = fconfig.get('BASIC', 'GPIO_P3_4') gpio5 = fconfig.get('BASIC', 'GPIO_P3_5') gpio6 = fconfig.get('BASIC', 'GPIO_P3_6') gpio7 = fconfig.get('BASIC', 'GPIO_P3_7') gpiomask = [gpio7, gpio6, gpio5, gpio4, gpio3, gpio2, gpio1, gpio0] if args.gpiop3clear: fconfig.set('BASIC', 'GPIO_P3_0', 0) fconfig.set('BASIC', 'GPIO_P3_1', 0) fconfig.set('BASIC', 'GPIO_P3_2', 0) fconfig.set('BASIC', 'GPIO_P3_3', 0) fconfig.set('BASIC', 'GPIO_P3_4', 0) fconfig.set('BASIC', 'GPIO_P3_5', 0) fconfig.set('BASIC', 'GPIO_P3_6', 0) fconfig.set('BASIC', 'GPIO_P3_7', 0) gpiop3bitmask = eightBitListToInt(gpiomask) fconfig.set('BASIC', 'GPIO_P3', gpiop3bitmask) # Detect and set GPIO P4 settings, create bitmask if args.gpiop4on >= 0 and args.gpiop4on <= 7: if args.gpiop4on is not None: fconfig.set('BASIC', 'GPIO_P4_' + str(args.gpiop4on), 1) if args.gpiop4off >= 0 and args.gpiop4off <= 7: if args.gpiop4off is not None: fconfig.set('BASIC', 'GPIO_P4_' + str(args.gpiop4off), 0) gpiomask = [0] * 8 if not args.gpiop4clear: gpio0 = fconfig.get('BASIC', 'GPIO_P4_0') gpio1 = fconfig.get('BASIC', 'GPIO_P4_1') gpio2 = fconfig.get('BASIC', 'GPIO_P4_2') gpio3 = fconfig.get('BASIC', 'GPIO_P4_3') gpio4 = fconfig.get('BASIC', 'GPIO_P4_4') gpio5 = fconfig.get('BASIC', 'GPIO_P4_5') gpio6 = fconfig.get('BASIC', 'GPIO_P4_6') gpio7 = fconfig.get('BASIC', 'GPIO_P4_7') gpiomask = [gpio7, gpio6, gpio5, gpio4, gpio3, gpio2, gpio1, gpio0] if args.gpiop4clear: fconfig.set('BASIC', 'GPIO_P4_0', 0) fconfig.set('BASIC', 'GPIO_P4_1', 0) fconfig.set('BASIC', 'GPIO_P4_2', 0) fconfig.set('BASIC', 'GPIO_P4_3', 0) fconfig.set('BASIC', 'GPIO_P4_4', 0) fconfig.set('BASIC', 'GPIO_P4_5', 0) fconfig.set('BASIC', 'GPIO_P4_6', 0) fconfig.set('BASIC', 'GPIO_P4_7', 0) gpiop4bitmask = eightBitListToInt(gpiomask) fconfig.set('BASIC', 'GPIO_P4', gpiop4bitmask) # Detect and set GPIO P5 settings, create bitmask if args.gpiop5on >= 0 and args.gpiop5on <= 7: if args.gpiop5on is not None: fconfig.set('BASIC', 'GPIO_P5_' + str(args.gpiop5on), 1) if args.gpiop5off >= 0 and args.gpiop5off <= 7: if args.gpiop5off is not None: fconfig.set('BASIC', 'GPIO_P5_' + str(args.gpiop5off), 0) gpiomask = [0] * 8 if not args.gpiop5clear: gpio0 = fconfig.get('BASIC', 'GPIO_P5_0') gpio1 = fconfig.get('BASIC', 'GPIO_P5_1') gpio2 = fconfig.get('BASIC', 'GPIO_P5_2') gpio3 = fconfig.get('BASIC', 'GPIO_P5_3') gpio4 = fconfig.get('BASIC', 'GPIO_P5_4') gpio5 = fconfig.get('BASIC', 'GPIO_P5_5') gpio6 = fconfig.get('BASIC', 'GPIO_P5_6') gpio7 = fconfig.get('BASIC', 'GPIO_P5_7') gpiomask = [gpio7, gpio6, gpio5, gpio4, gpio3, gpio2, gpio1, gpio0] if args.gpiop5clear: fconfig.set('BASIC', 'GPIO_P5_0', 0) fconfig.set('BASIC', 'GPIO_P5_1', 0) fconfig.set('BASIC', 'GPIO_P5_2', 0) fconfig.set('BASIC', 'GPIO_P5_3', 0) fconfig.set('BASIC', 'GPIO_P5_4', 0) fconfig.set('BASIC', 'GPIO_P5_5', 0) fconfig.set('BASIC', 'GPIO_P5_6', 0) fconfig.set('BASIC', 'GPIO_P5_7', 0) gpiop5bitmask = eightBitListToInt(gpiomask) fconfig.set('BASIC', 'GPIO_P5', gpiop5bitmask) if args.bootfrequency is not None: fconfig.set('RF', 'boot_frequency_mhz', args.bootfrequency) if args.bootrfpower is not None: fconfig.set('RF', 'boot_rf_power', args.bootrfpower) if args.latitude is not None: fconfig.set('GPS', 'default_latitude', args.latitude) if args.longitude is not None: fconfig.set('GPS', 'default_longitude', args.longitude) if args.latitudedir is not None: fconfig.set('GPS', 'default_latitude_direction', args.latitudedir) if args.longitudedir is not None: fconfig.set('GPS', 'default_longitude_direction', args.longitudedir) if args.altitude is not None: fconfig.set('GPS', 'default_altitude', args.altitude) if args.gpsbooton: fconfig.set('GPS', 'gps_boot_bit', 1) if args.gpsbootoff: fconfig.set('GPS', 'gps_boot_bit', 0) if args.gpsenabled: fconfig.set('GPS', 'gps_present_bit', 1) if args.gpsdisabled: fconfig.set('GPS', 'gps_present_bit', 0) if args.uarttelemetryenabled: fconfig.set('TELEMETRY', 'uart_telemetry_boot_bit', 1) if args.uarttelemetrydisabled: fconfig.set('TELEMETRY', 'uart_telemetry_boot_bit', 0) if args.rftelemetryenabled: fconfig.set('TELEMETRY', 'rf_telemetry_boot_bit', 1) if args.rftelemetrydisabled: fconfig.set('TELEMETRY', 'rf_telemetry_boot_bit', 0) if args.uartinterval is not None and args.uartinterval > 0: fconfig.set('TELEMETRY', 'telemetry_default_uart_interval', args.uartinterval) if args.rfinterval is not None and args.rfinterval > 0: fconfig.set('TELEMETRY', 'telemetry_default_rf_interval', args.rfinterval) # Save device configuration with open(deviceConfigPath, 'wb') as configfile: config.write(configfile) # Save Faraday configuration with open(faradayConfigPath, 'wb') as configfile: fconfig.write(configfile) # Now act upon the command line arguments # Initialize and configure Device Configuration if args.init: initializeDeviceConfigurationConfig() if args.initfaraday: initializeFaradayConfig() if args.faradayconfig: displayConfig(faradayConfigPath) # Check if configuration file is present if not os.path.isfile(deviceConfigPath): logger.error("Please initialize device configuration with \'--init-config\' option") sys.exit(0) # Check if configuration file is present if not os.path.isfile(faradayConfigPath): logger.error("Please initialize Faraday configuration with \'--init-faraday-config\' option") sys.exit(0) # Configure configuration file configureDeviceConfiguration(args, faradayConfigPath) # Check for --start option and exit if not present if not args.start: logger.warning("--start option not present, exiting Device Configuration server!") sys.exit(0) # Global Constants UART_PORT_APP_COMMAND = 2 # Initialize proxy object proxy = faradaybasicproxyio.proxyio() # Initialize faraday command module faradayCmd = faradaycommands.faraday_commands() # Initialize Flask microframework app = Flask(__name__) @app.route('/', methods=['GET', 'POST']) def unitconfig(): """ This function is called when the RESTful API GET or POST call is made to the '/' of the operating port. Querying a GET will command the local and queried unit's device configuration in Flash memory and return the information as a JSON dictionary. Issuing a POST will cause the local .INI file configuration to be loaded into the respective units Flash memory device configuration. """ if request.method == "POST": try: print "test POST" # Obtain URL parameters (for local unit device callsign/ID assignment) callsign = request.args.get("callsign", "%") nodeid = request.args.get("nodeid", "%") # Obtain configuration values config = ConfigParser.RawConfigParser() config.read(deviceConfigPath) hostname = config.get("PROXY", "HOST") # Read Faraday device configuration file # Read configuration file faradayConfig = ConfigParser.RawConfigParser() faradayConfig.read(faradayConfigPath) # Create dictionaries of each config section device_basic_dict = dict() device_basic_dict['CONFIGBOOTBITMASK'] = faradayConfig.get("BASIC", 'CONFIGBOOTBITMASK') device_basic_dict['CALLSIGN'] = faradayConfig.get("BASIC", 'CALLSIGN') device_basic_dict['ID'] = faradayConfig.get("BASIC", 'ID') device_basic_dict['GPIO_P3'] = faradayConfig.get("BASIC", 'GPIO_P3') device_basic_dict['GPIO_P4'] = faradayConfig.get("BASIC", 'GPIO_P4') device_basic_dict['GPIO_P5'] = faradayConfig.get("BASIC", 'GPIO_P5') device_rf_dict = dict() device_rf_dict['BOOT_FREQUENCY_MHZ'] = faradayConfig.get("RF", 'BOOT_FREQUENCY_MHZ') device_rf_dict['BOOT_RF_POWER'] = faradayConfig.get("RF", 'BOOT_RF_POWER') device_gps_dict = dict() device_gps_dict['DEFAULT_LATITUDE'] = faradayConfig.get("GPS", 'DEFAULT_LATITUDE') device_gps_dict['DEFAULT_LATITUDE_DIRECTION'] = faradayConfig.get("GPS", 'DEFAULT_LATITUDE_DIRECTION') device_gps_dict['DEFAULT_LONGITUDE'] = faradayConfig.get("GPS", 'DEFAULT_LONGITUDE') device_gps_dict['DEFAULT_LONGITUDE_DIRECTION'] = faradayConfig.get("GPS", 'DEFAULT_LONGITUDE_DIRECTION') device_gps_dict['DEFAULT_ALTITUDE'] = faradayConfig.get("GPS", 'DEFAULT_ALTITUDE') device_gps_dict['DEFAULT_ALTITUDE_UNITS'] = faradayConfig.get("GPS", 'DEFAULT_ALTITUDE_UNITS') device_gps_dict['GPS_BOOT_BIT'] = faradayConfig.get("GPS", 'GPS_BOOT_BIT') device_gps_dict['GPS_PRESENT_BIT'] = faradayConfig.get("GPS", 'GPS_PRESENT_BIT') device_telemetry_dict = dict() device_telemetry_dict['UART_TELEMETRY_BOOT_BIT'] = faradayConfig.get("TELEMETRY", 'UART_TELEMETRY_BOOT_BIT') device_telemetry_dict['RF_TELEMETRY_BOOT_BIT'] = faradayConfig.get("TELEMETRY", 'RF_TELEMETRY_BOOT_BIT') device_telemetry_dict['TELEMETRY_DEFAULT_UART_INTERVAL'] = faradayConfig.get("TELEMETRY", 'TELEMETRY_DEFAULT_UART_INTERVAL') device_telemetry_dict['TELEMETRY_DEFAULT_RF_INTERVAL'] = faradayConfig.get("TELEMETRY", 'TELEMETRY_DEFAULT_RF_INTERVAL') # Create device configuration module object to use for programming packet creation device_config_object = deviceconfig.DeviceConfigClass() # Update the device configuration object with the fields obtained from the INI configuration files loaded config_bitmask = device_config_object.create_bitmask_configuration(int(device_basic_dict['CONFIGBOOTBITMASK'])) status_basic = device_config_object.update_basic( config_bitmask, str(device_basic_dict['CALLSIGN']), int(device_basic_dict['ID']), int(device_basic_dict['GPIO_P3']), int(device_basic_dict['GPIO_P4']), int(device_basic_dict['GPIO_P5'])) status_rf = device_config_object.update_rf( float(device_rf_dict['BOOT_FREQUENCY_MHZ']), int(device_rf_dict['BOOT_RF_POWER'])) status_gps = device_config_object.update_gps( device_config_object.update_bitmask_gps_boot(int(device_gps_dict['GPS_PRESENT_BIT']), int(device_gps_dict['GPS_BOOT_BIT'])), device_gps_dict['DEFAULT_LATITUDE'], device_gps_dict['DEFAULT_LATITUDE_DIRECTION'], device_gps_dict['DEFAULT_LONGITUDE'], device_gps_dict['DEFAULT_LONGITUDE_DIRECTION'], device_gps_dict['DEFAULT_ALTITUDE'], device_gps_dict['DEFAULT_ALTITUDE_UNITS']) status_telem = device_config_object.update_telemetry(device_config_object.update_bitmask_telemetry_boot( int(device_telemetry_dict['RF_TELEMETRY_BOOT_BIT']), int(device_telemetry_dict['UART_TELEMETRY_BOOT_BIT'])), int(device_telemetry_dict['TELEMETRY_DEFAULT_UART_INTERVAL']), int(device_telemetry_dict['TELEMETRY_DEFAULT_RF_INTERVAL'])) if (status_basic and status_gps and status_rf and status_telem): # Create the raw device configuration packet to send to unit device_config_packet = device_config_object.create_config_packet() # Transmit device configuration to local unit as supplied by the function arguments proxy.POST(hostname, str(callsign), int(nodeid), UART_PORT_APP_COMMAND, faradayCmd.CommandLocal(faradayCmd.CMD_DEVICECONFIG, device_config_packet)) return '', 204 # nothing to return but successful transmission else: logger.error('Failed to create configuration packet!') return 'Failed to create configuration packet!', 400 except ValueError as e: logger.error("ValueError: " + str(e)) return json.dumps({"error": str(e)}), 400 except IndexError as e: logger.error("IndexError: " + str(e)) return json.dumps({"error": str(e)}), 400 except KeyError as e: logger.error("KeyError: " + str(e)) return json.dumps({"error": str(e)}), 400 else: # If a GET command """ Provides a RESTful interface to device-configuration at URL '/' """ try: # Obtain URL parameters callsign = request.args.get("callsign", "%") nodeid = request.args.get("nodeid", "%") # Obtain configuration values config = ConfigParser.RawConfigParser() config.read(deviceConfigPath) hostname = config.get("PROXY", "HOST") callsign = str(callsign).upper() nodeid = str(nodeid) # Flush all old data from recieve buffer of local unit proxy.FlushRxPort(callsign, nodeid, proxy.CMD_UART_PORT) proxy.POST(hostname, str(callsign), int(nodeid), UART_PORT_APP_COMMAND, faradayCmd.CommandLocalSendReadDeviceConfig()) # Wait enough time for Faraday to respond to commanded memory read. time.sleep(2) try: # Retrieve the next device configuration read packet to arrive data = proxy.GETWait(hostname, str(callsign), str(nodeid), proxy.CMD_UART_PORT, 2) # Create device configuration module object device_config_object = deviceconfig.DeviceConfigClass() # Decode BASE64 JSON data packet into data = proxy.DecodeRawPacket(data[0]["data"]) # Get first item data = device_config_object.extract_config_packet(data) # Parse device configuration into dictionary parsed_config_dict = device_config_object.parse_config_packet(data) # Encoded dictionary data for save network transit pickled_parsed_config_dict = json.dumps(parsed_config_dict) pickled_parsed_config_dict_b64 = base64.b64encode(pickled_parsed_config_dict) except ValueError as e: print e except IndexError as e: print e except KeyError as e: print e except StandardError as e: print e except ValueError as e: logger.error("ValueError: " + str(e)) return json.dumps({"error": str(e)}), 400 except IndexError as e: logger.error("IndexError: " + str(e)) return json.dumps({"error": str(e)}), 400 except KeyError as e: logger.error("KeyError: " + str(e)) return json.dumps({"error": str(e)}), 400 return json.dumps({"data": pickled_parsed_config_dict_b64}, indent=1), 200, \ {'Content-Type': 'application/json'} def main(): """Main function which starts deviceconfiguration Flask server.""" logger.info('Starting deviceconfiguration server') # Start the flask server deviceConfigHost = deviceConfigurationConfig.get("FLASK", "HOST") deviceConfigPort = deviceConfigurationConfig.getint("FLASK", "PORT") #proxyConfiguration = proxyConfig("127.0.0.1", 8000) app.run(host=deviceConfigHost, port=deviceConfigPort, threaded=True) if __name__ == '__main__': main()
FaradayRF/Faraday-Software
faraday/deviceconfiguration.py
Python
gpl-3.0
26,804
#!/usr/bin/env python # -*- coding: utf-8 -*- # Author: [email protected] # Date: Wed Jan 28 16:35:57 CET 2015 import re import os try: from setuptools import setup except ImportError: from distutils.core import setup def read(relpath): """ Return string containing the contents of the file at *relpath* relative to this file. """ cwd = os.path.dirname(__file__) abspath = os.path.join(cwd,os.path.normpath(relpath)) with open(abspath) as f: return f.read() PACKAGE = os.path.basename(os.getcwd()) PACKAGES = [PACKAGE] PROVIDES = [PACKAGE] PACKAGE_DIR = {PACKAGE: PACKAGE} SCRIPT_FILE = PACKAGE_DIR[PACKAGE] + '/__init__.py' # SCRIPTS=['scripts/' + PACKAGE] ENTRY_POINTS = { # 'console_scripts': [PACKAGE + '=' + PACKAGE + '.' + PACKAGE + ':main'], 'console_scripts': ['{0}={0}.{0}:main'.format(PACKAGE)], } PLATFORMS = ['Linux'] KEYWORDS = 'ipsec ike' INSTALL_REQUIRES = [ x.replace('-','_') for x in read('requirements.txt').split('\n') if x != '' ] # x.replace('-','_') for x in read('requirements.txt').split('\n') if x != '' main_py = open(SCRIPT_FILE).read() metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", main_py)) docstrings = re.findall('"""(.*?)"""', main_py, re.DOTALL) VERSION = metadata['version'] WEBSITE = metadata['website'] LICENSE = metadata['license'] AUTHOR_EMAIL = metadata['author'] AUTHOR, EMAIL = re.match(r'(.*) <(.*)>', AUTHOR_EMAIL).groups() DESCRIPTION = docstrings[0].strip() if '\n\n' in DESCRIPTION: DESCRIPTION, LONG_DESCRIPTION = DESCRIPTION.split('\n\n', 1) else: LONG_DESCRIPTION = None CLASSIFIERS = [ 'Development Status :: 3 - Beta', 'Environment :: Console', 'Intended Audience :: Developers', 'License :: GPL', 'Operating System :: OS Independent', 'Operating System :: POSIX :: Linux', 'Natural Language :: English', 'Programming Language :: Python', 'Programming Language :: Python :: 3', ] PARAMS = { 'platforms': PLATFORMS, 'name': PACKAGE, 'version': VERSION, 'description': DESCRIPTION, 'keywords': KEYWORDS, 'long_description': LONG_DESCRIPTION, 'author': AUTHOR, 'author_email': EMAIL, 'url': WEBSITE, 'license': LICENSE, 'packages': PACKAGES, 'package_dir': PACKAGE_DIR, #'scripts': SCRIPTS, 'entry_points': ENTRY_POINTS, 'provides': PROVIDES, 'requires': INSTALL_REQUIRES, 'install_requires': INSTALL_REQUIRES, 'classifiers': CLASSIFIERS, } setup(**PARAMS) # vim:ts=4 sts=4 tw=79 expandtab:
libcrack/iker
setup.py
Python
gpl-3.0
2,536
""" Python script 'process_NCEI_03_prcp_180d.py' by Matthew Garcia, PhD student Dept. of Forest and Wildlife Ecology University of Wisconsin - Madison [email protected] Copyright (C) 2015-2016 by Matthew Garcia Licensed Gnu GPL v3; see 'LICENSE_GnuGPLv3.txt' for complete terms Send questions, bug reports, any related requests to [email protected] See also 'README.md', 'DISCLAIMER.txt', 'CITATION.txt', 'ACKNOWLEDGEMENTS.txt' Treat others as you would be treated. Pay it forward. Valar dohaeris. PURPOSE: Temporal calculation of PRCP 180-day accumulation DEPENDENCIES: h5py, numpy 'process_NCEI_03_aux' module has its own requirements USAGE: '$ python process_NCEI_03_prcp_180d.py NCEI_WLS_1983 1983 ./grids' INPUT: copied '.h5' file from process_NCEI_03_preprocess.py (with the naming convention 'grids/[YYYYMMDD]_NCEI_grids_2.h5') OUTPUT: updated daily '.h5' file with new accumulation grid (with the naming convention 'grids/[YYYYMMDD]_NCEI_grids_2.h5') year-end '.h5' and '.pickle' files with rolling accounted variable """ import sys import datetime import glob import h5py as hdf import numpy as np from process_NCEI_03_aux import get_stn_lists, write_stn_lists, \ write_to_file, cube_sum def message(char_string): """ prints a string to the terminal and flushes the buffer """ print char_string sys.stdout.flush() return message(' ') message('process_NCEI_03_prcp_180d.py started at %s' % datetime.datetime.now().isoformat()) message(' ') # if len(sys.argv) < 4: message('input warning: no input directory indicated,, using ./grids') path = './grids' else: path = sys.argv[3] # if len(sys.argv) < 3: message('input error: need year to process') sys.exit(1) else: this_year = int(sys.argv[2]) # if len(sys.argv) < 2: message('input error: need prefix for weather data h5 file') sys.exit(1) else: NCEIfname = sys.argv[1] h5infname = '%s/../data/%s_processed.h5' % (path, NCEIfname) # message('reading dates information from %s' % h5infname) with hdf.File(h5infname, 'r') as h5infile: all_dates = np.copy(h5infile['dates']) message('- information for %d total dates found' % len(all_dates)) dates = sorted([j for j in all_dates if int(j // 1E4) == this_year]) message('- processing %d dates in %d' % (len(dates), this_year)) message(' ') # prev_year = this_year - 1 vars_files = sorted(glob.glob('%s/*_year_end_prcp_180d.h5' % path)) use_vars_file = False if len(vars_files) > 0: for vars_file in vars_files: if str(prev_year) in vars_file: use_vars_file = True varfname = vars_file break # # if rolling accounting variable files exist to be carried over # from previous year if use_vars_file: message('extracting prcp_180d datacube from %s' % varfname) with hdf.File(varfname, 'r') as h5infile: nrows = np.copy(h5infile['nrows']) ncols = np.copy(h5infile['ncols']) prcp_180d = np.copy(h5infile['prcp_180d']) message('extracting station lists') prcp_180d_stns = get_stn_lists(path, prev_year, 'prcp_180d_stns') else: # otherwise, initialize the variable space(s) h5infname = '%s/%d_NCEI_grids_2.h5' % (path, dates[0]) message('extracting grid information from %s' % h5infname) with hdf.File(h5infname, 'r') as h5infile: nrows = np.copy(h5infile['grid/nrows']) ncols = np.copy(h5infile['grid/ncols']) message('establishing prcp_180d datacube') prcp_180d = np.zeros((180, nrows, ncols)) prcp_180d_stns = [] message(' ') # for date in dates: h5infname = '%s/%d_NCEI_grids_2.h5' % (path, date) message('extracting PRCP grid from %s' % h5infname) with hdf.File(h5infname, 'r') as h5infile: prcp_stns = np.copy(h5infile['stns/prcp_stns']) prcp = np.copy(h5infile['grid_prcp']) # year = date // 10000 month = (date - (year * 10000)) // 100 day = date - (year * 10000) - (month * 100) # grid_prcp_180d, prcp_180d_stns_all, prcp_180d, prcp_180d_stns = \ cube_sum(180, prcp_180d, prcp, prcp_180d_stns, prcp_stns) message('- calculated updated 180-day running precipitation total, \ mean %.1f' % np.mean(grid_prcp_180d)) # h5outfname = '%s/%d_NCEI_grids_2.h5' % (path, date) message('saving grids to %s' % h5outfname) with hdf.File(h5outfname, 'r+') as h5outfile: del h5outfile['meta/last_updated'] h5outfile.create_dataset('meta/last_updated', data=datetime.datetime.now().isoformat()) del h5outfile['meta/at'] outstr = 'prcp_180d' h5outfile.create_dataset('meta/at', data=outstr) write_to_file(h5outfile, 'prcp_180d_sum', grid_prcp_180d, 'prcp_180d_stns', prcp_180d_stns_all) message(' ') # # save rolling accounting variable for next year's run varfname = '%s/%d_year_end_prcp_180d.h5' % (path, this_year) message('saving variable datacube to %s' % varfname) with hdf.File(varfname, 'w') as h5outfile: h5outfile.create_dataset('nrows', data=nrows) h5outfile.create_dataset('ncols', data=ncols) h5outfile.create_dataset('prcp_180d', data=prcp_180d, dtype=np.float32, compression='gzip') message('saving station lists') write_stn_lists(path, this_year, 'prcp_180d_stns', prcp_180d_stns) # message('process_NCEI_03_prcp_180d.py completed at %s' % datetime.datetime.now().isoformat()) message(' ') sys.exit(0) # end process_NCEI_03_prcp_180d.py
megarcia/GT16_JGRA
source/process_NCEI_03_prcp_180d.py
Python
gpl-3.0
5,554
#!/usr/bin/env python # # Copyright 2020 Free Software Foundation, Inc. # # This file is part of GNU Radio # # SPDX-License-Identifier: GPL-3.0-or-later # # from gnuradio import gr, gr_unittest import random, numpy from gnuradio import digital, blocks, channels class qa_linear_equalizer(gr_unittest.TestCase): def unpack_values(self, values_in, bits_per_value, bits_per_symbol): # verify that 8 is divisible by bits_per_symbol m = bits_per_value / bits_per_symbol # print(m) mask = 2**(bits_per_symbol)-1 if bits_per_value != m*bits_per_symbol: print("error - bits per symbols must fit nicely into bits_per_value bit values") return [] num_values = len(values_in) num_symbols = int(num_values*( m) ) cur_byte = 0 cur_bit = 0 out = [] for i in range(num_symbols): s = (values_in[cur_byte] >> (bits_per_value-bits_per_symbol-cur_bit)) & mask out.append(s) cur_bit += bits_per_symbol if cur_bit >= bits_per_value: cur_bit = 0 cur_byte += 1 return out def map_symbols_to_constellation(self, symbols, cons): l = list(map(lambda x: cons.points()[x], symbols)) return l def setUp(self): random.seed(987654) self.tb = gr.top_block() self.num_data = num_data = 10000 self.sps = sps = 4 self.eb = eb = 0.35 self.preamble = preamble = [0x27,0x2F,0x18,0x5D,0x5B,0x2A,0x3F,0x71,0x63,0x3C,0x17,0x0C,0x0A,0x41,0xD6,0x1F,0x4C,0x23,0x65,0x68,0xED,0x1C,0x77,0xA7,0x0E,0x0A,0x9E,0x47,0x82,0xA4,0x57,0x24,] self.payload_size = payload_size = 300 # bytes self.data = data = [0]*4+[random.getrandbits(8) for i in range(payload_size)] self.gain = gain = .001 # LMS gain self.corr_thresh = corr_thresh = 3e6 self.num_taps = num_taps = 16 def tearDown(self): self.tb = None def transform(self, src_data, gain, const): SRC = blocks.vector_source_c(src_data, False) EQU = digital.lms_dd_equalizer_cc(4, gain, 1, const.base()) DST = blocks.vector_sink_c() self.tb.connect(SRC, EQU, DST) self.tb.run() return DST.data() def test_001_identity(self): # Constant modulus signal so no adjustments const = digital.constellation_qpsk() src_data = const.points()*1000 N = 100 # settling time expected_data = src_data[N:] result = self.transform(src_data, 0.1, const)[N:] N = -500 self.assertComplexTuplesAlmostEqual(expected_data[N:], result[N:], 5) def test_qpsk_3tap_lms_training(self): # set up fg gain = 0.01 # LMS gain num_taps = 16 num_samp = 2000 num_test = 500 cons = digital.constellation_qpsk().base() rxmod = digital.generic_mod(cons, False, self.sps, True, self.eb, False, False) modulated_sync_word_pre = digital.modulate_vector_bc(rxmod.to_basic_block(), self.preamble+self.preamble, [1]) modulated_sync_word = modulated_sync_word_pre[86:(512+86)] # compensate for the RRC filter delay corr_max = numpy.abs(numpy.dot(modulated_sync_word,numpy.conj(modulated_sync_word))) corr_calc = self.corr_thresh/(corr_max*corr_max) preamble_symbols = self.map_symbols_to_constellation(self.unpack_values(self.preamble, 8, 2), cons) alg = digital.adaptive_algorithm_lms(cons, gain).base() evm = digital.meas_evm_cc(cons, digital.evm_measurement_t.EVM_PERCENT) leq = digital.linear_equalizer(num_taps, self.sps, alg, False, preamble_symbols, 'corr_est') correst = digital.corr_est_cc(modulated_sync_word, self.sps, 12, corr_calc, digital.THRESHOLD_ABSOLUTE) constmod = digital.generic_mod( constellation=cons, differential=False, samples_per_symbol=4, pre_diff_code=True, excess_bw=0.35, verbose=False, log=False) chan = channels.channel_model( noise_voltage=0.0, frequency_offset=0.0, epsilon=1.0, taps=(1.0 + 1.0j, 0.63-.22j, -.1+.07j), noise_seed=0, block_tags=False) vso = blocks.vector_source_b(self.preamble+self.data, True, 1, []) head = blocks.head(gr.sizeof_float*1, num_samp) vsi = blocks.vector_sink_f() self.tb.connect(vso, constmod, chan, correst, leq, evm, head, vsi) self.tb.run() # look at the last 1000 samples, should converge quickly, below 5% EVM upper_bound = list(20.0*numpy.ones((num_test,))) lower_bound = list(0.0*numpy.zeros((num_test,))) output_data = vsi.data() output_data = output_data[-num_test:] self.assertLess(output_data, upper_bound) self.assertGreater(output_data, lower_bound) if __name__ == '__main__': gr_unittest.run(qa_linear_equalizer)
jdemel/gnuradio
gr-digital/python/digital/qa_linear_equalizer.py
Python
gpl-3.0
5,126
# -*- coding: utf-8 -*- ############################ Copyrights and license ############################ # # # Copyright 2012 Vincent Jacques <[email protected]> # # Copyright 2012 Zearin <[email protected]> # # Copyright 2013 AKFish <[email protected]> # # Copyright 2013 Vincent Jacques <[email protected]> # # Copyright 2014 Vincent Jacques <[email protected]> # # Copyright 2016 Jannis Gebauer <[email protected]> # # Copyright 2016 Peter Buckley <[email protected]> # # Copyright 2017 Wan Liuyang <[email protected]> # # Copyright 2018 Wan Liuyang <[email protected]> # # Copyright 2018 sfdye <[email protected]> # # # # This file is part of PyGithub. # # http://pygithub.readthedocs.io/ # # # # PyGithub is free software: you can redistribute it and/or modify it under # # the terms of the GNU Lesser General Public License as published by the Free # # Software Foundation, either version 3 of the License, or (at your option) # # any later version. # # # # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY # # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. # # # ################################################################################ from __future__ import absolute_import import six import github.GithubObject import github.HookResponse class Hook(github.GithubObject.CompletableGithubObject): """ This class represents Hooks. The reference can be found here http://developer.github.com/v3/repos/hooks """ def __repr__(self): return self.get__repr__({"id": self._id.value, "url": self._url.value}) @property def active(self): """ :type: bool """ self._completeIfNotSet(self._active) return self._active.value @property def config(self): """ :type: dict """ self._completeIfNotSet(self._config) return self._config.value @property def created_at(self): """ :type: datetime.datetime """ self._completeIfNotSet(self._created_at) return self._created_at.value @property def events(self): """ :type: list of string """ self._completeIfNotSet(self._events) return self._events.value @property def id(self): """ :type: integer """ self._completeIfNotSet(self._id) return self._id.value @property def last_response(self): """ :type: :class:`github.HookResponse.HookResponse` """ self._completeIfNotSet(self._last_response) return self._last_response.value @property def name(self): """ :type: string """ self._completeIfNotSet(self._name) return self._name.value @property def test_url(self): """ :type: string """ self._completeIfNotSet(self._test_url) return self._test_url.value @property def updated_at(self): """ :type: datetime.datetime """ self._completeIfNotSet(self._updated_at) return self._updated_at.value @property def url(self): """ :type: string """ self._completeIfNotSet(self._url) return self._url.value @property def ping_url(self): """ :type: string """ self._completeIfNotSet(self._ping_url) return self._ping_url.value def delete(self): """ :calls: `DELETE /repos/:owner/:repo/hooks/:id <http://developer.github.com/v3/repos/hooks>`_ :rtype: None """ headers, data = self._requester.requestJsonAndCheck("DELETE", self.url) def edit( self, name, config, events=github.GithubObject.NotSet, add_events=github.GithubObject.NotSet, remove_events=github.GithubObject.NotSet, active=github.GithubObject.NotSet, ): """ :calls: `PATCH /repos/:owner/:repo/hooks/:id <http://developer.github.com/v3/repos/hooks>`_ :param name: string :param config: dict :param events: list of string :param add_events: list of string :param remove_events: list of string :param active: bool :rtype: None """ assert isinstance(name, (str, six.text_type)), name assert isinstance(config, dict), config assert events is github.GithubObject.NotSet or all( isinstance(element, (str, six.text_type)) for element in events ), events assert add_events is github.GithubObject.NotSet or all( isinstance(element, (str, six.text_type)) for element in add_events ), add_events assert remove_events is github.GithubObject.NotSet or all( isinstance(element, (str, six.text_type)) for element in remove_events ), remove_events assert active is github.GithubObject.NotSet or isinstance(active, bool), active post_parameters = { "name": name, "config": config, } if events is not github.GithubObject.NotSet: post_parameters["events"] = events if add_events is not github.GithubObject.NotSet: post_parameters["add_events"] = add_events if remove_events is not github.GithubObject.NotSet: post_parameters["remove_events"] = remove_events if active is not github.GithubObject.NotSet: post_parameters["active"] = active headers, data = self._requester.requestJsonAndCheck( "PATCH", self.url, input=post_parameters ) self._useAttributes(data) def test(self): """ :calls: `POST /repos/:owner/:repo/hooks/:id/tests <http://developer.github.com/v3/repos/hooks>`_ :rtype: None """ headers, data = self._requester.requestJsonAndCheck("POST", self.url + "/tests") def ping(self): """ :calls: `POST /repos/:owner/:repo/hooks/:id/pings <http://developer.github.com/v3/repos/hooks>`_ :rtype: None """ headers, data = self._requester.requestJsonAndCheck("POST", self.url + "/pings") def _initAttributes(self): self._active = github.GithubObject.NotSet self._config = github.GithubObject.NotSet self._created_at = github.GithubObject.NotSet self._events = github.GithubObject.NotSet self._id = github.GithubObject.NotSet self._last_response = github.GithubObject.NotSet self._name = github.GithubObject.NotSet self._test_url = github.GithubObject.NotSet self._updated_at = github.GithubObject.NotSet self._url = github.GithubObject.NotSet self._ping_url = github.GithubObject.NotSet def _useAttributes(self, attributes): if "active" in attributes: # pragma no branch self._active = self._makeBoolAttribute(attributes["active"]) if "config" in attributes: # pragma no branch self._config = self._makeDictAttribute(attributes["config"]) if "created_at" in attributes: # pragma no branch self._created_at = self._makeDatetimeAttribute(attributes["created_at"]) if "events" in attributes: # pragma no branch self._events = self._makeListOfStringsAttribute(attributes["events"]) if "id" in attributes: # pragma no branch self._id = self._makeIntAttribute(attributes["id"]) if "last_response" in attributes: # pragma no branch self._last_response = self._makeClassAttribute( github.HookResponse.HookResponse, attributes["last_response"] ) if "name" in attributes: # pragma no branch self._name = self._makeStringAttribute(attributes["name"]) if "test_url" in attributes: # pragma no branch self._test_url = self._makeStringAttribute(attributes["test_url"]) if "updated_at" in attributes: # pragma no branch self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"]) if "url" in attributes: # pragma no branch self._url = self._makeStringAttribute(attributes["url"]) if "ping_url" in attributes: # pragma no branch self._ping_url = self._makeStringAttribute(attributes["ping_url"])
pymedusa/Medusa
ext/github/Hook.py
Python
gpl-3.0
9,634
def interactiveConsole(a,b=None): ''' Useful function for debugging Placing interactiveConsole(locals(),globals()) into code will drop into an interactive console when run ''' import code d = {} if b: d.update(b) d.update(a) c=code.InteractiveConsole(locals=d) c.interact() class SecureDict(object): __slots__ = ('__items__',) def __init__(self, *a, **kw): self.__items__ = dict(*a, **kw) def getItem(self, item, default = None): if default!=None: return self.__items__.get(item,default) try: return self.__items__[item] except KeyError: raise KeyError('Key Error: %s'%item) def setItem(self, item, value): self.__items__[item] = value def __len__(self): return len(self.__items__) def __repr__(self): return 'SecureDict(%r)' % self.__items__ __str__ = __repr__ def keys(self): return self.__items__.keys() def values(self): return self.__items__.values() def pop(self,key): return self.__items__.pop(key)
UnionGospelMission/UGM-Database
Sandbox/SecureDict.py
Python
gpl-3.0
1,147
# Tests for source4/libnet/py_net_dckeytab.c # # Copyright (C) David Mulder <[email protected]> 2018 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # import os import sys import string from samba.net import Net from samba import enable_net_export_keytab from samba import tests from samba.param import LoadParm enable_net_export_keytab() def open_bytes(filename): if sys.version_info[0] == 3: return open(filename, errors='ignore') else: return open(filename, 'rb') class DCKeytabTests(tests.TestCase): def setUp(self): super(DCKeytabTests, self).setUp() self.lp = LoadParm() self.lp.load_default() self.creds = self.insta_creds(template=self.get_credentials()) self.ktfile = os.path.join(self.lp.get('private dir'), 'test.keytab') self.principal = self.creds.get_principal() def tearDown(self): super(DCKeytabTests, self).tearDown() os.remove(self.ktfile) def test_export_keytab(self): net = Net(None, self.lp) net.export_keytab(keytab=self.ktfile, principal=self.principal) assert os.path.exists(self.ktfile), 'keytab was not created' with open_bytes(self.ktfile) as bytes_kt: result = '' for c in bytes_kt.read(): if c in string.printable: result += c principal_parts = self.principal.split('@') assert principal_parts[0] in result and \ principal_parts[1] in result, \ 'Principal not found in generated keytab'
kernevil/samba
python/samba/tests/dckeytab.py
Python
gpl-3.0
2,161
#add by sq.luo import andbug.command, andbug.screed import andbug.vm def stepComplete(t): t = t[0] with andbug.screed.section("Single step complete in %s, suspended." % t): showCallStack(t, 1) def showCallStack(t, count = 0): if count >= len(t.frames) or count <= 0: count = len(t.frames) for f in t.frames[0:count]: name = str(f.loc) f.loc.method.firstLoc if f.native: name += ' <native>' andbug.screed.item(name) def printValues(dist, name = None): if name == None: for key in dist.keys(): print key + ' : ' + str(dist[key]) else : if dist[name] != None: print name + ' : ' + str(dist[name]) if (isinstance(dist[name], andbug.vm.Object)): print "{" printValues(dist[name].fields) print "}" else: print 'not found \"' + name + '\" variable' @andbug.command.action('', aliases=('vs',)) def values(ctxt, name = None): 'if you suspend, you print the values.' with andbug.screed.section('values'): if ctxt.sess.getSuspendState().isSuspend: t = ctxt.sess.getSuspendState().getThread() printValues(t.frames[0].values, name) else : print 'Not suspend, you can\'t print values' @andbug.command.action('<variable name> <value>', aliases=('set', 'sv', )) def setValues(ctxt, name = None, value = None): 'if you suspend, you can set the values.' if name == None or value == None: print 'parameter not enough' return with andbug.screed.section('values'): if ctxt.sess.getSuspendState().isSuspend: t = ctxt.sess.getSuspendState().getThread() t.frames[0].setValue(name, value) else : print 'Not suspend, you can\'t print values' @andbug.command.action('[<count/all>]', aliases=('bt',)) def backtrace(ctxt, count = None): 'if you suspend, you print the backtrace.' with andbug.screed.section('Back Trace'): if ctxt.sess.getSuspendState().isSuspend: t = ctxt.sess.getSuspendState().getThread() if count == 'all' or count == None: showCallStack(t) if count.isdigit(): showCallStack(t, int(count)) else : print 'Not suspend, you can\'t print backtrace' @andbug.command.action('', aliases=('s',)) def stepover(ctxt, expr=None): 'if you suspend, you can step over.' with andbug.screed.section('Step Over'): if ctxt.sess.getSuspendState().isSuspend: t = ctxt.sess.getSuspendState().getThread() t.singleStep(func = stepComplete) else : print 'Not suspend, you can\'t step' @andbug.command.action('', aliases=('si',)) def stepinto(ctxt, expr=None): 'if you suspend, you can step into.' with andbug.screed.section('Step Into'): if ctxt.sess.getSuspendState().isSuspend: t = ctxt.sess.getSuspendState().getThread() t.singleStep(func = stepComplete, stepdepth = 0) else : print 'Not suspend, you can\'t step into' @andbug.command.action('', aliases=('so',)) def stepout(ctxt, expr=None): 'if you suspend, you can step out.' with andbug.screed.section('Step Out'): if ctxt.sess.getSuspendState().isSuspend: t = ctxt.sess.getSuspendState().getThread() t.singleStep(func = stepComplete, stepdepth = 2) else : print 'Not suspend, you can\'t step out'
anbc/AndBug
lib/andbug/cmd/step.py
Python
gpl-3.0
3,688
#!/usr/bin/env python ######################################################################## # File : dirac-admin-proxy-upload.py # Author : Adrian Casajus ######################################################################## from __future__ import print_function import sys from DIRAC.Core.Base import Script from DIRAC.FrameworkSystem.Client.ProxyUpload import CLIParams, uploadProxy __RCSID__ = "$Id$" if __name__ == "__main__": cliParams = CLIParams() cliParams.registerCLISwitches() Script.parseCommandLine() retVal = uploadProxy(cliParams) if not retVal['OK']: print(retVal['Message']) sys.exit(1) sys.exit(0)
fstagni/DIRAC
FrameworkSystem/scripts/dirac-admin-proxy-upload.py
Python
gpl-3.0
650
# weaponUpgradesCpuNeedBonusPostPercentCpuLocationShipModulesRequiringMissileLauncherOperation # # Used by: # Implants named like: Zainou 'Gnome' Launcher CPU Efficiency LE (6 of 6) # Skill: Weapon Upgrades type = "passive" def handler(fit, container, context): level = container.level if "skill" in context else 1 fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Missile Launcher Operation"), "cpu", container.getModifiedItemAttr("cpuNeedBonus") * level)
Ebag333/Pyfa
eos/effects/weaponupgradescpuneedbonuspostpercentcpulocationshipmodulesrequiringmissilelauncheroperation.py
Python
gpl-3.0
517
import mpi4py, petsc4py from petsc4py import PETSc import numpy as np import pytest import gridPy import geometryPy petsc4py.init() petscComm = petsc4py.PETSc.COMM_WORLD comm = petscComm.tompi4py() rank = comm.Get_rank() numProcs = comm.Get_size() PETSc.Sys.Print("Using %d procs" % numProcs) N1 = int(pytest.config.getoption('N1')) N2 = int(pytest.config.getoption('N2')) N3 = int(pytest.config.getoption('N3')) dim = int(pytest.config.getoption('dim')) # Geometry parameters blackHoleSpin = float(pytest.config.getoption('blackHoleSpin')) hSlope = float(pytest.config.getoption('hSlope')) numGhost = 3 X1Start = 0.; X1End = 1. X2Start = 0.; X2End = 1. X3Start = 0.; X3End = 1. periodicBoundariesX1 = False periodicBoundariesX2 = False periodicBoundariesX3 = False XCoords = gridPy.coordinatesGridPy(N1, N2, N3, dim, numGhost, X1Start, X1End, X2Start, X2End, X3Start, X3End ) X1Coords, X2Coords, X3Coords = XCoords.getCoords(gridPy.CENTER) geomMinkowski = geometryPy.geometryPy(geometryPy.MINKOWSKI, 0., 0., XCoords ) def test_minkowski_params(): np.testing.assert_equal(N1, geomMinkowski.N1) np.testing.assert_equal(N2, geomMinkowski.N2) np.testing.assert_equal(N3, geomMinkowski.N3) np.testing.assert_equal(dim, geomMinkowski.dim) np.testing.assert_equal(numGhost, geomMinkowski.numGhost) def test_minkowski_gCov(): np.testing.assert_allclose(geomMinkowski.gCov[0][0], -1.) np.testing.assert_allclose(geomMinkowski.gCov[0][1], 0.) np.testing.assert_allclose(geomMinkowski.gCov[0][2], 0.) np.testing.assert_allclose(geomMinkowski.gCov[0][3], 0.) np.testing.assert_allclose(geomMinkowski.gCov[1][0], 0.) np.testing.assert_allclose(geomMinkowski.gCov[1][1], 1.) np.testing.assert_allclose(geomMinkowski.gCov[1][2], 0.) np.testing.assert_allclose(geomMinkowski.gCov[1][3], 0.) np.testing.assert_allclose(geomMinkowski.gCov[2][0], 0.) np.testing.assert_allclose(geomMinkowski.gCov[2][1], 0.) np.testing.assert_allclose(geomMinkowski.gCov[2][2], 1.) np.testing.assert_allclose(geomMinkowski.gCov[2][3], 0.) np.testing.assert_allclose(geomMinkowski.gCov[3][0], 0.) np.testing.assert_allclose(geomMinkowski.gCov[3][1], 0.) np.testing.assert_allclose(geomMinkowski.gCov[3][2], 0.) np.testing.assert_allclose(geomMinkowski.gCov[3][3], 1.) def test_minkowski_gCon(): np.testing.assert_allclose(geomMinkowski.gCon[0][0], -1.) np.testing.assert_allclose(geomMinkowski.gCon[0][1], 0.) np.testing.assert_allclose(geomMinkowski.gCon[0][2], 0.) np.testing.assert_allclose(geomMinkowski.gCon[0][3], 0.) np.testing.assert_allclose(geomMinkowski.gCon[1][0], 0.) np.testing.assert_allclose(geomMinkowski.gCon[1][1], 1.) np.testing.assert_allclose(geomMinkowski.gCon[1][2], 0.) np.testing.assert_allclose(geomMinkowski.gCon[1][3], 0.) np.testing.assert_allclose(geomMinkowski.gCon[2][0], 0.) np.testing.assert_allclose(geomMinkowski.gCon[2][1], 0.) np.testing.assert_allclose(geomMinkowski.gCon[2][2], 1.) np.testing.assert_allclose(geomMinkowski.gCon[2][3], 0.) np.testing.assert_allclose(geomMinkowski.gCon[3][0], 0.) np.testing.assert_allclose(geomMinkowski.gCon[3][1], 0.) np.testing.assert_allclose(geomMinkowski.gCon[3][2], 0.) np.testing.assert_allclose(geomMinkowski.gCon[3][3], 1.) def test_minkowski_g(): np.testing.assert_allclose(geomMinkowski.g, 1.) def test_minkowski_alpha(): np.testing.assert_allclose(geomMinkowski.g, 1.) geomKerrSchild = geometryPy.geometryPy(geometryPy.MODIFIED_KERR_SCHILD, blackHoleSpin, hSlope, XCoords ) # From McKinney and Gammie, 2004 # Check if the coordinate transformations have been done correctly r = np.exp(X1Coords) theta = np.pi*X2Coords + 0.5*(1. - hSlope)*np.sin(2.*np.pi*X2Coords) phi = 2*np.pi*X3Coords sigma = r**2. + (blackHoleSpin*np.cos(theta) )**2. delta = r**2. - 2*r + blackHoleSpin**2. A = (r**2. + blackHoleSpin**2.)**2. sigmaMinus = r**2. - (blackHoleSpin*np.cos(theta) )**2. # Coordinate transformation for log spacing in r and concentrating zones in the # mid plane dr_dX1 = np.exp(X1Coords) dtheta_dX2 = np.pi*(1. + (1. - hSlope)*np.cos(2.*np.pi*X2Coords)) d2theta_dX22 = -2.*np.pi*np.pi*(1-hSlope)*np.sin(2.*np.pi*X2Coords); N1Total = XCoords.N1Total N2Total = XCoords.N2Total N3Total = XCoords.N3Total gCovCheck = np.zeros([4, 4, N3Total, N2Total, N1Total]) gConCheck = np.zeros([4, 4, N3Total, N2Total, N1Total]) gCheck = np.zeros([N3Total, N2Total, N1Total]) gCovCheck[0][0] = -(1. - 2*r/sigma) # dt^2 gCovCheck[0][1] = (2*r/sigma) * dr_dX1 # dt dX1 gCovCheck[0][2] = 0. # dt dX2 gCovCheck[0][3] = -(2.*blackHoleSpin*r*np.sin(theta)**2./sigma) # dt dphi gCovCheck[1][0] = gCovCheck[0][1] gCovCheck[1][1] = (1. + 2*r/sigma) * dr_dX1**2. # dX1 dX1 gCovCheck[1][2] = 0. gCovCheck[1][3] = -blackHoleSpin * (1. + 2*r/sigma)*np.sin(theta)**2. \ * dr_dX1 # dX1 dphi gCovCheck[2][0] = gCovCheck[0][2] gCovCheck[2][1] = gCovCheck[1][2] gCovCheck[2][2] = sigma * dtheta_dX2 * dtheta_dX2 # dX2 dX2 gCovCheck[2][3] = 0. # dX2 dphi gCovCheck[3][0] = gCovCheck[0][3] gCovCheck[3][1] = gCovCheck[1][3] gCovCheck[3][2] = gCovCheck[2][3] gCovCheck[3][3] = np.sin(theta)**2. \ * (sigma + blackHoleSpin**2. \ * (1. + 2.*r/sigma)*np.sin(theta)**2. \ ) # dphi dphi gCovPerZone = np.zeros([4, 4]) for k in xrange(N3Total): for j in xrange(N2Total): for i in xrange(N1Total): gCovPerZone[0, 0] = gCovCheck[0][0][k, j, i] gCovPerZone[0, 1] = gCovCheck[0][1][k, j, i] gCovPerZone[0, 2] = gCovCheck[0][2][k, j, i] gCovPerZone[0, 3] = gCovCheck[0][3][k, j, i] gCovPerZone[1, 0] = gCovCheck[1][0][k, j, i] gCovPerZone[1, 1] = gCovCheck[1][1][k, j, i] gCovPerZone[1, 2] = gCovCheck[1][2][k, j, i] gCovPerZone[1, 3] = gCovCheck[1][3][k, j, i] gCovPerZone[2, 0] = gCovCheck[2][0][k, j, i] gCovPerZone[2, 1] = gCovCheck[2][1][k, j, i] gCovPerZone[2, 2] = gCovCheck[2][2][k, j, i] gCovPerZone[2, 3] = gCovCheck[2][3][k, j, i] gCovPerZone[3, 0] = gCovCheck[3][0][k, j, i] gCovPerZone[3, 1] = gCovCheck[3][1][k, j, i] gCovPerZone[3, 2] = gCovCheck[3][2][k, j, i] gCovPerZone[3, 3] = gCovCheck[3][3][k, j, i] gConPerZone = np.linalg.inv(gCovPerZone) gCheck[k, j, i] = np.sqrt(-np.linalg.det(gCovPerZone)) gConCheck[0][0][k, j, i] = gConPerZone[0, 0] gConCheck[0][1][k, j, i] = gConPerZone[0, 1] gConCheck[0][2][k, j, i] = gConPerZone[0, 2] gConCheck[0][3][k, j, i] = gConPerZone[0, 3] gConCheck[1][0][k, j, i] = gConPerZone[1, 0] gConCheck[1][1][k, j, i] = gConPerZone[1, 1] gConCheck[1][2][k, j, i] = gConPerZone[1, 2] gConCheck[1][3][k, j, i] = gConPerZone[1, 3] gConCheck[2][0][k, j, i] = gConPerZone[2, 0] gConCheck[2][1][k, j, i] = gConPerZone[2, 1] gConCheck[2][2][k, j, i] = gConPerZone[2, 2] gConCheck[2][3][k, j, i] = gConPerZone[2, 3] gConCheck[3][0][k, j, i] = gConPerZone[3, 0] gConCheck[3][1][k, j, i] = gConPerZone[3, 1] gConCheck[3][2][k, j, i] = gConPerZone[3, 2] gConCheck[3][3][k, j, i] = gConPerZone[3, 3] alphaCheck = 1./np.sqrt(-gConCheck[0][0]) geomKerrSchild.computeConnectionCoeffs() gammaUpDownDownCheck = np.zeros([4, 4, 4, N3Total, N2Total, N1Total]) gammaUpDownDownCheck[0][0][0] = 2.*r*sigmaMinus / sigma**3. gammaUpDownDownCheck[0][0][1] = r * (2*r + sigma) * sigmaMinus / sigma**3. gammaUpDownDownCheck[0][0][2] = -blackHoleSpin**2. * r * np.sin(2.*theta) \ * dtheta_dX2 / sigma**2. gammaUpDownDownCheck[0][0][3] = -2. * blackHoleSpin * r * np.sin(theta)**2. \ * sigmaMinus / sigma**3. gammaUpDownDownCheck[0][1][0] = gammaUpDownDownCheck[0][0][1] gammaUpDownDownCheck[0][1][1] = 2.*r**2.*(r**4. + r*sigmaMinus - (blackHoleSpin*np.cos(theta))**4. ) / sigma**3. gammaUpDownDownCheck[0][1][2] = -blackHoleSpin**2. * r**2. * np.sin(2.*theta) \ * dtheta_dX2 / sigma**2. gammaUpDownDownCheck[0][1][3] = blackHoleSpin * r * (-r*(r**3. + 2*sigmaMinus) + ( blackHoleSpin * np.cos(theta) )**4. ) * np.sin(theta)**2. \ / sigma**3. gammaUpDownDownCheck[0][2][0] = gammaUpDownDownCheck[0][0][2] gammaUpDownDownCheck[0][2][1] = gammaUpDownDownCheck[0][1][2] gammaUpDownDownCheck[0][2][2] = -2. * r**2. * dtheta_dX2**2. / sigma gammaUpDownDownCheck[0][2][3] = blackHoleSpin**3. * r * np.sin(theta)**2. \ * np.sin(2.*theta) * dtheta_dX2 / sigma**2. gammaUpDownDownCheck[0][3][0] = gammaUpDownDownCheck[0][0][3] gammaUpDownDownCheck[0][3][1] = gammaUpDownDownCheck[0][1][3] gammaUpDownDownCheck[0][3][2] = gammaUpDownDownCheck[0][2][3] gammaUpDownDownCheck[0][3][3] = 2.*r*np.sin(theta)**2. \ * (-r*sigma**2. + blackHoleSpin**2.*np.sin(theta)**2.*sigmaMinus ) / sigma**3. gammaUpDownDownCheck[1][0][0] = (blackHoleSpin**2. + r*(-2. + r)) \ * sigmaMinus / (r * sigma**3.) gammaUpDownDownCheck[1][0][1] = sigmaMinus \ * ( -2.*r + (blackHoleSpin*np.sin(theta))**2.) \ / sigma**3. gammaUpDownDownCheck[1][0][2] = 0. gammaUpDownDownCheck[1][0][3] = -blackHoleSpin * np.sin(theta)**2. \ * (blackHoleSpin**2. + r*(-2. + r)) * sigmaMinus \ / (r * sigma**3.) gammaUpDownDownCheck[1][1][0] = gammaUpDownDownCheck[1][0][1] gammaUpDownDownCheck[1][1][1] = \ ( r**4.*(-2. + r)*(1. + r) + blackHoleSpin**2. * ( blackHoleSpin**2.*r*(1. + 3.*r)*np.cos(theta)**4. \ + (blackHoleSpin*np.cos(theta))**4. * np.cos(theta)**2. \ + r**3.*np.sin(theta)**2. \ + r*np.cos(theta)**2. \ *(2.*r + 3.*r**3. - (blackHoleSpin*np.sin(theta))**2.) ) ) / sigma**3. gammaUpDownDownCheck[1][1][2] = -blackHoleSpin**2. * dtheta_dX2 \ * np.sin(2.*theta) \ / (blackHoleSpin**2. + 2.*r**2. + blackHoleSpin**2.*np.cos(2.*theta) ) gammaUpDownDownCheck[1][1][3] = \ blackHoleSpin * np.sin(theta)**2. * (blackHoleSpin**4. * r * np.cos(theta)**4. + r**2*(2.*r + r**3. -(blackHoleSpin*np.sin(theta))**2. ) \ + (blackHoleSpin*np.cos(theta))**2. \ * (2.*r*(-1. + r**2.) + (blackHoleSpin*np.sin(theta))**2. ) ) / sigma**3. gammaUpDownDownCheck[1][2][0] = gammaUpDownDownCheck[1][0][2] gammaUpDownDownCheck[1][2][1] = gammaUpDownDownCheck[1][1][2] gammaUpDownDownCheck[1][2][2] = -(blackHoleSpin**2. + r*(-2. + r)) \ * dtheta_dX2**2. / sigma gammaUpDownDownCheck[1][2][3] = 0. gammaUpDownDownCheck[1][3][0] = gammaUpDownDownCheck[1][0][3] gammaUpDownDownCheck[1][3][1] = gammaUpDownDownCheck[1][1][3] gammaUpDownDownCheck[1][3][2] = gammaUpDownDownCheck[1][2][3] gammaUpDownDownCheck[1][3][3] = \ -(blackHoleSpin**2. + r*(-2. + r) ) * np.sin(theta)**2. \ * (r * sigma**2. - blackHoleSpin**2.*sigmaMinus*np.sin(theta)**2. ) / (r * sigma**3.) gammaUpDownDownCheck[2][0][0] = -blackHoleSpin**2. * r * np.sin(2.*theta) \ / sigma**3. / dtheta_dX2 gammaUpDownDownCheck[2][0][1] = r * gammaUpDownDownCheck[2][0][0] gammaUpDownDownCheck[2][0][2] = 0. gammaUpDownDownCheck[2][0][3] = blackHoleSpin*r*(blackHoleSpin**2. + r**2.) \ * np.sin(2.*theta) / sigma**3. / dtheta_dX2 gammaUpDownDownCheck[2][1][0] = gammaUpDownDownCheck[2][0][1] gammaUpDownDownCheck[2][1][1] = r**2. * gammaUpDownDownCheck[2][0][0] gammaUpDownDownCheck[2][1][2] = r**2. / sigma gammaUpDownDownCheck[2][1][3] = (blackHoleSpin*r*np.cos(theta)*np.sin(theta) *(r**3.*(2. + r) + blackHoleSpin**2. *( 2.*r*(1. + r)*np.cos(theta)**2. + blackHoleSpin**2.*np.cos(theta)**4. + 2.*r*np.sin(theta)**2. ) ) ) / sigma**3. / dtheta_dX2 gammaUpDownDownCheck[2][2][0] = gammaUpDownDownCheck[2][0][2] gammaUpDownDownCheck[2][2][1] = gammaUpDownDownCheck[2][1][2] gammaUpDownDownCheck[2][2][2] = -blackHoleSpin**2.*np.cos(theta)*np.sin(theta) \ *dtheta_dX2/sigma + d2theta_dX22/dtheta_dX2 gammaUpDownDownCheck[2][2][3] = 0. gammaUpDownDownCheck[2][3][0] = gammaUpDownDownCheck[2][0][3] gammaUpDownDownCheck[2][3][1] = gammaUpDownDownCheck[2][1][3] gammaUpDownDownCheck[2][3][2] = gammaUpDownDownCheck[2][2][3] gammaUpDownDownCheck[2][3][3] = \ -np.cos(theta)*np.sin(theta) \ *(sigma**3. + (blackHoleSpin*np.sin(theta))**2. \ * sigma*(r*(4. + r) + (blackHoleSpin*np.cos(theta)**2.)) \ + 2.*r*(blackHoleSpin * np.sin(theta))**4. \ ) / sigma**3. / dtheta_dX2 gammaUpDownDownCheck[3][0][0] = blackHoleSpin * sigmaMinus / sigma**3. gammaUpDownDownCheck[3][0][1] = r * gammaUpDownDownCheck[3][0][0] gammaUpDownDownCheck[3][0][2] = -2.*blackHoleSpin*r*np.cos(theta) \ * dtheta_dX2 / (np.sin(theta) * sigma**2.) gammaUpDownDownCheck[3][0][3] = -blackHoleSpin**2. * np.sin(theta)**2. \ * sigmaMinus / sigma**3. gammaUpDownDownCheck[3][1][0] = gammaUpDownDownCheck[3][0][1] gammaUpDownDownCheck[3][1][1] = blackHoleSpin * r**2. * sigmaMinus \ / sigma**3. gammaUpDownDownCheck[3][1][2] = -2.*blackHoleSpin*r \ *(blackHoleSpin**2. + 2.*r*(2. + r) + blackHoleSpin**2. * np.cos(2.*theta) ) * np.cos(theta) * dtheta_dX2 \ / (np.sin(theta) \ * (blackHoleSpin**2. + 2.*r**2. + blackHoleSpin**2.*np.cos(2.*theta) )**2. ) gammaUpDownDownCheck[3][1][3] = \ r*(r*sigma**2. - (blackHoleSpin*np.sin(theta))**2.*sigmaMinus)/sigma**3. gammaUpDownDownCheck[3][2][0] = gammaUpDownDownCheck[3][0][2] gammaUpDownDownCheck[3][2][1] = gammaUpDownDownCheck[3][1][2] gammaUpDownDownCheck[3][2][2] = -blackHoleSpin * r * dtheta_dX2**2./sigma gammaUpDownDownCheck[3][2][3] = \ dtheta_dX2*(.25*(blackHoleSpin**2. + 2.*r**2. + blackHoleSpin**2.*np.cos(2.*theta) )**2. * np.cos(theta)/np.sin(theta) + blackHoleSpin**2. * r * np.sin(2.*theta) )/sigma**2. gammaUpDownDownCheck[3][3][0] = gammaUpDownDownCheck[3][0][3] gammaUpDownDownCheck[3][3][1] = gammaUpDownDownCheck[3][1][3] gammaUpDownDownCheck[3][3][2] = gammaUpDownDownCheck[3][2][3] gammaUpDownDownCheck[3][3][3] = \ (-blackHoleSpin * r * np.sin(theta)**2. * sigma**2. \ + blackHoleSpin**3. * np.sin(theta)**4. * sigmaMinus) / sigma**3. def test_modifiedKerrSchild_params(): np.testing.assert_equal(N1, geomKerrSchild.N1) np.testing.assert_equal(N2, geomKerrSchild.N2) np.testing.assert_equal(N3, geomKerrSchild.N3) np.testing.assert_equal(dim, geomKerrSchild.dim) np.testing.assert_equal(numGhost, geomKerrSchild.numGhost) def test_modifiedKerrSchild_xCoords(): np.testing.assert_allclose(r, geomKerrSchild.xCoords[0]) np.testing.assert_allclose(theta, geomKerrSchild.xCoords[1]) np.testing.assert_allclose(phi, geomKerrSchild.xCoords[2]) def test_modifiedKerrSchild_gCov(): np.testing.assert_allclose(gCovCheck[0][0], geomKerrSchild.gCov[0][0]) np.testing.assert_allclose(gCovCheck[0][1], geomKerrSchild.gCov[0][1]) np.testing.assert_allclose(gCovCheck[0][2], geomKerrSchild.gCov[0][2]) np.testing.assert_allclose(gCovCheck[0][3], geomKerrSchild.gCov[0][3]) np.testing.assert_allclose(gCovCheck[1][0], geomKerrSchild.gCov[1][0]) np.testing.assert_allclose(gCovCheck[1][1], geomKerrSchild.gCov[1][1]) np.testing.assert_allclose(gCovCheck[1][2], geomKerrSchild.gCov[1][2]) np.testing.assert_allclose(gCovCheck[1][3], geomKerrSchild.gCov[1][3]) np.testing.assert_allclose(gCovCheck[2][0], geomKerrSchild.gCov[2][0]) np.testing.assert_allclose(gCovCheck[2][1], geomKerrSchild.gCov[2][1]) np.testing.assert_allclose(gCovCheck[2][2], geomKerrSchild.gCov[2][2]) np.testing.assert_allclose(gCovCheck[2][3], geomKerrSchild.gCov[2][3]) np.testing.assert_allclose(gCovCheck[3][0], geomKerrSchild.gCov[3][0]) np.testing.assert_allclose(gCovCheck[3][1], geomKerrSchild.gCov[3][1]) np.testing.assert_allclose(gCovCheck[3][2], geomKerrSchild.gCov[3][2]) np.testing.assert_allclose(gCovCheck[3][3], geomKerrSchild.gCov[3][3]) def test_modifiedKerrSchild_gCon(): np.testing.assert_allclose(gConCheck[0][0], geomKerrSchild.gCon[0][0]) np.testing.assert_allclose(gConCheck[0][1], geomKerrSchild.gCon[0][1]) np.testing.assert_allclose(gConCheck[0][2], geomKerrSchild.gCon[0][2]) np.testing.assert_allclose(gConCheck[0][3], geomKerrSchild.gCon[0][3], atol=1e-14 ) np.testing.assert_allclose(gConCheck[1][0], geomKerrSchild.gCon[1][0]) np.testing.assert_allclose(gConCheck[1][1], geomKerrSchild.gCon[1][1]) np.testing.assert_allclose(gConCheck[1][2], geomKerrSchild.gCon[1][2]) np.testing.assert_allclose(gConCheck[1][3], geomKerrSchild.gCon[1][3]) np.testing.assert_allclose(gConCheck[2][0], geomKerrSchild.gCon[2][0]) np.testing.assert_allclose(gConCheck[2][1], geomKerrSchild.gCon[2][1]) np.testing.assert_allclose(gConCheck[2][2], geomKerrSchild.gCon[2][2]) np.testing.assert_allclose(gConCheck[2][3], geomKerrSchild.gCon[2][3]) np.testing.assert_allclose(gConCheck[3][0], geomKerrSchild.gCon[3][0], atol=1e-14 ) np.testing.assert_allclose(gConCheck[3][1], geomKerrSchild.gCon[3][1]) np.testing.assert_allclose(gConCheck[3][2], geomKerrSchild.gCon[3][2]) np.testing.assert_allclose(gConCheck[3][3], geomKerrSchild.gCon[3][3]) def test_modifiedKerrSchild_g(): np.testing.assert_allclose(gCheck, geomKerrSchild.g) def test_modifiedKerrSchild_alpha(): np.testing.assert_allclose(alphaCheck, geomKerrSchild.alpha) def test_modifiedKerrSchild_gammaUpDownDown(): np.testing.assert_allclose( gammaUpDownDownCheck[0][0][0], geomKerrSchild.gammaUpDownDown[0][0][0] ) np.testing.assert_allclose( gammaUpDownDownCheck[0][0][1], geomKerrSchild.gammaUpDownDown[0][0][1] ) np.testing.assert_allclose( gammaUpDownDownCheck[0][0][2], geomKerrSchild.gammaUpDownDown[0][0][2], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[0][0][3], geomKerrSchild.gammaUpDownDown[0][0][3] ) np.testing.assert_allclose( gammaUpDownDownCheck[0][1][0], geomKerrSchild.gammaUpDownDown[0][1][0] ) np.testing.assert_allclose( gammaUpDownDownCheck[0][1][1], geomKerrSchild.gammaUpDownDown[0][1][1] ) np.testing.assert_allclose( gammaUpDownDownCheck[0][1][2], geomKerrSchild.gammaUpDownDown[0][1][2], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[0][1][3], geomKerrSchild.gammaUpDownDown[0][1][3] ) np.testing.assert_allclose( gammaUpDownDownCheck[0][2][0], geomKerrSchild.gammaUpDownDown[0][2][0], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[0][2][1], geomKerrSchild.gammaUpDownDown[0][2][1], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[0][2][2], geomKerrSchild.gammaUpDownDown[0][2][2] ) np.testing.assert_allclose( gammaUpDownDownCheck[0][2][3], geomKerrSchild.gammaUpDownDown[0][2][3], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[0][3][0], geomKerrSchild.gammaUpDownDown[0][3][0] ) np.testing.assert_allclose( gammaUpDownDownCheck[0][3][1], geomKerrSchild.gammaUpDownDown[0][3][1], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[0][3][2], geomKerrSchild.gammaUpDownDown[0][3][2], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[0][3][3], geomKerrSchild.gammaUpDownDown[0][3][3] ) np.testing.assert_allclose( gammaUpDownDownCheck[1][0][0], geomKerrSchild.gammaUpDownDown[1][0][0] ) np.testing.assert_allclose( gammaUpDownDownCheck[1][0][1], geomKerrSchild.gammaUpDownDown[1][0][1] ) np.testing.assert_allclose( gammaUpDownDownCheck[1][0][2], geomKerrSchild.gammaUpDownDown[1][0][2], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[1][0][3], geomKerrSchild.gammaUpDownDown[1][0][3] ) np.testing.assert_allclose( gammaUpDownDownCheck[1][1][0], geomKerrSchild.gammaUpDownDown[1][1][0] ) np.testing.assert_allclose( gammaUpDownDownCheck[1][1][1], geomKerrSchild.gammaUpDownDown[1][1][1], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[1][1][2], geomKerrSchild.gammaUpDownDown[1][1][2], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[1][1][3], geomKerrSchild.gammaUpDownDown[1][1][3] ) np.testing.assert_allclose( gammaUpDownDownCheck[1][2][0], geomKerrSchild.gammaUpDownDown[1][2][0], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[1][2][1], geomKerrSchild.gammaUpDownDown[1][2][1], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[1][2][2], geomKerrSchild.gammaUpDownDown[1][2][2] ) np.testing.assert_allclose( gammaUpDownDownCheck[1][2][3], geomKerrSchild.gammaUpDownDown[1][2][3], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[1][3][0], geomKerrSchild.gammaUpDownDown[1][3][0] ) np.testing.assert_allclose( gammaUpDownDownCheck[1][3][1], geomKerrSchild.gammaUpDownDown[1][3][1], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[1][3][2], geomKerrSchild.gammaUpDownDown[1][3][2], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[1][3][3], geomKerrSchild.gammaUpDownDown[1][3][3] ) np.testing.assert_allclose( gammaUpDownDownCheck[2][0][0], geomKerrSchild.gammaUpDownDown[2][0][0], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[2][0][1], geomKerrSchild.gammaUpDownDown[2][0][1], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[2][0][2], geomKerrSchild.gammaUpDownDown[2][0][2] ) np.testing.assert_allclose( gammaUpDownDownCheck[2][0][3], geomKerrSchild.gammaUpDownDown[2][0][3], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[2][1][0], geomKerrSchild.gammaUpDownDown[2][1][0], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[2][1][1], geomKerrSchild.gammaUpDownDown[2][1][1], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[2][1][2], geomKerrSchild.gammaUpDownDown[2][1][2] ) np.testing.assert_allclose( gammaUpDownDownCheck[2][1][3], geomKerrSchild.gammaUpDownDown[2][1][3], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[2][2][0], geomKerrSchild.gammaUpDownDown[2][2][0], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[2][2][1], geomKerrSchild.gammaUpDownDown[2][2][1], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[2][2][2], geomKerrSchild.gammaUpDownDown[2][2][2] ) np.testing.assert_allclose( gammaUpDownDownCheck[2][2][3], geomKerrSchild.gammaUpDownDown[2][2][3], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[2][3][0], geomKerrSchild.gammaUpDownDown[2][3][0], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[2][3][1], geomKerrSchild.gammaUpDownDown[2][3][1], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[2][3][2], geomKerrSchild.gammaUpDownDown[2][3][2] ) np.testing.assert_allclose( gammaUpDownDownCheck[2][3][3], geomKerrSchild.gammaUpDownDown[2][3][3], atol=3e-3 ) np.testing.assert_allclose( gammaUpDownDownCheck[3][0][0], geomKerrSchild.gammaUpDownDown[3][0][0] ) np.testing.assert_allclose( gammaUpDownDownCheck[3][0][1], geomKerrSchild.gammaUpDownDown[3][0][1], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[3][0][2], geomKerrSchild.gammaUpDownDown[3][0][2] ) np.testing.assert_allclose( gammaUpDownDownCheck[3][0][3], geomKerrSchild.gammaUpDownDown[3][0][3] ) np.testing.assert_allclose( gammaUpDownDownCheck[3][1][0], geomKerrSchild.gammaUpDownDown[3][1][0] ) np.testing.assert_allclose( gammaUpDownDownCheck[3][1][1], geomKerrSchild.gammaUpDownDown[3][1][1], atol=1e-7 ) np.testing.assert_allclose( gammaUpDownDownCheck[3][1][2], geomKerrSchild.gammaUpDownDown[3][1][2] ) np.testing.assert_allclose( gammaUpDownDownCheck[3][1][3], geomKerrSchild.gammaUpDownDown[3][1][3] ) np.testing.assert_allclose( gammaUpDownDownCheck[3][2][0], geomKerrSchild.gammaUpDownDown[3][2][0] ) np.testing.assert_allclose( gammaUpDownDownCheck[3][2][1], geomKerrSchild.gammaUpDownDown[3][2][1] ) np.testing.assert_allclose( gammaUpDownDownCheck[3][2][2], geomKerrSchild.gammaUpDownDown[3][2][2] ) np.testing.assert_allclose( gammaUpDownDownCheck[3][2][3], geomKerrSchild.gammaUpDownDown[3][2][3] ) np.testing.assert_allclose( gammaUpDownDownCheck[3][3][0], geomKerrSchild.gammaUpDownDown[3][3][0] ) np.testing.assert_allclose( gammaUpDownDownCheck[3][3][1], geomKerrSchild.gammaUpDownDown[3][3][1] ) np.testing.assert_allclose( gammaUpDownDownCheck[3][3][2], geomKerrSchild.gammaUpDownDown[3][3][2] ) np.testing.assert_allclose( gammaUpDownDownCheck[3][3][3], geomKerrSchild.gammaUpDownDown[3][3][3] )
AFD-Illinois/grim
src/geometry/test_geometry.py
Python
gpl-3.0
31,846
# Speak.activity # A simple front end to the espeak text-to-speech engine on the XO laptop # http://wiki.laptop.org/go/Speak # # Copyright (C) 2008 Joshua Minor # This file is part of Speak.activity # # Parts of Speak.activity are based on code from Measure.activity # Copyright (C) 2007 Arjun Sarwal - [email protected] # # Speak.activity is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Speak.activity is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Speak.activity. If not, see <http://www.gnu.org/licenses/>. import math from gi.repository import Gtk class Eye(Gtk.DrawingArea): def __init__(self, fill_color): Gtk.DrawingArea.__init__(self) self.connect("draw", self.draw) self.x, self.y = 0, 0 self.fill_color = fill_color def has_padding(self): return True def has_left_center_right(self): return False def look_at(self, x, y): self.x = x self.y = y self.queue_draw() def look_ahead(self): self.x = None self.y = None self.queue_draw() # Thanks to xeyes :) def computePupil(self): a = self.get_allocation() if self.x is None or self.y is None: # look ahead, but not *directly* in the middle pw = self.get_parent().get_allocation().width if a.x + a.width // 2 < pw // 2: cx = a.width * 0.6 else: cx = a.width * 0.4 return cx, a.height * 0.6 EYE_X, EYE_Y = self.translate_coordinates( self.get_toplevel(), a.width // 2, a.height // 2) EYE_HWIDTH = a.width EYE_HHEIGHT = a.height BALL_DIST = EYE_HWIDTH / 4 dx = self.x - EYE_X dy = self.y - EYE_Y if dx or dy: angle = math.atan2(dy, dx) cosa = math.cos(angle) sina = math.sin(angle) h = math.hypot(EYE_HHEIGHT * cosa, EYE_HWIDTH * sina) x = (EYE_HWIDTH * EYE_HHEIGHT) * cosa / h y = (EYE_HWIDTH * EYE_HHEIGHT) * sina / h dist = BALL_DIST * math.hypot(x, y) if dist < math.hypot(dx, dy): dx = dist * cosa dy = dist * sina return a.width // 2 + dx, a.height // 2 + dy def draw(self, widget, cr): bounds = self.get_allocation() eyeSize = min(bounds.width, bounds.height) outlineWidth = eyeSize / 20.0 pupilSize = eyeSize / 10.0 pupilX, pupilY = self.computePupil() dX = pupilX - bounds.width / 2. dY = pupilY - bounds.height / 2. distance = math.sqrt(dX * dX + dY * dY) limit = eyeSize // 2 - outlineWidth * 2 - pupilSize if distance > limit: pupilX = bounds.width // 2 + dX * limit // distance pupilY = bounds.height // 2 + dY * limit // distance # background cr.set_source_rgba(*self.fill_color.get_rgba()) cr.rectangle(0, 0, bounds.width, bounds.height) cr.fill() # eye ball cr.arc(bounds.width // 2, bounds.height // 2, eyeSize // 2 - outlineWidth // 2, 0, 2 * math.pi) cr.set_source_rgb(1, 1, 1) cr.fill() # outline cr.set_line_width(outlineWidth) cr.arc(bounds.width // 2, bounds.height // 2, eyeSize // 2 - outlineWidth // 2, 0, 2 * math.pi) cr.set_source_rgb(0, 0, 0) cr.stroke() # pupil cr.arc(pupilX, pupilY, pupilSize, 0, 2 * math.pi) cr.set_source_rgb(0, 0, 0) cr.fill() return True
walterbender/speak
eye.py
Python
gpl-3.0
4,073
# -*- coding: utf-8 -*- # This file is part of emesene. # # emesene is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # emesene is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with emesene; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA '''This module contains the ChatTextEdit class''' import logging import PyQt4.QtGui as QtGui import PyQt4.QtCore as QtCore from e3.common import MessageFormatter import gui from gui.base import Plus from gui.base import Desktop log = logging.getLogger('qt4ui.widgets.ChatOutput') class ChatOutput (gui.base.OutputText, QtGui.QTextBrowser): '''A widget which displays various messages of a conversation''' NAME = 'Output Text' DESCRIPTION = _('A widget to display the conversation messages') AUTHOR = 'Gabriele "Whisky" Visconti' WEBSITE = '' search_request = QtCore.pyqtSignal(basestring) def __init__(self, config, parent=None): '''Constructor''' QtGui.QTextBrowser.__init__(self, parent) gui.base.OutputText.__init__(self, config) self.formatter = MessageFormatter() self._chat_text = QtCore.QString('') self.setOpenLinks(False) self.anchorClicked.connect(self._on_link_clicked) self.clear() def _on_link_clicked(self, url): href = unicode(url.toString()) if href.startswith("search://"): self.search_request.emit(href) return if not href.startswith("file://"): Desktop.open(href) return def clear(self, source="", target="", target_display="", source_img="", target_img=""): '''clear the content''' QtGui.QTextBrowser.clear(self) self._chat_text = QtCore.QString('') gui.base.OutputText.clear(self) def add_message(self, msg, scroll): if msg.type == "status": msg.message = Plus.msnplus_strip(msg.message) text = self.formatter.format_information(msg.message) else: msg.alias = Plus.msnplus_strip(msg.alias) msg.display_name = Plus.msnplus_strip(msg.display_name) text = self.formatter.format(msg) self._append_to_chat(text, scroll) def _append_to_chat(self, html_string, scroll): '''Method that appends an html string to the chat view''' vert_scroll_bar = self.verticalScrollBar() position = vert_scroll_bar.value() self._chat_text.append(html_string) self.setText(self._chat_text) if scroll: vert_scroll_bar.setValue(vert_scroll_bar.maximum()) else: vert_scroll_bar.setValue(position) def update_p2p(self, account, _type, *what): ''' new p2p data has been received (custom emoticons) ''' #FIXME: pass
tiancj/emesene
emesene/gui/qt4ui/widgets/ChatOutput.py
Python
gpl-3.0
3,318
#!/usr/bin/env python2 # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai from __future__ import (unicode_literals, division, absolute_import, print_function) ''' Created on 29 Jun 2012 @author: charles ''' import socket, select, json, os, traceback, time, sys, random import posixpath from collections import defaultdict import hashlib, threading import Queue from functools import wraps from errno import EAGAIN, EINTR from threading import Thread from calibre import prints from calibre.constants import numeric_version, DEBUG, cache_dir from calibre.devices.errors import (OpenFailed, OpenFeedback, ControlError, TimeoutError, InitialConnectionError, PacketError) from calibre.devices.interface import DevicePlugin, currently_connected_device from calibre.devices.usbms.books import Book, CollectionsBookList from calibre.devices.usbms.deviceconfig import DeviceConfig from calibre.devices.usbms.driver import USBMS from calibre.devices.utils import build_template_regexp from calibre.ebooks import BOOK_EXTENSIONS from calibre.ebooks.metadata import title_sort from calibre.ebooks.metadata.book.base import Metadata from calibre.ebooks.metadata.book.json_codec import JsonCodec from calibre.library import current_library_name from calibre.library.server import server_config as content_server_config from calibre.ptempfile import PersistentTemporaryFile from calibre.utils.ipc import eintr_retry_call from calibre.utils.config_base import tweaks from calibre.utils.filenames import ascii_filename as sanitize, shorten_components_to from calibre.utils.mdns import (publish as publish_zeroconf, unpublish as unpublish_zeroconf, get_all_ips) from calibre.utils.socket_inheritance import set_socket_inherit def synchronous(tlockname): """A decorator to place an instance based lock around a method """ def _synched(func): @wraps(func) def _synchronizer(self, *args, **kwargs): with self.__getattribute__(tlockname): return func(self, *args, **kwargs) return _synchronizer return _synched class ConnectionListener(Thread): def __init__(self, driver): Thread.__init__(self) self.daemon = True self.driver = driver self.keep_running = True self.all_ip_addresses = dict() def stop(self): self.keep_running = False def run(self): device_socket = None get_all_ips(reinitialize=True) while self.keep_running: try: time.sleep(1) except: # Happens during interpreter shutdown break if not self.keep_running: break if not self.all_ip_addresses: self.all_ip_addresses = get_all_ips() if self.all_ip_addresses: self.driver._debug("All IP addresses", self.all_ip_addresses) if not self.driver.connection_queue.empty(): d = currently_connected_device.device if d is not None: self.driver._debug('queue not serviced', d.get_gui_name()) try: sock = self.driver.connection_queue.get_nowait() s = self.driver._json_encode( self.driver.opcodes['CALIBRE_BUSY'], {'otherDevice': d.get_gui_name()}) self.driver._send_byte_string(device_socket, (b'%d' % len(s)) + s) sock.close() except Queue.Empty: pass if getattr(self.driver, 'broadcast_socket', None) is not None: while True: ans = select.select((self.driver.broadcast_socket,), (), (), 0) if len(ans[0]) > 0: try: packet = self.driver.broadcast_socket.recvfrom(100) remote = packet[1] content_server_port = b'' try : content_server_port = \ str(content_server_config().parse().port) except: pass message = str(self.driver.ZEROCONF_CLIENT_STRING + b' (on ' + str(socket.gethostname().partition('.')[0]) + b');' + content_server_port + b',' + str(self.driver.port)) self.driver._debug('received broadcast', packet, message) self.driver.broadcast_socket.sendto(message, remote) except: pass else: break if self.driver.connection_queue.empty() and \ getattr(self.driver, 'listen_socket', None) is not None: ans = select.select((self.driver.listen_socket,), (), (), 0) if len(ans[0]) > 0: # timeout in 100 ms to detect rare case where the socket goes # away between the select and the accept try: self.driver._debug('attempt to open device socket') device_socket = None self.driver.listen_socket.settimeout(0.100) device_socket, ign = eintr_retry_call( self.driver.listen_socket.accept) set_socket_inherit(device_socket, False) self.driver.listen_socket.settimeout(None) device_socket.settimeout(None) try: self.driver.connection_queue.put_nowait(device_socket) except Queue.Full: device_socket.close() device_socket = None self.driver._debug('driver is not answering') except socket.timeout: pass except socket.error: x = sys.exc_info()[1] self.driver._debug('unexpected socket exception', x.args[0]) device_socket.close() device_socket = None # raise class SDBook(Book): def __init__(self, prefix, lpath, size=None, other=None): Book.__init__(self, prefix, lpath, size=size, other=other) path = getattr(self, 'path', lpath) self.path = path.replace('\\', '/') class SMART_DEVICE_APP(DeviceConfig, DevicePlugin): name = 'SmartDevice App Interface' gui_name = _('Wireless Device') gui_name_template = '%s: %s' icon = I('devices/tablet.png') description = _('Communicate with Smart Device apps') supported_platforms = ['windows', 'osx', 'linux'] author = 'Charles Haley' version = (0, 0, 1) # Invalid USB vendor information so the scanner will never match VENDOR_ID = [0xffff] PRODUCT_ID = [0xffff] BCD = [0xffff] FORMATS = list(BOOK_EXTENSIONS) ALL_FORMATS = list(BOOK_EXTENSIONS) HIDE_FORMATS_CONFIG_BOX = True USER_CAN_ADD_NEW_FORMATS = False DEVICE_PLUGBOARD_NAME = 'SMART_DEVICE_APP' CAN_SET_METADATA = [] CAN_DO_DEVICE_DB_PLUGBOARD = False SUPPORTS_SUB_DIRS = True MUST_READ_METADATA = True NEWS_IN_FOLDER = True SUPPORTS_USE_AUTHOR_SORT = False WANTS_UPDATED_THUMBNAILS = True MANAGES_DEVICE_PRESENCE = True # Guess about the max length on windows. This number will be reduced by # the length of the path on the client, and by the fudge factor below. We # use this on all platforms because the device might be connected to windows # in the future. MAX_PATH_LEN = 250 # guess of length of MTP name. The length of the full path to the folder # on the device is added to this. That path includes the device's mount point # making this number effectively around 10 to 15 larger. PATH_FUDGE_FACTOR = 40 THUMBNAIL_HEIGHT = 160 DEFAULT_THUMBNAIL_HEIGHT = 160 THUMBNAIL_COMPRESSION_QUALITY = 75 DEFAULT_THUMBNAIL_COMPRESSION_QUALITY = 75 PREFIX = '' BACKLOADING_ERROR_MESSAGE = None SAVE_TEMPLATE = '{title} - {authors} ({id})' # Some network protocol constants BASE_PACKET_LEN = 4096 PROTOCOL_VERSION = 1 MAX_CLIENT_COMM_TIMEOUT = 300.0 # Wait at most N seconds for an answer MAX_UNSUCCESSFUL_CONNECTS = 5 SEND_NOOP_EVERY_NTH_PROBE = 5 DISCONNECT_AFTER_N_SECONDS = 30*60 # 30 minutes PURGE_CACHE_ENTRIES_DAYS = 30 CURRENT_CC_VERSION = 128 ZEROCONF_CLIENT_STRING = b'calibre wireless device client' # A few "random" port numbers to use for detecting clients using broadcast # The clients are expected to broadcast a UDP 'hi there' on all of these # ports when they attempt to connect. Calibre will respond with the port # number the client should use. This scheme backs up mdns. And yes, we # must hope that no other application on the machine is using one of these # ports in datagram mode. # If you change the ports here, all clients will also need to change. BROADCAST_PORTS = [54982, 48123, 39001, 44044, 59678] opcodes = { 'NOOP' : 12, 'OK' : 0, 'BOOK_DONE' : 11, 'CALIBRE_BUSY' : 18, 'SET_LIBRARY_INFO' : 19, 'DELETE_BOOK' : 13, 'DISPLAY_MESSAGE' : 17, 'FREE_SPACE' : 5, 'GET_BOOK_FILE_SEGMENT' : 14, 'GET_BOOK_METADATA' : 15, 'GET_BOOK_COUNT' : 6, 'GET_DEVICE_INFORMATION' : 3, 'GET_INITIALIZATION_INFO': 9, 'SEND_BOOKLISTS' : 7, 'SEND_BOOK' : 8, 'SEND_BOOK_METADATA' : 16, 'SET_CALIBRE_DEVICE_INFO': 1, 'SET_CALIBRE_DEVICE_NAME': 2, 'TOTAL_SPACE' : 4, } reverse_opcodes = dict([(v, k) for k,v in opcodes.iteritems()]) MESSAGE_PASSWORD_ERROR = 1 MESSAGE_UPDATE_NEEDED = 2 MESSAGE_SHOW_TOAST = 3 ALL_BY_TITLE = _('All by title') ALL_BY_AUTHOR = _('All by author') ALL_BY_SOMETHING = _('All by something') EXTRA_CUSTOMIZATION_MESSAGE = [ _('Enable connections at startup') + ':::<p>' + _('Check this box to allow connections when calibre starts') + '</p>', '', _('Security password') + ':::<p>' + _('Enter a password that the device app must use to connect to calibre') + '</p>', '', _('Use fixed network port') + ':::<p>' + _('If checked, use the port number in the "Port" box, otherwise ' 'the driver will pick a random port') + '</p>', _('Port number: ') + ':::<p>' + _('Enter the port number the driver is to use if the "fixed port" box is checked') + '</p>', _('Print extra debug information') + ':::<p>' + _('Check this box if requested when reporting problems') + '</p>', '', _('Comma separated list of metadata fields ' 'to turn into collections on the device.') + ':::<p>' + _('Possibilities include: series, tags, authors, etc' + '. Three special collections are available: %(abt)s:%(abtv)s, ' '%(aba)s:%(abav)s, and %(abs)s:%(absv)s. Add ' 'these values to the list to enable them. The collections will be ' 'given the name provided after the ":" character.')%dict( abt='abt', abtv=ALL_BY_TITLE, aba='aba', abav=ALL_BY_AUTHOR, abs='abs', absv=ALL_BY_SOMETHING), '', _('Enable the no-activity timeout') + ':::<p>' + _('If this box is checked, calibre will automatically disconnect if ' 'a connected device does nothing for %d minutes. Unchecking this ' ' box disables this timeout, so calibre will never automatically ' 'disconnect.')%(DISCONNECT_AFTER_N_SECONDS/60,) + '</p>', _('Use this IP address') + ':::<p>' + _('Use this option if you want to force the driver to listen on a ' 'particular IP address. The driver will listen only on the ' 'entered address, and this address will be the one advertized ' 'over mDNS (bonjour).') + '</p>', _('Replace books with same calibre ID') + ':::<p>' + _('Use this option to overwrite a book on the device if that book ' 'has the same calibre identifier as the book being sent. The file name of the ' 'book will not change even if the save template produces a ' 'different result. Using this option in most cases prevents ' 'having multiple copies of a book on the device.') + '</p>', _('Cover thumbnail compression quality') + ':::<p>' + _('Use this option to control the size and quality of the cover ' 'file sent to the device. It must be between 50 and 99. ' 'The larger the number the higher quality the cover, but also ' 'the larger the file. For example, changing this from 70 to 90 ' 'results in a much better cover that is approximately 2.5 ' 'times as big. To see the changes you must force calibre ' 'to resend metadata to the device, either by changing ' 'the metadata for the book (updating the last modification ' 'time) or resending the book itself.') + '</p>', _('Use metadata cache') + ':::<p>' + _('Setting this option allows calibre to keep a copy of metadata ' 'on the device, speeding up device connections. Unsetting this ' 'option disables keeping the copy, forcing the device to send ' 'metadata to calibre on every connect. Unset this option if ' 'you think that the cache might not be operating correctly.') + '</p>', ] EXTRA_CUSTOMIZATION_DEFAULT = [ False, '', '', '', False, '9090', False, '', '', '', False, '', True, '75', True ] OPT_AUTOSTART = 0 OPT_PASSWORD = 2 OPT_USE_PORT = 4 OPT_PORT_NUMBER = 5 OPT_EXTRA_DEBUG = 6 OPT_COLLECTIONS = 8 OPT_AUTODISCONNECT = 10 OPT_FORCE_IP_ADDRESS = 11 OPT_OVERWRITE_BOOKS_UUID = 12 OPT_COMPRESSION_QUALITY = 13 OPT_USE_METADATA_CACHE = 14 def __init__(self, path): self.sync_lock = threading.RLock() self.noop_counter = 0 self.debug_start_time = time.time() self.debug_time = time.time() self.is_connected = False def _debug(self, *args): # manual synchronization so we don't lose the calling method name import inspect with self.sync_lock: if not DEBUG: return total_elapsed = time.time() - self.debug_start_time elapsed = time.time() - self.debug_time print('SMART_DEV (%7.2f:%7.3f) %s'%(total_elapsed, elapsed, inspect.stack()[1][3]), end='') for a in args: try: if isinstance(a, dict): printable = {} for k,v in a.iteritems(): if isinstance(v, (str, unicode)) and len(v) > 50: printable[k] = 'too long' else: printable[k] = v prints('', printable, end='') else: prints('', a, end='') except: prints('', 'value too long', end='') print() self.debug_time = time.time() # local utilities # copied from USBMS. Perhaps this could be a classmethod in usbms? def _update_driveinfo_record(self, dinfo, prefix, location_code, name=None): from calibre.utils.date import isoformat, now import uuid if not isinstance(dinfo, dict): dinfo = {} if dinfo.get('device_store_uuid', None) is None: dinfo['device_store_uuid'] = unicode(uuid.uuid4()) if dinfo.get('device_name') is None: dinfo['device_name'] = self.get_gui_name() if name is not None: dinfo['device_name'] = name dinfo['location_code'] = location_code dinfo['last_library_uuid'] = getattr(self, 'current_library_uuid', None) dinfo['calibre_version'] = '.'.join([unicode(i) for i in numeric_version]) dinfo['date_last_connected'] = isoformat(now()) dinfo['prefix'] = self.PREFIX return dinfo # copied with changes from USBMS.Device. In particular, we needed to # remove the 'path' argument and all its uses. Also removed the calls to # filename_callback and sanitize_path_components def _create_upload_path(self, mdata, fname, create_dirs=True): fname = sanitize(fname) ext = os.path.splitext(fname)[1] try: # If we have already seen this book's UUID, use the existing path if self.settings().extra_customization[self.OPT_OVERWRITE_BOOKS_UUID]: existing_book = self._uuid_in_cache(mdata.uuid, ext) if (existing_book and existing_book.lpath and self.known_metadata.get(existing_book.lpath, None)): return existing_book.lpath # If the device asked for it, try to use the UUID as the file name. # Fall back to the ch if the UUID doesn't exist. if self.client_wants_uuid_file_names and mdata.uuid: return (mdata.uuid + ext) except: pass dotless_ext = ext[1:] if len(ext) > 0 else ext maxlen = (self.MAX_PATH_LEN - (self.PATH_FUDGE_FACTOR + self.exts_path_lengths.get(dotless_ext, self.PATH_FUDGE_FACTOR))) special_tag = None if mdata.tags: for t in mdata.tags: if t.startswith(_('News')) or t.startswith('/'): special_tag = t break settings = self.settings() template = self.save_template() if mdata.tags and _('News') in mdata.tags: try: p = mdata.pubdate date = (p.year, p.month, p.day) except: today = time.localtime() date = (today[0], today[1], today[2]) template = "{title}_%d-%d-%d" % date use_subdirs = self.SUPPORTS_SUB_DIRS and settings.use_subdirs from calibre.library.save_to_disk import get_components from calibre.library.save_to_disk import config opts = config().parse() if not isinstance(template, unicode): template = template.decode('utf-8') app_id = str(getattr(mdata, 'application_id', '')) id_ = mdata.get('id', fname) extra_components = get_components(template, mdata, id_, timefmt=opts.send_timefmt, length=maxlen-len(app_id)-1, last_has_extension=False) if not extra_components: extra_components.append(sanitize(fname)) else: extra_components[-1] = sanitize(extra_components[-1]+ext) if extra_components[-1] and extra_components[-1][0] in ('.', '_'): extra_components[-1] = 'x' + extra_components[-1][1:] if special_tag is not None: name = extra_components[-1] extra_components = [] tag = special_tag if tag.startswith(_('News')): if self.NEWS_IN_FOLDER: extra_components.append('News') else: for c in tag.split('/'): c = sanitize(c) if not c: continue extra_components.append(c) extra_components.append(name) if not use_subdirs: # Leave this stuff here in case we later decide to use subdirs extra_components = extra_components[-1:] def remove_trailing_periods(x): ans = x while ans.endswith('.'): ans = ans[:-1].strip() if not ans: ans = 'x' return ans extra_components = list(map(remove_trailing_periods, extra_components)) components = shorten_components_to(maxlen, extra_components) filepath = posixpath.join(*components) self._debug('lengths', dotless_ext, maxlen, self.exts_path_lengths.get(dotless_ext, self.PATH_FUDGE_FACTOR), len(filepath)) return filepath def _strip_prefix(self, path): if self.PREFIX and path.startswith(self.PREFIX): return path[len(self.PREFIX):] return path # JSON booklist encode & decode # If the argument is a booklist or contains a book, use the metadata json # codec to first convert it to a string dict def _json_encode(self, op, arg): res = {} for k,v in arg.iteritems(): if isinstance(v, (Book, Metadata)): res[k] = self.json_codec.encode_book_metadata(v) series = v.get('series', None) if series: tsorder = tweaks['save_template_title_series_sorting'] series = title_sort(series, order=tsorder) else: series = '' self._debug('series sort = ', series) res[k]['_series_sort_'] = series else: res[k] = v from calibre.utils.config import to_json return json.dumps([op, res], encoding='utf-8', default=to_json) # Network functions def _read_binary_from_net(self, length): try: self.device_socket.settimeout(self.MAX_CLIENT_COMM_TIMEOUT) v = self.device_socket.recv(length) self.device_socket.settimeout(None) return v except: self._close_device_socket() raise def _read_string_from_net(self): data = bytes(0) while True: dex = data.find(b'[') if dex >= 0: break # recv seems to return a pointer into some internal buffer. # Things get trashed if we don't make a copy of the data. v = self._read_binary_from_net(2) if len(v) == 0: return '' # documentation says the socket is broken permanently. data += v total_len = int(data[:dex]) data = data[dex:] pos = len(data) while pos < total_len: v = self._read_binary_from_net(total_len - pos) if len(v) == 0: return '' # documentation says the socket is broken permanently. data += v pos += len(v) return data def _send_byte_string(self, sock, s): if not isinstance(s, bytes): self._debug('given a non-byte string!') self._close_device_socket() raise PacketError("Internal error: found a string that isn't bytes") sent_len = 0 total_len = len(s) while sent_len < total_len: try: sock.settimeout(self.MAX_CLIENT_COMM_TIMEOUT) if sent_len == 0: amt_sent = sock.send(s) else: amt_sent = sock.send(s[sent_len:]) sock.settimeout(None) if amt_sent <= 0: raise IOError('Bad write on socket') sent_len += amt_sent except socket.error as e: self._debug('socket error', e, e.errno) if e.args[0] != EAGAIN and e.args[0] != EINTR: self._close_device_socket() raise time.sleep(0.1) # lets not hammer the OS too hard except: self._close_device_socket() raise # This must be protected by a lock because it is called from the GUI thread # (the sync stuff) and the device manager thread @synchronous('sync_lock') def _call_client(self, op, arg, print_debug_info=True, wait_for_response=True): if op != 'NOOP': self.noop_counter = 0 extra_debug = self.settings().extra_customization[self.OPT_EXTRA_DEBUG] if print_debug_info or extra_debug: if extra_debug: self._debug(op, 'wfr', wait_for_response, arg) else: self._debug(op, 'wfr', wait_for_response) if self.device_socket is None: return None, None try: s = self._json_encode(self.opcodes[op], arg) if print_debug_info and extra_debug: self._debug('send string', s) self._send_byte_string(self.device_socket, (b'%d' % len(s)) + s) if not wait_for_response: return None, None return self._receive_from_client(print_debug_info=print_debug_info) except socket.timeout: self._debug('timeout communicating with device') self._close_device_socket() raise TimeoutError('Device did not respond in reasonable time') except socket.error: self._debug('device went away') self._close_device_socket() raise ControlError(desc='Device closed the network connection') except: self._debug('other exception') traceback.print_exc() self._close_device_socket() raise raise ControlError(desc='Device responded with incorrect information') def _receive_from_client(self, print_debug_info=True): from calibre.utils.config import from_json extra_debug = self.settings().extra_customization[self.OPT_EXTRA_DEBUG] try: v = self._read_string_from_net() if print_debug_info and extra_debug: self._debug('received string', v) if v: v = json.loads(v, object_hook=from_json) if print_debug_info and extra_debug: self._debug('receive after decode') # , v) return (self.reverse_opcodes[v[0]], v[1]) self._debug('protocol error -- empty json string') except socket.timeout: self._debug('timeout communicating with device') self._close_device_socket() raise TimeoutError('Device did not respond in reasonable time') except socket.error: self._debug('device went away') self._close_device_socket() raise ControlError(desc='Device closed the network connection') except: self._debug('other exception') traceback.print_exc() self._close_device_socket() raise raise ControlError(desc='Device responded with incorrect information') # Write a file to the device as a series of binary strings. def _put_file(self, infile, lpath, book_metadata, this_book, total_books): close_ = False if not hasattr(infile, 'read'): infile, close_ = lopen(infile, 'rb'), True infile.seek(0, os.SEEK_END) length = infile.tell() book_metadata.size = length infile.seek(0) opcode, result = self._call_client('SEND_BOOK', {'lpath': lpath, 'length': length, 'metadata': book_metadata, 'thisBook': this_book, 'totalBooks': total_books, 'willStreamBooks': True, 'willStreamBinary' : True, 'wantsSendOkToSendbook' : self.can_send_ok_to_sendbook, 'canSupportLpathChanges': True}, print_debug_info=False, wait_for_response=self.can_send_ok_to_sendbook) if self.can_send_ok_to_sendbook: lpath = result.get('lpath', lpath) book_metadata.lpath = lpath self._set_known_metadata(book_metadata) pos = 0 failed = False with infile: while True: b = infile.read(self.max_book_packet_len) blen = len(b) if not b: break self._send_byte_string(self.device_socket, b) pos += blen self.time = None if close_: infile.close() return (-1, None) if failed else (length, lpath) def _get_smartdevice_option_number(self, opt_string): if opt_string == 'password': return self.OPT_PASSWORD elif opt_string == 'autostart': return self.OPT_AUTOSTART elif opt_string == 'use_fixed_port': return self.OPT_USE_PORT elif opt_string == 'port_number': return self.OPT_PORT_NUMBER elif opt_string == 'force_ip_address': return self.OPT_FORCE_IP_ADDRESS elif opt_string == 'thumbnail_compression_quality': return self.OPT_COMPRESSION_QUALITY else: return None def _metadata_in_cache(self, uuid, ext_or_lpath, lastmod): from calibre.utils.date import now, parse_date try: key = self._make_metadata_cache_key(uuid, ext_or_lpath) if isinstance(lastmod, unicode): if lastmod == 'None': return None lastmod = parse_date(lastmod) if key in self.device_book_cache and self.device_book_cache[key]['book'].last_modified == lastmod: self.device_book_cache[key]['last_used'] = now() return self.device_book_cache[key]['book'].deepcopy(lambda : SDBook('', '')) except: traceback.print_exc() return None def _metadata_already_on_device(self, book): try: v = self.known_metadata.get(book.lpath, None) if v is not None: # Metadata is the same if the uuids match, if the last_modified dates # match, and if the height of the thumbnails is the same. The last # is there to allow a device to demand a different thumbnail size if (v.get('uuid', None) == book.get('uuid', None) and v.get('last_modified', None) == book.get('last_modified', None)): v_thumb = v.get('thumbnail', None) b_thumb = book.get('thumbnail', None) if bool(v_thumb) != bool(b_thumb): return False return not v_thumb or v_thumb[1] == b_thumb[1] except: traceback.print_exc() return False def _uuid_in_cache(self, uuid, ext): try: for b in self.device_book_cache.itervalues(): metadata = b['book'] if metadata.get('uuid', '') != uuid: continue if metadata.get('lpath', '').endswith(ext): return metadata except: traceback.print_exc() return None def _read_metadata_cache(self): self._debug('device uuid', self.device_uuid) from calibre.utils.config import from_json try: old_cache_file_name = os.path.join(cache_dir(), 'device_drivers_' + self.__class__.__name__ + '_metadata_cache.pickle') if os.path.exists(old_cache_file_name): os.remove(old_cache_file_name) except: pass try: old_cache_file_name = os.path.join(cache_dir(), 'device_drivers_' + self.__class__.__name__ + '_metadata_cache.json') if os.path.exists(old_cache_file_name): os.remove(old_cache_file_name) except: pass cache_file_name = os.path.join(cache_dir(), 'wireless_device_' + self.device_uuid + '_metadata_cache.json') self.device_book_cache = defaultdict(dict) self.known_metadata = {} try: count = 0 if os.path.exists(cache_file_name): with lopen(cache_file_name, mode='rb') as fd: while True: rec_len = fd.readline() if len(rec_len) != 8: break raw = fd.read(int(rec_len)) book = json.loads(raw.decode('utf-8'), object_hook=from_json) key = book.keys()[0] metadata = self.json_codec.raw_to_book(book[key]['book'], SDBook, self.PREFIX) book[key]['book'] = metadata self.device_book_cache.update(book) lpath = metadata.get('lpath') self.known_metadata[lpath] = metadata count += 1 self._debug('loaded', count, 'cache items') except: traceback.print_exc() self.device_book_cache = defaultdict(dict) self.known_metadata = {} try: if os.path.exists(cache_file_name): os.remove(cache_file_name) except: traceback.print_exc() def _write_metadata_cache(self): self._debug() from calibre.utils.date import now now_ = now() from calibre.utils.config import to_json try: purged = 0 count = 0 prefix = os.path.join(cache_dir(), 'wireless_device_' + self.device_uuid + '_metadata_cache') with lopen(prefix + '.tmp', mode='wb') as fd: for key,book in self.device_book_cache.iteritems(): if (now_ - book['last_used']).days > self.PURGE_CACHE_ENTRIES_DAYS: purged += 1 continue json_metadata = defaultdict(dict) json_metadata[key]['book'] = self.json_codec.encode_book_metadata(book['book']) json_metadata[key]['last_used'] = book['last_used'] result = json.dumps(json_metadata, indent=2, default=to_json) fd.write("%0.7d\n"%(len(result)+1)) fd.write(result) fd.write('\n') count += 1 self._debug('wrote', count, 'entries, purged', purged, 'entries') from calibre.utils.filenames import atomic_rename atomic_rename(fd.name, prefix + '.json') except: traceback.print_exc() def _make_metadata_cache_key(self, uuid, lpath_or_ext): key = None if uuid and lpath_or_ext: key = uuid + lpath_or_ext return key def _set_known_metadata(self, book, remove=False): from calibre.utils.date import now lpath = book.lpath ext = os.path.splitext(lpath)[1] uuid = book.get('uuid', None) if self.client_cache_uses_lpaths: key = self._make_metadata_cache_key(uuid, lpath) else: key = self._make_metadata_cache_key(uuid, ext) if remove: self.known_metadata.pop(lpath, None) if key: self.device_book_cache.pop(key, None) else: # Check if we have another UUID with the same lpath. If so, remove it # Must try both the extension and the lpath because of the cache change existing_uuid = self.known_metadata.get(lpath, {}).get('uuid', None) if existing_uuid and existing_uuid != uuid: self.device_book_cache.pop(self._make_metadata_cache_key(existing_uuid, ext), None) self.device_book_cache.pop(self._make_metadata_cache_key(existing_uuid, lpath), None) new_book = book.deepcopy() self.known_metadata[lpath] = new_book if key: self.device_book_cache[key]['book'] = new_book self.device_book_cache[key]['last_used'] = now() def _close_device_socket(self): if self.device_socket is not None: try: self.device_socket.close() except: pass self.device_socket = None self._write_metadata_cache() self.is_connected = False def _attach_to_port(self, sock, port): try: ip_addr = self.settings().extra_customization[self.OPT_FORCE_IP_ADDRESS] self._debug('try ip address "'+ ip_addr + '"', 'on port', port) if ip_addr: sock.bind((ip_addr, port)) else: sock.bind(('', port)) except socket.error: self._debug('socket error on port', port) port = 0 except: self._debug('Unknown exception while attaching port to socket') traceback.print_exc() raise return port def _close_listen_socket(self): self.listen_socket.close() self.listen_socket = None self.is_connected = False if getattr(self, 'broadcast_socket', None) is not None: self.broadcast_socket.close() self.broadcast_socket = None def _read_file_metadata(self, temp_file_name): from calibre.ebooks.metadata.meta import get_metadata from calibre.customize.ui import quick_metadata ext = temp_file_name.rpartition('.')[-1].lower() with lopen(temp_file_name, 'rb') as stream: with quick_metadata: return get_metadata(stream, stream_type=ext, force_read_metadata=True, pattern=build_template_regexp(self.save_template())) # The public interface methods. @synchronous('sync_lock') def detect_managed_devices(self, devices_on_system, force_refresh=False): if getattr(self, 'listen_socket', None) is None: self.is_connected = False if self.is_connected: self.noop_counter += 1 if (self.noop_counter > self.SEND_NOOP_EVERY_NTH_PROBE and (self.noop_counter % self.SEND_NOOP_EVERY_NTH_PROBE) != 1): try: ans = select.select((self.device_socket,), (), (), 0) if len(ans[0]) == 0: return self # The socket indicates that something is there. Given the # protocol, this can only be a disconnect notification. Fall # through and actually try to talk to the client. # This will usually toss an exception if the socket is gone. except: pass if (self.settings().extra_customization[self.OPT_AUTODISCONNECT] and self.noop_counter > self.DISCONNECT_AFTER_N_SECONDS): self._close_device_socket() self._debug('timeout -- disconnected') else: try: if self._call_client('NOOP', dict())[0] is None: self._close_device_socket() except: self._close_device_socket() return self if self.is_connected else None if getattr(self, 'listen_socket', None) is not None: try: ans = self.connection_queue.get_nowait() self.device_socket = ans self.is_connected = True try: peer = self.device_socket.getpeername()[0] attempts = self.connection_attempts.get(peer, 0) if attempts >= self.MAX_UNSUCCESSFUL_CONNECTS: self._debug('too many connection attempts from', peer) self._close_device_socket() raise InitialConnectionError(_('Too many connection attempts from %s') % peer) else: self.connection_attempts[peer] = attempts + 1 except InitialConnectionError: raise except: pass except Queue.Empty: self.is_connected = False return self if self.is_connected else None return None @synchronous('sync_lock') def debug_managed_device_detection(self, devices_on_system, output): from functools import partial p = partial(prints, file=output) if self.is_connected: p("A wireless device is connected") return True all_ip_addresses = get_all_ips() if all_ip_addresses: p("All IP addresses", all_ip_addresses) else: p("No IP addresses found") p("No device is connected") return False @synchronous('sync_lock') def open(self, connected_device, library_uuid): from calibre.utils.date import isoformat, now self._debug() if not self.is_connected: # We have been called to retry the connection. Give up immediately raise ControlError(desc='Attempt to open a closed device') self.current_library_uuid = library_uuid self.current_library_name = current_library_name() self.device_uuid = '' try: password = self.settings().extra_customization[self.OPT_PASSWORD] if password: challenge = isoformat(now()) hasher = hashlib.new('sha1') hasher.update(password.encode('UTF-8')) hasher.update(challenge.encode('UTF-8')) hash_digest = hasher.hexdigest() else: challenge = '' hash_digest = '' opcode, result = self._call_client('GET_INITIALIZATION_INFO', {'serverProtocolVersion': self.PROTOCOL_VERSION, 'validExtensions': self.ALL_FORMATS, 'passwordChallenge': challenge, 'currentLibraryName': self.current_library_name, 'currentLibraryUUID': library_uuid, 'pubdateFormat': tweaks['gui_pubdate_display_format'], 'timestampFormat': tweaks['gui_timestamp_display_format'], 'lastModifiedFormat': tweaks['gui_last_modified_display_format'], 'calibre_version': numeric_version, 'canSupportUpdateBooks': True, 'canSupportLpathChanges': True}) if opcode != 'OK': # Something wrong with the return. Close the socket # and continue. self._debug('Protocol error - Opcode not OK') self._close_device_socket() return False if not result.get('versionOK', False): # protocol mismatch self._debug('Protocol error - protocol version mismatch') self._close_device_socket() return False if result.get('maxBookContentPacketLen', 0) <= 0: # protocol mismatch self._debug('Protocol error - bogus book packet length') self._close_device_socket() return False # Set up to recheck the sync columns self.have_checked_sync_columns = False client_can_stream_books = result.get('canStreamBooks', False) self._debug('Device can stream books', client_can_stream_books) client_can_stream_metadata = result.get('canStreamMetadata', False) self._debug('Device can stream metadata', client_can_stream_metadata) client_can_receive_book_binary = result.get('canReceiveBookBinary', False) self._debug('Device can receive book binary', client_can_receive_book_binary) client_can_delete_multiple = result.get('canDeleteMultipleBooks', False) self._debug('Device can delete multiple books', client_can_delete_multiple) if not (client_can_stream_books and client_can_stream_metadata and client_can_receive_book_binary and client_can_delete_multiple): self._debug('Software on device too old') self._close_device_socket() raise OpenFeedback(_('The app on your device is too old and is no ' 'longer supported. Update it to a newer version.')) self.client_can_use_metadata_cache = result.get('canUseCachedMetadata', False) self._debug('Device can use cached metadata', self.client_can_use_metadata_cache) self.client_cache_uses_lpaths = result.get('cacheUsesLpaths', False) self._debug('Cache uses lpaths', self.client_cache_uses_lpaths) self.can_send_ok_to_sendbook = result.get('canSendOkToSendbook', False) self._debug('Can send OK to sendbook', self.can_send_ok_to_sendbook) self.can_accept_library_info = result.get('canAcceptLibraryInfo', False) self._debug('Can accept library info', self.can_accept_library_info) self.will_ask_for_update_books = result.get('willAskForUpdateBooks', False) self._debug('Will ask for update books', self.will_ask_for_update_books) self.set_temp_mark_when_syncing_read = \ result.get('setTempMarkWhenReadInfoSynced', False) self._debug('Will set temp mark when syncing read', self.set_temp_mark_when_syncing_read) if not self.settings().extra_customization[self.OPT_USE_METADATA_CACHE]: self.client_can_use_metadata_cache = False self._debug('metadata caching disabled by option') self.client_device_kind = result.get('deviceKind', '') self._debug('Client device kind', self.client_device_kind) self.client_device_name = result.get('deviceName', self.client_device_kind) self._debug('Client device name', self.client_device_name) self.client_app_name = result.get('appName', "") self._debug('Client app name', self.client_app_name) self.app_version_number = result.get('ccVersionNumber', '0') self._debug('App version #:', self.app_version_number) try: if (self.client_app_name == 'CalibreCompanion' and self.app_version_number < self.CURRENT_CC_VERSION): self._debug('Telling client to update') self._call_client("DISPLAY_MESSAGE", {'messageKind': self.MESSAGE_UPDATE_NEEDED, 'lastestKnownAppVersion': self.CURRENT_CC_VERSION}) except: pass self.max_book_packet_len = result.get('maxBookContentPacketLen', self.BASE_PACKET_LEN) self._debug('max_book_packet_len', self.max_book_packet_len) exts = result.get('acceptedExtensions', None) if exts is None or not isinstance(exts, list) or len(exts) == 0: self._debug('Protocol error - bogus accepted extensions') self._close_device_socket() return False self.client_wants_uuid_file_names = result.get('useUuidFileNames', False) self._debug('Device wants UUID file names', self.client_wants_uuid_file_names) config = self._configProxy() config['format_map'] = exts self._debug('selected formats', config['format_map']) self.exts_path_lengths = result.get('extensionPathLengths', {}) self._debug('extension path lengths', self.exts_path_lengths) self.THUMBNAIL_HEIGHT = result.get('coverHeight', self.DEFAULT_THUMBNAIL_HEIGHT) self._debug('cover height', self.THUMBNAIL_HEIGHT) if 'coverWidth' in result: # Setting this field forces the aspect ratio self.THUMBNAIL_WIDTH = result.get('coverWidth', (self.DEFAULT_THUMBNAIL_HEIGHT/3) * 4) self._debug('cover width', self.THUMBNAIL_WIDTH) elif hasattr(self, 'THUMBNAIL_WIDTH'): delattr(self, 'THUMBNAIL_WIDTH') self.is_read_sync_col = result.get('isReadSyncCol', None) self._debug('Device is_read sync col', self.is_read_sync_col) self.is_read_date_sync_col = result.get('isReadDateSyncCol', None) self._debug('Device is_read_date sync col', self.is_read_date_sync_col) if password: returned_hash = result.get('passwordHash', None) if result.get('passwordHash', None) is None: # protocol mismatch self._debug('Protocol error - missing password hash') self._close_device_socket() return False if returned_hash != hash_digest: # bad password self._debug('password mismatch') try: self._call_client("DISPLAY_MESSAGE", {'messageKind': self.MESSAGE_PASSWORD_ERROR, 'currentLibraryName': self.current_library_name, 'currentLibraryUUID': library_uuid}) except: pass self._close_device_socket() # Don't bother with a message. The user will be informed on # the device. raise OpenFailed('') try: peer = self.device_socket.getpeername()[0] self.connection_attempts[peer] = 0 except: pass return True except socket.timeout: self._close_device_socket() except socket.error: x = sys.exc_info()[1] self._debug('unexpected socket exception', x.args[0]) self._close_device_socket() raise return False def get_gui_name(self): if getattr(self, 'client_device_name', None): return self.gui_name_template%(self.gui_name, self.client_device_name) if getattr(self, 'client_device_kind', None): return self.gui_name_template%(self.gui_name, self.client_device_kind) return self.gui_name def config_widget(self): from calibre.gui2.device_drivers.configwidget import ConfigWidget cw = ConfigWidget(self.settings(), self.FORMATS, self.SUPPORTS_SUB_DIRS, self.MUST_READ_METADATA, self.SUPPORTS_USE_AUTHOR_SORT, self.EXTRA_CUSTOMIZATION_MESSAGE, self) return cw @synchronous('sync_lock') def get_device_information(self, end_session=True): self._debug() self.report_progress(1.0, _('Get device information...')) opcode, result = self._call_client('GET_DEVICE_INFORMATION', dict()) if opcode == 'OK': self.driveinfo = result['device_info'] self._update_driveinfo_record(self.driveinfo, self.PREFIX, 'main') self.device_uuid = self.driveinfo['device_store_uuid'] self._call_client('SET_CALIBRE_DEVICE_INFO', self.driveinfo) self._read_metadata_cache() return (self.get_gui_name(), result['device_version'], result['version'], '', {'main':self.driveinfo}) return (self.get_gui_name(), '', '', '') @synchronous('sync_lock') def set_driveinfo_name(self, location_code, name): self._update_driveinfo_record(self.driveinfo, "main", name) self._call_client('SET_CALIBRE_DEVICE_NAME', {'location_code': 'main', 'name':name}) @synchronous('sync_lock') def reset(self, key='-1', log_packets=False, report_progress=None, detected_device=None) : self._debug() self.set_progress_reporter(report_progress) @synchronous('sync_lock') def set_progress_reporter(self, report_progress): self._debug() self.report_progress = report_progress if self.report_progress is None: self.report_progress = lambda x, y: x @synchronous('sync_lock') def card_prefix(self, end_session=True): self._debug() return (None, None) @synchronous('sync_lock') def total_space(self, end_session=True): self._debug() opcode, result = self._call_client('TOTAL_SPACE', {}) if opcode == 'OK': return (result['total_space_on_device'], 0, 0) # protocol error if we get here return (0, 0, 0) @synchronous('sync_lock') def free_space(self, end_session=True): self._debug() opcode, result = self._call_client('FREE_SPACE', {}) if opcode == 'OK': return (result['free_space_on_device'], 0, 0) # protocol error if we get here return (0, 0, 0) @synchronous('sync_lock') def books(self, oncard=None, end_session=True): self._debug(oncard) if oncard is not None: return CollectionsBookList(None, None, None) opcode, result = self._call_client('GET_BOOK_COUNT', {'canStream':True, 'canScan':True, 'willUseCachedMetadata': self.client_can_use_metadata_cache, 'supportsSync': (bool(self.is_read_sync_col) or bool(self.is_read_date_sync_col)), 'canSupportBookFormatSync': True}) bl = CollectionsBookList(None, self.PREFIX, self.settings) if opcode == 'OK': count = result['count'] will_use_cache = self.client_can_use_metadata_cache if will_use_cache: books_on_device = [] self._debug('caching. count=', count) for i in range(0, count): opcode, result = self._receive_from_client(print_debug_info=False) books_on_device.append(result) self._debug('received all books. count=', count) books_to_send = [] lpaths_on_device = set() for r in books_on_device: if r.get('lpath', None): book = self._metadata_in_cache(r['uuid'], r['lpath'], r['last_modified']) else: book = self._metadata_in_cache(r['uuid'], r['extension'], r['last_modified']) if book: if self.client_cache_uses_lpaths: lpaths_on_device.add(r.get('lpath')) bl.add_book_extended(book, replace_metadata=True, check_for_duplicates=not self.client_cache_uses_lpaths) book.set('_is_read_', r.get('_is_read_', None)) book.set('_sync_type_', r.get('_sync_type_', None)) book.set('_last_read_date_', r.get('_last_read_date_', None)) book.set('_format_mtime_', r.get('_format_mtime_', None)) else: books_to_send.append(r['priKey']) self._debug('processed cache. count=', len(books_on_device)) count_of_cache_items_deleted = 0 if self.client_cache_uses_lpaths: for lpath in tuple(self.known_metadata.iterkeys()): if lpath not in lpaths_on_device: try: uuid = self.known_metadata[lpath].get('uuid', None) if uuid is not None: key = self._make_metadata_cache_key(uuid, lpath) self.device_book_cache.pop(key, None) self.known_metadata.pop(lpath, None) count_of_cache_items_deleted += 1 except: self._debug('Exception while deleting book from caches', lpath) traceback.print_exc() self._debug('removed', count_of_cache_items_deleted, 'books from caches') count = len(books_to_send) self._debug('caching. Need count from device', count) self._call_client('NOOP', {'count': count}, print_debug_info=False, wait_for_response=False) for priKey in books_to_send: self._call_client('NOOP', {'priKey':priKey}, print_debug_info=False, wait_for_response=False) for i in range(0, count): if (i % 100) == 0: self._debug('getting book metadata. Done', i, 'of', count) opcode, result = self._receive_from_client(print_debug_info=False) if opcode == 'OK': try: if '_series_sort_' in result: del result['_series_sort_'] book = self.json_codec.raw_to_book(result, SDBook, self.PREFIX) book.set('_is_read_', result.get('_is_read_', None)) book.set('_sync_type_', result.get('_sync_type_', None)) book.set('_last_read_date_', result.get('_last_read_date_', None)) bl.add_book_extended(book, replace_metadata=True, check_for_duplicates=not self.client_cache_uses_lpaths) if '_new_book_' in result: book.set('_new_book_', True) else: self._set_known_metadata(book) except: self._debug('exception retrieving metadata for book', result.get('title', 'Unknown')) traceback.print_exc() else: raise ControlError(desc='book metadata not returned') total = 0 for book in bl: if book.get('_new_book_', None): total += 1 count = 0 for book in bl: if book.get('_new_book_', None): paths = [book.lpath] self._set_known_metadata(book, remove=True) self.prepare_addable_books(paths, this_book=count, total_books=total) book.smart_update(self._read_file_metadata(paths[0])) del book._new_book_ count += 1 self._debug('finished getting book metadata') return bl @synchronous('sync_lock') def sync_booklists(self, booklists, end_session=True): colattrs = [x.strip() for x in self.settings().extra_customization[self.OPT_COLLECTIONS].split(',')] self._debug('collection attributes', colattrs) coldict = {} if colattrs: collections = booklists[0].get_collections(colattrs) for k,v in collections.iteritems(): lpaths = [] for book in v: lpaths.append(book.lpath) coldict[k] = lpaths # If we ever do device_db plugboards, this is where it will go. We will # probably need to send two booklists, one with calibre's data that is # given back by "books", and one that has been plugboarded. books_to_send = [] for book in booklists[0]: if (book.get('_force_send_metadata_', None) or not self._metadata_already_on_device(book)): books_to_send.append(book) count = len(books_to_send) self._call_client('SEND_BOOKLISTS', {'count': count, 'collections': coldict, 'willStreamMetadata': True, 'supportsSync': (bool(self.is_read_sync_col) or bool(self.is_read_date_sync_col))}, wait_for_response=False) if count: for i,book in enumerate(books_to_send): self._debug('sending metadata for book', book.lpath, book.title) self._set_known_metadata(book) opcode, result = self._call_client( 'SEND_BOOK_METADATA', {'index': i, 'count': count, 'data': book, 'supportsSync': (bool(self.is_read_sync_col) or bool(self.is_read_date_sync_col))}, print_debug_info=False, wait_for_response=False) if not self.have_bad_sync_columns: # Update the local copy of the device's read info just in case # the device is re-synced. This emulates what happens on the device # when the metadata is received. try: if bool(self.is_read_sync_col): book.set('_is_read_', book.get(self.is_read_sync_col, None)) except: self._debug('failed to set local copy of _is_read_') traceback.print_exc() try: if bool(self.is_read_date_sync_col): book.set('_last_read_date_', book.get(self.is_read_date_sync_col, None)) except: self._debug('failed to set local copy of _last_read_date_') traceback.print_exc() # Write the cache here so that if we are interrupted on disconnect then the # almost-latest info will be available. self._write_metadata_cache() @synchronous('sync_lock') def eject(self): self._debug() self._close_device_socket() @synchronous('sync_lock') def post_yank_cleanup(self): self._debug() @synchronous('sync_lock') def upload_books(self, files, names, on_card=None, end_session=True, metadata=None): if self.settings().extra_customization[self.OPT_EXTRA_DEBUG]: self._debug(names) else: self._debug() paths = [] names = iter(names) metadata = iter(metadata) for i, infile in enumerate(files): mdata, fname = metadata.next(), names.next() lpath = self._create_upload_path(mdata, fname, create_dirs=False) self._debug('lpath', lpath) if not hasattr(infile, 'read'): infile = USBMS.normalize_path(infile) book = SDBook(self.PREFIX, lpath, other=mdata) length, lpath = self._put_file(infile, lpath, book, i, len(files)) if length < 0: raise ControlError(desc='Sending book %s to device failed' % lpath) paths.append((lpath, length)) # No need to deal with covers. The client will get the thumbnails # in the mi structure self.report_progress((i + 1) / float(len(files)), _('Transferring books to device...')) self.report_progress(1.0, _('Transferring books to device...')) self._debug('finished uploading %d books' % (len(files))) return paths @synchronous('sync_lock') def add_books_to_metadata(self, locations, metadata, booklists): self._debug('adding metadata for %d books' % (len(metadata))) metadata = iter(metadata) for i, location in enumerate(locations): self.report_progress((i + 1) / float(len(locations)), _('Adding books to device metadata listing...')) info = metadata.next() lpath = location[0] length = location[1] lpath = self._strip_prefix(lpath) book = SDBook(self.PREFIX, lpath, other=info) if book.size is None: book.size = length b = booklists[0].add_book(book, replace_metadata=True) if b: b._new_book = True from calibre.utils.date import isoformat, now b.set('_format_mtime_', isoformat(now())) self.report_progress(1.0, _('Adding books to device metadata listing...')) self._debug('finished adding metadata') @synchronous('sync_lock') def delete_books(self, paths, end_session=True): if self.settings().extra_customization[self.OPT_EXTRA_DEBUG]: self._debug(paths) else: self._debug() new_paths = [] for path in paths: new_paths.append(self._strip_prefix(path)) opcode, result = self._call_client('DELETE_BOOK', {'lpaths': new_paths}) for i in range(0, len(new_paths)): opcode, result = self._receive_from_client(False) self._debug('removed book with UUID', result['uuid']) self._debug('removed', len(new_paths), 'books') @synchronous('sync_lock') def remove_books_from_metadata(self, paths, booklists): if self.settings().extra_customization[self.OPT_EXTRA_DEBUG]: self._debug(paths) else: self._debug() for i, path in enumerate(paths): path = self._strip_prefix(path) self.report_progress((i + 1) / float(len(paths)), _('Removing books from device metadata listing...')) for bl in booklists: for book in bl: if path == book.path: bl.remove_book(book) self._set_known_metadata(book, remove=True) self.report_progress(1.0, _('Removing books from device metadata listing...')) self._debug('finished removing metadata for %d books' % (len(paths))) @synchronous('sync_lock') def get_file(self, path, outfile, end_session=True, this_book=None, total_books=None): if self.settings().extra_customization[self.OPT_EXTRA_DEBUG]: self._debug(path) else: self._debug() eof = False position = 0 while not eof: opcode, result = self._call_client('GET_BOOK_FILE_SEGMENT', {'lpath' : path, 'position': position, 'thisBook': this_book, 'totalBooks': total_books, 'canStream':True, 'canStreamBinary': True}, print_debug_info=False) if opcode == 'OK': length = result.get('fileLength') remaining = length while remaining > 0: v = self._read_binary_from_net(min(remaining, self.max_book_packet_len)) outfile.write(v) remaining -= len(v) eof = True else: raise ControlError(desc='request for book data failed') @synchronous('sync_lock') def prepare_addable_books(self, paths, this_book=None, total_books=None): for idx, path in enumerate(paths): (ign, ext) = os.path.splitext(path) with PersistentTemporaryFile(suffix=ext) as tf: self.get_file(path, tf, this_book=this_book, total_books=total_books) paths[idx] = tf.name tf.name = path return paths @synchronous('sync_lock') def set_plugboards(self, plugboards, pb_func): self._debug() self.plugboards = plugboards self.plugboard_func = pb_func @synchronous('sync_lock') def set_library_info(self, library_name, library_uuid, field_metadata): self._debug(library_name, library_uuid) if self.can_accept_library_info: self._call_client('SET_LIBRARY_INFO', {'libraryName' : library_name, 'libraryUuid': library_uuid, 'fieldMetadata': field_metadata.all_metadata()}, print_debug_info=True) @synchronous('sync_lock') def specialize_global_preferences(self, device_prefs): device_prefs.set_overrides(manage_device_metadata='on_connect') def _show_message(self, message): self._call_client("DISPLAY_MESSAGE", {'messageKind': self.MESSAGE_SHOW_TOAST, 'message': message}) def _check_if_format_send_needed(self, db, id_, book): if not self.will_ask_for_update_books: return (None, False) from calibre.utils.date import parse_date, isoformat try: if not hasattr(book, '_format_mtime_'): return (None, False) ext = posixpath.splitext(book.lpath)[1][1:] fmt_metadata = db.new_api.format_metadata(id_, ext) if fmt_metadata: calibre_mtime = fmt_metadata['mtime'] if calibre_mtime > self.now: if not self.have_sent_future_dated_book_message: self.have_sent_future_dated_book_message = True self._show_message(_('You have book formats in your library ' 'with dates in the future. See calibre ' 'for details')) return (None, True) cc_mtime = parse_date(book.get('_format_mtime_'), as_utc=True) self._debug(book.title, 'cal_mtime', calibre_mtime, 'cc_mtime', cc_mtime) if cc_mtime < calibre_mtime: book.set('_format_mtime_', isoformat(self.now)) return (posixpath.basename(book.lpath), False) except: self._debug('exception checking if must send format', book.title) traceback.print_exc() return (None, False) @synchronous('sync_lock') def synchronize_with_db(self, db, id_, book, first_call): from calibre.utils.date import parse_date, is_date_undefined, now if first_call: self.have_sent_future_dated_book_message = False self.now = now() if self.have_bad_sync_columns or not (self.is_read_sync_col or self.is_read_date_sync_col): # Not syncing or sync columns are invalid return (None, self._check_if_format_send_needed(db, id_, book)) # Check the validity of the columns once per connection. We do it # here because we have access to the db to get field_metadata if not self.have_checked_sync_columns: fm = db.field_metadata.custom_field_metadata() if self.is_read_sync_col: if self.is_read_sync_col not in fm: self._debug('is_read_sync_col not in field_metadata') self._show_message(_("The read sync column %s is " "not in calibre's library")%self.is_read_sync_col) self.have_bad_sync_columns = True elif fm[self.is_read_sync_col]['datatype'] != 'bool': self._debug('is_read_sync_col not bool type') self._show_message(_("The read sync column %s is " "not a Yes/No column")%self.is_read_sync_col) self.have_bad_sync_columns = True if self.is_read_date_sync_col: if self.is_read_date_sync_col not in fm: self._debug('is_read_date_sync_col not in field_metadata') self._show_message(_("The read date sync column %s is " "not in calibre's library")%self.is_read_date_sync_col) self.have_bad_sync_columns = True elif fm[self.is_read_date_sync_col]['datatype'] != 'datetime': self._debug('is_read_date_sync_col not date type') self._show_message(_("The read date sync column %s is " "not a Date column")%self.is_read_date_sync_col) self.have_bad_sync_columns = True self.have_checked_sync_columns = True if self.have_bad_sync_columns: return (None, self._check_if_format_send_needed(db, id_, book)) # if we are marking synced books, clear all the current marks if self.set_temp_mark_when_syncing_read: self._debug('clearing temp marks') db.set_marked_ids(()) sync_type = book.get('_sync_type_', None) # We need to check if our attributes are in the book. If they are not # then this is metadata coming from calibre to the device for the first # time, in which case we must not sync it. if hasattr(book, '_is_read_'): is_read = book.get('_is_read_', None) has_is_read = True else: has_is_read = False if hasattr(book, '_last_read_date_'): # parse_date returns UNDEFINED_DATE if the value is None is_read_date = parse_date(book.get('_last_read_date_', None)) if is_date_undefined(is_read_date): is_read_date = None has_is_read_date = True else: has_is_read_date = False force_return_changed_books = False changed_books = set() if sync_type == 3: # The book metadata was built by the device from metadata in the # book file itself. It must not be synced, because the metadata is # almost surely wrong. However, the fact that we got here means that # book matching has succeeded. Arrange that calibre's metadata is # sent back to the device. This isn't strictly necessary as sending # back the info will be arranged in other ways. self._debug('Book with device-generated metadata', book.get('title', 'huh?')) book.set('_force_send_metadata_', True) force_return_changed_books = True elif sync_type == 2: # This is a special case where the user just set a sync column. In # this case the device value wins if it is not None, otherwise the # calibre value wins. # Check is_read if has_is_read and self.is_read_sync_col: try: calibre_val = db.new_api.field_for(self.is_read_sync_col, id_, default_value=None) if is_read is not None: # The CC value wins. Check if it is different from calibre's # value to avoid updating the db to the same value if is_read != calibre_val: self._debug('special update calibre to is_read', book.get('title', 'huh?'), 'to', is_read, calibre_val) changed_books = db.new_api.set_field(self.is_read_sync_col, {id_: is_read}) if self.set_temp_mark_when_syncing_read: db.data.toggle_marked_ids({id_}) elif calibre_val is not None: # Calibre value wins. Force the metadata for the # book to be sent to the device even if the mod # dates haven't changed. self._debug('special update is_read to calibre value', book.get('title', 'huh?'), 'to', calibre_val) book.set('_force_send_metadata_', True) force_return_changed_books = True except: self._debug('exception special syncing is_read', self.is_read_sync_col) traceback.print_exc() # Check is_read_date. if has_is_read_date and self.is_read_date_sync_col: try: # The db method returns None for undefined dates. calibre_val = db.new_api.field_for(self.is_read_date_sync_col, id_, default_value=None) if is_read_date is not None: if is_read_date != calibre_val: self._debug('special update calibre to is_read_date', book.get('title', 'huh?'), 'to', is_read_date, calibre_val) changed_books |= db.new_api.set_field(self.is_read_date_sync_col, {id_: is_read_date}) if self.set_temp_mark_when_syncing_read: db.data.toggle_marked_ids({id_}) elif calibre_val is not None: self._debug('special update is_read_date to calibre value', book.get('title', 'huh?'), 'to', calibre_val) book.set('_force_send_metadata_', True) force_return_changed_books = True except: self._debug('exception special syncing is_read_date', self.is_read_sync_col) traceback.print_exc() else: # This is the standard sync case. If the CC value has changed, it # wins, otherwise the calibre value is synced to CC in the normal # fashion (mod date) if has_is_read and self.is_read_sync_col: try: orig_is_read = book.get(self.is_read_sync_col, None) if is_read != orig_is_read: # The value in the device's is_read checkbox is not the # same as the last one that came to the device from # calibre during the last connect, meaning that the user # changed it. Write the one from the device to calibre's # db. self._debug('standard update is_read', book.get('title', 'huh?'), 'to', is_read, 'was', orig_is_read) changed_books = db.new_api.set_field(self.is_read_sync_col, {id_: is_read}) if self.set_temp_mark_when_syncing_read: db.data.toggle_marked_ids({id_}) except: self._debug('exception standard syncing is_read', self.is_read_sync_col) traceback.print_exc() if has_is_read_date and self.is_read_date_sync_col: try: orig_is_read_date = book.get(self.is_read_date_sync_col, None) if is_date_undefined(orig_is_read_date): orig_is_read_date = None if is_read_date != orig_is_read_date: self._debug('standard update is_read_date', book.get('title', 'huh?'), 'to', is_read_date, 'was', orig_is_read_date) changed_books |= db.new_api.set_field(self.is_read_date_sync_col, {id_: is_read_date}) if self.set_temp_mark_when_syncing_read: db.data.toggle_marked_ids({id_}) except: self._debug('Exception standard syncing is_read_date', self.is_read_date_sync_col) traceback.print_exc() if changed_books or force_return_changed_books: # One of the two values was synced, giving a (perhaps empty) list of # changed books. Return that. return (changed_books, self._check_if_format_send_needed(db, id_, book)) # Nothing was synced. The user might have changed the value in calibre. # If so, that value will be sent to the device in the normal way. Note # that because any updated value has already been synced and so will # also be sent, the device should put the calibre value into its # checkbox (or whatever it uses) return (None, self._check_if_format_send_needed(db, id_, book)) @synchronous('sync_lock') def startup(self): self.listen_socket = None self.is_connected = False @synchronous('sync_lock') def startup_on_demand(self): if getattr(self, 'listen_socket', None) is not None: # we are already running return if len(self.opcodes) != len(self.reverse_opcodes): self._debug(self.opcodes, self.reverse_opcodes) self.is_connected = False self.listen_socket = None self.device_socket = None self.json_codec = JsonCodec() self.known_metadata = {} self.device_book_cache = defaultdict(dict) self.debug_time = time.time() self.debug_start_time = time.time() self.max_book_packet_len = 0 self.noop_counter = 0 self.connection_attempts = {} self.client_wants_uuid_file_names = False self.is_read_sync_col = None self.is_read_date_sync_col = None self.have_checked_sync_columns = False self.have_bad_sync_columns = False self.have_sent_future_dated_book_message = False self.now = None message = None compression_quality_ok = True try: cq = int(self.settings().extra_customization[self.OPT_COMPRESSION_QUALITY]) if cq < 50 or cq > 99: compression_quality_ok = False else: self.THUMBNAIL_COMPRESSION_QUALITY = cq except: compression_quality_ok = False if not compression_quality_ok: self.THUMBNAIL_COMPRESSION_QUALITY = 70 message = _('Bad compression quality setting. It must be a number ' 'between 50 and 99. Forced to be %d.')%self.DEFAULT_THUMBNAIL_COMPRESSION_QUALITY self._debug(message) self.set_option('thumbnail_compression_quality', str(self.DEFAULT_THUMBNAIL_COMPRESSION_QUALITY)) try: self.listen_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) set_socket_inherit(self.listen_socket, False) except: traceback.print_exc() message = 'creation of listen socket failed' self._debug(message) return message i = 0 if self.settings().extra_customization[self.OPT_USE_PORT]: try: opt_port = int(self.settings().extra_customization[self.OPT_PORT_NUMBER]) except: message = _('Invalid port in options: %s')% \ self.settings().extra_customization[self.OPT_PORT_NUMBER] self._debug(message) self._close_listen_socket() return message port = self._attach_to_port(self.listen_socket, opt_port) if port == 0: message = _('Failed to connect to port %d. Try a different value.')%opt_port self._debug(message) self._close_listen_socket() return message else: while i < 100: # try 9090 then up to 99 random port numbers i += 1 port = self._attach_to_port(self.listen_socket, 9090 if i == 1 else random.randint(8192, 32000)) if port != 0: break if port == 0: message = _('Failed to allocate a random port') self._debug(message) self._close_listen_socket() return message try: self.listen_socket.listen(0) except: message = 'listen on port %d failed' % port self._debug(message) self._close_listen_socket() return message try: ip_addr = self.settings().extra_customization[self.OPT_FORCE_IP_ADDRESS] publish_zeroconf('calibre smart device client', '_calibresmartdeviceapp._tcp', port, {}, use_ip_address=ip_addr) except: self._debug('registration with bonjour failed') traceback.print_exc() self._debug('listening on port', port) self.port = port # Now try to open a UDP socket to receive broadcasts on try: self.broadcast_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) except: message = 'creation of broadcast socket failed. This is not fatal.' self._debug(message) self.broadcast_socket = None else: for p in self.BROADCAST_PORTS: port = self._attach_to_port(self.broadcast_socket, p) if port != 0: self._debug('broadcast socket listening on port', port) break if port == 0: self.broadcast_socket.close() self.broadcast_socket = None message = 'attaching port to broadcast socket failed. This is not fatal.' self._debug(message) self.connection_queue = Queue.Queue(1) self.connection_listener = ConnectionListener(self) self.connection_listener.start() return message @synchronous('sync_lock') def shutdown(self): self._close_device_socket() if getattr(self, 'listen_socket', None) is not None: self.connection_listener.stop() try: unpublish_zeroconf('calibre smart device client', '_calibresmartdeviceapp._tcp', self.port, {}) except: self._debug('deregistration with bonjour failed') traceback.print_exc() self._close_listen_socket() # Methods for dynamic control @synchronous('sync_lock') def is_dynamically_controllable(self): return 'smartdevice' @synchronous('sync_lock') def start_plugin(self): return self.startup_on_demand() @synchronous('sync_lock') def stop_plugin(self): self.shutdown() @synchronous('sync_lock') def get_option(self, opt_string, default=None): opt = self._get_smartdevice_option_number(opt_string) if opt is not None: return self.settings().extra_customization[opt] return default @synchronous('sync_lock') def set_option(self, opt_string, value): opt = self._get_smartdevice_option_number(opt_string) if opt is not None: config = self._configProxy() ec = config['extra_customization'] ec[opt] = value config['extra_customization'] = ec @synchronous('sync_lock') def is_running(self): return getattr(self, 'listen_socket', None) is not None
hazrpg/calibre
src/calibre/devices/smart_device_app/driver.py
Python
gpl-3.0
89,254
# # Copyright © 2012–2022 Michal Čihař <[email protected]> # # This file is part of Weblate <https://weblate.org/> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. # import subprocess from distutils.version import LooseVersion from unittest import SkipTest from django.core.cache import cache from django.test import TestCase from django.test.utils import override_settings import weblate.vcs.gpg from weblate.utils.checks import check_data_writable from weblate.utils.unittest import tempdir_setting from weblate.vcs.gpg import ( generate_gpg_key, get_gpg_key, get_gpg_public_key, get_gpg_sign_key, ) class GPGTest(TestCase): gpg_error = None @classmethod def setUpClass(cls): """Check whether we can use gpg.""" super().setUpClass() try: result = subprocess.run( ["gpg", "--version"], check=True, text=True, capture_output=True, ) version = result.stdout.splitlines()[0].strip().rsplit(None, 1)[-1] if LooseVersion(version) < LooseVersion("2.1"): cls.gpg_error = "gpg too old" except (subprocess.CalledProcessError, OSError): cls.gpg_error = "gpg not found" def setUp(self): if self.gpg_error: raise SkipTest(self.gpg_error) def check_errors(self): self.assertEqual(weblate.vcs.gpg.GPG_ERRORS, {}) @tempdir_setting("DATA_DIR") @override_settings( WEBLATE_GPG_IDENTITY="Weblate <[email protected]>", WEBLATE_GPG_ALGO="rsa512" ) def test_generate(self): self.assertEqual(check_data_writable(), []) self.assertIsNone(get_gpg_key(silent=True)) key = generate_gpg_key() self.check_errors() self.assertIsNotNone(key) self.assertEqual(key, get_gpg_key()) @tempdir_setting("DATA_DIR") @override_settings( WEBLATE_GPG_IDENTITY="Weblate <[email protected]>", WEBLATE_GPG_ALGO="rsa512" ) def test_get(self): self.assertEqual(check_data_writable(), []) # This will generate new key key = get_gpg_sign_key() self.check_errors() self.assertIsNotNone(key) # Check cache access self.assertEqual(key, get_gpg_sign_key()) # Check empty cache cache.delete("gpg-key-id") self.assertEqual(key, get_gpg_sign_key()) @tempdir_setting("DATA_DIR") @override_settings( WEBLATE_GPG_IDENTITY="Weblate <[email protected]>", WEBLATE_GPG_ALGO="rsa512" ) def test_public(self): self.assertEqual(check_data_writable(), []) # This will generate new key key = get_gpg_public_key() self.check_errors() self.assertIsNotNone(key) # Check cache access self.assertEqual(key, get_gpg_public_key())
nijel/weblate
weblate/vcs/tests/test_gpg.py
Python
gpl-3.0
3,459
import factory from api import models class ClientFactory(factory.DjangoModelFactory): class Meta: model = models.Client name = 'Coaxis' @factory.django.mute_signals(models.post_save) class UserFactory(factory.DjangoModelFactory): class Meta: model = models.MyUser email = factory.Sequence(lambda n: 'u{0}@coaxis.com'.format(n)) password = factory.PostGenerationMethodCall('set_password', 'password') is_staff = False class EmployeeFactory(factory.DjangoModelFactory): class Meta: model = models.Employee user = factory.SubFactory(UserFactory) is_technician = False @factory.post_generation def clients(self, create, extracted, **kwargs): if not create: # Simple build, do nothing. return if extracted: # A list of objects were passed in, use them for client in extracted: self.clients.add(client) class TechnicianFactory(EmployeeFactory): is_technician = True class DaemonFactory(factory.DjangoModelFactory): class Meta: model = models.Daemon client = factory.SubFactory(ClientFactory)
Coaxis-ASP/opt
backend/api/tests/factories.py
Python
gpl-3.0
1,150
# -*- coding: utf-8 -*- import logging import re import salt.client from netaddr import IPNetwork, IPAddress log = logging.getLogger(__name__) def ping(cluster = None, exclude = None, **kwargs): """ Ping all addresses from all addresses on all minions. If cluster is passed, restrict addresses to public and cluster networks. Note: Some optimizations could be done here in the multi module (such as skipping the source and destination when they are the same). However, the unoptimized version is taking ~2.5 seconds on 18 minions with 72 addresses for success. Failures take between 6 to 12 seconds. Optimizations should focus there. TODO: Convert commented out print statements to log.debug CLI Example: (Before DeepSea with a cluster configuration) .. code-block:: bash sudo salt-run net.ping or you can run it with exclude .. code-block:: bash sudo salt-run net.ping exclude="E@host*,host-osd-name*,192.168.1.1" (After DeepSea with a cluster configuration) .. code-block:: bash sudo salt-run net.ping cluster=ceph sudo salt-run net.ping ceph """ exclude_string = exclude_iplist = None if exclude: exclude_string, exclude_iplist = _exclude_filter(exclude) extra_kwargs = _skip_dunder(kwargs) if _skip_dunder(kwargs): print "Unsupported parameters: {}".format(" ,".join(extra_kwargs.keys())) text = re.sub(re.compile("^ {12}", re.MULTILINE), "", ''' salt-run net.ping [cluster] [exclude] Ping all addresses from all addresses on all minions. If cluster is specified, restrict addresses to cluster and public networks. If exclude is specified, remove matching addresses. See Salt compound matchers. within exclude individual ip address will be remove a specific target interface instead of ping from, the ping to interface will be removed Examples: salt-run net.ping salt-run net.ping ceph salt-run net.ping ceph [email protected] salt-run net.ping cluster=ceph [email protected] salt-run net.ping [email protected] salt-run net.ping [email protected]/29 salt-run net.ping exclude="E@host*,host-osd-name*,192.168.1.1" ''') print text return local = salt.client.LocalClient() if cluster: search = "I@cluster:{}".format(cluster) if exclude_string: search += " and not ( " + exclude_string + " )" log.debug( "ping: search {} ".format(search)) networks = local.cmd(search , 'pillar.item', [ 'cluster_network', 'public_network' ], expr_form="compound") #print networks total = local.cmd(search , 'grains.get', [ 'ipv4' ], expr_form="compound") #print addresses addresses = [] for host in sorted(total.iterkeys()): if 'cluster_network' in networks[host]: addresses.extend(_address(total[host], networks[host]['cluster_network'])) if 'public_network' in networks[host]: addresses.extend(_address(total[host], networks[host]['public_network'])) else: search = "*" if exclude_string: search += " and not ( " + exclude_string + " )" log.debug( "ping: search {} ".format(search)) addresses = local.cmd(search , 'grains.get', [ 'ipv4' ], expr_form="compound") addresses = _flatten(addresses.values()) # Lazy loopback removal - use ipaddress when adding IPv6 try: if addresses: addresses.remove('127.0.0.1') if exclude_iplist: for ex_ip in exclude_iplist: log.debug( "ping: removing {} ip ".format(ex_ip)) addresses.remove(ex_ip) except ValueError: log.debug( "ping: remove {} ip doesn't exist".format(ex_ip)) pass #print addresses results = local.cmd(search, 'multi.ping', addresses, expr_form="compound") #print results _summarize(len(addresses), results) def _address(addresses, network): """ Return all addresses in the given network Note: list comprehension vs. netaddr vs. simple """ matched = [] for address in addresses: if IPAddress(address) in IPNetwork(network): matched.append(address) return matched def _exclude_filter(excluded): """ Internal exclude_filter return string in compound format Compound format = {'G': 'grain', 'P': 'grain_pcre', 'I': 'pillar', 'J': 'pillar_pcre', 'L': 'list', 'N': None, 'S': 'ipcidr', 'E': 'pcre'} IPV4 address = "255.255.255.255" hostname = "myhostname" """ log.debug( "_exclude_filter: excluding {}".format(excluded)) excluded = excluded.split(",") log.debug( "_exclude_filter: split ',' {}".format(excluded)) pattern_compound = re.compile("^.*([GPIJLNSE]\@).*$") pattern_iplist = re.compile( "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$" ) pattern_ipcidr = re.compile( "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$") pattern_hostlist = re.compile( "^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9-]*[a-zA-Z0-9]).)*([A-Za-z]|[A-Za-z][A-Za-z0-9-]*[A-Za-z0-9])$") compound = [] ipcidr = [] iplist = [] hostlist = [] regex_list = [] for para in excluded: if pattern_compound.match(para): log.debug( "_exclude_filter: Compound {}".format(para)) compound.append(para) elif pattern_iplist.match(para): log.debug( "_exclude_filter: ip {}".format(para)) iplist.append(para) elif pattern_ipcidr.match(para): log.debug( "_exclude_filter: ipcidr {}".format(para)) ipcidr.append("S@"+para) elif pattern_hostlist.match(para): hostlist.append("L@"+para) log.debug( "_exclude_filter: hostname {}".format(para)) else: regex_list.append("E@"+para) log.debug( "_exclude_filter: not sure but likely Regex host {}".format(para)) #if ipcidr: # log.debug("_exclude_filter ip subnet is not working yet ... = {}".format(ipcidr)) new_compound_excluded = " or ".join(compound + hostlist + regex_list + ipcidr) log.debug("_exclude_filter new formed compound excluded list = {}".format(new_compound_excluded)) if new_compound_excluded and iplist: return new_compound_excluded, iplist elif new_compound_excluded: return new_compound_excluded, None elif iplist: return None, iplist else: return None, None def _flatten(l): """ Flatten a array of arrays """ log.debug( "_flatten: {}".format(l)) return list(set(item for sublist in l for item in sublist)) def _summarize(total, results): """ Summarize the successes, failures and errors across all minions """ success = [] failed = [] errored = [] slow = [] log.debug( "_summarize: results {}".format(results)) for host in sorted(results.iterkeys()): if results[host]['succeeded'] == total: success.append(host) if 'failed' in results[host]: failed.append("{} from {}".format(results[host]['failed'], host)) if 'errored' in results[host]: errored.append("{} from {}".format(results[host]['errored'], host)) if 'slow' in results[host]: slow.append("{} from {} average rtt {}".format(results[host]['slow'], host, "{0:.2f}".format(results[host]['avg']))) if success: avg = sum( results[host].get('avg') for host in results) / len(results) else: avg = 0 print "Succeeded: {} addresses from {} minions average rtt {} ms".format(total, len(success), "{0:.2f}".format(avg)) if slow: print "Warning: \n {}".format("\n ".join(slow)) if failed: print "Failed: \n {}".format("\n ".join(failed)) if errored: print "Errored: \n {}".format("\n ".join(errored)) def _skip_dunder(settings): """ Skip double underscore keys """ return {k:v for k,v in settings.iteritems() if not k.startswith('__')}
supriti/DeepSea
srv/modules/runners/net.py
Python
gpl-3.0
8,475
"DiskCache: disk and file backed cache." from .core import Cache, Disk, UnknownFileWarning, EmptyDirWarning, Timeout from .core import DEFAULT_SETTINGS, EVICTION_POLICY from .fanout import FanoutCache from .persistent import Deque, Index __all__ = [ 'Cache', 'Disk', 'UnknownFileWarning', 'EmptyDirWarning', 'Timeout', 'DEFAULT_SETTINGS', 'EVICTION_POLICY', 'FanoutCache', 'Deque', 'Index', ] try: from .djangocache import DjangoCache # pylint: disable=wrong-import-position __all__.append('DjangoCache') except Exception: # pylint: disable=broad-except # Django not installed or not setup so ignore. pass __title__ = 'diskcache' __version__ = '2.9.0' __build__ = 0x020900 __author__ = 'Grant Jenks' __license__ = 'Apache 2.0' __copyright__ = 'Copyright 2016 Grant Jenks'
pymedusa/SickRage
ext/diskcache/__init__.py
Python
gpl-3.0
835
from .models import * from django.contrib import admin from django.db import models from website.base.form import TinyMCEAdminMixin from django.utils.translation import ugettext_lazy as _ from mediastore.admin import ModelAdmin class SessionAdmin(TinyMCEAdminMixin, ModelAdmin): list_display = ('title','day_of_week','cost','is_public','is_featured','sort_value',) list_editable = ('is_public','is_featured','sort_value') fieldsets = ( (_('Session'), { 'fields':( 'title', 'list_description', 'day_of_week', 'club', ) }), (_('Description'),{ 'fields':( 'description', ) }), (_('Cost'),{ 'fields':( 'cost', ) }), (_('Location'),{ 'fields':( 'location', ) }), (_('Settings'), { 'fields':( 'sort_value', 'is_public', 'is_featured', ) }) ) admin.site.register(Session,SessionAdmin)
samsath/skeleton
src/website/clubsessions/admin.py
Python
gpl-3.0
1,156
# -*- coding: utf-8 -*- ##Copyright (C) [2003] [Jürgen Hamel, D-32584 Löhne] ##This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as ##published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. ##This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied ##warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##for more details. ##You should have received a copy of the GNU General Public License along with this program; if not, write to the ##Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. from cuon.Databases.SingleData import SingleData import logging import pygtk pygtk.require('2.0') import gtk import gtk.glade import gobject #from gtk import TRUE, FALSE class SingleProposalMisc(SingleData): def __init__(self, allTables): SingleData.__init__(self) # tables.dbd and address self.sNameOfTable = "proposalmisc" self.xmlTableDef = 0 # self.loadTable() # self.saveTable() self.loadTable(allTables) #self.setStore( gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_UINT) ) #self.listHeader['names'] = ['number', 'designation', 'ID'] #self.listHeader['size'] = [25,10,25,25,10] #print "number of Columns " #print len(self.table.Columns) # self.ordernumber = 0 #self.statusfields = ['lastname', 'firstname'] def readNonWidgetEntries(self, dicValues): print 'readNonWidgetEntries(self) by SingleorderGets' dicValues['orderid'] = [self.ordernumber, 'int'] return dicValues
BackupTheBerlios/cuon-svn
cuon_client/cuon/Proposal/SingleProposalMisc.py
Python
gpl-3.0
1,877
import wx import eos.db import gui.mainFrame from gui import globalEvents as GE from gui.fitCommands.calc.module.projectedAdd import CalcAddProjectedModuleCommand from gui.fitCommands.helpers import InternalCommandHistory, ModuleInfo from service.fit import Fit class GuiAddProjectedModuleCommand(wx.Command): def __init__(self, fitID, itemID): wx.Command.__init__(self, True, 'Add Projected Module') self.internalHistory = InternalCommandHistory() self.fitID = fitID self.itemID = itemID def Do(self): cmd = CalcAddProjectedModuleCommand(fitID=self.fitID, modInfo=ModuleInfo(itemID=self.itemID)) success = self.internalHistory.submit(cmd) sFit = Fit.getInstance() if cmd.needsGuiRecalc: eos.db.flush() sFit.recalc(self.fitID) sFit.fill(self.fitID) eos.db.commit() wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitIDs=(self.fitID,))) return success def Undo(self): success = self.internalHistory.undoAll() eos.db.flush() sFit = Fit.getInstance() sFit.recalc(self.fitID) sFit.fill(self.fitID) eos.db.commit() wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitIDs=(self.fitID,))) return success
pyfa-org/Pyfa
gui/fitCommands/gui/projectedModule/add.py
Python
gpl-3.0
1,334
from django.conf.urls import patterns, url from . import views urlpatterns = patterns( '', url(r'^$', views.home, name='home'), url(r'^(?P<pk>\d+)/edit/$', views.edit, name='edit'), url(r'^new/$', views.new, name='new'), )
mozilla/peekaboo
peekaboo/locations/urls.py
Python
mpl-2.0
242
'''u413 - an open-source BBS/transmit/PI-themed forum Copyright (C) 2012 PiMaster Copyright (C) 2012 EnKrypt This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.''' import command import user import database as db import util import bbcode def user_id(uname): user=db.query("SELECT username,id FROM users WHERE LCASE(username)='%s';"%db.escape(uname.lower())) if len(user)==0: return None return int(user[0]["id"]) def user_exists(uname): user=user_id(uname) if user==None: return False return True def nmsg_func(args,u413): if "step" in u413.cmddata: if u413.cmddata["step"]==1: u413.cmddata["step"]=2 args=args.strip().split()[0] to=user_id(args) if to==None: u413.type('"%s" is not a u413 user.'%args) return u413.cmddata["to"]=to u413.type("Enter the topic:") u413.set_context("TOPIC") u413.continue_cmd() elif u413.cmddata["step"]==2: u413.cmddata["step"]=3 u413.cmddata["topic"]=args u413.type("Enter your message:") u413.set_context("MESSAGE") u413.continue_cmd() elif u413.cmddata["step"]==3: db.query("INSERT INTO messages(sender,receiver,topic,msg,sent,seen) VALUES(%i,%i,'%s','%s',NOW(),FALSE);"%(u413.user.userid,u413.cmddata["to"],db.escape(u413.cmddata["topic"]),db.escape(args))) u413.type("Message sent.") u413.set_context('') else: params=args.split(' ',1) if len(args)==0: u413.cmddata["step"]=1 u413.type("Enter the receiver:") u413.set_context("USER") u413.continue_cmd() elif len(params)==1: u413.cmddata["step"]=2 args=params[0].strip().split()[0] to=user_id(args) if to==None: u413.type('"%s" is not a u413 user.'%args) return u413.cmddata["to"]=to u413.type("Enter the topic:") u413.set_context("TOPIC") u413.continue_cmd() else: u413.cmddata["step"]=3 args=params[0].strip().split()[0] to=user_id(args) if to==None: u413.type('"%s" is not a u413 user.'%args) return u413.cmddata["to"]=to u413.cmddata["topic"]=params[1] u413.type("Enter your message:") u413.set_context("MESSAGE") u413.continue_cmd() command.Command("NEWMESSAGE","[user [topic]]",{"id":"The ID of the PM"},"Sends a private message to another user.",nmsg_func,user.User.member)
mwgamera/u413
newmessage.py
Python
agpl-3.0
2,828
# -*- coding: utf-8 -*- # Copyright(C) 2014 Bezleputh # # This file is part of weboob. # # weboob is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # weboob is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with weboob. If not, see <http://www.gnu.org/licenses/>. from .backend import RegionsjobBackend __all__ = ['RegionsjobBackend']
yannrouillard/weboob
modules/regionsjob/__init__.py
Python
agpl-3.0
805
# ############################################################################ # OSIS stands for Open Student Information System. It's an application # designed to manage the core business of higher education institutions, # such as universities, faculties, institutes and professional schools. # The core business involves the administration of students, teachers, # courses, programs and so on. # # Copyright (C) 2015-2019 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # A copy of this license - GNU General Public License - is available # at the root of the source code of this program. If not, # see http://www.gnu.org/licenses/. # ############################################################################ import pypom from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.common.by import By from features.pages.common import CommonPageMixin from features.fields.fields import InputField, SelectField, ButtonField class SearchEntityPage(CommonPageMixin, pypom.Page): URL_TEMPLATE = '/entities/' acronym = InputField(By.ID, 'id_acronym') title = InputField(By.ID, 'id_title') entity_type = SelectField(By.ID, "id_entity_type") search = ButtonField(By.ID, "bt_submit_entity_search") def find_acronym_in_table(self, row: int = 1): return self.find_element(By.ID, 'td_entity_%d' % row).text class SearchOrganizationPage(CommonPageMixin, pypom.Page): URL_TEMPLATE = '/organizations/' acronym = InputField(By.ID, 'id_acronym') name = InputField(By.ID, 'id_name') type = SelectField(By.ID, "id_type") search = ButtonField(By.ID, "bt_submit_organization_search") def find_acronym_in_table(self, row: int = 1): return self.find_element(By.ID, 'td_organization_%d' % row).text class SearchStudentPage(CommonPageMixin, pypom.Page): URL_TEMPLATE = '/students/' registration_id = InputField(By.ID, 'id_registration_id') name = InputField(By.ID, 'id_name') search = ButtonField(By.ID, "bt_submit_student_search") def find_registration_id_in_table(self, row: int = 1): return self.find_element(By.ID, 'td_student_%d' % row).text def find_name_in_table(self): names = [] row = 1 last = False while not last: try: elt = self.find_element(By.ID, 'spn_student_name_%d' % row) names.append(elt.text) row += 1 except NoSuchElementException as e: return names return names
uclouvain/OSIS-Louvain
features/steps/utils/pages.py
Python
agpl-3.0
3,065
# -*- coding: utf-8; -*- # # This file is part of Superdesk. # # Copyright 2013, 2014 Sourcefabric z.u. and contributors. # # For the full copyright and license information, please see the # AUTHORS and LICENSE files distributed with this source code, or # at https://www.sourcefabric.org/superdesk/license import unittest from .volume_cubic_inches_to_metric import cubic_inches_to_metric class VolumeTestCase(unittest.TestCase): def test(self): text = ( "Total volume is 100.50 cubic inches for this land. " "Total volume is 15.7 cubic in for this land. " "Total volume is 1 Cubic Inch for this land. " "Total volume is 1-16 cu-in for this land. " "Total volume is 1-16 cb. in for this land. " "Total volume is 16.7-Cubic-in for this land. " "Total volume is 16,500-cu. in. for this land. " ) item = {"body_html": text} res, diff = cubic_inches_to_metric(item) self.assertEqual(diff["100.50 cubic inches"], "100.50 cubic inches (1,647 cubic centimeter)") self.assertEqual(diff["15.7 cubic in"], "15.7 cubic in (257.3 cubic centimeter)") self.assertEqual(diff["1 Cubic Inch"], "1 Cubic Inch (16 cubic centimeter)") self.assertEqual(diff["1-16 cu-in"], "1-16 cu-in (16-262 cubic centimeter)") self.assertEqual(diff["1-16 cb. in"], "1-16 cb. in (16-262 cubic centimeter)") self.assertEqual(diff["16.7-Cubic-in"], "16.7-Cubic-in (273.7 cubic centimeter)") self.assertEqual(diff["16,500-cu. in"], "16,500-cu. in (0.3 cubic meter)") self.assertEqual(res["body_html"], item["body_html"])
petrjasek/superdesk-core
superdesk/macros/imperial/volume_cubic_inches_to_metric_test.py
Python
agpl-3.0
1,669
from rest_framework import serializers from models import SurveyDraft from taggit.models import Tag class WritableJSONField(serializers.Field): """ Serializer for JSONField -- required to make field writable""" """ ALSO REQUIRED because the default JSONField serialization includes the `u` prefix on strings when running Django 1.8, resulting in invalid JSON """ def __init__(self, **kwargs): self.allow_blank= kwargs.pop('allow_blank', False) super(WritableJSONField, self).__init__(**kwargs) def to_internal_value(self, data): if (not data) and (not self.required): return None else: try: return json.loads(data) except Exception as e: raise serializers.ValidationError( u'Unable to parse JSON: {}'.format(e)) def to_representation(self, value): return value class ListSurveyDraftSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = SurveyDraft fields = ('id', 'name', 'asset_type', 'summary', 'date_modified', 'description') summary = WritableJSONField(required=False) class DetailSurveyDraftSerializer(serializers.HyperlinkedModelSerializer): tags = serializers.SerializerMethodField('get_tag_names') summary = WritableJSONField(required=False) class Meta: model = SurveyDraft fields = ('id', 'name', 'body', 'summary', 'date_modified', 'description', 'tags') def get_tag_names(self, obj): return obj.tags.names() class TagSerializer(serializers.HyperlinkedModelSerializer): count = serializers.SerializerMethodField() label = serializers.CharField(source='name') class Meta: model = Tag fields = ('id', 'label', 'count') def get_count(self, obj): return SurveyDraft.objects.filter(tags__name__in=[obj.name])\ .filter(user=self.context.get('request', None).user)\ .filter(asset_type='question')\ .count()
onaio/dkobo
dkobo/koboform/serializers.py
Python
agpl-3.0
2,038
############################################################################## # # Copyright (C) 2019-2020 Compassion CH (http://www.compassion.ch) # @author: Christopher Meier <[email protected]> # # The licence is in the file __manifest__.py # ############################################################################## """ This file blocks all the routes defined automatically by cms_form. """ from odoo import http from odoo.addons.cms_form.controllers.main import ( CMSFormController, CMSWizardFormController, CMSSearchFormController, ) class UwantedCMSFormController(CMSFormController): @http.route() def cms_form(self, model, model_id=None, **kw): return http.request.render("website.404") class UnwantedCMSWizardFormController(CMSWizardFormController): @http.route() def cms_wiz(self, wiz_model, model_id=None, **kw): return http.request.render("website.404") class UnwantedCMSSearchFormController(CMSSearchFormController): @http.route() def cms_form(self, model, **kw): return http.request.render("website.404")
CompassionCH/compassion-switzerland
website_compassion/controllers/cms_form.py
Python
agpl-3.0
1,098
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('orentapp', '0016_auto_20150422_1803'), ] operations = [ migrations.AddField( model_name='product', name='step', field=models.DecimalField(max_digits=8, null=True, decimal_places=2), preserve_default=True, ), ]
0rent/0rent
orentapp/migrations/0017_product_step.py
Python
agpl-3.0
466
from openerp import fields, models,osv from base_olims_model import BaseOLiMSModel from openerp.tools.translate import _ from fields.string_field import StringField from fields.text_field import TextField from fields.widget.widget import TextAreaWidget schema = (StringField('Title', required=1, ), TextField('Description', widget=TextAreaWidget( label=_('Description'), description=_('Used in item listings and search results.')), ), fields.One2many('olims.instrument', 'Type', string='Type') ) class InstrumentType(models.Model, BaseOLiMSModel):#(BaseContent): _name = 'olims.instrument_type' _rec_name = 'Title' InstrumentType.initialze(schema)
sciCloud/OLiMS
models/instrumenttype.py
Python
agpl-3.0
794
#!/usr/bin/python # This file is part of OpenHatch. # Copyright (C) 2010 OpenHatch, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. ### The purpose of this script is to create a version of the database ### that helps a U Mass Amherst researcher look through the OpenHatch ### data and perform text classification and other text analysis. ### To protect our users' privacy, we: ### * set the password column to the empty string ### * set the email column to the empty string ### * delete (from the database) any PortfolioEntry that is_deleted ### * delete (from the database) any Citation that is_deleted ### * delete all WebResponse objects import mysite.profile.models import django.contrib.auth.models ### set the email and password columns to the empty string for user in django.contrib.auth.models.User.objects.all(): user.email = '' user.password = '' user.save() ### delete PortfolioEntry instances that is_deleted for pfe in mysite.profile.models.PortfolioEntry.objects.all(): if pfe.is_deleted: pfe.delete() ### delete Citation instances that is_deleted for citation in mysite.profile.models.Citation.objects.all(): if citation.is_deleted: citation.delete() ### delete all WebResponse objects for wr in mysite.customs.models.WebResponse.objects.all(): wr.delete()
jledbetter/openhatch
mysite/scripts/clean_data_for_academic_analysis.py
Python
agpl-3.0
1,935
# -*- coding: utf-8; -*- # # This file is part of Superdesk. # # Copyright 2013, 2014 Sourcefabric z.u. and contributors. # # For the full copyright and license information, please see the # AUTHORS and LICENSE files distributed with this source code, or # at https://www.sourcefabric.org/superdesk/license from superdesk.resource import Resource from content_api import MONGO_PREFIX class CompaniesResource(Resource): """ Company schema """ schema = { "name": {"type": "string", "unique": True, "required": True}, "sd_subscriber_id": {"type": "string"}, "is_enabled": {"type": "boolean", "default": True}, "contact_name": {"type": "string"}, "phone": {"type": "string"}, "country": {"type": "string"}, } datasource = {"source": "companies", "default_sort": [("name", 1)]} item_methods = ["GET", "PATCH", "PUT"] resource_methods = ["GET", "POST"] mongo_prefix = MONGO_PREFIX
petrjasek/superdesk-core
content_api/companies/resource.py
Python
agpl-3.0
963
# -*- coding: utf-8 -*- # © 2016 FactorLibre - Hugo Santos <[email protected]> # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import computed_purchase_order
factorlibre/odoo-addons-cpo
purchase_compute_order_product_filter_season/models/__init__.py
Python
agpl-3.0
197
"""Mercator proposal.""" from adhocracy_core.resources import add_resource_type_to_registry from adhocracy_core.resources import process from adhocracy_core.resources import proposal from adhocracy_core.sheets.geo import IPoint from adhocracy_core.sheets.geo import ILocationReference from adhocracy_core.sheets.image import IImageReference import adhocracy_meinberlin.sheets.kiezkassen class IProposalVersion(proposal.IProposalVersion): """Kiezkassen proposal version.""" proposal_version_meta = proposal.proposal_version_meta._replace( iresource=IProposalVersion, )._add(extended_sheets=(adhocracy_meinberlin.sheets.kiezkassen.IProposal, IPoint)) class IProposal(proposal.IProposal): """Kiezkassen proposal versions pool.""" proposal_meta = proposal.proposal_meta._replace( iresource=IProposal, element_types=(IProposalVersion,), item_type=IProposalVersion, ) class IProcess(process.IProcess): """Kiezkassen participation process.""" process_meta = process.process_meta._replace( content_name='KiezkassenProcess', iresource=IProcess, element_types=(IProposal, ), is_implicit_addable=True, extended_sheets=( ILocationReference, IImageReference, ), default_workflow='kiezkassen', ) def includeme(config): """Add resource type to content.""" add_resource_type_to_registry(proposal_meta, config) add_resource_type_to_registry(proposal_version_meta, config) add_resource_type_to_registry(process_meta, config)
liqd/adhocracy3.mercator
src/adhocracy_meinberlin/adhocracy_meinberlin/resources/kiezkassen.py
Python
agpl-3.0
1,552
#!/usr/bin/env python # -*- coding: utf8 -*- # ***************************************************************** # ** PTS -- Python Toolkit for working with SKIRT ** # ** © Astronomical Observatory, Ghent University ** # ***************************************************************** ## \package pts.do.core.makewavemovie Create a movie that runs through all wavelengths in the SKIRT simulation output. # # This script creates a movie for the output of each SKIRT simulation specified through the command line argument # (see below). The movie combines the SEDs (bottom panel) and the pixel frames (top panel, from left to right) # for up to three instruments, running through all wavelengths in the simulation. The movie is placed next to the # original file(s) with a similar name (omitting the instrument name) but a different extension. # # The script expects the complete output of a SKIRT simulation to be present (including log file etc.). # If there are no arguments, the script processes all simulation output sets residing in the current directory. # If the first argument contains a slash, the script processes all simulation output sets in the indicated directory. # If the first argument does not contain a slash, the script processes just the simulation in the current directory # with the indicated prefix. # # By default both axes of the SED plot and the luminosity of the frames are autoscaled. You can hardcode specific # ranges in the script. # ----------------------------------------------------------------- # Import standard modules import sys # Import the relevant PTS classes and modules from pts.core.simulation.simulation import createsimulations from pts.core.plot.wavemovie import makewavemovie # ----------------------------------------------------------------- # a value of None means that the axis is autoscaled; # alternatively specify a range through a tuple with min and max values xlim = None ylim = None #xlim = ( 5e-2, 1e3 ) #ylim = ( 1e-13, 1e-9 ) # the percentile values, in range [0,100], used to clip the luminosity values # loaded from the fits files; the default values are 30 and 100 respectively from_percentile = 30 to_percentile = 100 # ----------------------------------------------------------------- print "Starting makewavemovie..." # get the command-line argument specifying the simulation(s) argument = sys.argv[1] if len(sys.argv) > 1 else "" # construct the list of simulation objects and make the movies for simulation in createsimulations(argument): makewavemovie(simulation, xlim=xlim, ylim=ylim, from_percentile=from_percentile, to_percentile=to_percentile) print "Finished makewavemovie" # -----------------------------------------------------------------
SKIRT/PTS
do/core/makewavemovie.py
Python
agpl-3.0
2,769
import copy from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.core.urlresolvers import reverse from django.utils.translation import ugettext as _ from django_countries import countries import accounts import third_party_auth from edxmako.shortcuts import marketing_link from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers from openedx.core.djangoapps.user_api.helpers import FormDescription from openedx.features.enterprise_support.api import enterprise_customer_for_request from student.forms import get_registration_extension_form from student.models import UserProfile def get_password_reset_form(): """Return a description of the password reset form. This decouples clients from the API definition: if the API decides to modify the form, clients won't need to be updated. See `user_api.helpers.FormDescription` for examples of the JSON-encoded form description. Returns: HttpResponse """ form_desc = FormDescription("post", reverse("password_change_request")) # Translators: This label appears above a field on the password reset # form meant to hold the user's email address. email_label = _(u"Email") # Translators: This example email address is used as a placeholder in # a field on the password reset form meant to hold the user's email address. email_placeholder = _(u"[email protected]") # Translators: These instructions appear on the password reset form, # immediately below a field meant to hold the user's email address. email_instructions = _(u"The email address you used to register with {platform_name}").format( platform_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME) ) form_desc.add_field( "email", field_type="email", label=email_label, placeholder=email_placeholder, instructions=email_instructions, restrictions={ "min_length": accounts.EMAIL_MIN_LENGTH, "max_length": accounts.EMAIL_MAX_LENGTH, } ) return form_desc def get_login_session_form(): """Return a description of the login form. This decouples clients from the API definition: if the API decides to modify the form, clients won't need to be updated. See `user_api.helpers.FormDescription` for examples of the JSON-encoded form description. Returns: HttpResponse """ form_desc = FormDescription("post", reverse("user_api_login_session")) # Translators: This label appears above a field on the login form # meant to hold the user's email address. email_label = _(u"Email") # Translators: This example email address is used as a placeholder in # a field on the login form meant to hold the user's email address. email_placeholder = _(u"[email protected]") # Translators: These instructions appear on the login form, immediately # below a field meant to hold the user's email address. email_instructions = _("The email address you used to register with {platform_name}").format( platform_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME) ) form_desc.add_field( "email", field_type="email", label=email_label, placeholder=email_placeholder, instructions=email_instructions, restrictions={ "min_length": accounts.EMAIL_MIN_LENGTH, "max_length": accounts.EMAIL_MAX_LENGTH, } ) # Translators: This label appears above a field on the login form # meant to hold the user's password. password_label = _(u"Password") form_desc.add_field( "password", label=password_label, field_type="password", restrictions={ "max_length": accounts.PASSWORD_MAX_LENGTH, } ) form_desc.add_field( "remember", field_type="checkbox", label=_("Remember me"), default=False, required=False, ) return form_desc class RegistrationFormFactory(object): """HTTP end-points for creating a new user. """ DEFAULT_FIELDS = ["email", "name", "username", "password"] EXTRA_FIELDS = [ "confirm_email", "first_name", "last_name", "city", "state", "country", "gender", "year_of_birth", "level_of_education", "company", "title", "mailing_address", "goals", "honor_code", "terms_of_service", "profession", "specialty", ] def _is_field_visible(self, field_name): """Check whether a field is visible based on Django settings. """ return self._extra_fields_setting.get(field_name) in ["required", "optional"] def _is_field_required(self, field_name): """Check whether a field is required based on Django settings. """ return self._extra_fields_setting.get(field_name) == "required" def __init__(self): # Backwards compatibility: Honor code is required by default, unless # explicitly set to "optional" in Django settings. self._extra_fields_setting = copy.deepcopy(configuration_helpers.get_value('REGISTRATION_EXTRA_FIELDS')) if not self._extra_fields_setting: self._extra_fields_setting = copy.deepcopy(settings.REGISTRATION_EXTRA_FIELDS) self._extra_fields_setting["honor_code"] = self._extra_fields_setting.get("honor_code", "required") # Check that the setting is configured correctly for field_name in self.EXTRA_FIELDS: if self._extra_fields_setting.get(field_name, "hidden") not in ["required", "optional", "hidden"]: msg = u"Setting REGISTRATION_EXTRA_FIELDS values must be either required, optional, or hidden." raise ImproperlyConfigured(msg) # Map field names to the instance method used to add the field to the form self.field_handlers = {} valid_fields = self.DEFAULT_FIELDS + self.EXTRA_FIELDS for field_name in valid_fields: handler = getattr(self, "_add_{field_name}_field".format(field_name=field_name)) self.field_handlers[field_name] = handler field_order = configuration_helpers.get_value('REGISTRATION_FIELD_ORDER') if not field_order: field_order = settings.REGISTRATION_FIELD_ORDER or valid_fields # Check that all of the valid_fields are in the field order and vice versa, if not set to the default order if set(valid_fields) != set(field_order): field_order = valid_fields self.field_order = field_order def get_registration_form(self, request): """Return a description of the registration form. This decouples clients from the API definition: if the API decides to modify the form, clients won't need to be updated. This is especially important for the registration form, since different edx-platform installations might collect different demographic information. See `user_api.helpers.FormDescription` for examples of the JSON-encoded form description. Arguments: request (HttpRequest) Returns: HttpResponse """ form_desc = FormDescription("post", reverse("user_api_registration")) self._apply_third_party_auth_overrides(request, form_desc) # Custom form fields can be added via the form set in settings.REGISTRATION_EXTENSION_FORM custom_form = get_registration_extension_form() if custom_form: # Default fields are always required for field_name in self.DEFAULT_FIELDS: self.field_handlers[field_name](form_desc, required=True) for field_name, field in custom_form.fields.items(): restrictions = {} if getattr(field, 'max_length', None): restrictions['max_length'] = field.max_length if getattr(field, 'min_length', None): restrictions['min_length'] = field.min_length field_options = getattr( getattr(custom_form, 'Meta', None), 'serialization_options', {} ).get(field_name, {}) field_type = field_options.get('field_type', FormDescription.FIELD_TYPE_MAP.get(field.__class__)) if not field_type: raise ImproperlyConfigured( "Field type '{}' not recognized for registration extension field '{}'.".format( field_type, field_name ) ) form_desc.add_field( field_name, label=field.label, default=field_options.get('default'), field_type=field_options.get('field_type', FormDescription.FIELD_TYPE_MAP.get(field.__class__)), placeholder=field.initial, instructions=field.help_text, required=field.required, restrictions=restrictions, options=getattr(field, 'choices', None), error_messages=field.error_messages, include_default_option=field_options.get('include_default_option'), ) # Extra fields configured in Django settings # may be required, optional, or hidden for field_name in self.EXTRA_FIELDS: if self._is_field_visible(field_name): self.field_handlers[field_name]( form_desc, required=self._is_field_required(field_name) ) else: # Go through the fields in the fields order and add them if they are required or visible for field_name in self.field_order: if field_name in self.DEFAULT_FIELDS: self.field_handlers[field_name](form_desc, required=True) elif self._is_field_visible(field_name): self.field_handlers[field_name]( form_desc, required=self._is_field_required(field_name) ) return form_desc def _add_email_field(self, form_desc, required=True): """Add an email field to a form description. Arguments: form_desc: A form description Keyword Arguments: required (bool): Whether this field is required; defaults to True """ # Translators: This label appears above a field on the registration form # meant to hold the user's email address. email_label = _(u"Email") # Translators: This example email address is used as a placeholder in # a field on the registration form meant to hold the user's email address. email_placeholder = _(u"[email protected]") # Translators: These instructions appear on the registration form, immediately # below a field meant to hold the user's email address. email_instructions = _(u"This is what you will use to login.") form_desc.add_field( "email", field_type="email", label=email_label, placeholder=email_placeholder, instructions=email_instructions, restrictions={ "min_length": accounts.EMAIL_MIN_LENGTH, "max_length": accounts.EMAIL_MAX_LENGTH, }, required=required ) def _add_confirm_email_field(self, form_desc, required=True): """Add an email confirmation field to a form description. Arguments: form_desc: A form description Keyword Arguments: required (bool): Whether this field is required; defaults to True """ # Translators: This label appears above a field on the registration form # meant to confirm the user's email address. email_label = _(u"Confirm Email") error_msg = accounts.REQUIRED_FIELD_CONFIRM_EMAIL_MSG form_desc.add_field( "confirm_email", label=email_label, required=required, error_messages={ "required": error_msg } ) def _add_name_field(self, form_desc, required=True): """Add a name field to a form description. Arguments: form_desc: A form description Keyword Arguments: required (bool): Whether this field is required; defaults to True """ # Translators: This label appears above a field on the registration form # meant to hold the user's full name. name_label = _(u"Full Name") # Translators: This example name is used as a placeholder in # a field on the registration form meant to hold the user's name. name_placeholder = _(u"Jane Q. Learner") # Translators: These instructions appear on the registration form, immediately # below a field meant to hold the user's full name. name_instructions = _(u"This name will be used on any certificates that you earn.") form_desc.add_field( "name", label=name_label, placeholder=name_placeholder, instructions=name_instructions, restrictions={ "max_length": accounts.NAME_MAX_LENGTH, }, required=required ) def _add_username_field(self, form_desc, required=True): """Add a username field to a form description. Arguments: form_desc: A form description Keyword Arguments: required (bool): Whether this field is required; defaults to True """ # Translators: This label appears above a field on the registration form # meant to hold the user's public username. username_label = _(u"Public Username") username_instructions = _( # Translators: These instructions appear on the registration form, immediately # below a field meant to hold the user's public username. u"The name that will identify you in your courses. " u"It cannot be changed later." ) # Translators: This example username is used as a placeholder in # a field on the registration form meant to hold the user's username. username_placeholder = _(u"Jane_Q_Learner") form_desc.add_field( "username", label=username_label, instructions=username_instructions, placeholder=username_placeholder, restrictions={ "min_length": accounts.USERNAME_MIN_LENGTH, "max_length": accounts.USERNAME_MAX_LENGTH, }, required=required ) def _add_password_field(self, form_desc, required=True): """Add a password field to a form description. Arguments: form_desc: A form description Keyword Arguments: required (bool): Whether this field is required; defaults to True """ # Translators: This label appears above a field on the registration form # meant to hold the user's password. password_label = _(u"Password") form_desc.add_field( "password", label=password_label, field_type="password", restrictions={ "min_length": accounts.PASSWORD_MIN_LENGTH, "max_length": accounts.PASSWORD_MAX_LENGTH, }, required=required ) def _add_level_of_education_field(self, form_desc, required=True): """Add a level of education field to a form description. Arguments: form_desc: A form description Keyword Arguments: required (bool): Whether this field is required; defaults to True """ # Translators: This label appears above a dropdown menu on the registration # form used to select the user's highest completed level of education. education_level_label = _(u"Highest level of education completed") error_msg = accounts.REQUIRED_FIELD_LEVEL_OF_EDUCATION_MSG # The labels are marked for translation in UserProfile model definition. options = [(name, _(label)) for name, label in UserProfile.LEVEL_OF_EDUCATION_CHOICES] # pylint: disable=translation-of-non-string form_desc.add_field( "level_of_education", label=education_level_label, field_type="select", options=options, include_default_option=True, required=required, error_messages={ "required": error_msg } ) def _add_gender_field(self, form_desc, required=True): """Add a gender field to a form description. Arguments: form_desc: A form description Keyword Arguments: required (bool): Whether this field is required; defaults to True """ # Translators: This label appears above a dropdown menu on the registration # form used to select the user's gender. gender_label = _(u"Gender") # The labels are marked for translation in UserProfile model definition. options = [(name, _(label)) for name, label in UserProfile.GENDER_CHOICES] # pylint: disable=translation-of-non-string form_desc.add_field( "gender", label=gender_label, field_type="select", options=options, include_default_option=True, required=required ) def _add_year_of_birth_field(self, form_desc, required=True): """Add a year of birth field to a form description. Arguments: form_desc: A form description Keyword Arguments: required (bool): Whether this field is required; defaults to True """ # Translators: This label appears above a dropdown menu on the registration # form used to select the user's year of birth. yob_label = _(u"Year of birth") options = [(unicode(year), unicode(year)) for year in UserProfile.VALID_YEARS] form_desc.add_field( "year_of_birth", label=yob_label, field_type="select", options=options, include_default_option=True, required=required ) def _add_field_with_configurable_select_options(self, field_name, field_label, form_desc, required=False): """Add a field to a form description. If select options are given for this field, it will be a select type otherwise it will be a text type. Arguments: field_name: name of field field_label: label for the field form_desc: A form description Keyword Arguments: required (bool): Whether this field is required; defaults to False """ extra_field_options = configuration_helpers.get_value('EXTRA_FIELD_OPTIONS') if extra_field_options is None or extra_field_options.get(field_name) is None: field_type = "text" include_default_option = False options = None error_msg = '' exec("error_msg = accounts.REQUIRED_FIELD_%s_TEXT_MSG" % (field_name.upper())) else: field_type = "select" include_default_option = True field_options = extra_field_options.get(field_name) options = [(unicode(option.lower()), option) for option in field_options] error_msg = '' exec("error_msg = accounts.REQUIRED_FIELD_%s_SELECT_MSG" % (field_name.upper())) form_desc.add_field( field_name, label=field_label, field_type=field_type, options=options, include_default_option=include_default_option, required=required, error_messages={ "required": error_msg } ) def _add_profession_field(self, form_desc, required=False): """Add a profession field to a form description. Arguments: form_desc: A form description Keyword Arguments: required (bool): Whether this field is required; defaults to False """ # Translators: This label appears above a dropdown menu on the registration # form used to select the user's profession profession_label = _("Profession") self._add_field_with_configurable_select_options('profession', profession_label, form_desc, required=required) def _add_specialty_field(self, form_desc, required=False): """Add a specialty field to a form description. Arguments: form_desc: A form description Keyword Arguments: required (bool): Whether this field is required; defaults to False """ # Translators: This label appears above a dropdown menu on the registration # form used to select the user's specialty specialty_label = _("Specialty") self._add_field_with_configurable_select_options('specialty', specialty_label, form_desc, required=required) def _add_mailing_address_field(self, form_desc, required=True): """Add a mailing address field to a form description. Arguments: form_desc: A form description Keyword Arguments: required (bool): Whether this field is required; defaults to True """ # Translators: This label appears above a field on the registration form # meant to hold the user's mailing address. mailing_address_label = _(u"Mailing address") error_msg = accounts.REQUIRED_FIELD_MAILING_ADDRESS_MSG form_desc.add_field( "mailing_address", label=mailing_address_label, field_type="textarea", required=required, error_messages={ "required": error_msg } ) def _add_goals_field(self, form_desc, required=True): """Add a goals field to a form description. Arguments: form_desc: A form description Keyword Arguments: required (bool): Whether this field is required; defaults to True """ # Translators: This phrase appears above a field on the registration form # meant to hold the user's reasons for registering with edX. goals_label = _(u"Tell us why you're interested in {platform_name}").format( platform_name=configuration_helpers.get_value("PLATFORM_NAME", settings.PLATFORM_NAME) ) error_msg = accounts.REQUIRED_FIELD_GOALS_MSG form_desc.add_field( "goals", label=goals_label, field_type="textarea", required=required, error_messages={ "required": error_msg } ) def _add_city_field(self, form_desc, required=True): """Add a city field to a form description. Arguments: form_desc: A form description Keyword Arguments: required (bool): Whether this field is required; defaults to True """ # Translators: This label appears above a field on the registration form # which allows the user to input the city in which they live. city_label = _(u"City") error_msg = accounts.REQUIRED_FIELD_CITY_MSG form_desc.add_field( "city", label=city_label, required=required, error_messages={ "required": error_msg } ) def _add_state_field(self, form_desc, required=False): """Add a State/Province/Region field to a form description. Arguments: form_desc: A form description Keyword Arguments: required (bool): Whether this field is required; defaults to False """ # Translators: This label appears above a field on the registration form # which allows the user to input the State/Province/Region in which they live. state_label = _(u"State/Province/Region") form_desc.add_field( "state", label=state_label, required=required ) def _add_company_field(self, form_desc, required=False): """Add a Company field to a form description. Arguments: form_desc: A form description Keyword Arguments: required (bool): Whether this field is required; defaults to False """ # Translators: This label appears above a field on the registration form # which allows the user to input the Company company_label = _(u"Company") form_desc.add_field( "company", label=company_label, required=required ) def _add_title_field(self, form_desc, required=False): """Add a Title field to a form description. Arguments: form_desc: A form description Keyword Arguments: required (bool): Whether this field is required; defaults to False """ # Translators: This label appears above a field on the registration form # which allows the user to input the Title title_label = _(u"Title") form_desc.add_field( "title", label=title_label, required=required ) def _add_first_name_field(self, form_desc, required=False): """Add a First Name field to a form description. Arguments: form_desc: A form description Keyword Arguments: required (bool): Whether this field is required; defaults to False """ # Translators: This label appears above a field on the registration form # which allows the user to input the First Name first_name_label = _(u"First Name") form_desc.add_field( "first_name", label=first_name_label, required=required ) def _add_last_name_field(self, form_desc, required=False): """Add a Last Name field to a form description. Arguments: form_desc: A form description Keyword Arguments: required (bool): Whether this field is required; defaults to False """ # Translators: This label appears above a field on the registration form # which allows the user to input the First Name last_name_label = _(u"Last Name") form_desc.add_field( "last_name", label=last_name_label, required=required ) def _add_country_field(self, form_desc, required=True): """Add a country field to a form description. Arguments: form_desc: A form description Keyword Arguments: required (bool): Whether this field is required; defaults to True """ # Translators: This label appears above a dropdown menu on the registration # form used to select the country in which the user lives. country_label = _(u"Country or Region of Residence") country_instructions = _( # Translators: These instructions appear on the registration form, immediately # below a field meant to hold the user's country. u"The country or region where you live." ) error_msg = accounts.REQUIRED_FIELD_COUNTRY_MSG # If we set a country code, make sure it's uppercase for the sake of the form. default_country = form_desc._field_overrides.get('country', {}).get('defaultValue') if default_country: form_desc.override_field_properties( 'country', default=default_country.upper() ) form_desc.add_field( "country", label=country_label, instructions=country_instructions, field_type="select", options=list(countries), include_default_option=True, required=required, error_messages={ "required": error_msg } ) def _add_honor_code_field(self, form_desc, required=True): """Add an honor code field to a form description. Arguments: form_desc: A form description Keyword Arguments: required (bool): Whether this field is required; defaults to True """ # Separate terms of service and honor code checkboxes if self._is_field_visible("terms_of_service"): terms_label = _(u"Honor Code") terms_link = marketing_link("HONOR") terms_text = _(u"Review the Honor Code") # Combine terms of service and honor code checkboxes else: # Translators: This is a legal document users must agree to # in order to register a new account. terms_label = _(u"Terms of Service and Honor Code") terms_link = marketing_link("HONOR") terms_text = _(u"Review the Terms of Service and Honor Code") # Translators: "Terms of Service" is a legal document users must agree to # in order to register a new account. label = _(u"I agree to the {platform_name} {terms_of_service}").format( platform_name=configuration_helpers.get_value("PLATFORM_NAME", settings.PLATFORM_NAME), terms_of_service=terms_label ) # Translators: "Terms of Service" is a legal document users must agree to # in order to register a new account. error_msg = _(u"You must agree to the {platform_name} {terms_of_service}").format( platform_name=configuration_helpers.get_value("PLATFORM_NAME", settings.PLATFORM_NAME), terms_of_service=terms_label ) form_desc.add_field( "honor_code", label=label, field_type="checkbox", default=False, required=required, error_messages={ "required": error_msg }, supplementalLink=terms_link, supplementalText=terms_text ) def _add_terms_of_service_field(self, form_desc, required=True): """Add a terms of service field to a form description. Arguments: form_desc: A form description Keyword Arguments: required (bool): Whether this field is required; defaults to True """ # Translators: This is a legal document users must agree to # in order to register a new account. terms_label = _(u"Terms of Service") terms_link = marketing_link("TOS") terms_text = _(u"Review the Terms of Service") # Translators: "Terms of service" is a legal document users must agree to # in order to register a new account. label = _(u"I agree to the {platform_name} {terms_of_service}").format( platform_name=configuration_helpers.get_value("PLATFORM_NAME", settings.PLATFORM_NAME), terms_of_service=terms_label ) # Translators: "Terms of service" is a legal document users must agree to # in order to register a new account. error_msg = _(u"You must agree to the {platform_name} {terms_of_service}").format( platform_name=configuration_helpers.get_value("PLATFORM_NAME", settings.PLATFORM_NAME), terms_of_service=terms_label ) form_desc.add_field( "terms_of_service", label=label, field_type="checkbox", default=False, required=required, error_messages={ "required": error_msg }, supplementalLink=terms_link, supplementalText=terms_text ) def _apply_third_party_auth_overrides(self, request, form_desc): """Modify the registration form if the user has authenticated with a third-party provider. If a user has successfully authenticated with a third-party provider, but does not yet have an account with EdX, we want to fill in the registration form with any info that we get from the provider. This will also hide the password field, since we assign users a default (random) password on the assumption that they will be using third-party auth to log in. Arguments: request (HttpRequest): The request for the registration form, used to determine if the user has successfully authenticated with a third-party provider. form_desc (FormDescription): The registration form description """ if third_party_auth.is_enabled(): running_pipeline = third_party_auth.pipeline.get(request) if running_pipeline: current_provider = third_party_auth.provider.Registry.get_from_pipeline(running_pipeline) if current_provider: # Override username / email / full name field_overrides = current_provider.get_register_form_data( running_pipeline.get('kwargs') ) # When the TPA Provider is configured to skip the registration form and we are in an # enterprise context, we need to hide all fields except for terms of service and # ensure that the user explicitly checks that field. hide_registration_fields_except_tos = (current_provider.skip_registration_form and enterprise_customer_for_request(request)) for field_name in self.DEFAULT_FIELDS + self.EXTRA_FIELDS: if field_name in field_overrides: form_desc.override_field_properties( field_name, default=field_overrides[field_name] ) if (field_name not in ['terms_of_service', 'honor_code'] and field_overrides[field_name] and hide_registration_fields_except_tos): form_desc.override_field_properties( field_name, field_type="hidden", label="", instructions="", ) # Hide the password field form_desc.override_field_properties( "password", default="", field_type="hidden", required=False, label="", instructions="", restrictions={} ) # used to identify that request is running third party social auth form_desc.add_field( "social_auth_provider", field_type="hidden", label="", default=current_provider.name if current_provider.name else "Third Party", required=False, )
angelapper/edx-platform
openedx/core/djangoapps/user_api/api.py
Python
agpl-3.0
35,762
# ############################################################################ # OSIS stands for Open Student Information System. It's an application # designed to manage the core business of higher education institutions, # such as universities, faculties, institutes and professional schools. # The core business involves the administration of students, teachers, # courses, programs and so on. # # Copyright (C) 2015-2020 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # A copy of this license - GNU General Public License - is available # at the root of the source code of this program. If not, # see http://www.gnu.org/licenses/. # ############################################################################ from unittest import mock from django.test import SimpleTestCase from program_management.ddd import command from program_management.ddd.domain.service.identity_search import ProgramTreeVersionIdentitySearch from program_management.ddd.repositories.program_tree_version import ProgramTreeVersionRepository from program_management.ddd.service.read import get_program_tree_version_from_node_service class TestGetProgramTreeVersionFromNodeService(SimpleTestCase): @mock.patch.object(ProgramTreeVersionIdentitySearch, 'get_from_node_identity') @mock.patch.object(ProgramTreeVersionRepository, 'get') def test_domain_service_is_called(self, mock_domain_service, mock_repository_get): cmd = command.GetProgramTreeVersionFromNodeCommand(code="LDROI1200", year=2018) get_program_tree_version_from_node_service.get_program_tree_version_from_node(cmd) self.assertTrue(mock_domain_service.called) self.assertTrue(mock_repository_get.called)
uclouvain/OSIS-Louvain
program_management/tests/ddd/service/read/test_get_program_tree_version_from_node_service.py
Python
agpl-3.0
2,219
# -*- coding: utf-8; -*- # # This file is part of Superdesk. # # Copyright 2013, 2014 Sourcefabric z.u. and contributors. # # For the full copyright and license information, please see the # AUTHORS and LICENSE files distributed with this source code, or # at https://www.sourcefabric.org/superdesk/license import logging from lxml import etree from superdesk.metadata.item import ITEM_TYPE, CONTENT_TYPE, FORMATS, FORMAT from superdesk.etree import parse_html from superdesk.text_utils import get_text from superdesk.publish import registered_transmitters formatters = [] logger = logging.getLogger(__name__) class FormatterRegistry(type): """Registry metaclass for formatters.""" def __init__(cls, name, bases, attrs): """Register sub-classes of Formatter class when defined.""" super(FormatterRegistry, cls).__init__(name, bases, attrs) if name != "Formatter": formatters.append(cls) class Formatter(metaclass=FormatterRegistry): """Base Formatter class for all types of Formatters like News ML 1.2, News ML G2, NITF, etc.""" def __init__(self): self.can_preview = False self.can_export = False self.destination = None self.subscriber = None def format(self, article, subscriber, codes=None): """Formats the article and returns the transformed string""" raise NotImplementedError() def export(self, article, subscriber, codes=None): """Formats the article and returns the output string for export""" raise NotImplementedError() def can_format(self, format_type, article): """Test if formatter can format for given article.""" raise NotImplementedError() def append_body_footer(self, article): """ Checks if the article has any Public Service Announcements and if available appends each of them to the body. :return: body with public service announcements. """ try: article["body_html"] = article["body_html"].replace("<br>", "<br/>") except KeyError: pass body = "" if article[ITEM_TYPE] in [CONTENT_TYPE.TEXT, CONTENT_TYPE.PREFORMATTED]: body = article.get("body_html", "") elif article[ITEM_TYPE] in [CONTENT_TYPE.AUDIO, CONTENT_TYPE.PICTURE, CONTENT_TYPE.VIDEO]: body = article.get("description", "") if body and article.get(FORMAT, "") == FORMATS.PRESERVED: body = body.replace("\n", "\r\n").replace("\r\r", "\r") parsed = parse_html(body, content="html") for br in parsed.xpath("//br"): br.tail = "\r\n" + br.tail if br.tail else "\r\n" etree.strip_elements(parsed, "br", with_tail=False) body = etree.tostring(parsed, encoding="unicode") if body and article.get("body_footer"): footer = article.get("body_footer") if article.get(FORMAT, "") == FORMATS.PRESERVED: body = "{}\r\n{}".format(body, get_text(footer)) else: body = "{}{}".format(body, footer) return body def append_legal(self, article, truncate=False): """ Checks if the article has the legal flag on and adds 'Legal:' to the slugline :param article: article having the slugline :param truncate: truncates the slugline to 24 characters :return: updated slugline """ slugline = article.get("slugline", "") or "" if article.get("flags", {}).get("marked_for_legal", False): slugline = "{}: {}".format("Legal", slugline) if truncate: slugline = slugline[:24] return slugline def map_html_to_xml(self, element, html): """ Map the html text tags to xml :param etree.Element element: The xml element to populate :param str html: the html to parse the text from :return: """ root = parse_html(html, content="html") # if there are no ptags just br if not len(root.xpath("//p")) and len(root.xpath("//br")): para = etree.SubElement(element, "p") for br in root.xpath("//br"): etree.SubElement(para, "br").text = br.text for p in root.xpath("//p"): para = etree.SubElement(element, "p") if len(p.xpath(".//br")) > 0: for br in p.xpath(".//br"): etree.SubElement(para, "br").text = br.text para.text = etree.tostring(p, encoding="unicode", method="text") # there neither ptags pr br's if len(list(element)) == 0: etree.SubElement(element, "p").text = etree.tostring(root, encoding="unicode", method="text") def set_destination(self, destination=None, subscriber=None): self.destination = destination self.subscriber = subscriber def get_formatter(format_type, article): for formatter_cls in formatters: formatter_instance = formatter_cls() if formatter_instance.can_format(format_type, article): return formatter_instance def get_all_formatters(): """Return all formatters registered.""" return [formatter_cls() for formatter_cls in formatters] from .nitf_formatter import NITFFormatter # NOQA from .ninjs_formatter import NINJSFormatter, NINJS2Formatter # NOQA from .newsml_1_2_formatter import NewsML12Formatter # NOQA from .newsml_g2_formatter import NewsMLG2Formatter # NOQA from .email_formatter import EmailFormatter # NOQA from .ninjs_newsroom_formatter import NewsroomNinjsFormatter # NOQA from .idml_formatter import IDMLFormatter # NOQA from .ninjs_ftp_formatter import FTPNinjsFormatter # NOQA from .imatrics import IMatricsFormatter # NOQA
petrjasek/superdesk-core
superdesk/publish/formatters/__init__.py
Python
agpl-3.0
5,788
#!/usr/bin/env python ## \file change_version_number.py # \brief Python script for updating the version number of the SU2 suite. # \author A. Aranake # \version 5.0.0 "Raven" # # SU2 Original Developers: Dr. Francisco D. Palacios. # Dr. Thomas D. Economon. # # SU2 Developers: Prof. Juan J. Alonso's group at Stanford University. # Prof. Piero Colonna's group at Delft University of Technology. # Prof. Nicolas R. Gauger's group at Kaiserslautern University of Technology. # Prof. Alberto Guardone's group at Polytechnic University of Milan. # Prof. Rafael Palacios' group at Imperial College London. # Prof. Edwin van der Weide's group at the University of Twente. # Prof. Vincent Terrapon's group at the University of Liege. # # Copyright (C) 2012-2017 SU2, the open-source CFD code. # # SU2 is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # SU2 is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with SU2. If not, see <http://www.gnu.org/licenses/>. # Run the script from the base directory (ie $SU2HOME). Grep will search directories recursively for matches in version number import os,sys oldvers = '4.3.0 "Cardinal"' newvers = '5.0.0 "Raven"' os.system('rm -rf version.txt') # Grep flag cheatsheet: # -I : Ignore binary files # -F : Match exact pattern (instead of regular expressions) # -w : Match whole word # -r : search directory recursively # -v : Omit search string (.svn omitted, line containing ISC is CGNS related) os.system("grep -IFwr '%s' *|grep -vF '.svn' |grep -v ISC > version.txt"%oldvers) # Create a list of files to adjust filelist = [] f = open('version.txt','r') for line in f.readlines(): candidate = line.split(':')[0] if not candidate in filelist and candidate.find(sys.argv[0])<0: filelist.append(candidate) f.close() print filelist # Prompt user before continuing yorn = '' while(not yorn.lower()=='y'): yorn = raw_input('Replace %s with %s in the listed files? [Y/N]: '%(oldvers,newvers)) if yorn.lower()=='n': print 'The file version.txt contains matches of oldvers' sys.exit() # Loop through and correct all files for fname in filelist: s = open(fname,'r').read() s_new = s.replace(oldvers,newvers) f = open(fname,'w') f.write(s_new) f.close() os.system('rm -rf version.txt')
pawhewitt/Dev
SU2_PY/change_version_number.py
Python
lgpl-2.1
2,840
############################################################################## # Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, [email protected], All rights reserved. # LLNL-CODE-647188 # # For details, see https://github.com/spack/spack # Please also see the NOTICE and LICENSE files for our notice and the LGPL. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License (as # published by the Free Software Foundation) version 2.1, February 1999. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and # conditions of the GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## from spack import * import sys import os class Nwchem(Package): """High-performance computational chemistry software""" homepage = "http://www.nwchem-sw.org" url = "http://www.nwchem-sw.org/images/Nwchem-6.6.revision27746-src.2015-10-20.tar.gz" tags = ['ecp', 'ecp-apps'] version('6.8', '50b18116319f4c15d1cb7eaa1b433006', url='https://github.com/nwchemgit/nwchem/archive/v6.8-release.tar.gz') version('6.6', 'c581001c004ea5e5dfacb783385825e3', url='http://www.nwchem-sw.org/images/Nwchem-6.6.revision27746-src.2015-10-20.tar.gz') depends_on('blas') depends_on('lapack') depends_on('mpi') depends_on('scalapack') depends_on('[email protected]:2.8', type=('build', 'link', 'run')) # first hash is sha256 of the patch (required for URL patches), # second is sha256 for the archive. # patches for 6.6-27746: urls_for_patches = { '@6.6': [ ('http://www.nwchem-sw.org/images/Tddft_mxvec20.patch.gz', 'ae04d4754c25fc324329dab085d4cc64148c94118ee702a7e14fce6152b4a0c5', 'cdfa8a5ae7d6ee09999407573b171beb91e37e1558a3bfb2d651982a85f0bc8f'), ('http://www.nwchem-sw.org/images/Tools_lib64.patch.gz', 'ef2eadef89c055c4651ea807079577bd90e1bc99ef6c89f112f1f0e7560ec9b4', '76b8d3e1b77829b683234c8307fde55bc9249b87410914b605a76586c8f32dae'), ('http://www.nwchem-sw.org/images/Config_libs66.patch.gz', '56f9c4bab362d82fb30d97564469e77819985a38e15ccaf04f647402c1ee248e', 'aa17f03cbb22ad7d883e799e0fddad1b5957f5f30b09f14a1a2caeeb9663cc07'), ('http://www.nwchem-sw.org/images/Cosmo_meminit.patch.gz', 'f05f09ca235ad222fe47d880bfd05a1b88d0148b990ca8c7437fa231924be04b', '569c5ee528f3922ee60ca831eb20ec6591633a36f80efa76cbbe41cabeb9b624'), ('http://www.nwchem-sw.org/images/Sym_abelian.patch.gz', 'e3470fb5786ab30bf2eda3bb4acc1e4c48fb5e640a09554abecf7d22b315c8fd', 'aa693e645a98dbafbb990e26145d65b100d6075254933f36326cf00bac3c29e0'), ('http://www.nwchem-sw.org/images/Xccvs98.patch.gz', '75540e0436c12e193ed0b644cff41f5036d78c101f14141846083f03ad157afa', '1c0b0f1293e3b9b05e9e51e7d5b99977ccf1edb4b072872c8316452f6cea6f13'), ('http://www.nwchem-sw.org/images/Dplot_tolrho.patch.gz', '8c30f92730d15f923ec8a623e3b311291eb2ba8b9d5a9884716db69a18d14f24', '2ebb1a5575c44eef4139da91f0e1e60057b2eccdba7f57a8fb577e840c326cbb'), ('http://www.nwchem-sw.org/images/Driver_smalleig.patch.gz', 'a040df6f1d807402ce552ba6d35c9610d5efea7a9d6342bbfbf03c8d380a4058', 'dd65bfbae6b472b94c8ee81d74f6c3ece37c8fc8766ff7a3551d8005d44815b8'), ('http://www.nwchem-sw.org/images/Ga_argv.patch.gz', '6fcd3920978ab95083483d5ed538cd9a6f2a80c2cafa0c5c7450fa5621f0a314', '8a78cb2af14314b92be9d241b801e9b9fed5527b9cb47a083134c7becdfa7cf1'), ('http://www.nwchem-sw.org/images/Raman_displ.patch.gz', 'ca4312cd3ed1ceacdc3a7d258bb05b7824c393bf44f44c28a789ebeb29a8dba4', '6a16f0f589a5cbb8d316f68bd2e6a0d46cd47f1c699a4b256a3973130061f6c3'), ('http://www.nwchem-sw.org/images/Ga_defs.patch.gz', 'f8ac827fbc11f7d2a9d8ec840c6f79d4759ef782bd4d291f2e88ec81b1b230aa', 'c6f1a48338d196e1db22bcfc6087e2b2e6eea50a34d3a2b2d3e90cccf43742a9'), ('http://www.nwchem-sw.org/images/Zgesvd.patch.gz', 'c333a94ceb2c35a490f24b007485ac6e334e153b03cfc1d093b6037221a03517', '4af592c047dc3e0bc4962376ae2c6ca868eb7a0b40a347ed9b88e887016ad9ed'), ('http://www.nwchem-sw.org/images/Cosmo_dftprint.patch.gz', '449d59983dc68c23b34e6581370b2fb3d5ea425b05c3182f0973e5b0e1a62651', 'd3b73431a68d6733eb7b669d471e18a83e03fa8e40c48e536fe8edecd99250ff'), ('http://www.nwchem-sw.org/images/Txs_gcc6.patch.gz', '1dab87f23b210e941c765f7dd7cc2bed06d292a2621419dede73f10ba1ca1bcd', '139692215718cd7414896470c0cc8b7817a73ece1e4ca93bf752cf1081a195af'), ('http://www.nwchem-sw.org/images/Gcc6_optfix.patch.gz', '8f8a5f8246bc1e42ef0137049acab4448a2e560339f44308703589adf753c148', '15cff43ab0509e0b0e83c49890032a848d6b7116bd6c8e5678e6c933f2d051ab'), ('http://www.nwchem-sw.org/images/Util_gnumakefile.patch.gz', '173e17206a9099c3512b87e3f42441f5b089db82be1d2b306fe2a0070e5c8fad', '5dd82b9bd55583152295c999a0e4d72dd9d5c6ab7aa91117c2aae57a95a14ba1'), ('http://www.nwchem-sw.org/images/Util_getppn.patch.gz', 'c4a23592fdcfb1fb6b65bc6c1906ac36f9966eec4899c4329bc8ce12015d2495', '8be418e1f8750778a31056f1fdf2a693fa4a12ea86a531f1ddf6f3620421027e'), ('http://www.nwchem-sw.org/images/Gcc6_macs_optfix.patch.gz', 'ff33d5f1ccd33385ffbe6ce7a18ec1506d55652be6e7434dc8065af64c879aaa', 'fade16098a1f54983040cdeb807e4e310425d7f66358807554e08392685a7164'), ('http://www.nwchem-sw.org/images/Notdir_fc.patch.gz', '54c722fa807671d6bf1a056586f0923593319d09c654338e7dd461dcd29ff118', 'a6a233951eb254d8aff5b243ca648def21fa491807a66c442f59c437f040ee69') ] } # Iterate over patches for __condition, __urls in urls_for_patches.items(): for __url, __sha256, __archive_sha256 in __urls: patch(__url, when=__condition, level=0, sha256=__sha256, archive_sha256=__archive_sha256) def install(self, spec, prefix): scalapack = spec['scalapack'].libs lapack = spec['lapack'].libs blas = spec['blas'].libs # see http://www.nwchem-sw.org/index.php/Compiling_NWChem args = [] args.extend([ 'NWCHEM_TOP=%s' % self.stage.source_path, # NWCHEM is picky about FC and CC. They should NOT be full path. # see http://www.nwchem-sw.org/index.php/Special:AWCforum/sp/id7524 'CC=%s' % os.path.basename(spack_cc), 'FC=%s' % os.path.basename(spack_fc), 'USE_MPI=y', 'MPI_LOC=%s' % spec['mpi'].prefix, 'USE_PYTHONCONFIG=y', 'PYTHONVERSION=%s' % spec['python'].version.up_to(2), 'PYTHONHOME=%s' % spec['python'].home, 'BLASOPT=%s' % ((lapack + blas).ld_flags), 'BLAS_LIB=%s' % blas.ld_flags, 'LAPACK_LIB=%s' % lapack.ld_flags, 'USE_SCALAPACK=y', 'SCALAPACK=%s' % scalapack.ld_flags, 'NWCHEM_MODULES=all python', 'NWCHEM_LONG_PATHS=Y' # by default NWCHEM_TOP is 64 char max ]) # TODO: query if blas/lapack/scalapack uses 64bit Ints # A flag to distinguish between 32bit and 64bit integers in linear # algebra (Blas, Lapack, Scalapack) use_32_bit_lin_alg = True if use_32_bit_lin_alg: args.extend([ 'USE_64TO32=y', 'BLAS_SIZE=4', 'LAPACK_SIZE=4', 'SCALAPACK_SIZE=4' ]) else: args.extend([ 'BLAS_SIZE=8', 'LAPACK_SIZE=8' 'SCALAPACK_SIZE=8' ]) if sys.platform == 'darwin': target = 'MACX64' args.extend([ 'CFLAGS_FORGA=-DMPICH_NO_ATTR_TYPE_TAGS' ]) else: target = 'LINUX64' args.extend(['NWCHEM_TARGET=%s' % target]) with working_dir('src'): make('nwchem_config', *args) if use_32_bit_lin_alg: make('64_to_32', *args) make(*args) # need to install by hand. Follow Ubuntu: # http://packages.ubuntu.com/trusty/all/nwchem-data/filelist # http://packages.ubuntu.com/trusty/amd64/nwchem/filelist share_path = join_path(prefix, 'share', 'nwchem') mkdirp(prefix.bin) install_tree('data', share_path) install_tree(join_path('basis', 'libraries'), join_path(share_path, 'libraries')) install_tree(join_path('nwpw', 'libraryps'), join_path(share_path, 'libraryps')) b_path = join_path(self.stage.source_path, 'bin', target, 'nwchem') chmod = which('chmod') chmod('+x', b_path) install(b_path, prefix.bin) # Finally, make user's life easier by creating a .nwchemrc file # to point to the required data files. nwchemrc = """\ nwchem_basis_library {data}/libraries/ nwchem_nwpw_library {data}/libraryps/ ffield amber amber_1 {data}/amber_s/ amber_2 {data}/amber_q/ amber_3 {data}/amber_x/ amber_4 {data}/amber_u/ spce {data}/solvents/spce.rst charmm_s {data}/charmm_s/ charmm_x {data}/charmm_x/ """.format(data=share_path) with open(".nwchemrc", 'w') as f: f.write(nwchemrc) install(".nwchemrc", share_path)
mfherbst/spack
var/spack/repos/builtin/packages/nwchem/package.py
Python
lgpl-2.1
9,995
############################################################################## # Name: misc/scripts/update_doc_utils.py # Purpose: base utilities for others update_doc_*.py scripts # Created: 2007-08-1 # RCS-ID: $Id$ # Copyright: (c) 2007 Francesco Montorsi # Licence: wxWindows licence ############################################################################## import sys, os, glob, distutils.file_util DOCS_PATH="../../docs/latex/wx" # Calls the given callback with the name of a documented class, its .tex related file, # the content of that .tex file and the number of the line of the relative \class tag, # for all documented class in DOCS_PATH. If the callback returns false the processing is stopped. # Returns the number of .tex files processed. def scanTexFiles(callback): count = 0 for f in glob.glob(DOCS_PATH + '/*.tex'): file = open(f, "r") if not file: print "could not open %s" % f continue print "opened file %s" % f count = count + 1 # search \class tags content = file.readlines() classdecl = 0 for i in range(len(content)): line = content[i] if "\class{" in line: classdecl = classdecl + 1 # polish the class name classname = line classname = classname[classname.find("\class{"):] classname = classname[classname.find("{")+1:classname.find("}")] print " the class declared is named '%s'" % classname # process this \class if not callback(classname, f, content, i): return count print " file %s contains %d class declarations" % (f, classdecl) return count
enachb/freetel-code
src/wxWidgets-2.9.4/misc/scripts/update_doc_utils.py
Python
lgpl-2.1
1,788