summaryrefslogtreecommitdiffstats
path: root/srs-client/include/srs-client.h
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2013-03-07 14:41:30 +0100
committerPaul Kocialkowski <contact@paulk.fr>2013-03-07 14:41:30 +0100
commit8507877c6dba1cca27268dc4e8079b4a96da51a9 (patch)
treeb64b7336a830478e739fb37d5b9254d5b83cc43d /srs-client/include/srs-client.h
parent0d0f2ab21d3d26bc8a5d04a4b7a717763382e855 (diff)
downloadhardware_ril_samsung-ril-8507877c6dba1cca27268dc4e8079b4a96da51a9.zip
hardware_ril_samsung-ril-8507877c6dba1cca27268dc4e8079b4a96da51a9.tar.gz
hardware_ril_samsung-ril-8507877c6dba1cca27268dc4e8079b4a96da51a9.tar.bz2
SRS: srs-client library, proper structures for protocol data
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Diffstat (limited to 'srs-client/include/srs-client.h')
-rw-r--r--srs-client/include/srs-client.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/srs-client/include/srs-client.h b/srs-client/include/srs-client.h
new file mode 100644
index 0000000..b98e5e9
--- /dev/null
+++ b/srs-client/include/srs-client.h
@@ -0,0 +1,60 @@
+/**
+ * This file is part of samsung-ril.
+ *
+ * Copyright (C) 2013 Paul Kocialkowski <contact@oaulk.fr>
+ *
+ * samsung-ril 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * samsung-ril 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 samsung-ril. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <pthread.h>
+
+#include <samsung-ril-socket.h>
+
+#ifndef _SRS_CLIENT_H_
+#define _SRS_CLIENT_H_
+
+#define SRS_CLIENT_TIMEOUT 500000
+
+#define SRS_CLIENT_LOCK(client) pthread_mutex_lock(&(client->mutex))
+#define SRS_CLIENT_UNLOCK(client) pthread_mutex_unlock(&(client->mutex))
+
+typedef void (*srs_client_thread_cb)(struct srs_message *message);
+
+struct srs_client {
+ int fd;
+
+ pthread_mutex_t mutex;
+ pthread_t thread;
+ int thread_run;
+
+ srs_client_thread_cb thread_cb;
+};
+
+int srs_client_recv_message(struct srs_client *client, struct srs_message *message);
+int srs_client_send_message(struct srs_client *client, struct srs_message *message);
+int srs_client_send(struct srs_client *client, unsigned short command, void *data, int length);
+
+int srs_client_open(struct srs_client *client);
+int srs_client_close(struct srs_client *client);
+int srs_client_create(struct srs_client **client_p);
+int srs_client_destroy(struct srs_client *client);
+
+int srs_client_thread_start(struct srs_client *client,
+ srs_client_thread_cb cb);
+int srs_client_thread_stop(struct srs_client *client);
+
+int srs_client_ping(struct srs_client *client);
+
+#endif