diff --git a/examples/simple_java/Decoder.java b/examples/simple/Decoder.java similarity index 100% rename from examples/simple_java/Decoder.java rename to examples/simple/Decoder.java diff --git a/examples/simple_java/Encoder.java b/examples/simple/Encoder.java similarity index 100% rename from examples/simple_java/Encoder.java rename to examples/simple/Encoder.java diff --git a/examples/simple_java/README b/examples/simple/README similarity index 100% rename from examples/simple_java/README rename to examples/simple/README diff --git a/examples/simple_java/compile.sh b/examples/simple/compile.sh similarity index 96% rename from examples/simple_java/compile.sh rename to examples/simple/compile.sh index 29149b5b2d6a5899316fe6a39b7a96d041a1652a..6a25a2ac145828593d3fc576f08297e6d2bbf025 100644 --- a/examples/simple_java/compile.sh +++ b/examples/simple/compile.sh @@ -1,3 +1,5 @@ +(cd ../../lib/c; make) + java -jar ../../labComm.jar --java=gen --c=gen/simple.c --h=gen/simple.h simple.lc javac -cp ../../lib/java:. gen/*.java Encoder.java Decoder.java diff --git a/examples/simple/datagram/README b/examples/simple/datagram/README new file mode 100644 index 0000000000000000000000000000000000000000..ee1860c2f90a6170b6e9a6b1861821c98d22b68b --- /dev/null +++ b/examples/simple/datagram/README @@ -0,0 +1,10 @@ +The simple labcomm example over a datagram channel + +files: + +udp_encoder.c : the same as the simple encoder, but over an UDP writer +udp_decoder.c : d:o + +thr_example.c : the samei over a raw ethernet datagram protocol, in one file,and parameterized + to take the ethernet interface to use and the destination to send to as + command line parameters diff --git a/examples/simple/datagram/thr_compile.sh b/examples/simple/datagram/thr_compile.sh new file mode 100644 index 0000000000000000000000000000000000000000..fc17ae6f61dd80dbaeed22f1031e6e26ef34c5c8 --- /dev/null +++ b/examples/simple/datagram/thr_compile.sh @@ -0,0 +1,3 @@ +(cd ../../../lib/c; make) +gcc -o thr_example -L ../../../lib/c -I . -I .. -I ../../../lib/c thr_example.c ../gen/simple.c -llabcomm +#gcc -o thr_example -L ../../../lib/c -I . -I .. -I ../../../lib/c thr_example.c ../gen/simple.c ../../../lib/c/labcomm_thr_reader_writer.c ../../../lib/c/ThrottleDrv/*.c -llabcomm diff --git a/examples/simple_java/thr_example.c b/examples/simple/datagram/thr_example.c similarity index 100% rename from examples/simple_java/thr_example.c rename to examples/simple/datagram/thr_example.c diff --git a/examples/simple/datagram/udp_compile.sh b/examples/simple/datagram/udp_compile.sh new file mode 100644 index 0000000000000000000000000000000000000000..e5a2017ba95660101b8e8e25edc65bb8e7ea09ce --- /dev/null +++ b/examples/simple/datagram/udp_compile.sh @@ -0,0 +1,5 @@ +(cd ../../../lib/c; make) + +gcc -g -o udp_encoder -L ../../../lib/c -I . -I .. -I ../../../lib/c udp_encoder.c ../gen/simple.c ../../../lib/c/labcomm_udp_reader_writer.c udp_hack.c -llabcomm + +gcc -g -o udp_decoder -L ../../../lib/c -I . -I .. -I ../../../lib/c udp_decoder.c ../gen/simple.c ../../../lib/c/labcomm_udp_reader_writer.c udp_hack.c -llabcomm diff --git a/examples/simple_java/udp_decoder.c b/examples/simple/datagram/udp_decoder.c similarity index 100% rename from examples/simple_java/udp_decoder.c rename to examples/simple/datagram/udp_decoder.c diff --git a/examples/simple_java/udp_encoder.c b/examples/simple/datagram/udp_encoder.c similarity index 100% rename from examples/simple_java/udp_encoder.c rename to examples/simple/datagram/udp_encoder.c diff --git a/examples/simple_java/example_decoder.c b/examples/simple/example_decoder.c similarity index 100% rename from examples/simple_java/example_decoder.c rename to examples/simple/example_decoder.c diff --git a/examples/simple_java/example_encoder.c b/examples/simple/example_encoder.c similarity index 100% rename from examples/simple_java/example_encoder.c rename to examples/simple/example_encoder.c diff --git a/examples/simple_java/run.sh b/examples/simple/run.sh similarity index 100% rename from examples/simple_java/run.sh rename to examples/simple/run.sh diff --git a/examples/simple_java/simple.lc b/examples/simple/simple.lc similarity index 100% rename from examples/simple_java/simple.lc rename to examples/simple/simple.lc diff --git a/examples/simple_java/thr_decoder.c b/examples/simple/thr_decoder.c similarity index 100% rename from examples/simple_java/thr_decoder.c rename to examples/simple/thr_decoder.c diff --git a/examples/simple_java/thr_encoder.c b/examples/simple/thr_encoder.c similarity index 100% rename from examples/simple_java/thr_encoder.c rename to examples/simple/thr_encoder.c diff --git a/examples/simple_java/thr_compile.sh b/examples/simple_java/thr_compile.sh deleted file mode 100644 index 5779c8a56f62f1787298fbb7cb6b4ee09fa3f149..0000000000000000000000000000000000000000 --- a/examples/simple_java/thr_compile.sh +++ /dev/null @@ -1,5 +0,0 @@ -#gcc -o thr_encoder -L ../../lib/c -I . -I ../../lib/c thr_encoder.c gen/simple.c ../../lib/c/labcomm_thr_reader_writer.c ../../lib/c/ThrottleDrv/*.c -llabcomm - -#gcc -o thr_decoder -L ../../lib/c -I . -I ../../lib/c thr_decoder.c gen/simple.c ../../lib/c/labcomm_thr_reader_writer.c ../../lib/c/ThrottleDrv/*.c -llabcomm - -gcc -o thr_example -L ../../lib/c -I . -I ../../lib/c thr_example.c gen/simple.c ../../lib/c/labcomm_thr_reader_writer.c ../../lib/c/ThrottleDrv/*.c -llabcomm diff --git a/examples/simple_java/udp_compile.sh b/examples/simple_java/udp_compile.sh deleted file mode 100644 index 9f3479567639fb69888c4d3bbbc4456ccc0e559a..0000000000000000000000000000000000000000 --- a/examples/simple_java/udp_compile.sh +++ /dev/null @@ -1,3 +0,0 @@ -gcc -g -o udp_encoder -L ../../lib/c -I . -I ../../lib/c udp_encoder.c gen/simple.c ../../lib/c/labcomm_udp_reader_writer.c ../../lib/c/udp_hack.c -llabcomm - -gcc -g -o udp_decoder -L ../../lib/c -I . -I ../../lib/c udp_decoder.c gen/simple.c ../../lib/c/labcomm_udp_reader_writer.c ../../lib/c/udp_hack.c -llabcomm diff --git a/lib/c/Makefile b/lib/c/Makefile index 7ef5643a4f75c4ac54863b2009274517d04e203c..ad619b3f6aa8872002da14d5794a6b38d9a027e0 100644 --- a/lib/c/Makefile +++ b/lib/c/Makefile @@ -1,8 +1,9 @@ CC = gcc CFLAGS = -g -liblabcomm.a : labcomm.o labcomm_fd_reader_writer.o ethaddr.o - ar -r liblabcomm.a labcomm.o labcomm_fd_reader_writer.o ethaddr.o +liblabcomm.a : labcomm.o labcomm_fd_reader_writer.o labcomm_udp_reader_writer.o labcomm_thr_reader_writer.o ethaddr.o ThrottleDrv/ethernet_drv.o ThrottleDrv/throttle_drv.o +# ar -r liblabcomm.a labcomm.o labcomm_fd_reader_writer.o ethaddr.o + ar -r liblabcomm.a $^ labcomm.o : labcomm.c labcomm.h labcomm_private.h @@ -10,6 +11,8 @@ labcomm_fd_reader_writer.o : labcomm_fd_reader_writer.c labcomm_fd_reader_write ethaddr.o: ethaddr.c +%o: %c %h + clean: rm *.o diff --git a/lib/c/README b/lib/c/README new file mode 100644 index 0000000000000000000000000000000000000000..11ca01f3f6a68c0fe118e5ecaee06e6d8c3bda78 --- /dev/null +++ b/lib/c/README @@ -0,0 +1,7 @@ +Throttlenet library + +The library consists of a generic part and readers/writers for the low-level transport. + +The stable low-level is the _fd_ variety, on top of unix sockets. + +Currently, experimental varieties include datagrams on top of UDP and raw ethernet