/*++ /* NAME /* find_inet 3 /* SUMMARY /* inet-domain name services /* SYNOPSIS /* #include <find_inet.h> /* /* unsigned find_inet_addr(host) /* const char *host; /* /* int find_inet_port(port, proto) /* const char *port; /* const char *proto; /* DESCRIPTION /* These functions translate network address information from /* between printable form to the internal the form used by the /* BSD TCP/IP network software. /* /* find_inet_addr() translates a symbolic or numerical hostname. /* This function is deprecated. Use hostname_to_hostaddr() instead. /* /* find_inet_port() translates a symbolic or numerical port name. /* BUGS /* find_inet_addr() ignores all but the first address listed for /* a symbolic hostname. /* DIAGNOSTICS /* Lookup and conversion errors are fatal. /* LICENSE /* .ad /* .fi /* The Secure Mailer license must be distributed with this software. /* AUTHOR(S) /* Wietse Venema /* IBM T.J. Watson Research /* P.O. Box 704 /* Yorktown Heights, NY 10598, USA /* /* Wietse Venema /* Google, Inc. /* 111 8th Avenue /* New York, NY 10011, USA
/*--*/
struct association { constchar *lhs; /* service name */ constchar *rhs; /* service port */
};
struct test_case { constchar *label; /* identifies test case */ struct association associations[10]; constchar *service; constchar *proto; constchar *exp_warning; /* expected error */ int exp_hport; /* expected port, host byte order */
};
struct test_case test_cases[] = {
{"good-symbolic", /* association */ {{"foobar", "25252"}, 0}, /* service */ "foobar", /* proto */ "tcp", /* exp_warning */ "", /* exp_hport */ 25252,
},
{"good-numeric", /* association */ {{"foobar", "25252"}, 0}, /* service */ "25252", /* proto */ "tcp", /* exp_warning */ "", /* exp_hport */ 25252,
},
{"bad-symbolic", /* association */ {{"foobar", "25252"}, 0}, /* service */ "an-impossible-name", /* proto */ "tcp", /* exp_warning */ "find_inet: warning: unknown service: an-impossible-name/tcp\n",
},
{"bad-numeric", /* association */ {{"foobar", "25252"}, 0}, /* service */ "123456", /* proto */ "tcp", /* exp_warning */ "find_inet: warning: bad port number: 123456\n",
},
};
int main(int argc, char **argv)
{ struct test_case *tp; struct association *ap; int pass = 0; int fail = 0; constchar *err; int test_failed; int nport;
VSTRING *msg_buf;
VSTREAM *memory_stream;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.