Commit graph

23 commits

Author SHA1 Message Date
AKP
672d883974
Move some files around for easier reuse 2023-10-30 14:56:38 +00:00
76f63f3e78 Update firewall-rules/README.md 2023-10-11 11:39:24 +00:00
5e797f6ab7 Add firewall-rules/README.md 2023-10-11 11:38:14 +00:00
4669327d24 Add assignment 1 problem statement 2023-10-11 11:37:28 +00:00
AKP
be3eece61c
Alter 5 files
Add `.clang-format`
Update `checkPacket.c`
Update `parser.c`
Update `readFirewall.c`
Update `types.c`
2023-10-08 19:35:23 +01:00
AKP
c9e2c11fb3 Revert "Reformat code"
This reverts commit 03aa84720a.
2023-10-08 19:25:14 +01:00
AKP
03aa84720a Reformat code 2023-10-08 19:21:01 +01:00
AKP
96490bd41c Silence parser warning about ParseState_done being unchecked 2023-10-08 19:08:23 +01:00
AKP
aa99b0b0bf
Rename checkFirewall to checkPacket 2023-10-08 19:06:10 +01:00
AKP
087ac26c84
Optionally read from stdin 2023-10-08 19:01:34 +01:00
AKP
e514846c98
Move test data 2023-10-08 19:01:05 +01:00
AKP
c3ef9bffe0 Add firewall rule checking 2023-10-08 18:19:19 +01:00
AKP
cca3460d21
Add parse_port function 2023-10-06 23:30:31 +01:00
AKP
21b8037bd6
Refactor for reuse of file parsing logic 2023-10-06 23:24:14 +01:00
AKP
e95a1607dd
Docs 2023-10-06 23:03:37 +01:00
AKP
7715c9da29
Fix test cases 2023-10-06 23:02:04 +01:00
AKP
b9e9411554
Optimize error text printing 2023-10-06 23:01:40 +01:00
AKP
91b17efc5c
Do value checking in parser 2023-10-06 23:01:09 +01:00
AKP
4563b208a6
Fix sort
Sorting was broken due to a miscast of a void pointer.

qsort has an argumen for a comparison function of type
`int (*) (const void*, const void*)`, where the void is the type
of the items in the main array being sorted.

In this case, the array was of type `struct Rule*[]`. The
comparison function was being provided with `struct Rule**`s as
void pointers, which were being cast to `struct Rule*`s and used
like that, causing weird behaviour.

This commit corrects the typecast to cast to `struct Rule**` and
dereferences appropriately.
2023-10-06 22:34:33 +01:00
AKP
ebb9ce2690
Why does this sorting not sort 2023-10-06 15:10:36 +01:00
AKP
5fa87929e2
Parse rules from file 2023-10-06 12:31:49 +01:00
AKP
193d06e922
Alter 2 files
Update `parser.c`
Update `readFirewall.c`
2023-10-05 23:41:52 +01:00
AKP
061dedc40c
Initial parser implementation 2023-10-05 23:40:35 +01:00