summaryrefslogtreecommitdiff
path: root/AK/MACAddress.h
AgeCommit message (Collapse)Author
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-02-16AK+Kernel: Return KString from MACAddress::to_string() in the KernelIdan Horowitz
This lets us safely handle allocation failure.
2021-11-11Everywhere: Pass AK::StringView by valueAndreas Kling
2021-11-10AK+Everywhere: Stop including Vector.h from StringView.hAndreas Kling
Preparation for using Error.h from Vector.h. This required moving some things out of line.
2021-08-03Everywhere: Make use of container version of all_ofLenny Maiorani
Problem: - New `all_of` implementation takes the entire container so the user does not need to pass explicit begin/end iterators. This is unused except is in tests. Solution: - Make use of the new and more user-friendly version where possible.
2021-07-27AK: Add copy_to span method for AK::MACAddressBrian Gianforcaro
2021-07-25AK: Create MACAddress from stringbrapru
Previously there was no way to create a MACAddress by passing a direct address as a string. This will allow programs like the arp utility to create a MACAddress instance by user-passed addresses.
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-02-26Everywhere: Remove a bunch of redundant 'AK::' namespace prefixesLinus Groh
This is basically just for consistency, it's quite strange to see multiple AK container types next to each other, some with and some without the namespace prefix - we're 'using AK::Foo;' a lot and should leverage that. :^)
2021-02-23Everywhere: Rename ASSERT => VERIFYAndreas Kling
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
2020-12-31Everywhere: Re-format with clang-format-11Linus Groh
Compared to version 10 this fixes a bunch of formatting issues, mostly around structs/classes with attributes like [[gnu::packed]], and incorrect insertion of spaces in parameter types ("T &"/"T &&"). I also removed a bunch of // clang-format off/on and FIXME comments that are no longer relevant - on the other hand it tried to destroy a couple of neatly formatted comments, so I had to add some as well.
2020-11-21MACAddress: Use all_of to implement is_zeroLenny Maiorani
Problem: - `is_zero()` is implemented by checking each value in the array by hand. This is error-prone and less expressive than using an algorithm. Solution: - Implement `is_zero()` in terms of `all_of`.
2020-11-20MACAddress: AK::Array as member variable instead of C-arrayLenny Maiorani
Problem: - C-style arrays do not automatically provide bounds checking and are less type safe overall. - `__builtin_memcmp` is not a constant expression in the current gcc. Solution: - Change private m_data to be AK::Array. - Eliminate constructor from C-style array. - Change users of the C-style array constructor to use the default constructor. - Change `operator==()` to be a hand-written comparison loop and let the optimizer figure out to use `memcmp`.
2020-11-19MACAddress: constexpr supportLenny Maiorani
Problem: - `MACAddress` class is not usable in a compile-time context. - `__builtin_memcpy` is not constexpr in gcc. Solution: - Decorate functions with `constexpr` keyword. - Use default constructors and destructors. - Change `__builtin_memcpy` to a hand-written `for` loop and let the compiler's optimizer take care of it. - Add tests to ensure compile-time capabilities.
2020-11-17MACAddress: Unit testing for basic functionalityLenny Maiorani
Problem: - There are no unit tests for `MACAddress` class. This makes it difficult to refactor and ensure the same behavior. - `m_data` private member variable is uninitialized leading to undefined behavior of `is_zero()`. Solution: - Add unit tests to cover basic functionality. - Initialize `m_data`.
2020-10-08AK: Use new format functions.asynts
2020-09-25Meta+AK: Make clang-format-10 cleanBen Wiederhake
2020-04-05Kernel+AK: Separate out MACAddress and move it into AKAnotherTest