mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
datastorage: improve linked list
- Simplify linked list search - code was unnecessarily complex for no benefit - Adjust some MAC address handling to simplify code [cleanup commit message] Signed-off-by: Nick Hainke <vincent@systemli.org>
This commit is contained in:
parent
160ccf8917
commit
6e03e37ce8
6 changed files with 53 additions and 131 deletions
|
|
@ -25,11 +25,11 @@ struct mac_entry_s {
|
|||
// ---------------- Functions ----------
|
||||
void insert_macs_from_file();
|
||||
|
||||
int insert_to_maclist(struct dawn_mac mac);
|
||||
struct mac_entry_s* insert_to_maclist(struct dawn_mac mac);
|
||||
|
||||
int mac_in_maclist(struct dawn_mac mac);
|
||||
struct mac_entry_s* mac_find_entry(struct dawn_mac mac);
|
||||
|
||||
struct mac_entry_s* insert_to_mac_array(struct mac_entry_s* entry, struct mac_entry_s** insert_pos);
|
||||
struct mac_entry_s* insert_to_mac_array(struct mac_entry_s* entry);
|
||||
|
||||
void mac_array_delete(struct mac_entry_s* entry);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ struct __attribute__((__packed__)) dawn_mac
|
|||
uint8_t u8[ETH_ALEN];
|
||||
};
|
||||
|
||||
// Used as a filler where a value is required but not used functionally
|
||||
extern const struct dawn_mac dawn_mac_null;
|
||||
|
||||
// Compare a raw MAC address to 00:00:00:00:00:00
|
||||
#define mac_is_null(a1) ((a1)[0] == 0) && ((a1)[1] == 0) && ((a1)[2] == 0) && ((a1)[3] == 0) && ((a1)[4] == 0) && ((a1)[5] == 0)
|
||||
|
||||
|
|
@ -41,6 +44,12 @@ struct __attribute__((__packed__)) dawn_mac
|
|||
*/
|
||||
int hwaddr_aton(const char* txt, uint8_t* addr);
|
||||
|
||||
/**
|
||||
* Parse MAC from string.
|
||||
* @param s
|
||||
*/
|
||||
struct dawn_mac str2mac(char* s);
|
||||
|
||||
/**
|
||||
* Write mac to a file.
|
||||
* @param path
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue