blob: 9515d978959c2643bd5253d068fcf84f4bd2bdc1 [file] [log] [blame]
Benny Prijonob681a2f2007-03-25 18:44:51 +00001/* $Id$ */
2/*
3 * Copyright (C)2003-2007 Benny Prijono <benny@prijono.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19#ifndef __PJ_IP_ROUTE_H__
20#define __PJ_IP_ROUTE_H__
21
22/**
23 * @file ip_helper.h
24 * @brief IP helper API
25 */
26
27#include <pj/sock.h>
28
29PJ_BEGIN_DECL
30
31/**
32 * @defgroup pj_ip_helper IP Interface and Routing Helper
33 * @ingroup PJ_IO
34 * @{
35 *
36 * This module provides functions to query local host's IP interface and
37 * routing table.
38 */
39
40/**
41 * This structure describes IP routing entry.
42 */
43typedef union pj_ip_route_entry
44{
45 /** IP routing entry for IP version 4 routing */
46 struct
47 {
48 pj_in_addr if_addr; /**< Local interface IP address. */
49 pj_in_addr dst_addr; /**< Destination IP address. */
50 pj_in_addr mask; /**< Destination mask. */
51 } ipv4;
52} pj_ip_route_entry;
53
54
55/**
56 * Enumerate the local IP interface currently active in the host.
57 *
58 * @param count On input, specify the number of entries. On output,
59 * it will be filled with the actual number of entries.
60 * @param ifs Array of IP addresses.
61 *
62 * @return PJ_SUCCESS on success, or the appropriate error code.
63 */
64PJ_DECL(pj_status_t) pj_enum_ip_interface(unsigned *count,
65 pj_in_addr ifs[]);
66
67
68/**
69 * Enumerate the IP routing table for this host.
70 *
71 * @param count On input, specify the number of routes entries. On output,
72 * it will be filled with the actual number of route entries.
73 * @param routes Array of IP routing entries.
74 *
75 * @return PJ_SUCCESS on success, or the appropriate error code.
76 */
77PJ_DECL(pj_status_t) pj_enum_ip_route(unsigned *count,
78 pj_ip_route_entry routes[]);
79
80
81
82/** @} */
83
84PJ_END_DECL
85
86
87#endif /* __PJ_IP_ROUTE_H__ */
88