summaryrefslogtreecommitdiffstats
path: root/ipc.h
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2014-08-07 13:12:15 +0200
committerPaul Kocialkowski <contact@paulk.fr>2014-08-07 13:12:15 +0200
commita7ff1df1869ce543171a6ee92cbf821647b1bf7d (patch)
tree659e315b3d609f0f9e661d4de21b52077e6e2b81 /ipc.h
parentc8408cd2c116b0b99a399282032b6607a1318b84 (diff)
downloadhardware_ril_samsung-ril-a7ff1df1869ce543171a6ee92cbf821647b1bf7d.zip
hardware_ril_samsung-ril-a7ff1df1869ce543171a6ee92cbf821647b1bf7d.tar.gz
hardware_ril_samsung-ril-a7ff1df1869ce543171a6ee92cbf821647b1bf7d.tar.bz2
Samsung-RIL rewrite: harder, better, probably not faster but definitely stronger
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Diffstat (limited to 'ipc.h')
-rw-r--r--ipc.h110
1 files changed, 97 insertions, 13 deletions
diff --git a/ipc.h b/ipc.h
index 3ede416..3874b76 100644
--- a/ipc.h
+++ b/ipc.h
@@ -1,8 +1,7 @@
/*
* This file is part of Samsung-RIL.
*
- * Copyright (C) 2010-2011 Joerie de Gram <j.de.gram@gmail.com>
- * Copyright (C) 2011-2013 Paul Kocialkowski <contact@paulk.fr>
+ * Copyright (C) 2011-2014 Paul Kocialkowski <contact@paulk.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
@@ -21,21 +20,106 @@
#ifndef _SAMSUNG_RIL_IPC_H_
#define _SAMSUNG_RIL_IPC_H_
-#include "samsung-ril.h"
+#include <stdlib.h>
-#define ipc_fmt_send_get(command, mseq) \
- ipc_fmt_send(command, IPC_TYPE_GET, NULL, 0, mseq)
+#include <samsung-ril.h>
-#define ipc_fmt_send_set(command, mseq, data, length) \
- ipc_fmt_send(command, IPC_TYPE_SET, data, length, mseq)
+struct ril_client;
-#define ipc_fmt_send_exec(command, mseq) \
- ipc_fmt_send(command, IPC_TYPE_EXEC, NULL, 0, mseq)
+/*
+ * Values
+ */
+
+#define IPC_CLIENT_CLOSE 0x00
+#define IPC_CLIENT_IO_ERROR 0x01
+
+/*
+ * Structures
+ */
+
+struct ipc_fmt_request {
+ int request;
+ RIL_Token token;
+ unsigned char seq;
+};
+
+struct ipc_fmt_data {
+ struct ipc_client *ipc_client;
+ int event_fd;
+
+ struct list_head *gen_phone_res_expect;
+
+ struct ipc_sec_sim_icc_type_data sim_icc_type_data;
+ struct ipc_gprs_hsdpa_status_data hsdpa_status_data;
+ int svc_session;
+
+ struct list_head *requests;
+ unsigned char seq;
+};
+
+struct ipc_rfs_data {
+ struct ipc_client *ipc_client;
+ int event_fd;
+};
-extern struct ril_client_funcs ipc_fmt_client_funcs;
-extern struct ril_client_funcs ipc_rfs_client_funcs;
+struct ipc_dispatch_handler {
+ unsigned short command;
+ int (*handler)(struct ipc_message *message);
+};
+
+/*
+ * Helpers
+ */
+
+/* Utils */
+void ipc_log_handler(void *log_data, const char *message);
+
+/* IPC FMT */
+int ipc_fmt_send(unsigned char mseq, unsigned short command, unsigned char type,
+ const void *data, size_t size);
+unsigned char ipc_fmt_seq(void);
+unsigned char ipc_fmt_request_seq(RIL_Token token);
+RIL_Token ipc_fmt_request_token(unsigned char seq);
+
+/* IPC FMT client */
+int ipc_fmt_create(struct ril_client *client);
+int ipc_fmt_destroy(struct ril_client *client);
+int ipc_fmt_open(struct ril_client *client);
+int ipc_fmt_close(struct ril_client *client);
+int ipc_fmt_dispatch(struct ril_client *client, struct ipc_message *message);
+int ipc_fmt_loop(struct ril_client *client);
+int ipc_fmt_request_register(struct ril_client *client, int request,
+ RIL_Token token);
+int ipc_fmt_request_unregister(struct ril_client *client, int request,
+ RIL_Token token);
+int ipc_fmt_request_flush(struct ril_client *client);
+struct ipc_fmt_request *ipc_fmt_request_find_token(struct ril_client *client,
+ RIL_Token token);
+struct ipc_fmt_request *ipc_fmt_request_find_seq(struct ril_client *client,
+ unsigned char seq);
+int ipc_fmt_flush(struct ril_client *client);
+
+/* IPC RFS */
+int ipc_rfs_send(unsigned char mseq, unsigned short command, const void *data,
+ size_t size);
+
+/* IPC RFS client */
+int ipc_rfs_create(struct ril_client *client);
+int ipc_rfs_destroy(struct ril_client *client);
+int ipc_rfs_open(struct ril_client *client);
+int ipc_rfs_close(struct ril_client *client);
+int ipc_rfs_dispatch(struct ril_client *client, struct ipc_message *message);
+int ipc_rfs_loop(struct ril_client *client);
+
+/*
+ * RIL clients
+ */
-void ipc_fmt_send(const unsigned short command, const char type, unsigned char *data, const int length, unsigned char mseq);
-void ipc_rfs_send(const unsigned short command, unsigned char *data, const int length, unsigned char mseq);
+extern struct ril_client_handlers ipc_fmt_handlers;
+extern struct ril_client_handlers ipc_rfs_handlers;
+extern struct ril_client_callbacks ipc_fmt_callbacks;
+extern struct ril_client_callbacks ipc_rfs_callbacks;
+extern struct ril_client ipc_fmt_client;
+extern struct ril_client ipc_rfs_client;
#endif