packaging: Bump to 1.17
[platform/upstream/ofono.git] / gatchat / gatppp.h
1 /*
2  *
3  *  PPP library with GLib integration
4  *
5  *  Copyright (C) 2009-2011  Intel Corporation. All rights reserved.
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License version 2 as
9  *  published by the Free Software Foundation.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  */
21
22 #ifndef __G_AT_PPP_H
23 #define __G_AT_PPP_H
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 #include "gat.h"
30 #include "gathdlc.h"
31
32 struct _GAtPPP;
33
34 typedef struct _GAtPPP GAtPPP;
35
36 typedef enum _GAtPPPDisconnectReason {
37         G_AT_PPP_REASON_UNKNOWN,
38         G_AT_PPP_REASON_AUTH_FAIL,      /* Failed to authenticate */
39         G_AT_PPP_REASON_IPCP_FAIL,      /* Failed to negotiate IPCP */
40         G_AT_PPP_REASON_NET_FAIL,       /* Failed to create tun */
41         G_AT_PPP_REASON_PEER_CLOSED,    /* Peer initiated a close */
42         G_AT_PPP_REASON_LINK_DEAD,      /* Link to the peer died */
43         G_AT_PPP_REASON_LOCAL_CLOSE,    /* Normal user close */
44 } GAtPPPDisconnectReason;
45
46 typedef enum _GAtPPPAuthMethod {
47         G_AT_PPP_AUTH_METHOD_CHAP,
48         G_AT_PPP_AUTH_METHOD_PAP,
49 } GAtPPPAuthMethod;
50
51 typedef void (*GAtPPPConnectFunc)(const char *iface, const char *local,
52                                         const char *peer,
53                                         const char *dns1, const char *dns2,
54                                         gpointer user_data);
55 typedef void (*GAtPPPDisconnectFunc)(GAtPPPDisconnectReason reason,
56                                         gpointer user_data);
57
58 GAtPPP *g_at_ppp_new(void);
59 GAtPPP *g_at_ppp_server_new(const char *local);
60 GAtPPP *g_at_ppp_server_new_full(const char *local, int fd);
61
62 gboolean g_at_ppp_open(GAtPPP *ppp, GAtIO *io);
63 gboolean g_at_ppp_listen(GAtPPP *ppp, GAtIO *io);
64 void g_at_ppp_set_connect_function(GAtPPP *ppp, GAtPPPConnectFunc callback,
65                                         gpointer user_data);
66 void g_at_ppp_set_disconnect_function(GAtPPP *ppp, GAtPPPDisconnectFunc func,
67                                         gpointer user_data);
68 void g_at_ppp_set_suspend_function(GAtPPP *ppp, GAtSuspendFunc func,
69                                         gpointer user_data);
70 void g_at_ppp_set_debug(GAtPPP *ppp, GAtDebugFunc func, gpointer user_data);
71 void g_at_ppp_shutdown(GAtPPP *ppp);
72 void g_at_ppp_suspend(GAtPPP *ppp);
73 void g_at_ppp_resume(GAtPPP *ppp);
74 void g_at_ppp_ref(GAtPPP *ppp);
75 void g_at_ppp_unref(GAtPPP *ppp);
76
77 gboolean g_at_ppp_set_credentials(GAtPPP *ppp, const char *username,
78                                                 const char *passwd);
79 const char *g_at_ppp_get_username(GAtPPP *ppp);
80 const char *g_at_ppp_get_password(GAtPPP *ppp);
81
82 gboolean g_at_ppp_set_auth_method(GAtPPP *ppp, GAtPPPAuthMethod method);
83 GAtPPPAuthMethod g_at_ppp_get_auth_method(GAtPPP *ppp);
84
85 void g_at_ppp_set_recording(GAtPPP *ppp, const char *filename);
86
87 void g_at_ppp_set_server_info(GAtPPP *ppp, const char *remote_ip,
88                                 const char *dns1, const char *dns2);
89
90 void g_at_ppp_set_acfc_enabled(GAtPPP *ppp, gboolean enabled);
91 void g_at_ppp_set_pfc_enabled(GAtPPP *ppp, gboolean enabled);
92
93 #ifdef __cplusplus
94 }
95 #endif
96
97 #endif /* __G_AT_PPP_H */