diff options
author | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2008-08-20 00:21:51 +0000 |
---|---|---|
committer | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2008-08-20 00:21:51 +0000 |
commit | 1ff0402e472496cf5165dbd796df1bdc131a360b (patch) | |
tree | d363346777c732dd016aeb78e4a4e1a5b330c826 /cups/http-addr.c | |
parent | 9f5eb9be66a1755edd2c93bd7809883519c2e8eb (diff) |
Merge changes from CUPS 1.4svn-r7851.
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@913 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'cups/http-addr.c')
-rw-r--r-- | cups/http-addr.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/cups/http-addr.c b/cups/http-addr.c index bde526ffe..b16961886 100644 --- a/cups/http-addr.c +++ b/cups/http-addr.c @@ -3,7 +3,7 @@ * * HTTP address routines for the Common UNIX Printing System (CUPS). * - * Copyright 2007 by Apple Inc. + * Copyright 2007-2008 by Apple Inc. * Copyright 1997-2006 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -18,6 +18,7 @@ * httpAddrEqual() - Compare two addresses. * httpAddrLocalhost() - Check for the local loopback address. * httpAddrLookup() - Lookup the hostname associated with the address. + * _httpAddrPort() - Get the port number associated with an address. * httpAddrString() - Convert an IP address to a dotted string. * httpGetHostByName() - Lookup a hostname or IP address, and return * address records for the specified name. @@ -242,6 +243,25 @@ httpAddrLookup( /* + * '_httpAddrPort()' - Get the port number associated with an address. + */ + +int /* O - Port number */ +_httpAddrPort(http_addr_t *addr) /* I - Address */ +{ +#ifdef AF_INET6 + if (addr->addr.sa_family == AF_INET6) + return (ntohs(addr->ipv6.sin6_port)); + else +#endif /* AF_INET6 */ + if (addr->addr.sa_family == AF_INET) + return (ntohs(addr->ipv4.sin_port)); + else + return (ippPort()); +} + + +/* * 'httpAddrString()' - Convert an address to a numeric string. * * @since CUPS 1.2@ |