ether_ntoa, ether_aton, ether_ntohost, ether_hostton, or ether_line Subroutine

Purpose

Maps 48-bit Ethernet numbers.

Library

Standard C Library (libc.a)

Syntax

#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>

char *ether_ntoa (EthernetNumber)
struct ether_addr * EthernetNumber;

struct ether_addr *other_aton( String);
char *string

int *ether_ntohost (HostName, EthernetNumber)
char * HostName;
struct ether_addr *EthernetNumber;

int *ether_hostton (HostName, EthernetNumber)
char *HostName;
struct ether_addr *EthernetNumber;

int *ether_line (Line, EthernetNumber, HostName)
char * Line, *HostName;
struct ether_addr *EthernetNumber;

Description

Attention: Do not use the ether_ntoa or ether_aton subroutine in a multithreaded environment.

The ether_ntoa subroutine maps a 48-bit Ethernet number pointed to by the EthernetNumber parameter to its standard ASCII representation. The subroutine returns a pointer to the ASCII string. The representation is in the form x:x:x:x:x:x: where x is a hexadecimal number between 0 and ff. The ether_aton subroutine converts the ASCII string pointed to by the String parameter to a 48-bit Ethernet number. This subroutine returns a null value if the string cannot be scanned correctly.

The ether_ntohost subroutine maps a 48-bit Ethernet number pointed to by the EthernetNumber parameter to its associated host name. The string pointed to by the HostName parameter must be long enough to hold the host name and a null character. The ether_hostton subroutine maps the host name string pointed to by the HostName parameter to its corresponding 48-bit Ethernet number. This subroutine modifies the Ethernet number pointed to by the EthernetNumber parameter.

The ether_line subroutine scans the line pointed to by line and sets the hostname pointed to by the HostName parameter and the Ethernet number pointed to by the EthernetNumber parameter to the information parsed from LINE.

Parameters

Item Description
EthernetNumber Points to an Ethernet number.
String Points to an ASCII string.
HostName Points to a host name.
Line Points to a line.

Return Values

Item Description
0 Indicates that the subroutine was successful.
non-zero Indicates that the subroutine was not successful.

Files

Item Description
/etc/ethers Contains information about the known (48-bit) Ethernet addresses of hosts on the Internet.