diff mbox series

[5/8] connection: Document 'inet_mask_addr_data'.

Message ID 20231215001032.2127527-6-gerickson@nuovations.com (mailing list archive)
State Not Applicable, archived
Headers show
Series inet: Add IPv{4,6} Host/Network Route Add/Delete with Metric / Priority Functions | expand

Commit Message

Grant Erickson Dec. 15, 2023, 12:10 a.m. UTC
This adds documentation to the 'inet_mask_addr_data' function.
---
 src/inet.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
diff mbox series

Patch

diff --git a/src/inet.c b/src/inet.c
index cc450355bf7e..ca999fa31633 100644
--- a/src/inet.c
+++ b/src/inet.c
@@ -651,6 +651,31 @@  static int inet_get_addr_data(int family,
 	return 0;
 }
 
+/**
+ *  @brief
+ *    Apply the specified prefix length to the specified binary
+ *    address data.
+ *
+ *  This attempts to apply the specified prefix length as a network /
+ *  prefix mask to the specified address data, in network (that is,
+ *  big endian) byte order, to generate a network address / prefix.
+ *
+ *  @param[in]      addr_len   The length, in bytes of the address
+ *                             pointed to by @a addr_data.
+ *  @param[in,out]  addr_data  A pointer to the mutable address data
+ *                             in binary form in network (that is,
+ *                             big endian) byte order to mask with @a
+ *                             prefixlen.
+ *  @param[in]      prefixlen  The prefix length to apply to @a
+ *                             addr_data as a mask to generate a
+ *                             network address / prefix.
+ *
+ *  @retval  0              If successful.
+ *  @retval  -EINVAL        If @a addr_len or @a addr_data are null
+ *                          or if the specified prefix length exceeds
+ *                          the address length.
+ *
+ */
 static int inet_mask_addr_data(size_t addr_len,
 			void *addr_data,
 			uint8_t prefixlen)