diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..2d8ff23
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+hdlc1.c
+hdlc1.h
+hdlc_frame.c
+hdlc_frame.h
+main1.c
+uart.c
+uart.h
+
+!./hdlc
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
index 639da93..4922bfe 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -2,7 +2,7 @@
-
+
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..5aea8e2
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,6 @@
+cmake_minimum_required(VERSION 3.25)
+project(untitled1 C)
+
+set(CMAKE_C_STANDARD 11)
+
+add_executable(untitled1 hdlc/fcs.h hdlc/fcs.c hdlc/hdlc.h hdlc/hdlc.c hdlc/main.c hdlc/client.c)
diff --git a/client.c b/hdlc/client.c
similarity index 100%
rename from client.c
rename to hdlc/client.c
diff --git a/client.h b/hdlc/client.h
similarity index 100%
rename from client.h
rename to hdlc/client.h
diff --git a/fcs.c b/hdlc/fcs.c
similarity index 100%
rename from fcs.c
rename to hdlc/fcs.c
diff --git a/fcs.h b/hdlc/fcs.h
similarity index 100%
rename from fcs.h
rename to hdlc/fcs.h
diff --git a/hdlc.c b/hdlc/hdlc.c
similarity index 100%
rename from hdlc.c
rename to hdlc/hdlc.c
diff --git a/hdlc.h b/hdlc/hdlc.h
similarity index 100%
rename from hdlc.h
rename to hdlc/hdlc.h
diff --git a/hdlc/main.c b/hdlc/main.c
new file mode 100644
index 0000000..3b12622
--- /dev/null
+++ b/hdlc/main.c
@@ -0,0 +1,179 @@
+//#include "hdlc.h"
+#include "stdio.h"
+#include "client.h"
+#include
+#include
+
+int main(){
+ struct Client hdlc;
+ init_hdlc_client(&hdlc, 200);
+ hdlc_control_t frame;
+ connect(&hdlc, &frame);
+ uint8_t buffer_for_ex[25];
+ uint8_t fake_buffer[2];
+ hdlc_get_raw_frame(&hdlc, &frame, buffer_for_ex, sizeof(buffer_for_ex));
+
+ for (int i = 0; i < 200; i++){
+ int z = hdlc_timeout_handler(&hdlc, 1);
+ if (z < 0){
+ printf("%d\n", z);
+ }
+ hdlc_decode_recived_raw_data(&hdlc, fake_buffer, sizeof(fake_buffer));
+ }
+
+ hdlc_get_raw_frame(&hdlc, &frame, buffer_for_ex, sizeof(buffer_for_ex));
+ int i = hdlc_decode_recived_raw_data(&hdlc, buffer_for_ex, sizeof(buffer_for_ex));
+ printf("%d\n", i);
+
+ hdlc_control_t frame_data;
+ uint8_t data = 003;
+ send_data(&hdlc, &frame_data, &data, sizeof(data));
+ uint8_t buffer_for_ex_data[128];
+
+ hdlc_get_raw_frame(&hdlc, &frame_data, buffer_for_ex_data, sizeof(buffer_for_ex_data));
+
+ i = hdlc_decode_recived_raw_data(&hdlc, buffer_for_ex_data, sizeof(buffer_for_ex_data));
+ printf("%d\n", i);
+
+
+
+// uint8_t send[64];
+// uint8_t buffer[134];
+// for (int i = 0; i < sizeof(send); i++) {
+// send[i] = (uint8_t) (rand() % 0x70);
+// }
+// send_data(&hdlc, send, sizeof(send_data));
+// //get_frame(&hdlc, buffer, sizeof(buffer), send_data, sizeof(send_data));
+//
+// hdlc_get_raw_data(&hdlc, buffer, sizeof(buffer));
+
+ // test 1
+
+// int ret;
+// uint8_t frame_data[8], recv_data[8];
+// size_t i, frame_length = 0, recv_length = 0;
+// hdlc_control_t control_send, control_recv;
+
+// // Run through the supported sequence numbers (3-bit)
+// for (i = 0; i <= 7; i++) {
+// // Initialize the control field structure with frame type and sequence number
+// control_send.frame = HDLC_FRAME_ACK;
+// control_send.seq_no = i;
+//
+// // Create an empty frame with the control field information
+// ret = hdlc_frame_data(&control_send, NULL, 0, frame_data, &frame_length);
+//
+// // Get the data from the frame
+// ret = hdlc_get_data(&control_recv, frame_data, frame_length, recv_data,
+// &recv_length);
+//
+// // Result should be frame_length minus start flag to be discarded and no bytes received
+// if(ret != (int )frame_length - 1){
+// printf("err");
+// }
+// }
+// if (recv_length != 0){
+// printf("err2");
+// }
+//
+// if (control_send.frame != control_recv.frame){
+// printf("err3");
+// }
+//
+// if (control_send.seq_no != control_recv.seq_no){
+// printf("err4");
+// }
+
+ // test 2
+
+ // Run through the supported sequence numbers (3-bit)
+// for (i = 0; i <= 7; i++) {
+// // Initialize the control field structure with frame type and sequence number
+// control_send.frame = HDLC_FRAME_DATA;
+// control_send.seq_no = i;
+//
+// char* input = "311";
+// uint8_t data = (uint8_t)atoi(input);
+//
+// // Create an empty frame with the control field information
+// ret = hdlc_frame_data(&control_send, &data, 3, frame_data, &frame_length);
+// if (ret != 0){
+// printf("err123\n");
+// }
+//
+// // Get the data from the frame
+// ret = hdlc_get_data(&control_recv, frame_data, frame_length, recv_data,
+// &recv_length);
+//
+// // Result should be frame_length minus start flag to be discarded and no bytes received
+// if(ret != (int )frame_length - 1){
+// printf("err333\n");
+// }
+// if (recv_length != 0){
+// printf("err2\n");
+// }
+//
+// // Verify the control field information
+// if (control_send.frame != control_recv.frame){
+// printf("err3\n");
+// }
+//
+// if (control_send.seq_no != control_recv.seq_no){
+// printf("err4\n");
+// }
+// }
+
+// int ret;
+// hdlc_control_t control;
+// uint8_t send_data[512], frame_data[530], recv_data[530];
+// size_t i, frame_length = 0, recv_length = 0, buf_length = 16;
+//
+// // Initialize data to be send with random values (up to 0x70 to keep below the values to be escaped)
+// for (i = 0; i < sizeof(send_data); i++) {
+// send_data[i] = (uint8_t) (rand() % 0x70);
+// }
+//
+// // Initialize control field structure and create frame
+// control.frame = HDLC_FRAME_DATA;
+// ret = hdlc_frame_data(&control, send_data, sizeof(send_data), frame_data,
+// &frame_length);
+//
+// // Check that frame length is maximum 2 bytes larger than data due to escape of FCS value
+// if(frame_length >= ((sizeof(send_data) + 6) + 2)){
+// printf("1");
+// }
+// if(ret != 0){
+// printf("2");
+// }
+//
+// // Run though the different buffers (simulating decode of buffers from UART)
+// for (i = 0; i <= sizeof(send_data); i += buf_length) {
+// // Decode the data
+// ret = hdlc_get_data(&control, &frame_data[i], buf_length, recv_data,
+// &recv_length);
+//
+// printf("%zu: %s\n", i, recv_data);
+//
+// if (i < sizeof(send_data)) {
+// // All chunks until the last should return no message and zero length
+// if (ret != -ENOMSG){
+// printf("3");
+// }
+// if (recv_length != 0){
+// printf("1231");
+// }
+// } else {
+// if (ret > 7){
+// printf("332");
+// }
+// if (recv_length != sizeof(send_data)){
+// printf("88888");
+// }
+// // The last chunk should return max 6 frame bytes - 1 start flag sequence byte + 2 byte for the possible
+// // escaped FCS = 7 bytes
+//// BOOST_CHECK(ret <= 7);
+//// BOOST_CHECK_EQUAL(recv_length, sizeof(send_data));
+// //printf("5");
+// }
+// }
+}
\ No newline at end of file