NET_ATON(3N) — Series 300 and 500 Only
NAME
net_aton, net_ntoa − network station address string conversion routines
SYNOPSIS
#include <stdio.h>
char *net_aton(dstr, sstr, size)
char *dstr;
char *sstr;
int size;
char *net_ntoa(dstr, sstr, size)
char *dstr;
char *sstr;
int size;
DESCRIPTION
Net_aton interprets the null-terminated ASCII form of a network station address (e.g. IEEE802.3 address or Ethernet address) contained in sstr, placing the network-internal form of the address in dstr. Sstr may be in octal, decimal, or hexadecimal format. Size is the required length of the network-internal form and must be greater than 0 and less than 7 (e.g. 6 for IEEE802.3 and Ethernet). Dstr is returned.
Net_ntoa converts the network-internal form of a network station address contained in sstr into its (hexadecimal) ASCII equivalent in dstr. The length of sstr is input in the size parameter. Size must be a value greater than 0 and less than 7. Dstr must be at least (2*size+3) bytes in length. Dstr is returned null-terminated, with leading zeroes when appropriate (e.g. "0x00DD0002AD00" not "0xDD0002AD00").
DIAGNOSTICS
The value NULL is returned if any error occurs.
EXAMPLE
#include <stdio.h>
#include <netio.h>
#define destination_addr "0x00DD0002AD00"
...
fis arg;
char str[16];
...
net_aton(arg.value.s, destination_addr, 6);
/* arg.value.s = "\000\335\000\002\255\000" */
net_ntoa(str, arg.value.s, 6);
/* str = "0x00DD0002AD00\0" */
DEPENDENCIES
Implemented on the Series 300 and 500 only.
AUTHOR
HP
SEE ALSO
Hewlett-Packard Company — May 11, 2021