summaryrefslogtreecommitdiff
path: root/common/ipc/ctsvc_ipc_name.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/ipc/ctsvc_ipc_name.c')
-rw-r--r--common/ipc/ctsvc_ipc_name.c86
1 files changed, 86 insertions, 0 deletions
diff --git a/common/ipc/ctsvc_ipc_name.c b/common/ipc/ctsvc_ipc_name.c
new file mode 100644
index 0000000..22578c1
--- /dev/null
+++ b/common/ipc/ctsvc_ipc_name.c
@@ -0,0 +1,86 @@
+#include "ctsvc_ipc_macros.h"
+
+
+#include "ctsvc_internal.h"
+#include "ctsvc_ipc_marshal.h"
+#include "contacts_record.h"
+
+static int __ctsvc_ipc_unmarshal_name(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
+static int __ctsvc_ipc_marshal_name(const contacts_record_h record, pims_ipc_data_h ipc_data);
+static int __ctsvc_ipc_marshal_name_get_primary_id(const contacts_record_h record, unsigned int *property_id, int *id);
+
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_name_plugin_cb = {
+ .unmarshal_record = __ctsvc_ipc_unmarshal_name,
+ .marshal_record = __ctsvc_ipc_marshal_name,
+ .get_primary_id = __ctsvc_ipc_marshal_name_get_primary_id
+};
+
+
+static int __ctsvc_ipc_unmarshal_name(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+{
+ RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
+ RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA);
+
+ ctsvc_name_s* name_p = (ctsvc_name_s*) record;
+
+ do {
+ if (ctsvc_ipc_unmarshal_bool(ipc_data, &name_p->is_default) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_unmarshal_bool(ipc_data, &name_p->is_changed) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_unmarshal_int(ipc_data, &name_p->id) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_unmarshal_int(ipc_data, &name_p->contact_id) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_unmarshal_int(ipc_data, &name_p->language_type) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->first) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->last) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->addition) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->prefix) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->suffix) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->phonetic_first) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->phonetic_middle) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->phonetic_last) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->lookup) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->reverse_lookup) != CONTACTS_ERROR_NONE) break;
+
+ return CONTACTS_ERROR_NONE;
+
+ } while(0);
+
+ CTS_ERR("_ctsvc_ipc_unmarshal fail");
+ return CONTACTS_ERROR_INVALID_PARAMETER;
+}
+
+static int __ctsvc_ipc_marshal_name(const contacts_record_h record, pims_ipc_data_h ipc_data)
+{
+ ctsvc_name_s* name_p = (ctsvc_name_s*)record;
+ RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
+ RETV_IF(name_p==NULL,CONTACTS_ERROR_NO_DATA);
+
+ do {
+ if (ctsvc_ipc_marshal_bool((name_p->is_default),ipc_data) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_marshal_bool((name_p->is_changed),ipc_data) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_marshal_int((name_p->id),ipc_data) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_marshal_int((name_p->contact_id),ipc_data) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_marshal_int((name_p->language_type),ipc_data) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_marshal_string((name_p->first),ipc_data) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_marshal_string((name_p->last),ipc_data) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_marshal_string((name_p->addition),ipc_data) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_marshal_string((name_p->prefix),ipc_data) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_marshal_string((name_p->suffix),ipc_data) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_marshal_string((name_p->phonetic_first),ipc_data) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_marshal_string((name_p->phonetic_middle),ipc_data) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_marshal_string((name_p->phonetic_last),ipc_data) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_marshal_string((name_p->lookup),ipc_data) != CONTACTS_ERROR_NONE) break;
+ if (ctsvc_ipc_marshal_string((name_p->reverse_lookup),ipc_data) != CONTACTS_ERROR_NONE) break;
+
+ return CONTACTS_ERROR_NONE;
+
+ } while(0);
+
+ CTS_ERR("_ctsvc_ipc_marshal fail");
+ return CONTACTS_ERROR_INVALID_PARAMETER;
+}
+
+static int __ctsvc_ipc_marshal_name_get_primary_id(const contacts_record_h record, unsigned int *property_id, int *id)
+{
+ *property_id = CTSVC_PROPERTY_NAME_ID;
+ return contacts_record_get_int(record, *property_id, id );
+}