[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Communications, Volume 2

inet_net_pton Subroutine

Purpose

Converts between text and binary address formats.

Library

Library (libc.a)

Syntax

int inet_net_pton (af, src, dst, size)
int af;
const char *src;
void *dst;
size_t size;

Description

This function converts a network address in ascii into the binary network address. The ascii representation can be CIDR-based (for example, 9.3.149.0/24) or class-based (for example, 9.3.149.0). The af parameter specifies the family of the address. The src parameter points to the string being passed in. The dst parameter points to a buffer where the function will store the resulting numeric address. The size parameter is the size (in bytes) of the buffer pointed to by the dst parameter.

Parameters

af Specifies the family of the address.
src Points to the string being passed in.
dst Points to a buffer where the resulting numeric address is stored.
size Specifies the size (in bytes) of the buffer pointed to by the dst parameter.

Return Values

If successful, the number of bits, either inputted classfully or specified with /CIDR, is returned. If unsuccessful, a -1 (negative one) is returned (check errno). ENOENT means it was not a valid network specification.

Related Information

inet_net_ntop Subroutine, inet_ntop Subroutine, and inet_pton Subroutine.

Subroutines Overview in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]