提交 ab264fde 编写于 作者: C calin.cerchez

added python parser for ASN.1 files

上级 a3e7def8
#Tue Aug 07 12:39:51 EEST 2012
eclipse.preferences.version=1
encoding/<project>=US-ASCII
此差异已折叠。
file 24863 1344238656
version 2
run General-0-20120724-18:36:56-5212
attr configname General
attr datetime 20120724-18:36:56
attr experiment General
attr inifile omnetpp.ini
attr iterationvars ""
attr iterationvars2 $repetition=0
attr measurement ""
attr network Test
attr processid 5212
attr repetition 0
attr replication #0
attr resultdir results
attr runnumber 0
attr seedset 0
vector 2 Test.enb.eth[0].mac framesSent ETV
2 12050 314 53 935 0.001006719999 8.000011359999 13 1 13 91 819
vector 4 Test.enb.eth[0].mac bytesSent ETV
4 12677 338 53 935 0.001006719999 8.000011359999 13 64 1212 8136 6774856
vector 35 Test.mme.eth[0].mac framesReceivedOK ETV
35 14627 327 54 936 0.001006719999 8.000011359999 13 1 13 91 819
vector 37 Test.mme.eth[0].mac bytesReceivedOK ETV
37 15304 351 54 936 0.001006719999 8.000011359999 13 64 1212 8136 6774856
vector 41 Test.mme.eth[0].mac framesPassedToHL ETV
41 15655 327 54 936 0.001006719999 8.000011359999 13 1 13 91 819
vector 34 Test.mme.eth[0].mac framesSent ETV
34 14301 326 65 954 0.001013439998 8.200018239998 13 1 13 91 819
vector 36 Test.mme.eth[0].mac bytesSent ETV
36 14954 350 65 954 0.001013439998 8.200018239998 13 64 1150 7856 6173416
vector 3 Test.enb.eth[0].mac framesReceivedOK ETV
3 12364 313 66 955 0.001013439998 8.200018239998 13 1 13 91 819
vector 5 Test.enb.eth[0].mac bytesReceivedOK ETV
5 13015 337 66 955 0.001013439998 8.200018239998 13 64 1150 7856 6173416
vector 9 Test.enb.eth[0].mac framesPassedToHL ETV
9 13352 313 66 955 0.001013439998 8.200018239998 13 1 13 91 819
vector 199 Test.mme.sctp "Slow Start Threshold 13:192.168.2.1" ETV
199 7843 109 110 1578 0.001047199995 30 5 0 65535 262140 17179344900
vector 200 Test.mme.sctp "Congestion Window 13:192.168.2.1" ETV
200 7952 105 110 1578 0.001047199995 30 5 0 4380 17520 76737600
vector 203 Test.mme.sctp "HB Sent 13:192.168.2.1" ETV
203 8579 26 110 110 0.001047199995 0.001047199995 1 1 1 1 1
vector 197 Test.mme.sctp "RTO 13:192.168.2.1" ETV
197 8057 145 110 1578 0.001047199995 30 6 0 3 7 13
vector 32 Test.mme.eth[0].queue "queue length" ETV
32 14202 99 119 214 0.001047199995 0.00108543999 4 0 1 2 2
vector 190 Test.enb.sctp "HB ACK Sent 5:192.168.2.2" ETV
190 7580 26 131 131 0.001054079994 0.001054079994 1 1 1 1 1
vector 191 Test.enb.sctp "HB Received 5:192.168.2.2" ETV
191 7554 26 131 131 0.001054079994 0.001054079994 1 1 1 1 1
vector 185 Test.enb.sctp "Slow Start Threshold 5:192.168.2.2" ETV
185 6707 126 147 1578 0.001060799993 30 6 0 65535 327675 21474181125
vector 186 Test.enb.sctp "Congestion Window 5:192.168.2.2" ETV
186 6833 121 147 1578 0.001060799993 30 6 0 4380 21900 95922000
vector 189 Test.enb.sctp "HB Sent 5:192.168.2.2" ETV
189 7528 26 147 147 0.001060799993 0.001060799993 1 1 1 1 1
vector 183 Test.enb.sctp "RTO 5:192.168.2.2" ETV
183 6954 171 147 1578 0.001060799993 30 7 0 3 8 14
vector 212 Test.enb.sctp "SendQueue of Association 5" ETV
212 7752 91 151 926 0.001060799993 8 5 0 0 0 0
vector 187 Test.enb.sctp "TSN Sent 5:192.168.2.2" ETV
187 7335 106 151 926 0.001060799993 8 5 1000 1004 5010 5020030
vector 0 Test.enb.eth[0].queue "queue length" ETV
0 11954 96 154 168 0.001060799993 0.001067839992 4 0 2 4 6
vector 206 Test.mme.sctp "HB ACK Received 13:192.168.2.1" ETV
206 8657 26 165 165 0.001060959993 0.001060959993 1 1 1 1 1
vector 198 Test.mme.sctp "RTT 13:192.168.2.1" ETV
198 8202 171 165 1578 0.001060959993 30 5 0 0.200024959998 0.400078559991 0.080016385635084
vector 204 Test.mme.sctp "HB ACK Sent 13:192.168.2.1" ETV
204 8631 26 175 175 0.001067839992 0.001067839992 1 1 1 1 1
vector 205 Test.mme.sctp "HB Received 13:192.168.2.1" ETV
205 8605 26 175 175 0.001067839992 0.001067839992 1 1 1 1 1
vector 192 Test.enb.sctp "HB ACK Received 5:192.168.2.2" ETV
192 7606 26 191 191 0.001074719991 0.001074719991 1 1 1 1 1
vector 184 Test.enb.sctp "RTT 5:192.168.2.2" ETV
184 7125 210 191 1578 0.001074719991 30 6 0 0.200019199998 0.80008751999 0.16002944154819
vector 202 Test.mme.sctp "TSN Received 13:192.168.2.1" ETV
202 8434 145 197 940 0.001078559991 8.000011359999 5 1000 1004 5010 5020030
vector 194 Test.mme.sctp "Advertised Receiver Window 10" ETV
194 8683 150 197 945 0.001078559991 8.200011359999 5 65489 65535 327629 21468154021
vector 209 Test.mme.sctp "SendQueue of Association 13" ETV
209 8833 52 204 816 0.001078559991 6 3 0 0 0 0
vector 201 Test.mme.sctp "TSN Sent 13:192.168.2.1" ETV
201 8373 61 204 816 0.001078559991 6 3 2000 2002 6003 12012005
vector 188 Test.enb.sctp "TSN Received 5:192.168.2.2" ETV
188 7441 87 229 830 0.001095519989 6.000018079999 3 2000 2002 6003 12012005
vector 182 Test.enb.sctp "Advertised Receiver Window 5" ETV
182 7632 120 229 892 0.001095519989 6.200018079999 4 65498 65535 262103 17174496679
vector 48 Test.mme.eth[1].mac framesSent ETV
48 16082 388 257 1416 1.000006719999 23.296778892706 15 1 15 120 1240
vector 50 Test.mme.eth[1].mac bytesSent ETV
50 16858 418 257 1416 1.000006719999 23.296778892706 15 64 1780 13874 17894172
vector 81 Test.hss.eth[0].mac framesReceivedOK ETV
81 19362 388 258 1417 1.000006719999 23.296778892706 15 1 15 120 1240
vector 83 Test.hss.eth[0].mac bytesReceivedOK ETV
83 20167 418 258 1417 1.000006719999 23.296778892706 15 64 1780 13874 17894172
vector 87 Test.hss.eth[0].mac framesPassedToHL ETV
87 20585 388 258 1417 1.000006719999 23.296778892706 15 1 15 120 1240
vector 80 Test.hss.eth[0].mac framesSent ETV
80 18974 388 269 1431 1.000013439998 23.296791212705 15 1 15 120 1240
vector 82 Test.hss.eth[0].mac bytesSent ETV
82 19750 417 269 1431 1.000013439998 23.296791212705 15 64 1818 13950 18296876
vector 49 Test.mme.eth[1].mac framesReceivedOK ETV
49 16470 388 270 1432 1.000013439998 23.296791212705 15 1 15 120 1240
vector 51 Test.mme.eth[1].mac bytesReceivedOK ETV
51 17276 417 270 1432 1.000013439998 23.296791212705 15 64 1818 13950 18296876
vector 55 Test.mme.eth[1].mac framesPassedToHL ETV
55 17693 388 270 1432 1.000013439998 23.296791212705 15 1 15 120 1240
vector 227 Test.hss.sctp "Slow Start Threshold 14:192.168.3.2" ETV
227 10392 168 314 1578 1.000047199995 30 6 0 65535 327675 21474181125
vector 228 Test.hss.sctp "Congestion Window 14:192.168.3.2" ETV
228 10560 163 314 1578 1.000047199995 30 6 0 4380 21900 95922000
vector 231 Test.hss.sctp "HB Sent 14:192.168.3.2" ETV
231 11473 26 314 314 1.000047199995 1.000047199995 1 1 1 1 1
vector 225 Test.hss.sctp "RTO 14:192.168.3.2" ETV
225 10723 201 314 1578 1.000047199995 30 8 0 3 9 15
vector 78 Test.hss.eth[0].queue "queue length" ETV
78 18875 99 323 418 1.000047199995 1.00009439999 4 0 1 2 2
vector 221 Test.mme.sctp "HB ACK Sent 8:192.168.3.1" ETV
221 10020 26 335 335 1.000054079994 1.000054079994 1 1 1 1 1
vector 222 Test.mme.sctp "HB Received 8:192.168.3.1" ETV
222 9994 26 335 335 1.000054079994 1.000054079994 1 1 1 1 1
vector 216 Test.mme.sctp "Slow Start Threshold 8:192.168.3.1" ETV
216 8885 169 351 1578 1.000060799993 30 6 0 65535 327675 21474181125
vector 217 Test.mme.sctp "Congestion Window 8:192.168.3.1" ETV
217 9054 164 351 1578 1.000060799993 30 6 0 4380 21900 95922000
vector 220 Test.mme.sctp "HB Sent 8:192.168.3.1" ETV
220 9968 26 351 351 1.000060799993 1.000060799993 1 1 1 1 1
vector 214 Test.mme.sctp "RTO 8:192.168.3.1" ETV
214 9218 200 351 1578 1.000060799993 30 8 0 3 9 15
vector 240 Test.mme.sctp "SendQueue of Association 8" ETV
240 10258 134 355 1389 1.000060799993 23.096772012707 5 0 0 0 0
vector 218 Test.mme.sctp "TSN Sent 8:192.168.3.1" ETV
218 9670 149 355 1389 1.000060799993 23.096772012707 5 1000 1004 5010 5020030
vector 46 Test.mme.eth[1].queue "queue length" ETV
46 15982 100 358 372 1.000060799993 1.000067839992 4 0 2 4 6
vector 234 Test.hss.sctp "HB ACK Received 14:192.168.3.2" ETV
234 11551 26 369 369 1.000060959993 1.000060959993 1 1 1 1 1
vector 226 Test.hss.sctp "RTT 14:192.168.3.2" ETV
226 10924 253 369 1578 1.000060959993 30 7 0 0.200040319998 0.800148959987 0.16004032422738
vector 232 Test.hss.sctp "HB ACK Sent 14:192.168.3.2" ETV
232 11525 26 379 379 1.000067839992 1.000067839992 1 1 1 1 1
vector 233 Test.hss.sctp "HB Received 14:192.168.3.2" ETV
233 11499 26 379 379 1.000067839992 1.000067839992 1 1 1 1 1
vector 223 Test.mme.sctp "HB ACK Received 8:192.168.3.1" ETV
223 10046 26 395 395 1.000074719991 1.000074719991 1 1 1 1 1
vector 215 Test.mme.sctp "RTT 8:192.168.3.1" ETV
215 9418 252 395 1578 1.000074719991 30 7 0 0.200031039998 0.800147039987 0.16003981194783
vector 230 Test.hss.sctp "TSN Received 14:192.168.3.2" ETV
230 11325 148 401 1403 1.000087519991 23.096784332706 5 1000 1004 5010 5020030
vector 195 Test.hss.sctp "Advertised Receiver Window 12" ETV
195 11577 244 401 1422 1.000087519991 23.296784332706 8 65375 65535 524120 34337744200
vector 237 Test.hss.sctp "SendQueue of Association 14" ETV
237 11821 133 408 1371 1.000087519991 23.096760652708 5 0 0 0 0
vector 229 Test.hss.sctp "TSN Sent 14:192.168.3.2" ETV
229 11177 148 408 1371 1.000087519991 23.096760652708 5 2000 2004 10010 20040030
vector 219 Test.mme.sctp "TSN Received 8:192.168.3.1" ETV
219 9819 149 433 1385 1.000115039989 23.096772012707 5 2000 2004 10010 20040030
vector 213 Test.mme.sctp "Advertised Receiver Window 8" ETV
213 10072 186 433 1407 1.000115039989 23.296772012707 6 65363 65535 393038 25746502894
vector 62 Test.mme.eth[2].mac framesSent ETV
62 18081 155 646 1570 4.000076639996 29.480276757934 6 1 6 21 91
vector 64 Test.mme.eth[2].mac bytesSent ETV
64 18390 166 646 1570 4.000076639996 29.480276757934 6 64 384 1344 372736
vector 143 Test.sgw.eth[1].mac framesReceivedOK ETV
143 23078 161 647 1571 4.000076639996 29.480276757934 6 1 6 21 91
vector 145 Test.sgw.eth[1].mac bytesReceivedOK ETV
145 23410 172 647 1571 4.000076639996 29.480276757934 6 64 384 1344 372736
vector 149 Test.sgw.eth[1].mac framesPassedToHL ETV
149 23582 161 647 1571 4.000076639996 29.480276757934 6 1 6 21 91
vector 142 Test.sgw.eth[1].mac framesSent ETV
142 22918 160 658 1554 4.000083359995 29.480270037935 6 1 6 21 91
vector 144 Test.sgw.eth[1].mac bytesSent ETV
144 23239 171 658 1554 4.000083359995 29.480270037935 6 64 384 1344 372736
vector 63 Test.mme.eth[2].mac framesReceivedOK ETV
63 18236 154 659 1555 4.000083359995 29.480270037935 6 1 6 21 91
vector 65 Test.mme.eth[2].mac bytesReceivedOK ETV
65 18556 165 659 1555 4.000083359995 29.480270037935 6 64 384 1344 372736
vector 69 Test.mme.eth[2].mac framesPassedToHL ETV
69 18721 154 659 1555 4.000083359995 29.480270037935 6 1 6 21 91
vector 128 Test.sgw.eth[0].mac framesSent ETV
128 22223 136 686 1537 4.000096799993 28.503079284997 5 1 5 15 55
vector 130 Test.sgw.eth[0].mac bytesSent ETV
130 22494 145 686 1537 4.000096799993 28.503079284997 5 64 320 960 225280
vector 99 Test.pgw.eth[0].mac framesReceivedOK ETV
99 21103 131 687 1538 4.000096799993 28.503079284997 5 1 5 15 55
vector 101 Test.pgw.eth[0].mac bytesReceivedOK ETV
101 21378 145 687 1538 4.000096799993 28.503079284997 5 64 320 960 225280
vector 105 Test.pgw.eth[0].mac framesPassedToHL ETV
105 21523 136 687 1538 4.000096799993 28.503079284997 5 1 5 15 55
vector 98 Test.pgw.eth[0].mac framesSent ETV
98 20973 130 698 1521 4.000103519992 28.503072564998 5 1 5 15 55
vector 100 Test.pgw.eth[0].mac bytesSent ETV
100 21234 144 698 1521 4.000103519992 28.503072564998 5 64 320 960 225280
vector 129 Test.sgw.eth[0].mac framesReceivedOK ETV
129 22359 135 699 1522 4.000103519992 28.503072564998 5 1 5 15 55
vector 131 Test.sgw.eth[0].mac bytesReceivedOK ETV
131 22639 144 699 1522 4.000103519992 28.503072564998 5 64 320 960 225280
vector 135 Test.sgw.eth[0].mac framesPassedToHL ETV
135 22783 135 699 1522 4.000103519992 28.503072564998 5 1 5 15 55
vector 16 Test.enb.eth[1].mac framesSent ETV
16 13665 104 971 1488 9.090631898068 28.422056252807 4 1 4 10 30
vector 18 Test.enb.eth[1].mac bytesSent ETV
18 13874 111 971 1488 9.090631898068 28.422056252807 4 64 256 640 122880
vector 171 Test.sgw.eth[3].mac framesReceivedOK ETV
171 24416 108 972 1489 9.090631898068 28.422056252807 4 1 4 10 30
vector 173 Test.sgw.eth[3].mac bytesReceivedOK ETV
173 24640 115 972 1489 9.090631898068 28.422056252807 4 64 256 640 122880
vector 177 Test.sgw.eth[3].mac framesPassedToHL ETV
177 24755 108 972 1489 9.090631898068 28.422056252807 4 1 4 10 30
vector 170 Test.sgw.eth[3].mac framesSent ETV
170 24307 109 983 1504 9.090638618067 28.422062972806 4 1 4 10 30
vector 172 Test.sgw.eth[3].mac bytesSent ETV
172 24524 116 983 1504 9.090638618067 28.422062972806 4 64 256 640 122880
vector 17 Test.enb.eth[1].mac framesReceivedOK ETV
17 13769 105 984 1505 9.090638618067 28.422062972806 4 1 4 10 30
vector 19 Test.enb.eth[1].mac bytesReceivedOK ETV
19 13985 112 984 1505 9.090638618067 28.422062972806 4 64 256 640 122880
vector 23 Test.enb.eth[1].mac framesPassedToHL ETV
23 14097 105 984 1505 9.090638618067 28.422062972806 4 1 4 10 30
vector 112 Test.pgw.eth[1].mac framesSent ETV
112 21659 110 1061 1469 9.919915405609 27.050129693673 4 1 4 10 30
vector 114 Test.pgw.eth[1].mac bytesSent ETV
114 21879 117 1061 1469 9.919915405609 27.050129693673 4 64 256 640 122880
vector 157 Test.sgw.eth[2].mac framesReceivedOK ETV
157 23853 110 1062 1470 9.919915405609 27.050129693673 4 1 4 10 30
vector 159 Test.sgw.eth[2].mac bytesReceivedOK ETV
159 24080 117 1062 1470 9.919915405609 27.050129693673 4 64 256 640 122880
vector 163 Test.sgw.eth[2].mac framesPassedToHL ETV
163 24197 110 1062 1470 9.919915405609 27.050129693673 4 1 4 10 30
vector 156 Test.sgw.eth[2].mac framesSent ETV
156 23743 110 1073 1453 9.919922125608 27.050122973674 4 1 4 10 30
vector 158 Test.sgw.eth[2].mac bytesSent ETV
158 23963 117 1073 1453 9.919922125608 27.050122973674 4 64 256 640 122880
vector 113 Test.pgw.eth[1].mac framesReceivedOK ETV
113 21769 110 1074 1454 9.919922125608 27.050122973674 4 1 4 10 30
vector 115 Test.pgw.eth[1].mac bytesReceivedOK ETV
115 21996 117 1074 1454 9.919922125608 27.050122973674 4 64 256 640 122880
vector 119 Test.pgw.eth[1].mac framesPassedToHL ETV
119 22113 110 1074 1454 9.919922125608 27.050122973674 4 1 4 10 30
此差异已折叠。
file 13724 1344238656
file 13724 1344331863
version 2
run General-0-20120709-16:16:37-6492
attr configname General
......
......@@ -16,10 +16,12 @@
//
#include "RRC.h"
#include "RRCPdu.h"
#include "RRCMessage.h"
#include "PerEncoder.h"
#include "LTEUtils.h"
Define_Module(RRC);
RRC::RRC() {
// TODO Auto-generated constructor stub
......@@ -44,9 +46,12 @@ void RRC::initialize(int stage) {
TmsiAndLaiGsmMap *tmsiAndLaiGsmMap = new TmsiAndLaiGsmMap(tmsi, lai);
InitialUeIdentity initUeId = InitialUeIdentity();
initUeId.setValue(tmsiAndLaiGsmMap, tmsiAndLai);
RRCConnectionRequest rrcConnReq = RRCConnectionRequest(initUeId, interRATCellReselection, noError);
RRCConnectionRequest *rrcConnReq = new RRCConnectionRequest(initUeId, interRATCellReselection, noError);
UlCcchMessageType ulCchMessageType = UlCcchMessageType();
ulCchMessageType.setValue(rrcConnReq, rrcConnectionRequest);
UlCcchMessage ulCchMessage = UlCcchMessage(ulCchMessageType);
PerEncoder perEnc = PerEncoder(UNALIGNED);
perEnc.encodeSequence(rrcConnReq);
perEnc.encodeSequence(ulCchMessage);
LTEUtils().printBytes(perEnc.getBuffer(), perEnc.getLength());
}
......@@ -18,7 +18,9 @@
#ifndef RRC_H_
#define RRC_H_
class RRC {
#include <omnetpp.h>
class RRC : public cSimpleModule {
public:
RRC();
virtual ~RRC();
......
//
// Copyright (C) 2012 Calin Cerchez
//
// 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, 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 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, see http://www.gnu.org/licenses/.
//
#ifndef RRCCONSTANT_H_
#define RRCCONSTANT_H_
#define hiPDSCHidentities 64
#define hiPUSCHidentities 64
#define hiRM 256
#define maxAC 16
#define maxAdditionalMeas 4
#define maxASC 8
#define maxASCmap 7
#define maxASCpersist 6
#define maxCCTrCH 8
#define maxCellMeas 32
#define maxCellMeasOnSecULFreq 32
#define maxCellMeas_1 31
#define maxCellMeasOnSecULFreq_1 31
#define maxCNdomains 4
#define maxCommonHRNTI 4
#define maxCommonQueueID 2
#define maxCPCHsets 16
#define maxDedicatedCSGFreq 4
#define maxDPCH_DLchan 8
#define maxDPDCH_UL 6
#define maxDRACclasses 8
#define maxE_DCHMACdFlow 8
#define maxE_DCHMACdFlow_1 7
#define maxEUTRACellPerFreq 16
#define maxEUTRATargetFreqs 8
#define maxEDCHRL 4
#define maxEDCHRL_1 3
#define maxEDCHs 32
#define maxEDCHTxPattern_TDD128 4
#define maxEDCHTxPattern_TDD128_1 3
#define maxERNTIgroup 32
#define maxERNTIperGroup 2
#define maxERUCCH 256
#define maxFACHPCH 8
#define maxFreq 8
#define maxFreqBandsEUTRA 16
#define maxFreqBandsFDD 8
#define maxFreqBandsFDD_ext 15
#define maxFreqBandsTDD 4
#define maxFreqBandsTDD_ext 16
#define maxFreqBandsGSM 16
#define maxGANSS 8
#define maxGANSS_1 7
#define maxGANSSSat 64
#define maxGANSSSat_1 63
#define maxGERAN_SI 8
#define maxGSMTargetCells 32
#define maxHNBNameSize 48
#define maxHProcesses 8
#define maxHS_SCCHLessTrBlk 4
#define maxHSDSCHTBIndex 64
#define maxHSDSCHTBIndex_tdd384 512
#define maxHSSCCHs 4
#define maxHSSCCHs_1 3
#define maxHSSICH_TDD128 4
#define maxHSSICH_TDD128_1 3
#define maxInterSysMessages 4
#define maxLoCHperRLC 2
#define maxMAC_d_PDUsizes 8
#define maxMBMS_CommonCCTrCh 32
#define maxMBMS_CommonPhyCh 32
#define maxMBMS_CommonRB 32
#define maxMBMS_CommonTrCh 32
#define maxMBMS_Freq 4
#define maxMBMS_L1CP 4
#define maxMBMSservCount 8
#define maxMBMSservModif 32
#define maxMBMSservSched 16
#define maxMBMSservSelect 8
#define maxMBMSservUnmodif 64
#define maxMBMSTransmis 4
#define maxMBSFNClusters 16
#define maxMeasCSGRange 4
#define maxMeasEvent 8
#define maxMeasEventOnSecULFreq 8
#define maxMeasIntervals 3
#define maxMeasOccasionPattern 5
#define maxMeasOccasionPattern_1 4
#define maxMeasParEvent 2
#define maxNumCDMA2000Freqs 8
#define maxNumE_AGCH 4
#define maxNumE_HICH 4
#define maxNumEUTRAFreqs 8
#define maxNumGSMCellGroup 16
#define maxNumGSMFreqRanges 32
#define maxNumFDDFreqs 8
#define maxNumTDDFreqs 8
#define maxNoOfMeas 16
#define maxOtherRAT 15
#define maxOtherRAT_16 16
#define maxPage1 8
#define maxPCPCH_APsig 16
#define maxPCPCH_APsubCh 12
#define maxPCPCH_CDsig 16
#define maxPCPCH_CDsubCh 12
#define maxPCPCH_SF 7
#define maxPCPCHs 64
#define maxPDCPAlgoType 8
#define maxPDSCH 8
#define maxPDSCH_TFCIgroups 256
#define maxPRACH 16
#define maxPRACH_FPACH 8
#define maxPredefConfig 16
#define maxPrio 8
#define maxPrio_1 7
#define maxPUSCH 8
#define maxQueueIDs 8
#define maxRABsetup 16
#define maxRAT 16
#define maxRB 32
#define maxRBallRABs 27
#define maxRBMuxOptions 8
#define maxRBperRAB 8
#define maxRBperTrCh 16
#define maxReportedEUTRACellPerFreq 4
#define maxReportedEUTRAFreqs 4
#define maxReportedGSMCells 8
#define maxRL 8
#define maxRL_1 7
#define maxRLCPDUsizePerLogChan 32
#define maxRFC3095_CID 16384
#define maxROHC_PacketSizes_r4 16
#define maxROHC_Profile_r4 8
#define maxRxPatternForHSDSCH_TDD128 4
#define maxRxPatternForHSDSCH_TDD128_1 3
#define maxSat 16
#define maxSatClockModels 4
#define maxSCCPCH 16
#define maxSgnType 8
#define maxSIB 32
#define maxSIB_FACH 8
#define maxSIBperMsg 16
#define maxSIrequest 4
#define maxSRBsetup 8
#define maxSystemCapability 16
#define maxTDD128Carrier 6
#define maxTbsForHSDSCH_TDD128 4
#define maxTbsForHSDSCH_TDD128_1 3
#define maxTF 32
#define maxTF_CPCH 16
#define maxTFC 1024
#define maxTFCsub 1024
#define maxTFCI_2_Combs 512
#define maxTGPS 6
#define maxTrCH 32
#define maxTrCHpreconf 32
#define maxTS 14
#define maxTS_1 13
#define maxTS_2 12
#define maxTS_LCR 6
#define maxTS_LCR_1 5
#define maxURA 8
#define maxURNTI_Group 8
#endif /* RRCCONSTANT_H_ */
......@@ -17,6 +17,24 @@
#include "RRCIe.h"
const void *Fdd::itemsInfo[1] = {
&MeasurementQuantity::theInfo
};
bool Fdd::itemsPres[1] = {
1
};
const Fdd::Info Fdd::theInfo = {
Fdd::create,
SEQUENCE,
0,
false,
itemsInfo,
itemsPres,
1, 0, 0
};
const void *ImsiAndEsnDs41::itemsInfo[2] = {
&ImsiDs41::theInfo,
&EsnDs41::theInfo,
......@@ -27,6 +45,36 @@ bool ImsiAndEsnDs41::itemsPres[2] = {
1
};
const ImsiAndEsnDs41::Info ImsiAndEsnDs41::theInfo = {
ImsiAndEsnDs41::create,
SEQUENCE,
0,
false,
itemsInfo,
itemsPres,
2, 0, 0
};
const void *IntegrityCheckInfo::itemsInfo[2] = {
&MessageAuthenticationCode::theInfo,
&RrcMessageSequenceNumber::theInfo,
};
bool IntegrityCheckInfo::itemsPres[2] = {
1,
1
};
const IntegrityCheckInfo::Info IntegrityCheckInfo::theInfo = {
IntegrityCheckInfo::create,
SEQUENCE,
0,
false,
itemsInfo,
itemsPres,
2, 0, 0
};
Mcc *toMcc(std::vector<unsigned char> mcc) {
Mcc *ret = new Mcc();
for (unsigned i = 0; i < mcc.size(); i++)
......@@ -55,6 +103,42 @@ std::vector<unsigned char> fromMnc(Mcc *mnc) {
return ret;
}
const void *MeasurementQuantity::choicesInfo[4] = {
&CpichEcN0::theInfo,
&CpichRscp::theInfo,
&Pathloss::theInfo,
&Spare::theInfo,
};
const MeasurementQuantity::Info MeasurementQuantity::theInfo = {
MeasurementQuantity::create,
CHOICE,
0,
false,
choicesInfo,
3
};
const void *MeasuredResultsOnRACH::itemsInfo[2] = {
&DummyIe::theInfo,
&DummyIe::theInfo,
};
bool MeasuredResultsOnRACH::itemsPres[2] = {
1,
0
};
const MeasuredResultsOnRACH::Info MeasuredResultsOnRACH::theInfo = {
MeasuredResultsOnRACH::create,
SEQUENCE,
0,
false,
itemsInfo,
itemsPres,
2, 1, 0
};
const void *PlmnIdentity::itemsInfo[2] = {
&Mcc::theInfo,
&Mnc::theInfo,
......@@ -65,6 +149,16 @@ bool PlmnIdentity::itemsPres[2] = {
1
};
const PlmnIdentity::Info PlmnIdentity::theInfo = {
PlmnIdentity::create,
SEQUENCE,
0,
false,
itemsInfo,
itemsPres,
2, 0, 0
};
PlmnIdentity::PlmnIdentity(std::vector<unsigned char>mcc, std::vector<unsigned char>mnc) : Sequence(&theInfo) {
setMcc(mcc);
setMnc(mnc);
......@@ -80,6 +174,16 @@ bool Lai::itemsPres[2] = {
1
};
const Lai::Info Lai::theInfo = {
Lai::create,
SEQUENCE,
0,
false,
itemsInfo,
itemsPres,
2, 0, 0
};
Lai::Lai(PlmnIdentity& plmnId, char *lac) : Sequence(&theInfo) {
setPlmnIdentity(plmnId);
setLac(lac);
......@@ -95,6 +199,16 @@ bool Rai::itemsPres[2] = {
1
};
const Rai::Info Rai::theInfo = {
Rai::create,
SEQUENCE,
0,
false,
itemsInfo,
itemsPres,
2, 0, 0
};
const void *PTmsiAndRaiGsmMap::itemsInfo[2] = {
&PTmsiGsmMap::theInfo,
&Rai::theInfo,
......@@ -105,6 +219,50 @@ bool PTmsiAndRaiGsmMap::itemsPres[2] = {
1
};
const PTmsiAndRaiGsmMap::Info PTmsiAndRaiGsmMap::theInfo = {
PTmsiAndRaiGsmMap::create,
SEQUENCE,
0,
false,
itemsInfo,
itemsPres,
2, 0, 0
};
const void *SfnSfnObsTimeDifference::choicesInfo[2] = {
&SfnSfnObsTimeDifference1::theInfo,
&SfnSfnObsTimeDifference2::theInfo,
};
const SfnSfnObsTimeDifference::Info SfnSfnObsTimeDifference::theInfo = {
SfnSfnObsTimeDifference::create,
CHOICE,
0,
false,
choicesInfo,
1
};
const void *Tdd::itemsInfo[2] = {
&TimeslotIscp::theInfo,
&PrimaryCcphRscp::theInfo
};
bool Tdd::itemsPres[2] = {
0,
0
};
const Tdd::Info Tdd::theInfo = {
Tdd::create,
SEQUENCE,
0,
false,
itemsInfo,
itemsPres,
2, 2, 0
};
const void *TmsiAndLaiGsmMap::itemsInfo[2] = {
&TmsiGsmMap::theInfo,
&Lai::theInfo,
......@@ -115,6 +273,16 @@ bool TmsiAndLaiGsmMap::itemsPres[2] = {
1
};
const TmsiAndLaiGsmMap::Info TmsiAndLaiGsmMap::theInfo = {
TmsiAndLaiGsmMap::create,
SEQUENCE,
0,
false,
itemsInfo,
itemsPres,
2, 0, 0
};
TmsiAndLaiGsmMap::TmsiAndLaiGsmMap(char *tmsi, Lai& lai) : Sequence(&theInfo) {
setTmsiGsmMap(tmsi);
setLai(lai);
......@@ -132,11 +300,31 @@ const void *InitialUeIdentity::choicesInfo[8] = {
};
const InitialUeIdentity::Info InitialUeIdentity::theInfo = {
Choice::create,
InitialUeIdentity::create,
CHOICE,
0,
true,
false,
choicesInfo,
7
};
const void *V3d0NonCriticalExtensions::itemsInfo[2] = {
&DummyIe::theInfo,
&DummyIe::theInfo,
};
bool V3d0NonCriticalExtensions::itemsPres[2] = {
1,
0
};
const V3d0NonCriticalExtensions::Info V3d0NonCriticalExtensions::theInfo = {
V3d0NonCriticalExtensions::create,
SEQUENCE,
0,
false,
itemsInfo,
itemsPres,
2, 1, 0
};
//
// Copyright (C) 2012 Calin Cerchez
//
// 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, 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 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, see http://www.gnu.org/licenses/.
//
#include "RRCMessage.h"
const void *UlCcchMessageType::choicesInfo[4] = {
&CellUpdate::theInfo,
&RRCConnectionRequest::theInfo,
&URAUpdate::theInfo,
&Spare::theInfo,
};
const UlCcchMessageType::Info UlCcchMessageType::theInfo = {
UlCcchMessageType::create,
CHOICE,
0,
false,
choicesInfo,
3
};
const void *UlCcchMessage::itemsInfo[2] = {
&IntegrityCheckInfo::theInfo,
&UlCcchMessageType::theInfo,
};
bool UlCcchMessage::itemsPres[2] = {
0,
1
};
const UlCcchMessage::Info UlCcchMessage::theInfo = {
UlCcchMessage::create,
SEQUENCE,
0,
false,
itemsInfo,
itemsPres,
2, 1, 0
};
UlCcchMessage::UlCcchMessage(UlCcchMessageType& message, IntegrityCheckInfo *integrityCheckInfo) : Sequence(&theInfo) {
setUlCchMessageType(message);
}
//
// Copyright (C) 2012 Calin Cerchez
//
// 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, 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 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, see http://www.gnu.org/licenses/.
//
#ifndef RRCMESSAGE_H_
#define RRCMESSAGE_H_
#include "RRCPdu.h"
enum UlCcchMessageTypes {
cellUpdate = 0,
rrcConnectionRequest = 1,
uraUpdate = 2,
spareUlCcchMessageType = 3
};
class UlCcchMessageType : public Choice {
private:
static const void *choicesInfo[4];
public:
static const Info theInfo;
UlCcchMessageType() : Choice(&theInfo) {}
// void setId(char *id);
// char *getId();
};
class UlCcchMessage : public Sequence {
private:
static const void *itemsInfo[2];
static bool itemsPres[2];
public:
static const Info theInfo;
UlCcchMessage(UlCcchMessageType& message, IntegrityCheckInfo *integrityCheckInfo = NULL);
// unsigned char getProcedureCode() { return static_cast<IntegerBase*>(items.at(0))->getValue(); }
// OpenType *getValue() { return static_cast<OpenType*>(items.at(2)); }
//
void setUlCchMessageType(UlCcchMessageType& message) { *static_cast<UlCcchMessageType*>(items[1]) = message; }
// void setEstablishmentCause(unsigned char estCause) { static_cast<EstablishmentCause*>(items[1])->setValue(estCause); }
// void setProtocolErrorIndicator(unsigned char protErrInd) { static_cast<ProtocolErrorIndicator*>(items[1])->setValue(protErrInd); }
};
#endif /* RRCMESSAGE_H_ */
......@@ -17,6 +17,40 @@
#include "RRCPdu.h"
const void *CellUpdate::itemsInfo[9] = {
&DummyIe::theInfo,
&DummyIe::theInfo,
&DummyIe::theInfo,
&DummyIe::theInfo,
&DummyIe::theInfo,
&DummyIe::theInfo,
&DummyIe::theInfo,
&DummyIe::theInfo,
&DummyIe::theInfo,
};
bool CellUpdate::itemsPres[9] = {
1,
1,
1,
1,
1,
0,
1,
0,
0,
};
const CellUpdate::Info CellUpdate::theInfo = {
CellUpdate::create,
SEQUENCE,
0,
false,
itemsInfo,
itemsPres,
9, 3, 0
};
const void *RRCConnectionRequest::itemsInfo[5] = {
&InitialUeIdentity::theInfo,
&EstablishmentCause::theInfo,
......@@ -33,8 +67,42 @@ bool RRCConnectionRequest::itemsPres[5] = {
0
};
const RRCConnectionRequest::Info RRCConnectionRequest::theInfo = {
RRCConnectionRequest::create,
SEQUENCE,
0,
false,
itemsInfo,
itemsPres,
5, 2, 0
};
RRCConnectionRequest::RRCConnectionRequest(InitialUeIdentity& initUeId, unsigned char estCause, bool protErrInd, MeasuredResultsOnRACH *measResOnRach, V3d0NonCriticalExtensions *v3d0NonCritExt) : Sequence(&theInfo) {
setInitialUeIdentity(initUeId);
setEstablishmentCause(estCause);
setProtocolErrorIndicator(protErrInd);
}
const void *URAUpdate::itemsInfo[4] = {
&DummyIe::theInfo,
&DummyIe::theInfo,
&DummyIe::theInfo,
&DummyIe::theInfo,
};
bool URAUpdate::itemsPres[4] = {
1,
1,
1,
0
};
const URAUpdate::Info URAUpdate::theInfo = {
URAUpdate::create,
SEQUENCE,
0,
false,
itemsInfo,
itemsPres,
4, 1, 0
};
......@@ -20,6 +20,23 @@
#include "RRCIe.h"
class CellUpdate : public Sequence {
private:
static const void *itemsInfo[9];
static bool itemsPres[9];
public:
static const Info theInfo;
// RRCConnectionRequest(InitialUeIdentity& initUeId, unsigned char estCause, bool protErrInd, MeasuredResultsOnRACH *measResOnRach = NULL, V3d0NonCriticalExtensions *v3d0NonCritExt = NULL);
// unsigned char getProcedureCode() { return static_cast<IntegerBase*>(items.at(0))->getValue(); }
// OpenType *getValue() { return static_cast<OpenType*>(items.at(2)); }
//
// void setInitialUeIdentity(InitialUeIdentity& initUeId) { *static_cast<InitialUeIdentity*>(items[0]) = initUeId; }
// void setEstablishmentCause(unsigned char estCause) { static_cast<EstablishmentCause*>(items[1])->setValue(estCause); }
// void setProtocolErrorIndicator(unsigned char protErrInd) { static_cast<ProtocolErrorIndicator*>(items[1])->setValue(protErrInd); }
};
class RRCConnectionRequest : public Sequence {
private:
static const void *itemsInfo[5];
......@@ -37,4 +54,21 @@ public:
};
class URAUpdate : public Sequence {
private:
static const void *itemsInfo[4];
static bool itemsPres[4];
public:
static const Info theInfo;
// RRCConnectionRequest(InitialUeIdentity& initUeId, unsigned char estCause, bool protErrInd, MeasuredResultsOnRACH *measResOnRach = NULL, V3d0NonCriticalExtensions *v3d0NonCritExt = NULL);
// unsigned char getProcedureCode() { return static_cast<IntegerBase*>(items.at(0))->getValue(); }
// OpenType *getValue() { return static_cast<OpenType*>(items.at(2)); }
//
// void setInitialUeIdentity(InitialUeIdentity& initUeId) { *static_cast<InitialUeIdentity*>(items[0]) = initUeId; }
// void setEstablishmentCause(unsigned char estCause) { static_cast<EstablishmentCause*>(items[1])->setValue(estCause); }
// void setProtocolErrorIndicator(unsigned char protErrInd) { static_cast<ProtocolErrorIndicator*>(items[1])->setValue(protErrInd); }
};
#endif /* RRCPDU_H_ */
......@@ -88,6 +88,31 @@ bool OpenType::encode(PerEncoder &encoder) const {
return encoder.encodeOpenType(*this);
}
const Null::Info Null::theInfo = {
&Null::create,
_NULL,
0,
};
Null& Null::operator=(const Null& other) {
return *this;
}
int64_t Null::compare(const AbstractType& other) const {
if (typeid(other) != typeid(Null))
return -1;
return 0;
}
bool Null::decode(char *buffer) {
return PerDecoder(buffer).decodeNull(*this);
}
bool Null::encode(PerEncoder &encoder) const {
return encoder.encodeNull(*this);
}
const IntegerBase::Info IntegerBase::theInfo = {
&IntegerBase::create,
INTEGER,
......
......@@ -32,16 +32,18 @@ enum ConstraintType {
};
enum ObjectType {
INTEGER = 0,
ENUMERATED = 1,
BITSTRING = 3,
OCTETSTRING = 4,
SEQUENCE = 6,
SEQUENCEOF = 7,
CHOICE = 10,
PRINTABLESTRING = 16,
OPENTYPE = 19,
ABSTRACTTYPELIST = 20
BOOLEAN = 0,
INTEGER = 1,
ENUMERATED = 2,
BITSTRING = 4,
OCTETSTRING = 5,
_NULL = 6,
SEQUENCE = 7,
SEQUENCEOF = 8,
CHOICE = 11,
PRINTABLESTRING = 17,
OPENTYPE = 20,
ABSTRACTTYPELIST = 21
};
/*
......@@ -161,6 +163,33 @@ public:
bool encode(PerEncoder& encoder) const;
};
/*
* Class for ASN.1 NULL type
*/
class Null : public AbstractType {
public:
static const Info theInfo;
/* Constructors. */
Null(const void *info = &theInfo) : AbstractType(info) {}
Null(const OpenType& other) : AbstractType(other) { operator=(other); }
virtual ~Null() {}
/* Operator methods. */
Null &operator=(const Null& other);
/* Utility methods. */
virtual AbstractType *clone() const { return new Null(*this); }
virtual int64_t compare(const AbstractType& other) const;
static AbstractType *create(const void *info) { return new Null(info); }
/* Wrapper methods. */
bool decode(char *buffer);
bool encode(PerEncoder& encoder) const;
};
/*
* Class for ASN.1 Integer type.
*/
......
......@@ -173,6 +173,8 @@ bool PerDecoder::decodeAbstractType(AbstractType& abstractType) {
return decodeBitString(dynamic_cast<BitStringBase&>(abstractType));
case OCTETSTRING:
return decodeOctetString(dynamic_cast<OctetStringBase&>(abstractType));
case _NULL:
return decodeNull(dynamic_cast<Null&>(abstractType));
case SEQUENCE:
return decodeSequence(dynamic_cast<Sequence&>(abstractType));
case SEQUENCEOF:
......@@ -196,6 +198,10 @@ bool PerDecoder::decodeOpenType(OpenType& openType) {
return true;
}
bool PerDecoder::decodeNull(Null& null) {
return true;
}
bool PerDecoder::decodeInteger(IntegerBase& integer) {
if ((integer.isExtendable() && decodeBits(1))
|| integer.getConstraintType() > EXTCONSTRAINED)
......
......@@ -58,6 +58,7 @@ public:
/* Decoding methods. */
bool decodeAbstractType(AbstractType& abstractType);
bool decodeOpenType(OpenType& openType);
bool decodeNull(Null& null);
bool decodeInteger(IntegerBase& integer);
bool decodeEnumerated(EnumeratedBase& enumerated);
bool decodeBitString(BitStringBase& bitString);
......
......@@ -152,7 +152,8 @@ void PerEncoder::encodeBits(char value, unsigned char length) {
// if there are 8 bits available in the last byte copy the
// value in this byte and set the number of used bits
if (usedBits == 8) {
encodeBytes(&value, 1);
this->buffer = (char *)realloc(this->buffer, this->length++);
memcpy(this->buffer + this->length, &value, 1);
usedBits = length;
return;
......@@ -165,7 +166,8 @@ void PerEncoder::encodeBits(char value, unsigned char length) {
// and set the number of used bits according to this part
unsigned char tmpBits = length - (8 - usedBits);
value = (unsigned char)value << (length - tmpBits);
encodeBytes(&value, 1);
this->buffer = (char *)realloc(this->buffer, this->length++);
memcpy(this->buffer + this->length, &value, 1);
usedBits = tmpBits;
// if the value fits in the last byte put it and increase
......@@ -194,6 +196,8 @@ bool PerEncoder::encodeAbstractType(const AbstractType& abstractType) {
return encodeBitString(static_cast<const BitStringBase&>(abstractType));
case OCTETSTRING:
return encodeOctetString(static_cast<const OctetStringBase&>(abstractType));
case _NULL:
return encodeNull(static_cast<const Null&>(abstractType));
case SEQUENCE:
return encodeSequence(static_cast<const Sequence&>(abstractType));
case SEQUENCEOF:
......@@ -220,6 +224,10 @@ bool PerEncoder::encodeOpenType(const OpenType& openType) {
return true;
}
bool PerEncoder::encodeNull(const Null& null) {
return true;
}
bool PerEncoder::encodeInteger(const IntegerBase& integer) {
bool isExtension = (integer.getValue() > integer.getUpperBound());
......
......@@ -59,6 +59,7 @@ public:
/* Encoding methods */
bool encodeAbstractType(const AbstractType& abstractType);
bool encodeOpenType(const OpenType& openType);
bool encodeNull(const Null& null);
bool encodeInteger(const IntegerBase& integer);
bool encodeEnumerated(const EnumeratedBase& enumerated);
bool encodeBitString(const BitStringBase& bitString);
......
import re
from optparse import OptionParser
openbracket = '{'
closedbracket = '}'
assign = '::='
integertxt = 'INTEGER'
bitstringtxt = 'BIT STRING'
octetstringtxt = 'OCTET STRING'
sequencetxt = 'SEQUENCE'
choicetxt = 'CHOICE'
enumeratedtxt = 'ENUMERATED'
asnobjs = list()
openparanthesis = '('
closedparanthesis = ')'
importstxt = 'IMPORTS'
size = "SIZE"
comment = "-- "
comma = ','
tripledash = "..."
class ASNObject:
type = ''
name = ''
constrainttype = ''
lowerlimit = ''
upperlimit = ''
objs = list()
written = 0
def parsebracket(asnobj, string, cursor):
#print string
objstring = ""
i = cursor
openbrackets = 0
objs = list()
for i in range(0, len(string)):
if string[i] == comma and openbrackets == 0:
childobj = parsestring(objstring.strip())
objs.append(childobj)
objstring = ""
else:
if string[i] == openbracket:
openbrackets += 1
elif string[i] == closedbracket:
if openbrackets != 0:
openbrackets -= 1
objstring += string[i]
if tripledash in objstring:
asnobj.constrainttype = "EXTCONSTRAINED"
else:
childobj = parsestring(objstring.strip())
objs.append(childobj)
asnobj.constrainttype = "CONSTRAINED"
asnobj.objs = objs
def parsesize(asnobj, string):
count = 0
limits = list()
limits.append("")
skip = 0
begin = 0
if size in string:
for i in range(0, len(string)):
begin += 1
if string[i] == '(':
break
if comma in string:
asnobj.constrainttype = "EXTCONSTRAINED"
else:
asnobj.constrainttype = "CONSTRAINED"
for i in range(begin, len(string)):
if string[i] != '.' and string[i] != ')':
limits[count] += string[i]
if string[i] == '.' and skip == 0:
count += 1
limits.append("")
skip = 1
if string[i] == ')':
break
if count == 0:
limits.append(limits[count])
if not limits[0].replace("-", "").isdigit():
limits[0] = limits[0].replace("-", "_")
if not limits[1].replace("-", "").isdigit():
limits[1] = limits[1].replace("-", "_")
asnobj.lowerlimit = limits[0]
asnobj.upperlimit = limits[1]
def parsetype(asnobj, string):
type = ""
for i in range(0, len(string)):
if string[i] == openparanthesis or string[i] == openbracket:
break
else:
type += string[i]
type = type.strip()
if type == integertxt:
asnobj.type = "Integer"
elif type == bitstringtxt:
asnobj.type = "BitString"
elif type == octetstringtxt:
asnobj.type = "OctetString"
elif type == sequencetxt:
asnobj.type = "Sequence"
elif type == choicetxt:
asnobj.type = "Choice"
elif type == enumeratedtxt:
asnobj.type = "Enumerated"
def parsestring(string):
asnobj = ASNObject()
words = list()
if importstxt in string:
return asnobj
if assign in string:
string = string.replace("\t", ' ')
string = string.replace("\n", '')
string = re.sub('\s+', ' ', string)
words = string.split(assign)
asnobj.name = words[0].replace("-", "").strip()
else:
words = string.split(' ', 1)
asnobj.name = words[0].replace("-", "_").strip()
#print string
if len(words) > 1:
parsetype(asnobj, words[1])
for i in range(0, len(string)):
if string[i] == openparanthesis:
words = words[1].split(openparanthesis, 1)
parsesize(asnobj, words[1])
break
elif string[i] == openbracket:
words = words[1].split(openbracket, 1)
words[1] = words[1].strip()[:-1]
parsebracket(asnobj, words[1], 0)
break
else:
asnobj.constrainttype = "UNCONSTRAINED"
return asnobj
def printobjects(asnobjs):
for i in range(0, len(asnobjs)):
asnobj = asnobjs[i]
print asnobj.type + " - " + asnobj.name
if asnobj.lowerlimit != '':
print "<" + asnobj.constrainttype + ", " + asnobj.lowerlimit + ", " + asnobj.upperlimit + ">"
#for j in range (0, len(asnobj.objs)):
# print asnobj.objs[j]
if len(asnobj.objs) > 0:
print "children s"
printobjects(asnobj.objs)
print "children e"
def writeobjects(filename):
file = open(filename, 'w')
for i in range (0, len(asnobjs)):
asnobj = asnobjs[i]
if asnobj.type == "Integer" or asnobj.type == "BitString" or asnobj.type == "OctetString":
file.write("typedef " + asnobj.type + "<" + asnobj.constrainttype)
if asnobj.lowerlimit != '':
file.write(", " + asnobj.lowerlimit)
if asnobj.upperlimit != '':
file.write(", " + asnobj.upperlimit)
file.write("> " + asnobj.name + ";\n")
if asnobj.type == "Enumerated":
file.write("enum " + asnobj.name + "Values {\n")
for j in range(0, len(asnobj.objs)):
childobj = asnobj.objs[j]
file.write("\t" + childobj.name + " = " + str(j) + ",\n")
file.write("};\n")
file.write("typedef " + asnobj.type + "<" + asnobj.constrainttype + ", " + str(len(asnobj.objs) - 1) + "> " + asnobj.name + ";\n")
file.write("\n")
file.close()
def main():
usage = "usage: %prog [options] input filename"
parser = OptionParser(usage)
parser.add_option("-o", "--output", dest="filename",
help="name of output file", metavar="FILENAME")
(options, args) = parser.parse_args()
file = open("/root/workspace/ASNParser/src/rrc_ie_def.asn", "r")
lines = file.readlines()
file.close()
objectstring = ""
print "parsing file..."
for i, line in enumerate(lines):
if assign in line:
if len(objectstring) > 0:
asnobjs.append(parsestring(objectstring))
objectstring = line
elif comment not in line and line != "\n":
objectstring += line
asnobjs.append(parsestring(objectstring))
#printobjects(asnobjs)
print "writing source files..."
writeobjects('/root/workspace/ASNParser/src/rrc_ie_def.h')
if __name__ == "__main__":
main()
此差异已折叠。
InformationElements DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
IMPORTS
hiPDSCHidentities,
hiPUSCHidentities,
hiRM,
maxAC,
Ansi-41-IDNNS::=BIT STRING(SIZE(14))
Digit ::= INTEGER (0..9)
CN-DomainIdentity::=ENUMERATED{cs-domain,ps-domain,...}
PagingPermissionWithAccessControlParameters ::= SEQUENCE {
pagingResponseRestrictionIndicator ENUMERATED {all, cS, pS, none},
locationRegistrationRestrictionIndicator ENUMERATED {all, cS, pS},
locationRegistration LocationRegistrationParameter
}
Gsm-map-IDNNS ::= SEQUENCE {
routingbasis CHOICE {
localPTMSI SEQUENCE {
routingparameter RoutingParameter
},
tMSIofsamePLMN SEQUENCE {
routingparameter RoutingParameter
},
tMSIofdifferentPLMN SEQUENCE {
routingparameter RoutingParameter
},
iMSIresponsetopaging SEQUENCE {
routingparameter RoutingParameter
},
iMSIcauseUEinitiatedEvent SEQUENCE {
routingparameter RoutingParameter
},
iMEI SEQUENCE {
routingparameter RoutingParameter
},
spare2 SEQUENCE {
routingparameter RoutingParameter
},
spare1 SEQUENCE {
routingparameter RoutingParameter
}
},
-- dummy is not used in this version of the specification and
-- it should be ignored by the receiver.
dummy BOOLEAN
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册