packaging: Bump to 1.17
[platform/upstream/ofono.git] / gatchat / gatresult.h
1 /*
2  *
3  *  AT chat library with GLib integration
4  *
5  *  Copyright (C) 2008-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 __GATCHAT_RESULT_H
23 #define __GATCHAT_RESULT_H
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 struct _GAtResult {
30         GSList *lines;
31         char *final_or_pdu;
32 };
33
34 typedef struct _GAtResult GAtResult;
35
36 #define G_AT_RESULT_LINE_LENGTH_MAX 2048
37
38 struct _GAtResultIter {
39         GAtResult *result;
40         GSList *l;
41         char buf[G_AT_RESULT_LINE_LENGTH_MAX + 1];
42         unsigned int line_pos;
43         GSList pre;
44 };
45
46 typedef struct _GAtResultIter GAtResultIter;
47
48 void g_at_result_iter_init(GAtResultIter *iter, GAtResult *result);
49
50 gboolean g_at_result_iter_next(GAtResultIter *iter, const char *prefix);
51 gboolean g_at_result_iter_open_list(GAtResultIter *iter);
52 gboolean g_at_result_iter_close_list(GAtResultIter *iter);
53
54 gboolean g_at_result_iter_skip_next(GAtResultIter *iter);
55
56 gboolean g_at_result_iter_next_range(GAtResultIter *iter, gint *min, gint *max);
57 gboolean g_at_result_iter_next_string(GAtResultIter *iter, const char **str);
58 gboolean g_at_result_iter_next_unquoted_string(GAtResultIter *iter,
59                                                 const char **str);
60 gboolean g_at_result_iter_next_number(GAtResultIter *iter, gint *number);
61 gboolean g_at_result_iter_next_number_default(GAtResultIter *iter, gint dflt,
62                                                 gint *number);
63 gboolean g_at_result_iter_next_hexstring(GAtResultIter *iter,
64                 const guint8 **str, gint *length);
65
66 const char *g_at_result_iter_raw_line(GAtResultIter *iter);
67
68 const char *g_at_result_final_response(GAtResult *result);
69 const char *g_at_result_pdu(GAtResult *result);
70
71 gint g_at_result_num_response_lines(GAtResult *result);
72
73 #ifdef __cplusplus
74 }
75 #endif
76
77 #endif /* __GATCHAT_RESULT_H */