getnetentのヘルプ・マニュアル
日本語 英語
getnetent --help
man getnetent
GETNETENT(3) Linux Programmer’s Manual GETNETENT(3)
名前
getnetent, getnetbyname, getnetbyaddr, setnetent, endnetent - ネットワ
ークエントリを取得する
書式
#include
struct netent *getnetent(void);
struct netent *getnetbyname(const char *name);
struct netent *getnetbyaddr(uint32_t net, int type);
void setnetent(int stayopen);
void endnetent(void);
説明
getnetent() 関数はネットワークデータベースから次のエントリを読み込み 、
そ のエントリを netent 構造体の要素別のフィールドに格納し、その構造体を
返す。必要であれば、データベースへの接続がオープンされる。
getnetbyname() 関数は、ネットワーク名 name にマッチするエントリをデータ
ベースから探し、そのエントリを収めた netent 構造体を返す。
getnetbyaddr() 関数は、type 型のネットワーク番号 net にマッチするエント
リをデータベースから探し、そのエントリを収めた netent 構造体を 返 す 。
net 引き数はホスト・バイトオーダでなければならない。
setnetent() 関数はデータベースへの接続をオープンし、次の読み込みエント
リを先頭のエントリに設定する。 stayopen が 0 でない場合、一 つ 一 つ の
getnet*() 関数の呼び出し間でデータベースへの接続をクローズしない。
endnetent() 関数はデータベースへの接続をクローズする。
netent 構造体は で以下のように定義されている。
struct netent {
char *n_name; /* official network name */
char **n_aliases; /* alias list */
int n_addrtype; /* net address type */
uint32_t n_net; /* network number */
}
netent 構造体のメンバは以下の通り。
n_name ネットワークの正式名 (official name)。
n_aliases ネットワークの別名からなるリスト。リストは NULL で終
端される。
n_addrtype ネットワーク番号の形式。現在は AF_INET のみ。
n_net ホスト・バイトオーダ形式のネットワーク番号。
返り値
getnetent(), getnetbyname(), getnetbyaddr() 関数は、静的に割り当てら れ
た netent 構造体へのポインタを返す。エラーが起こったり、ファイルの末尾
に達した場合は NULL ポインタを返す。
ファイル
/etc/networks
ネットワークデータベースファイル
準拠
4.3BSD, POSIX.1-2001.
注意
バージョン 2.2 より前の glibc では、 getnetbyaddr() の引き 数 net は
long 型だった。
関連項目
getnetent_r(3), getprotoent(3), getservent(3)
RFC 1101
GNU 2008-08-19 GETNETENT(3)
GETNETENT(3) Linux Programmer’s Manual GETNETENT(3)
NAME
getnetent, getnetbyname, getnetbyaddr, setnetent, endnetent - get net-
work entry
SYNOPSIS
#include
struct netent *getnetent(void);
struct netent *getnetbyname(const char *name);
struct netent *getnetbyaddr(uint32_t net, int type);
void setnetent(int stayopen);
void endnetent(void);
DESCRIPTION
The getnetent() function reads the next entry from the networks
database and returns a netent structure containing the broken-out
fields from the entry. A connection is opened to the database if nec-
essary.
The getnetbyname() function returns a netent structure for the entry
from the database that matches the network name.
The getnetbyaddr() function returns a netent structure for the entry
from the database that matches the network number net of type type.
The net argument must be in host byte order.
The setnetent() function opens a connection to the database, and sets
the next entry to the first entry. If stayopen is non-zero, then the
connection to the database will not be closed between calls to one of
the getnet*() functions.
The endnetent() function closes the connection to the database.
The netent structure is defined in as follows:
struct netent {
char *n_name; /* official network name */
char **n_aliases; /* alias list */
int n_addrtype; /* net address type */
uint32_t n_net; /* network number */
}
The members of the netent structure are:
n_name The official name of the network.
n_aliases
A NULL-terminated list of alternative names for the network.
n_addrtype
The type of the network number; always AF_INET.
n_net The network number in host byte order.
RETURN VALUE
The getnetent(), getnetbyname() and getnetbyaddr() functions return a
pointer to a statically allocated netent structure, or a NULL pointer
if an error occurs or the end of the file is reached.
FILES
/etc/networks
networks database file
CONFORMING TO
4.3BSD, POSIX.1-2001.
NOTES
In glibc versions before 2.2, the net argument of getnetbyaddr() was of
type long.
SEE ALSO
getnetent_r(3), getprotoent(3), getservent(3)
RFC 1101
COLOPHON
This page is part of release 3.22 of the Linux man-pages project. A
description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
GNU 2008-08-19 GETNETENT(3)