-
Notifications
You must be signed in to change notification settings - Fork 4
WIP: review #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: empty
Are you sure you want to change the base?
WIP: review #10
Changes from all commits
01df2cf
f1d0a76
12c5452
37e5f89
127c954
9dfacd6
04f1a04
306d563
4f2a866
16f7f7f
9210397
cdaf2dd
048f085
7f623e4
f04b911
6dbb10d
ac050d4
ebf788a
2ee2eb3
4d0c2ac
bc0e650
7eae1af
0b11a37
c8a1625
1d0b70e
57843a3
19d9478
1489d92
72d00b2
168abdf
6195973
b26b8c8
b485d3c
ef1ebb4
98a54fc
e1fe62f
0e25b7a
927af38
2e5ce71
db0c15c
48453a0
63f7ce6
1811de4
719bd09
c574ce8
22f78c4
2c00070
aaa29ea
9ef118e
5120080
34f7a36
66744b7
6792a92
bf1fd4a
471f0a9
6b9190f
e372824
ee85354
cc962b2
7236385
c4dacb0
5519db6
3895daa
a2572ad
a72040f
9005e1a
21b1a03
6f55e8a
d14aebc
c54d3a6
8265c1f
9014525
b8315e5
7af27bb
51c85de
4397946
97b49ca
6e844f3
e3d77f3
0f94a47
cc62dea
70ff7f5
92b495d
aad2641
dbc4f5f
b5ff795
fe5eb7e
3416be7
3607379
9873f0b
402673f
80d6495
0de8f92
b8dc607
0a0450b
4f54cf6
c852bf7
16a691b
6b7edea
bcfc0da
d7b66fb
7cc9023
24c3d17
599f79f
70c7e4e
bd7192c
3eca3c7
9fb9e79
c2f5ce1
1fed18d
b65c505
199c57c
62ccc5d
bf43ca8
04e90bc
30269ea
e18b073
90656c2
01a2f8c
9550922
cf86367
af5b894
6312e5b
5dd3571
e7b5770
da197eb
d4ac3f9
0da5140
8bfdbf2
a3226ca
ce85328
432d9c0
575b3da
f782e43
8758f8a
c2a0463
eda8396
09dd00f
da458f4
7ede482
5746cdd
7c8dc75
8d91b69
2dc5054
00163e9
05312cb
eacc2de
f525d47
577be3e
fc1c658
3fd25fb
265067a
3a5950e
697f8b5
094926f
1ceb4db
25e73d2
6655a63
10815de
615797b
5cfa445
8510506
8ca3118
bf752e1
d1bbcef
b5accf8
3f80c44
dfa1741
6574dec
3d5501d
6e4f288
f1dbebf
d055d77
0bb9a65
bc12c07
23ddb93
73a91f8
d581a71
5be5757
b87da32
737f810
c606ee0
b038521
d242e66
ead712c
e8f31b5
44372df
905a5fc
ae4912e
c2a7875
8f9cc29
0125f80
c9fa4c3
2a3efdb
dc17b0b
8c7c703
e98918f
64917df
213a7c8
df338f4
a2b5b9a
f22602a
fcbbed8
1d760c4
47511a3
3aeebb3
a6f68a0
513f938
de8e03b
1ab730c
d4eec23
d5e0356
f9d5ea3
7fb261d
1add6af
013c9d5
d14c2ae
6f64804
3ad2f52
250f3ed
bdb5956
db75e71
a4515db
5319961
39696cf
3b466bd
aac7e9a
ab0c8d3
97f5c9b
ddc04c7
5575ffc
a720972
2d9b597
13c4c2c
3346d37
023d32c
ae88c77
f36dac1
1faccf8
cec6729
56351c5
78e5884
9b8193c
9bd7bf2
68e3f05
8d859b6
314cc41
0e88357
451baf7
0041546
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| Program/src/*.o | ||
| main | ||
| settings.json | ||
| SpaceProjects.odt | ||
| Program/src/incomplete_requests | ||
| Program/src/obj | ||
| Program/test/incomplete_requests | ||
| Program/test/temp | ||
|
|
||
| *.o | ||
| *.a | ||
| TODO | ||
| Program/FreeRTOSv10.2.1 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could wildcard;
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. great idea, also, I suppose I could remove the .gitingore entirely from the repo. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would not get rid of
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suppose we may want to use a negative pattern? Like ignore all, then explicitly not ignore things we want to keep. what do you think? that way it doesn't need to change depending on who is using it. --if someone has a different IDE for example, and wants to add their own additions to a .gitignore. |
||
| Program/libcsp | ||
| .vscode* | ||
| *.jpg | ||
| *.jpeg | ||
| .gitignore | ||
|
|
||
| give_packet_loss.sh | ||
| Program/libcsp | ||
| Program/__pycache__ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [submodule "Program/libcsp"] | ||
| path = Program/libcsp | ||
| url = git@github.com:EvanGee/libcsp.git |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| The MIB is known as the management information base. | ||
| This base holds the configuration information for users (peers or applications). | ||
| This data is used for determining how and who we can send file or commands | ||
| to. Files will not be sent to users that are not included in the MIB. | ||
|
|
||
| The MIB is currently configured as key value pairs. These pairs are formatted | ||
| in the JSON format. | ||
|
|
||
| Here is an example of a MIB entry: | ||
| { | ||
| "cfdp_id": 1, | ||
| "UT_address" : 2130706433, | ||
| "UT_port" : 1111, | ||
| "type_of_network" : 1, | ||
| "default_transmission_mode" : 1, | ||
| "MTU" : 1500, | ||
| "one_way_light_time" : 123, | ||
| "total_round_trip_allowance" : 123, | ||
| "async_NAK_interval" : 123, | ||
| "async_keep_alive_interval" : 123, | ||
| "async_report_interval" : 123, | ||
| "immediate_nak_mode_enabled" : 123, | ||
| "prompt_transmission_interval" : 123, | ||
| "disposition_of_incomplete" : 123, | ||
| "CRC_required" : 0, | ||
| "keep_alive_discrepancy_limit" : 8, | ||
| "positive_ack_timer_expiration_limit" : 123, | ||
| "nak_timer_expiration_limit" : 123, | ||
| "transaction_inactivity_limit" : 123 | ||
| } | ||
|
|
||
|
|
||
| Below are the meanings of the fields for the MIB | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this list complete? |
||
|
|
||
| - cfdp_id | ||
| This is the unique identifier of a peer on the network. We can start it at 1 | ||
| and increment it from there. This is an unsigned integer (32 bit) value; | ||
|
|
||
| - UT_address | ||
| This is an Underlying Transmission address. For example, in an IP stack, this | ||
| would be an IP4 Ip address. This value is a decimal representation of an IP | ||
| address. This particular one is 127.0.0.1. | ||
|
|
||
| - UT_port | ||
| This os an Underlying Transmission port. For example, in an IP stack, this | ||
| would be a 16 bit value -- like port 8080. combined with the UT_address, | ||
| together they form a complete UT address. The one above would be equal to | ||
| 127.0.0.1:1111. This is an unsigned integer (16 bit) value | ||
|
|
||
| - type_of_network | ||
| This number represents what type of network the underlying UT address takes. | ||
| currently, the only acceptable values are 0 and 1. | ||
| - 0: UDP | ||
| - 1: TCP | ||
| - 2: csp | ||
|
|
||
| - default_transmission_mode: | ||
| not implemented | ||
|
|
||
| - MTU | ||
| This number represents the 'maximum transmissible unit' -- this will also | ||
| take the form of a buffer in the program. This value is the maximum size | ||
| packet that the application will receive. | ||
|
|
||
| - one_way_light_time : not implemented | ||
| - total_round_trip_allowance : not implemented | ||
| - async_NAK_interval : not implemented | ||
| - async_keep_alive_interval : not implemented | ||
| - async_report_interval : not implemented | ||
| - immediate_nak_mode_enabled : not implemented | ||
| - prompt_transmission_interval : not implemented | ||
| - disposition_of_incomplete : not implemented | ||
| - CRC_required : not implemented | ||
| - keep_alive_discrepancy_limit : not implemented | ||
| - positive_ack_timer_expiration_limit : not implemented | ||
| - nak_timer_expiration_limit : not implemented | ||
| - transaction_inactivity_limit : not implemented | ||
|
|
||
| if you want to get in contact with me | ||
| email me at evangiese77@gmail.com | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| import subprocess | ||
| from pprint import pprint | ||
| import os | ||
| import datetime | ||
|
|
||
| def change_working_dir(): | ||
| path = os.path.abspath(__file__) | ||
| split = path.split("/")[0:-1] | ||
| split.append("src") | ||
| new_path = "/".join(split) | ||
| os.chdir(new_path) | ||
|
|
||
|
|
||
| class logger(): | ||
| def __init__(self, path="ftp_log/log.txt"): | ||
| self.log_file = self.create_ftp_log(path) | ||
|
|
||
| def create_ftp_log(self, path): | ||
| if not os.path.exists("ftp_log"): | ||
| os.makedirs("ftp_log") | ||
|
|
||
| file = open(path, "a") | ||
| return file | ||
|
|
||
| def close(self): | ||
| self.log_file.close() | ||
|
|
||
| def log(self, stuff): | ||
| self.log_file.writelines(str(datetime.datetime.today()) + ":" + stuff) | ||
|
|
||
| def get_request(sat_path, file_path, block=True): | ||
| change_working_dir() | ||
|
|
||
| print("need sudo password for opening /dev/ttyUSB0") | ||
| cmd = ["sudo", "./main", "-i", "10", "-c", "1", "-k", "/dev/ttyUSB0", "-f", 'GET {0}|{1}'.format(sat_path, file_path)] | ||
|
|
||
| if block: | ||
| output = subprocess.run(cmd) | ||
| print(output) | ||
| return | ||
|
|
||
| #subprocess.Popen(cmd) | ||
|
|
||
| def put_request(file_path, sat_path, block=True): | ||
| change_working_dir() | ||
|
|
||
| print("need sudo password for opening /dev/ttyUSB0") | ||
| cmd = ["sudo", "./main", "-i", "10", "-c", "1", "-k", "/dev/ttyUSB0", "-f", 'PUT {0}|{1}'.format(file_path, sat_path)] | ||
|
|
||
| if block: | ||
| output = subprocess.run(cmd) | ||
| print(output) | ||
| return | ||
|
|
||
| #subprocess.Popen(cmd) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| print("thats not how you use this, please import either 'get_request' or 'put_request' into your program") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /*------------------------------------------------------------------------------ | ||
| This file is protected under copyright. If you want to use it, | ||
| please include this text, that is my only stipulation. | ||
|
|
||
| Author: Evan Giese | ||
| ------------------------------------------------------------------------------*/ | ||
| #ifndef SSP_TASKS_H | ||
| #define SSP_TASKS_H | ||
|
|
||
| #include "types.h" | ||
|
|
||
| void ssp_cleanup_client(Client *client); | ||
| void ssp_cleanup_req(void *request); | ||
| void ssp_cleanup_ftp(FTP *app); | ||
| void *ssp_connectionless_server_task(void *params); | ||
| void *ssp_connectionless_client_task(void* params); | ||
|
|
||
| void *ssp_connection_client_task(void *params); | ||
| void *ssp_connection_server_task(void *params); | ||
| void *ssp_csp_connectionless_client_task(void *params); | ||
| void *ssp_csp_connectionless_server_task(void *params); | ||
| void *ssp_csp_connection_client_task(void *params); | ||
| void *ssp_csp_connection_server_task(void *params); | ||
| void ssp_client_join(Client *client); | ||
| void *ssp_generic_client_task(void *params); | ||
| void *ssp_generic_server_task(void *params); | ||
|
|
||
| void reset_timeout(int *prevtime); | ||
| void remove_request_check(Node *node, void *request, void *args); | ||
|
|
||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| added PDU_NAK_METADATA directive, due to spec not containing room for missing metadata packet |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /*------------------------------------------------------------------------------ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here and elsewhere the guidelines for comments and such are not being followed. See ex2_eps |
||
| This file is protected under copyright. If you want to use it, | ||
| please include this text, that is my only stipulation. | ||
|
|
||
| Author: Evan Giese | ||
| ------------------------------------------------------------------------------*/ | ||
| #ifndef CSP_SERVER_H | ||
| #define CSP_SERVER_H | ||
| #include "stdint.h" | ||
|
|
||
| void csp_connectionless_client(uint8_t dest_id, uint8_t dest_port, uint8_t src_port, uint32_t packet_len, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Every prototype should be documented. |
||
| int (*onSend)(int sfd, void *addr, uint32_t size_of_addr, void *onSendParams), | ||
| int (*onRecv)(int sfd, char *packet, uint32_t packet_len, uint32_t *buff_size, void *addr, size_t size_of_addr, void *onRecvParams) , | ||
| int (*checkExit)(void *checkExitParams), | ||
| void (*onExit)(void *params), | ||
| void *params); | ||
|
|
||
| void csp_connectionless_server(uint8_t my_port, uint32_t packet_len, uint32_t time_out, | ||
| int (*onRecv)(int sfd, char *packet, uint32_t packet_len, uint32_t *buff_size, void *addr, size_t size_of_addr, void *other), | ||
| int (*onTimeOut)(void *other), | ||
| int (*checkExit)(void *other), | ||
| void (*onExit)(void *other), | ||
| void *other); | ||
|
|
||
| void csp_connection_server(uint8_t my_port, uint32_t packet_len, uint32_t time_out, | ||
| int (*onRecv)(int sfd, char *packet, uint32_t packet_len, uint32_t *buff_size, void *addr, size_t size_of_addr, void *other), | ||
| int (*onTimeOut)(void *other), | ||
| int (*checkExit)(void *other), | ||
| void (*onExit)(void *other), | ||
| void *other); | ||
|
|
||
| void csp_connection_client(uint8_t dest_id, uint8_t dest_port, uint8_t my_port, uint32_t packet_len, uint32_t time_out, void*lock, | ||
| int (*onSend)(int sfd, void *addr, uint32_t size_of_addr, void *onSendParams), | ||
| int (*onRecv)(int sfd, char *packet, uint32_t packet_len, uint32_t *buff_size, void *addr, size_t size_of_addr, void *onRecvParams) , | ||
| int (*checkExit)(void *checkExitParams), | ||
| void (*onExit)(void *params), | ||
| void *params); | ||
| int csp_custom_ftp_ping(uint32_t dest_id, uint32_t port); | ||
| #endif | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| /*------------------------------------------------------------------------------ | ||
| This file is protected under copyright. If you want to use it, | ||
| please include this text, that is my only stipulation. | ||
|
|
||
| Author: Evan Giese | ||
| ------------------------------------------------------------------------------*/ | ||
| #ifndef FTP_APP_H | ||
| #define FTP_APP_H | ||
| #include "types.h" | ||
|
|
||
| int init_ftp(uint32_t my_cfdp_address, FTP *app); | ||
| Client *ssp_client(uint32_t cfdp_id, FTP *app); | ||
| void create_ssp_server(FTP *app); | ||
| int create_ssp_server_drivers(FTP *app); | ||
| void *create_ftp_task(uint32_t cfdp_id, FTP *app); | ||
| Client *init_client(uint32_t dest_cfdp_id, uint32_t my_cfdp_id); | ||
|
|
||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| /*------------------------------------------------------------------------------ | ||
| This file is protected under copyright. If you want to use it, | ||
| please include this text, that is my only stipulation. | ||
|
|
||
| Author: Evan Giese | ||
| ------------------------------------------------------------------------------*/ | ||
| #ifndef FILESYSTEM_FUNCS_H | ||
| #define FILESYSTEM_FUNCS_H | ||
| #include "types.h" | ||
|
|
||
| #define TEMP_FILESIZE 1000 | ||
|
|
||
| struct params { | ||
| int error; | ||
| int fd; | ||
| }; | ||
|
|
||
|
|
||
| int get_file_size(char *source_file_name); | ||
|
|
||
| //allocates space for a file pointer | ||
| File *create_file(char *source_file_name, int clear_file_contents); | ||
| void ssp_free_file(void *file); | ||
| int add_first_offset(File *file, uint32_t file_size); | ||
|
|
||
| int does_file_exist(char *source_file_name); | ||
| int get_offset(File *file, void *buff, uint32_t buf_size, int offset); | ||
| int write_offset(File *file, void *buff, uint32_t size, uint32_t offset); | ||
| uint32_t calc_check_sum(char *data, uint32_t length); | ||
| uint32_t check_sum_file(File *file, uint16_t stack_buffer); | ||
| int receive_offset(File *file, uint32_t offset_start, uint32_t offset_end); | ||
| File *create_temp_file(char *file_name, uint32_t size); | ||
| int change_tempfile_to_actual(char *temp, char *destination_file_name, uint32_t file_size, File *file); | ||
| int read_json(char *file_name, int (*callback)(char *key, char *value, void *params), void *params); | ||
|
|
||
| int write_lv(int fd, LV lv); | ||
| int read_lv(int fd, LV *lv); | ||
|
|
||
| int read_id(int fd, uint64_t *id); | ||
| int write_id(int fd, uint64_t id); | ||
|
|
||
| int save_req_to_file(Request *req); | ||
| int save_file_to_file(int fd, File *file); | ||
| int get_file_from_file(int fd, File *file); | ||
| int get_req_from_file(uint32_t dest_cfdp_id, uint64_t transaction_seq_num, uint32_t my_cfdp_id, Request *req); | ||
| int delete_saved_request(Request *req); | ||
| int read_request_from_file(int fd, Request *req); | ||
|
|
||
|
|
||
| //new json stuff: | ||
| int write_request_json (Request *req, char *file_name); | ||
| int get_request_from_json (Request *req, char *file_name); | ||
|
|
||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #ifndef SSP_GENERIC_PROVIDER_H | ||
| #define SSP_GENERIC_PROVIDER_H | ||
| #include "port.h" | ||
|
|
||
| void csp_generic_server( | ||
| int (*onRecv)(int sfd, char *packet, uint32_t packet_len, uint32_t *buff_size, void *addr, size_t size_of_addr, void *app), | ||
| int (*onTimeOut)(void *app), | ||
| int (*checkExit)(void *app), | ||
| void (*onExit)(void *app), | ||
| void *app); | ||
|
|
||
| void csp_generic_client(uint8_t dest_id, uint8_t dest_port, uint8_t my_port, uint32_t packet_len, | ||
| int (*onSend)(int sfd, void *addr, uint32_t size_of_addr, void *onSendParams), | ||
| int (*onRecv)(int sfd, char *packet, uint32_t packet_len, uint32_t *buff_size, void *addr, size_t size_of_addr, void *onRecvParams) , | ||
| int (*checkExit)(void *checkExitParams), | ||
| void (*onExit)(void *params), | ||
| void *params); | ||
|
|
||
| #endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this included? It's part of the repo, so seems to belong. Maybe this is to ensure it stays in the
Documentsfolder? If so, no problem.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be fixed by the 'negative pattern' I spoke about above ^^