Upgrade ofono to 1.2
[profile/ivi/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 void (*GAtPPPConnectFunc)(const char *iface, const char *local,
47                                         const char *peer,
48                                         const char *dns1, const char *dns2,
49                                         gpointer user_data);
50 typedef void (*GAtPPPDisconnectFunc)(GAtPPPDisconnectReason reason,
51                                         gpointer user_data);
52
53 GAtPPP *g_at_ppp_new(void);
54 GAtPPP *g_at_ppp_server_new(const char *local);
55 GAtPPP *g_at_ppp_server_new_full(const char *local, int fd);
56
57 gboolean g_at_ppp_open(GAtPPP *ppp, GAtIO *io);
58 gboolean g_at_ppp_listen(GAtPPP *ppp, GAtIO *io);
59 void g_at_ppp_set_connect_function(GAtPPP *ppp, GAtPPPConnectFunc callback,
60                                         gpointer user_data);
61 void g_at_ppp_set_disconnect_function(GAtPPP *ppp, GAtPPPDisconnectFunc func,
62                                         gpointer user_data);
63 void g_at_ppp_set_suspend_function(GAtPPP *ppp, GAtSuspendFunc func,
64                                         gpointer user_data);
65 void g_at_ppp_set_debug(GAtPPP *ppp, GAtDebugFunc func, gpointer user_data);
66 void g_at_ppp_shutdown(GAtPPP *ppp);
67 void g_at_ppp_suspend(GAtPPP *ppp);
68 void g_at_ppp_resume(GAtPPP *ppp);
69 void g_at_ppp_ref(GAtPPP *ppp);
70 void g_at_ppp_unref(GAtPPP *ppp);
71
72 gboolean g_at_ppp_set_credentials(GAtPPP *ppp, const char *username,
73                                                 const char *passwd);
74 const char *g_at_ppp_get_username(GAtPPP *ppp);
75 const char *g_at_ppp_get_password(GAtPPP *ppp);
76
77 void g_at_ppp_set_recording(GAtPPP *ppp, const char *filename);
78
79 void g_at_ppp_set_server_info(GAtPPP *ppp, const char *remote_ip,
80                                 const char *dns1, const char *dns2);
81
82 void g_at_ppp_set_acfc_enabled(GAtPPP *ppp, gboolean enabled);
83 void g_at_ppp_set_pfc_enabled(GAtPPP *ppp, gboolean enabled);
84
85 #ifdef __cplusplus
86 }
87 #endif
88
89 #endif /* __G_AT_PPP_H */