monotone

monotone Mtn Source Tree

Root/netxx/resolve.h

1/*
2 * Copyright (C) 2001-2004 Peter J Jones (pjones@pmade.org)
3 * All Rights Reserved
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
14 * distribution.
15 * 3. Neither the name of the Author nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
23 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
29 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33/** @file
34 * This file contains the definitions of the Netxx resolve functions. These
35 * functions resolve host names and service names based on a compile time
36 * test to determin which system calls to use.
37**/
38
39#ifndef _netxx_resolve_h_
40#define _netxx_resolve_h_
41
42// Netxx includes
43#include "netxx/types.h"
44#include "netxx/peer.h"
45
46// standard includes
47#include <vector>
48
49namespace Netxx {
50
51 //####################################################################
52 /**
53 * Resolve the given hostname and add each resulting address into a
54 * given vector of Peer classes.
55 *
56 * @param hostname The hostname to resolve.
57 * @param port The port used when creating Netxx::Peer classes.
58 * @param use_ipv6 Accept IPv6 addresses.
59 * @param addrs The vector to add peer addresses to.
60 * @author Peter Jones
61 **/
62 //####################################################################
63 void resolve_hostname (const char *hostname, port_type port, bool use_ipv6, std::vector<Peer> &addrs);
64
65 //####################################################################
66 /**
67 * Resolve the given service name and return the port number. This
68 * function does not take the protocol type and therefor will use "tcp"
69 * everytime. This is a simplification but may break on extreamly rare
70 * situations.
71 *
72 * @param service The name of the server to resolve.
73 * @return The port number for that service or 0 if there was an error.
74 * @author Peter Jones
75 **/
76 //####################################################################
77 port_type resolve_service (const char *service);
78
79} // end Netxx namespace
80#endif

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status