~stgraber/+junk/nm-ofono

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* nm-ip6-manager.c - Handle IPv6 address configuration for NetworkManager
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Copyright (C) 2009 - 2010 Red Hat, Inc.
 */

#ifndef NM_IP6_MANAGER_H
#define NM_IP6_MANAGER_H

#include <glib.h>
#include <glib-object.h>

#include <nm-setting-ip6-config.h>

#include "nm-ip6-config.h"

#define NM_TYPE_IP6_MANAGER            (nm_ip6_manager_get_type ())
#define NM_IP6_MANAGER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_IP6_MANAGER, NMIP6Manager))
#define NM_IP6_MANAGER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_IP6_MANAGER, NMIP6ManagerClass))
#define NM_IS_IP6_MANAGER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_IP6_MANAGER))
#define NM_IS_IP6_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_IP6_MANAGER))
#define NM_IP6_MANAGER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_IP6_MANAGER, NMIP6ManagerClass))

enum {
	IP6_DHCP_OPT_NONE = 0,
	IP6_DHCP_OPT_OTHERCONF,
	IP6_DHCP_OPT_MANAGED
};

typedef struct {
	GObject parent;
} NMIP6Manager;

typedef struct {
	GObjectClass parent;

	/* Signals */

	/* addrconf_complete is emitted only during initial configuration to indicate
	 * that the initial configuration is complete.
	 */
	void (*addrconf_complete) (NMIP6Manager *manager,
	                           guint32 ifindex,
	                           guint dhcp_opts,
	                           gboolean success);

	/* config_changed gets emitted only *after* initial configuration is
	 * complete; it's like DHCP renew and indicates that the existing config
	 * of the interface has changed.
	 */
	void (*config_changed)    (NMIP6Manager *manager,
	                           guint32 ifindex,
	                           guint dhcp_opts,
	                           gboolean success);
} NMIP6ManagerClass;

GType nm_ip6_manager_get_type (void);

NMIP6Manager *nm_ip6_manager_get               (void);
gboolean      nm_ip6_manager_prepare_interface (NMIP6Manager *manager,
                                                int ifindex,
                                                const guint8 *hwaddr,
                                                guint hwaddr_len,
                                                NMSettingIP6Config *s_ip6,
                                                const char *accept_ra_path);
void          nm_ip6_manager_begin_addrconf    (NMIP6Manager *manager,
                                                int ifindex);
void          nm_ip6_manager_cancel_addrconf   (NMIP6Manager *manager,
                                                int ifindex);

NMIP6Config * nm_ip6_manager_get_ip6_config    (NMIP6Manager *manager,
                                                int ifindex);

#endif /* NM_IP6_MANAGER_H */