diff --git a/src/Makefile b/src/Makefile index eadda10..aabecac 100644 --- a/src/Makefile +++ b/src/Makefile @@ -18,6 +18,8 @@ crc_test: crc_test.o tetra_common.o libosmo-tetra-mac.a tetra-rx: tetra-rx.o libosmo-tetra-phy.a libosmo-tetra-mac.a +testsds: testsds.o libosmo-tetra-phy.a libosmo-tetra-mac.a + conv_enc_test: conv_enc_test.o testpdu.o libosmo-tetra-phy.a libosmo-tetra-mac.a tunctl: tunctl.o diff --git a/src/testsds.c b/src/testsds.c new file mode 100644 index 0000000..366b3ee --- /dev/null +++ b/src/testsds.c @@ -0,0 +1,97 @@ +/* testsds.c - a quick hack to test the sds parsing functions. + * expects a copy of the sds binary dump from telive.log as an argument + * + * (C) 2015 by Jacek Lipkowski + * All Rights Reserved + * + * 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 . + * + */ + +#include +#include +#include +#include +#include + +#include + +#include + + +#include "tetra_common.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tetra_common.h" +#include "tetra_prim.h" +#include "tetra_upper_mac.h" +#include "tetra_mac_pdu.h" +#include "tetra_llc_pdu.h" +#include "tetra_mm_pdu.h" +#include "tetra_cmce_pdu.h" +#include "tetra_sndcp_pdu.h" +#include "tetra_mle_pdu.h" +#include "tetra_gsmtap.h" +#include "tetra_sds.h" + +extern int rx_tl_sdu(struct tetra_mac_state *tms, struct msgb *msg, unsigned int len); + +int char_to_ubits(char *c,unsigned char *out) +{ + int len=0; + while (*c) { + if (*c=='1') { *out=1; } else { *out=0; } + + c++; + len++; + out++; + + } + return(len); +} + + + + +int main(int argc,char **argv) { + unsigned char buf1[8192]; + unsigned char buf[8192]; + int len,len1; + + struct tetra_mac_state tms; + struct msgb msg; + + //len1=char_to_ubits("0000000010011110100110001011110110010001111011001000100110",(char *)&buf1); //dummy header so the osmo-tetra functions work + len1=char_to_ubits("0000000010011110000000000000000000000001111011001000100110",(char *)&buf1); //dummy header so the osmo-tetra functions work + len=char_to_ubits(argv[1],(char *)&buf); + msg.l1h=(unsigned char *)&buf1; + msg.l3h=(unsigned char *)&buf; + + parse_d_sds_data(&tms,&msg,len); + +}