summaryrefslogtreecommitdiff
path: root/src/ip6.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ip6.c')
-rw-r--r--src/ip6.c137
1 files changed, 64 insertions, 73 deletions
diff --git a/src/ip6.c b/src/ip6.c
index e5a7214..49a2a88 100644
--- a/src/ip6.c
+++ b/src/ip6.c
@@ -6,19 +6,18 @@
/**
@file ip6.c
- @author djb, fefe, feh
- @source ucspi-tcp, ucspi-tcp6
+ @authors djb, fefe, feh
+ @ref ucspi-tcp, ucspi-tcp6
@brief handling of IPv6 addresses
*/
-/***
- @brief ip6_fmt
- convert IPv6 address to compactified IPv6 address string
- @param input: IPv6 char array
- output: pointer to IPv6 address string
- @return int length of address (ok > 0)
- */
-
+/**
+ @brief ip6_fmt
+ convert IPv6 address to compactified IPv6 address string
+ @param input: IPv6 char array
+ output: pointer to IPv6 address string
+ @return int length of address (ok > 0)
+*/
unsigned int ip6_fmt(char *s, char ip[16])
{
unsigned int len;
@@ -76,14 +75,13 @@ unsigned int ip6_fmt(char *s, char ip[16])
return len;
}
-/***
- @brief ip6_fmt_flat
- convert IPv6 address to IPv6 address string
- @param input: IPv6 char array
- output: pointer to IPv6 address string
- @return int length of address (ok > 0)
- */
-
+/**
+ * @brief ip6_fmt_flat
+ * convert IPv6 address to IPv6 address string
+ * @param input: IPv6 char array
+ * output: pointer to IPv6 address string
+ * @return int length of address (ok > 0)
+ */
unsigned int ip6_fmt_flat(char *s, char ip[16])
{
int i;
@@ -95,13 +93,13 @@ unsigned int ip6_fmt_flat(char *s, char ip[16])
}
/**
- @brief ia6_fmt
- convert IPv6 address to inverse DNS nibble format
- 1.2.3.4.5.6.7.8.9.a.b.c.d.e.f.1.2.3.4.5.6.7.8.9.a.b.c.d.e.f.ip6.arpa
- @param input: IPv6 char array
- output: pointer to IPv6 address string
- @return int length of address
-*/
+ * @brief ia6_fmt
+ * convert IPv6 address to inverse DNS nibble format
+ * 1.2.3.4.5.6.7.8.9.a.b.c.d.e.f.1.2.3.4.5.6.7.8.9.a.b.c.d.e.f.ip6.arpa
+ * @param input: IPv6 char array
+ * output: pointer to IPv6 address string
+ * @return int length of address
+ */
unsigned int ia6_fmt(char *s, char ip[16])
{
unsigned int i;
@@ -132,15 +130,13 @@ unsigned int ia6_fmt(char *s, char ip[16])
return len;
}
-
-/***
- @brief ip6_scan_flat
- convert IPv6 address string to IPv6 address array
- @param input: pointer to IPv6 address string
- output: IPv6 char array
- @return int length of address (ok > 0)
- */
-
+/**
+ * @brief ip6_scan_flat
+ * convert IPv6 address string to IPv6 address array
+ * @param input: pointer to IPv6 address string
+ * output: IPv6 char array
+ * @return int length of address (ok > 0)
+ */
unsigned int ip6_scan_flat(const char *s, char ip[16])
{
int i, tmp;
@@ -156,14 +152,13 @@ unsigned int ip6_scan_flat(const char *s, char ip[16])
return 32;
}
-/***
- @brief ip6_scan
- parse compactified IPv6 address string and convert to IPv6 address array
- @param input: pointer to IPv6 address string
- output: IPv6 char array
- @return int length of ip6_address/ip
- */
-
+/**
+ * @brief ip6_scan
+ * parse compactified IPv6 address string and convert to IPv6 address array
+ * @param input: pointer to IPv6 address string
+ * output: IPv6 char array
+ * @return int length of ip6_address/ip
+ */
unsigned int ip6_scan(const char *s, char ip[16])
{
unsigned int i, j;
@@ -251,14 +246,13 @@ unsigned int ip6_scan(const char *s, char ip[16])
return len;
}
-/***
- @brief ip6_scanbracket
- parse IPv6 string address enclosed in brackets
- @param input: pointer to IPv6 address string
- output: IPv6 char array
- @return int length of ip_address (ok > 0)
- */
-
+/**
+ * @brief ip6_scanbracket
+ * parse IPv6 string address enclosed in brackets
+ * @param input: pointer to IPv6 address string
+ * output: IPv6 char array
+ * @return int length of ip_address (ok > 0)
+ */
unsigned int ip6_scanbracket(const char *s, char ip[16])
{
unsigned int len;
@@ -271,14 +265,13 @@ unsigned int ip6_scanbracket(const char *s, char ip[16])
}
/**
- @brief ip6_ifscan
- parse compactified IPv6 address string
- concatinated with the interface name: fe80::1%eth0
- @param input: pointer to IPv6 address string
- output: IPv6 char array, stralloc interface_name
- @return int length of ip6_address/ip
- */
-
+ * @brief ip6_ifscan
+ * parse compactified IPv6 address string
+ * concatinated with the interface name: fe80::1%eth0
+ * @param input: pointer to IPv6 address string
+ * output: IPv6 char array, stralloc interface_name
+ * @return int length of ip6_address/ip
+ */
unsigned int ip6_ifscan(char *s, char ip[16], stralloc *ifname)
{
int i;
@@ -303,14 +296,13 @@ unsigned int ip6_ifscan(char *s, char ip[16], stralloc *ifname)
}
/**
- @brief ip6_cidr
- parse compactified IPv6 address string
- concatinated with the prefix length: fe80::1/64
- @param input: pointer to IPv6 address string
- output: IPv6 char array, long plen
- @return int length of ip6_address/ip
- */
-
+ * @brief ip6_cidr
+ * parse compactified IPv6 address string
+ * concatinated with the prefix length: fe80::1/64
+ * @param input: pointer to IPv6 address string
+ * output: IPv6 char array, long plen
+ * @return int length of ip6_address/ip
+ */
unsigned int ip6_cidr(char *s, char ip[16], unsigned long *plen)
{
unsigned int j = 0;
@@ -325,13 +317,12 @@ unsigned int ip6_cidr(char *s, char ip[16], unsigned long *plen)
}
/**
- @brief ip6_bytestring
- parse IPv6 address and represent as char string with length prefix
- @param input: IPv6 char array, prefix length
- output: pointer to stralloc bit string;
- @return n: number of bytes, if ok; -1: memory shortage
- */
-
+ * @brief ip6_bytestring
+ * parse IPv6 address and represent as char string with length prefix
+ * @param input: IPv6 char array, prefix length
+ * output: pointer to stralloc bit string;
+ * @return n: number of bytes, if ok; -1: memory shortage
+ */
unsigned int ip6_bytestring(stralloc *ipstring, char ip[16], int prefix)
{
int i, j, n = 0;