summaryrefslogtreecommitdiff
path: root/gril/parcel.h
diff options
context:
space:
mode:
authorTony Espy <espy@canonical.com>2015-10-13 18:07:52 +0200
committerDenis Kenzior <denkenz@gmail.com>2015-10-13 16:02:11 -0500
commit9c2af753c0ca7e344019e33911bc590f35f81b12 (patch)
tree25611b0d70fedde1397eb3002c32e7d26f77ab6f /gril/parcel.h
parentab9fedc6ef3bde5855b2776acfae59aaae3e787a (diff)
downloadofono-9c2af753c0ca7e344019e33911bc590f35f81b12.tar.gz
gril: Library to communicate with rild
gril is a library used to communicate with rild, the Android telephony daemon. Communication happens using a named socket over which binder parcels are transmitted. Co-authored-by: Tony Espy <espy@canonical.com> Co-authored-by: Ricardo Salveti de Araujo <ricardo.salveti@canonical.com> Co-authored-by: Alfonso Sanchez-Beato <alfonso.sanchez-beato@canonical.com> Co-authored-by: Mikko Hurskainen <mikko.hurskainen@nomovok.com> Co-authored-by: You-Sheng Yang <vicamo.yang@canonical.com> Co-authored-by: Ratchanan Srirattanamet <peathot@hotmail.com>
Diffstat (limited to 'gril/parcel.h')
-rw-r--r--gril/parcel.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/gril/parcel.h b/gril/parcel.h
new file mode 100644
index 00000000..fd448117
--- /dev/null
+++ b/gril/parcel.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright © 2011 Joel Armstrong <jcarmst@sandia.gov>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License (`GPL') as published by
+ * the Free Software Foundation; either version 2 of the License, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Based on parcel implementation from https://bitbucket.org/floren/inferno
+ *
+ */
+
+#ifndef __PARCEL_H
+#define __PARCEL_H
+
+#include <stdlib.h>
+
+struct parcel {
+ char *data;
+ size_t offset;
+ size_t capacity;
+ size_t size;
+ int malformed;
+};
+
+struct parcel_str_array {
+ int num_str;
+ char *str[];
+};
+
+void parcel_init(struct parcel *p);
+void parcel_grow(struct parcel *p, size_t size);
+void parcel_free(struct parcel *p);
+int32_t parcel_r_int32(struct parcel *p);
+int parcel_w_int32(struct parcel *p, int32_t val);
+int parcel_w_string(struct parcel *p, const char *str);
+char *parcel_r_string(struct parcel *p);
+int parcel_w_raw(struct parcel *p, const void *data, size_t len);
+void *parcel_r_raw(struct parcel *p, int *len);
+size_t parcel_data_avail(struct parcel *p);
+struct parcel_str_array *parcel_r_str_array(struct parcel *p);
+void parcel_free_str_array(struct parcel_str_array *str_arr);
+
+#endif