From 89db2820d03f280d0bf0e217d520e89c2bb8acd2 Mon Sep 17 00:00:00 2001 From: Alexandra Ellwood Date: Tue, 30 Sep 2008 21:23:17 +0000 Subject: [PATCH] CCAPI should use common ipc and stream code KIM and CCAPI should share the same IPC and stream object types. Modified CCAPI to use code in src/util (stream) and src/util/mac (ipc) ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20787 dc483132-0cff-0310-8789-dd5450dbe970 --- src/ccapi/common/cci_common.h | 3 +- src/ccapi/common/cci_cred_union.c | 128 ++--- src/ccapi/common/cci_cred_union.h | 4 +- src/ccapi/common/cci_identifier.c | 16 +- src/ccapi/common/cci_identifier.h | 4 +- src/ccapi/common/cci_message.c | 70 ++- src/ccapi/common/cci_message.h | 13 +- src/ccapi/common/cci_stream.c | 498 -------------------- src/ccapi/common/cci_stream.h | 77 --- src/ccapi/common/cci_types.h | 4 +- src/ccapi/common/mac/cci_mig.defs | 54 --- src/ccapi/common/mac/cci_mig_reply.defs | 58 --- src/ccapi/common/mac/cci_mig_request.defs | 62 --- src/ccapi/common/mac/cci_mig_types.h | 56 --- src/ccapi/common/win/tls.c | 4 +- src/ccapi/common/win/tls.h | 6 +- src/ccapi/lib/ccapi_ccache.c | 132 +++--- src/ccapi/lib/ccapi_ccache.h | 2 +- src/ccapi/lib/ccapi_ccache_iterator.c | 10 +- src/ccapi/lib/ccapi_ccache_iterator.h | 2 +- src/ccapi/lib/ccapi_context.c | 118 ++--- src/ccapi/lib/ccapi_credentials.c | 4 +- src/ccapi/lib/ccapi_credentials.h | 4 +- src/ccapi/lib/ccapi_credentials_iterator.c | 10 +- src/ccapi/lib/ccapi_credentials_iterator.h | 2 +- src/ccapi/lib/ccapi_ipc.c | 28 +- src/ccapi/lib/ccapi_ipc.h | 8 +- src/ccapi/lib/ccapi_os_ipc.h | 4 +- src/ccapi/lib/mac/ccapi_os_ipc.c | 242 +--------- src/ccapi/lib/win/ccapi_os_ipc.cxx | 16 +- src/ccapi/lib/win/ccs_reply_proc.c | 6 +- src/ccapi/lib/win/debug.exports | 6 +- src/ccapi/server/ccs_cache_collection.c | 108 ++--- src/ccapi/server/ccs_cache_collection.h | 4 +- src/ccapi/server/ccs_callback.c | 2 +- src/ccapi/server/ccs_callback.h | 2 +- src/ccapi/server/ccs_ccache.c | 138 +++--- src/ccapi/server/ccs_ccache.h | 8 +- src/ccapi/server/ccs_ccache_iterator.c | 22 +- src/ccapi/server/ccs_ccache_iterator.h | 4 +- src/ccapi/server/ccs_credentials.c | 4 +- src/ccapi/server/ccs_credentials.h | 4 +- src/ccapi/server/ccs_credentials_iterator.c | 22 +- src/ccapi/server/ccs_credentials_iterator.h | 4 +- src/ccapi/server/ccs_list.c | 4 +- src/ccapi/server/ccs_list.h | 4 +- src/ccapi/server/ccs_list_internal.c | 2 +- src/ccapi/server/ccs_list_internal.h | 2 +- src/ccapi/server/ccs_os_server.h | 2 +- src/ccapi/server/ccs_server.c | 24 +- src/ccapi/server/ccs_server.h | 4 +- src/ccapi/server/mac/ccs_os_server.c | 174 +------ src/ccapi/server/win/WorkItem.cpp | 18 +- src/ccapi/server/win/WorkQueue.cpp | 4 +- src/ccapi/server/win/WorkQueue.h | 4 +- src/ccapi/server/win/ccs_os_server.cpp | 18 +- src/ccapi/server/win/ccs_request_proc.c | 6 +- src/ccapi/server/win/workitem.h | 8 +- src/include/k5-ipc_stream.h | 5 - src/util/support/ipc_stream.c | 44 +- 60 files changed, 565 insertions(+), 1731 deletions(-) delete mode 100644 src/ccapi/common/cci_stream.c delete mode 100644 src/ccapi/common/cci_stream.h delete mode 100644 src/ccapi/common/mac/cci_mig.defs delete mode 100644 src/ccapi/common/mac/cci_mig_reply.defs delete mode 100644 src/ccapi/common/mac/cci_mig_request.defs delete mode 100644 src/ccapi/common/mac/cci_mig_types.h diff --git a/src/ccapi/common/cci_common.h b/src/ccapi/common/cci_common.h index 56f21c370..c1a5d0864 100644 --- a/src/ccapi/common/cci_common.h +++ b/src/ccapi/common/cci_common.h @@ -51,6 +51,7 @@ #include "cci_debugging.h" #include "cci_identifier.h" #include "cci_message.h" -#include "cci_stream.h" + +#include "k5-ipc_stream.h" #endif /* CCI_COMMON_H */ diff --git a/src/ccapi/common/cci_cred_union.c b/src/ccapi/common/cci_cred_union.c index e8e230d49..9740ffd47 100644 --- a/src/ccapi/common/cci_cred_union.c +++ b/src/ccapi/common/cci_cred_union.c @@ -49,7 +49,7 @@ static cc_uint32 cci_credentials_v4_release (cc_credentials_v4_t *io_v4creds) /* ------------------------------------------------------------------------ */ static cc_uint32 cci_credentials_v4_read (cc_credentials_v4_t **out_v4creds, - cci_stream_t io_stream) + k5_ipc_stream io_stream) { cc_int32 err = ccNoError; cc_credentials_v4_t *v4creds = NULL; @@ -63,59 +63,59 @@ static cc_uint32 cci_credentials_v4_read (cc_credentials_v4_t **out_v4creds, } if (!err) { - err = cci_stream_read_uint32 (io_stream, &v4creds->version); + err = k5_ipc_stream_read_uint32 (io_stream, &v4creds->version); } if (!err) { - err = cci_stream_read (io_stream, v4creds->principal, cc_v4_name_size); + err = k5_ipc_stream_read (io_stream, v4creds->principal, cc_v4_name_size); } if (!err) { - err = cci_stream_read (io_stream, v4creds->principal_instance, cc_v4_instance_size); + err = k5_ipc_stream_read (io_stream, v4creds->principal_instance, cc_v4_instance_size); } if (!err) { - err = cci_stream_read (io_stream, v4creds->service, cc_v4_name_size); + err = k5_ipc_stream_read (io_stream, v4creds->service, cc_v4_name_size); } if (!err) { - err = cci_stream_read (io_stream, v4creds->service_instance, cc_v4_instance_size); + err = k5_ipc_stream_read (io_stream, v4creds->service_instance, cc_v4_instance_size); } if (!err) { - err = cci_stream_read (io_stream, v4creds->realm, cc_v4_realm_size); + err = k5_ipc_stream_read (io_stream, v4creds->realm, cc_v4_realm_size); } if (!err) { - err = cci_stream_read (io_stream, v4creds->session_key, cc_v4_key_size); + err = k5_ipc_stream_read (io_stream, v4creds->session_key, cc_v4_key_size); } if (!err) { - err = cci_stream_read_int32 (io_stream, &v4creds->kvno); + err = k5_ipc_stream_read_int32 (io_stream, &v4creds->kvno); } if (!err) { - err = cci_stream_read_int32 (io_stream, &v4creds->string_to_key_type); + err = k5_ipc_stream_read_int32 (io_stream, &v4creds->string_to_key_type); } if (!err) { - err = cci_stream_read_time (io_stream, &v4creds->issue_date); + err = k5_ipc_stream_read_time (io_stream, &v4creds->issue_date); } if (!err) { - err = cci_stream_read_int32 (io_stream, &v4creds->lifetime); + err = k5_ipc_stream_read_int32 (io_stream, &v4creds->lifetime); } if (!err) { - err = cci_stream_read_uint32 (io_stream, &v4creds->address); + err = k5_ipc_stream_read_uint32 (io_stream, &v4creds->address); } if (!err) { - err = cci_stream_read_int32 (io_stream, &v4creds->ticket_size); + err = k5_ipc_stream_read_int32 (io_stream, &v4creds->ticket_size); } if (!err) { - err = cci_stream_read (io_stream, v4creds->ticket, cc_v4_ticket_size); + err = k5_ipc_stream_read (io_stream, v4creds->ticket, cc_v4_ticket_size); } if (!err) { @@ -131,7 +131,7 @@ static cc_uint32 cci_credentials_v4_read (cc_credentials_v4_t **out_v4creds, /* ------------------------------------------------------------------------ */ static cc_uint32 cci_credentials_v4_write (cc_credentials_v4_t *in_v4creds, - cci_stream_t io_stream) + k5_ipc_stream io_stream) { cc_int32 err = ccNoError; @@ -139,59 +139,59 @@ static cc_uint32 cci_credentials_v4_write (cc_credentials_v4_t *in_v4creds, if (!in_v4creds) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_write_uint32 (io_stream, in_v4creds->version); + err = k5_ipc_stream_write_uint32 (io_stream, in_v4creds->version); } if (!err) { - err = cci_stream_write (io_stream, in_v4creds->principal, cc_v4_name_size); + err = k5_ipc_stream_write (io_stream, in_v4creds->principal, cc_v4_name_size); } if (!err) { - err = cci_stream_write (io_stream, in_v4creds->principal_instance, cc_v4_instance_size); + err = k5_ipc_stream_write (io_stream, in_v4creds->principal_instance, cc_v4_instance_size); } if (!err) { - err = cci_stream_write (io_stream, in_v4creds->service, cc_v4_name_size); + err = k5_ipc_stream_write (io_stream, in_v4creds->service, cc_v4_name_size); } if (!err) { - err = cci_stream_write (io_stream, in_v4creds->service_instance, cc_v4_instance_size); + err = k5_ipc_stream_write (io_stream, in_v4creds->service_instance, cc_v4_instance_size); } if (!err) { - err = cci_stream_write (io_stream, in_v4creds->realm, cc_v4_realm_size); + err = k5_ipc_stream_write (io_stream, in_v4creds->realm, cc_v4_realm_size); } if (!err) { - err = cci_stream_write (io_stream, in_v4creds->session_key, cc_v4_key_size); + err = k5_ipc_stream_write (io_stream, in_v4creds->session_key, cc_v4_key_size); } if (!err) { - err = cci_stream_write_int32 (io_stream, in_v4creds->kvno); + err = k5_ipc_stream_write_int32 (io_stream, in_v4creds->kvno); } if (!err) { - err = cci_stream_write_int32 (io_stream, in_v4creds->string_to_key_type); + err = k5_ipc_stream_write_int32 (io_stream, in_v4creds->string_to_key_type); } if (!err) { - err = cci_stream_write_time (io_stream, in_v4creds->issue_date); + err = k5_ipc_stream_write_time (io_stream, in_v4creds->issue_date); } if (!err) { - err = cci_stream_write_int32 (io_stream, in_v4creds->lifetime); + err = k5_ipc_stream_write_int32 (io_stream, in_v4creds->lifetime); } if (!err) { - err = cci_stream_write_uint32 (io_stream, in_v4creds->address); + err = k5_ipc_stream_write_uint32 (io_stream, in_v4creds->address); } if (!err) { - err = cci_stream_write_int32 (io_stream, in_v4creds->ticket_size); + err = k5_ipc_stream_write_int32 (io_stream, in_v4creds->ticket_size); } if (!err) { - err = cci_stream_write (io_stream, in_v4creds->ticket, cc_v4_ticket_size); + err = k5_ipc_stream_write (io_stream, in_v4creds->ticket, cc_v4_ticket_size); } return cci_check_error (err); @@ -238,7 +238,7 @@ static cc_uint32 cci_cc_data_release (cc_data *io_ccdata) /* ------------------------------------------------------------------------ */ static cc_uint32 cci_cc_data_read (cc_data *io_ccdata, - cci_stream_t io_stream) + k5_ipc_stream io_stream) { cc_int32 err = ccNoError; cc_uint32 type = 0; @@ -249,11 +249,11 @@ static cc_uint32 cci_cc_data_read (cc_data *io_ccdata, if (!io_ccdata) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_read_uint32 (io_stream, &type); + err = k5_ipc_stream_read_uint32 (io_stream, &type); } if (!err) { - err = cci_stream_read_uint32 (io_stream, &length); + err = k5_ipc_stream_read_uint32 (io_stream, &length); } if (!err && length > 0) { @@ -261,7 +261,7 @@ static cc_uint32 cci_cc_data_read (cc_data *io_ccdata, if (!data) { err = cci_check_error (ccErrNoMem); } if (!err) { - err = cci_stream_read (io_stream, data, length); + err = k5_ipc_stream_read (io_stream, data, length); } } @@ -280,7 +280,7 @@ static cc_uint32 cci_cc_data_read (cc_data *io_ccdata, /* ------------------------------------------------------------------------ */ static cc_uint32 cci_cc_data_write (cc_data *in_ccdata, - cci_stream_t io_stream) + k5_ipc_stream io_stream) { cc_int32 err = ccNoError; @@ -288,15 +288,15 @@ static cc_uint32 cci_cc_data_write (cc_data *in_ccdata, if (!in_ccdata) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_write_uint32 (io_stream, in_ccdata->type); + err = k5_ipc_stream_write_uint32 (io_stream, in_ccdata->type); } if (!err) { - err = cci_stream_write_uint32 (io_stream, in_ccdata->length); + err = k5_ipc_stream_write_uint32 (io_stream, in_ccdata->length); } if (!err && in_ccdata->length > 0) { - err = cci_stream_write (io_stream, in_ccdata->data, in_ccdata->length); + err = k5_ipc_stream_write (io_stream, in_ccdata->data, in_ccdata->length); } return cci_check_error (err); @@ -329,7 +329,7 @@ static cc_uint32 cci_cc_data_array_release (cc_data **io_ccdata_array) /* ------------------------------------------------------------------------ */ static cc_uint32 cci_cc_data_array_read (cc_data ***io_ccdata_array, - cci_stream_t io_stream) + k5_ipc_stream io_stream) { cc_int32 err = ccNoError; cc_uint32 count = 0; @@ -340,7 +340,7 @@ static cc_uint32 cci_cc_data_array_read (cc_data ***io_ccdata_array, if (!io_ccdata_array) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_read_uint32 (io_stream, &count); + err = k5_ipc_stream_read_uint32 (io_stream, &count); } if (!err && count > 0) { @@ -376,7 +376,7 @@ static cc_uint32 cci_cc_data_array_read (cc_data ***io_ccdata_array, /* ------------------------------------------------------------------------ */ static cc_uint32 cci_cc_data_array_write (cc_data **in_ccdata_array, - cci_stream_t io_stream) + k5_ipc_stream io_stream) { cc_int32 err = ccNoError; cc_uint32 count = 0; @@ -387,7 +387,7 @@ static cc_uint32 cci_cc_data_array_write (cc_data **in_ccdata_array, if (!err) { for (count = 0; in_ccdata_array && in_ccdata_array[count]; count++); - err = cci_stream_write_uint32 (io_stream, count); + err = k5_ipc_stream_write_uint32 (io_stream, count); } if (!err) { @@ -443,7 +443,7 @@ static cc_uint32 cci_credentials_v5_release (cc_credentials_v5_t *io_v5creds) /* ------------------------------------------------------------------------ */ static cc_uint32 cci_credentials_v5_read (cc_credentials_v5_t **out_v5creds, - cci_stream_t io_stream) + k5_ipc_stream io_stream) { cc_int32 err = ccNoError; cc_credentials_v5_t *v5creds = NULL; @@ -461,11 +461,11 @@ static cc_uint32 cci_credentials_v5_read (cc_credentials_v5_t **out_v5creds, } if (!err) { - err = cci_stream_read_string (io_stream, &v5creds->client); + err = k5_ipc_stream_read_string (io_stream, &v5creds->client); } if (!err) { - err = cci_stream_read_string (io_stream, &v5creds->server); + err = k5_ipc_stream_read_string (io_stream, &v5creds->server); } if (!err) { @@ -473,27 +473,27 @@ static cc_uint32 cci_credentials_v5_read (cc_credentials_v5_t **out_v5creds, } if (!err) { - err = cci_stream_read_time (io_stream, &v5creds->authtime); + err = k5_ipc_stream_read_time (io_stream, &v5creds->authtime); } if (!err) { - err = cci_stream_read_time (io_stream, &v5creds->starttime); + err = k5_ipc_stream_read_time (io_stream, &v5creds->starttime); } if (!err) { - err = cci_stream_read_time (io_stream, &v5creds->endtime); + err = k5_ipc_stream_read_time (io_stream, &v5creds->endtime); } if (!err) { - err = cci_stream_read_time (io_stream, &v5creds->renew_till); + err = k5_ipc_stream_read_time (io_stream, &v5creds->renew_till); } if (!err) { - err = cci_stream_read_uint32 (io_stream, &v5creds->is_skey); + err = k5_ipc_stream_read_uint32 (io_stream, &v5creds->is_skey); } if (!err) { - err = cci_stream_read_uint32 (io_stream, &v5creds->ticket_flags); + err = k5_ipc_stream_read_uint32 (io_stream, &v5creds->ticket_flags); } if (!err) { @@ -525,7 +525,7 @@ static cc_uint32 cci_credentials_v5_read (cc_credentials_v5_t **out_v5creds, /* ------------------------------------------------------------------------ */ static cc_uint32 cci_credentials_v5_write (cc_credentials_v5_t *in_v5creds, - cci_stream_t io_stream) + k5_ipc_stream io_stream) { cc_int32 err = ccNoError; @@ -533,11 +533,11 @@ static cc_uint32 cci_credentials_v5_write (cc_credentials_v5_t *in_v5creds, if (!in_v5creds) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_write_string (io_stream, in_v5creds->client); + err = k5_ipc_stream_write_string (io_stream, in_v5creds->client); } if (!err) { - err = cci_stream_write_string (io_stream, in_v5creds->server); + err = k5_ipc_stream_write_string (io_stream, in_v5creds->server); } if (!err) { @@ -545,27 +545,27 @@ static cc_uint32 cci_credentials_v5_write (cc_credentials_v5_t *in_v5creds, } if (!err) { - err = cci_stream_write_time (io_stream, in_v5creds->authtime); + err = k5_ipc_stream_write_time (io_stream, in_v5creds->authtime); } if (!err) { - err = cci_stream_write_time (io_stream, in_v5creds->starttime); + err = k5_ipc_stream_write_time (io_stream, in_v5creds->starttime); } if (!err) { - err = cci_stream_write_time (io_stream, in_v5creds->endtime); + err = k5_ipc_stream_write_time (io_stream, in_v5creds->endtime); } if (!err) { - err = cci_stream_write_time (io_stream, in_v5creds->renew_till); + err = k5_ipc_stream_write_time (io_stream, in_v5creds->renew_till); } if (!err) { - err = cci_stream_write_uint32 (io_stream, in_v5creds->is_skey); + err = k5_ipc_stream_write_uint32 (io_stream, in_v5creds->is_skey); } if (!err) { - err = cci_stream_write_uint32 (io_stream, in_v5creds->ticket_flags); + err = k5_ipc_stream_write_uint32 (io_stream, in_v5creds->ticket_flags); } if (!err) { @@ -615,7 +615,7 @@ cc_uint32 cci_credentials_union_release (cc_credentials_union *io_cred_union) /* ------------------------------------------------------------------------ */ cc_uint32 cci_credentials_union_read (cc_credentials_union **out_credentials_union, - cci_stream_t io_stream) + k5_ipc_stream io_stream) { cc_int32 err = ccNoError; cc_credentials_union *credentials_union = NULL; @@ -629,7 +629,7 @@ cc_uint32 cci_credentials_union_read (cc_credentials_union **out_credentials_uni } if (!err) { - err = cci_stream_read_uint32 (io_stream, &credentials_union->version); + err = k5_ipc_stream_read_uint32 (io_stream, &credentials_union->version); } if (!err) { @@ -660,7 +660,7 @@ cc_uint32 cci_credentials_union_read (cc_credentials_union **out_credentials_uni /* ------------------------------------------------------------------------ */ cc_uint32 cci_credentials_union_write (const cc_credentials_union *in_credentials_union, - cci_stream_t io_stream) + k5_ipc_stream io_stream) { cc_int32 err = ccNoError; @@ -668,7 +668,7 @@ cc_uint32 cci_credentials_union_write (const cc_credentials_union *in_credential if (!in_credentials_union) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_write_uint32 (io_stream, in_credentials_union->version); + err = k5_ipc_stream_write_uint32 (io_stream, in_credentials_union->version); } if (!err) { diff --git a/src/ccapi/common/cci_cred_union.h b/src/ccapi/common/cci_cred_union.h index 3264d350a..44dd6348d 100644 --- a/src/ccapi/common/cci_cred_union.h +++ b/src/ccapi/common/cci_cred_union.h @@ -33,10 +33,10 @@ cc_uint32 cci_credentials_union_release (cc_credentials_union *io_credentials); cc_uint32 cci_credentials_union_read (cc_credentials_union **out_credentials_union, - cci_stream_t io_stream); + k5_ipc_stream io_stream); cc_uint32 cci_credentials_union_write (const cc_credentials_union *in_credentials_union, - cci_stream_t io_stream); + k5_ipc_stream io_stream); cc_uint32 cci_cred_union_release (cred_union *io_cred_union); diff --git a/src/ccapi/common/cci_identifier.c b/src/ccapi/common/cci_identifier.c index dac2e1544..5ca962f1c 100644 --- a/src/ccapi/common/cci_identifier.c +++ b/src/ccapi/common/cci_identifier.c @@ -242,7 +242,7 @@ cc_int32 cci_identifier_is_initialized (cci_identifier_t in_identifier, /* ------------------------------------------------------------------------ */ cc_uint32 cci_identifier_read (cci_identifier_t *out_identifier, - cci_stream_t io_stream) + k5_ipc_stream io_stream) { cc_int32 err = ccNoError; cci_uuid_string_t server_id = NULL; @@ -252,19 +252,19 @@ cc_uint32 cci_identifier_read (cci_identifier_t *out_identifier, if (!io_stream ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_read_string (io_stream, &server_id); + err = k5_ipc_stream_read_string (io_stream, &server_id); } if (!err) { - err = cci_stream_read_string (io_stream, &object_id); + err = k5_ipc_stream_read_string (io_stream, &object_id); } if (!err) { err = cci_identifier_alloc (out_identifier, server_id, object_id); } - if (server_id) { free (server_id); } - if (object_id) { free (object_id); } + k5_ipc_stream_free_string (server_id); + k5_ipc_stream_free_string (object_id); return cci_check_error (err); } @@ -272,7 +272,7 @@ cc_uint32 cci_identifier_read (cci_identifier_t *out_identifier, /* ------------------------------------------------------------------------ */ cc_uint32 cci_identifier_write (cci_identifier_t in_identifier, - cci_stream_t io_stream) + k5_ipc_stream io_stream) { cc_int32 err = ccNoError; @@ -280,11 +280,11 @@ cc_uint32 cci_identifier_write (cci_identifier_t in_identifier, if (!io_stream ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_write_string (io_stream, in_identifier->server_id); + err = k5_ipc_stream_write_string (io_stream, in_identifier->server_id); } if (!err) { - err = cci_stream_write_string (io_stream, in_identifier->object_id); + err = k5_ipc_stream_write_string (io_stream, in_identifier->object_id); } return cci_check_error (err); diff --git a/src/ccapi/common/cci_identifier.h b/src/ccapi/common/cci_identifier.h index 7d835de0a..2c7ea20ab 100644 --- a/src/ccapi/common/cci_identifier.h +++ b/src/ccapi/common/cci_identifier.h @@ -57,9 +57,9 @@ cc_int32 cci_identifier_is_initialized (cci_identifier_t in_identifier, cc_uint32 *out_is_initialized); cc_uint32 cci_identifier_read (cci_identifier_t *out_identifier, - cci_stream_t io_stream); + k5_ipc_stream io_stream); cc_uint32 cci_identifier_write (cci_identifier_t in_identifier, - cci_stream_t io_stream); + k5_ipc_stream io_stream); #endif /* CCI_IDENTIFIER_H */ diff --git a/src/ccapi/common/cci_message.c b/src/ccapi/common/cci_message.c index 4152e6c3c..b54155889 100644 --- a/src/ccapi/common/cci_message.c +++ b/src/ccapi/common/cci_message.c @@ -57,21 +57,21 @@ cc_int32 cci_message_invalid_object_err (enum cci_msg_id_t in_request_name) /* ------------------------------------------------------------------------ */ -cc_int32 cci_message_new_request_header (cci_stream_t *out_request, +cc_int32 cci_message_new_request_header (k5_ipc_stream *out_request, enum cci_msg_id_t in_request_name, cci_identifier_t in_identifier) { cc_int32 err = ccNoError; - cci_stream_t request = NULL; + k5_ipc_stream request = NULL; if (!out_request) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { - err = cci_stream_write_uint32 (request, in_request_name); + err = k5_ipc_stream_write_uint32 (request, in_request_name); } if (!err) { @@ -83,14 +83,14 @@ cc_int32 cci_message_new_request_header (cci_stream_t *out_request, request = NULL; } - cci_stream_release (request); + k5_ipc_stream_release (request); return cci_check_error (err); } /* ------------------------------------------------------------------------ */ -cc_int32 cci_message_read_request_header (cci_stream_t in_request, +cc_int32 cci_message_read_request_header (k5_ipc_stream in_request, enum cci_msg_id_t *out_request_name, cci_identifier_t *out_identifier) { @@ -103,7 +103,7 @@ cc_int32 cci_message_read_request_header (cci_stream_t in_request, if (!out_identifier ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_read_uint32 (in_request, &request_name); + err = k5_ipc_stream_read_uint32 (in_request, &request_name); } if (!err) { @@ -123,20 +123,20 @@ cc_int32 cci_message_read_request_header (cci_stream_t in_request, /* ------------------------------------------------------------------------ */ -cc_int32 cci_message_new_reply_header (cci_stream_t *out_reply, +cc_int32 cci_message_new_reply_header (k5_ipc_stream *out_reply, cc_int32 in_error) { cc_int32 err = ccNoError; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; if (!out_reply) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&reply); + err = k5_ipc_stream_new (&reply); } if (!err) { - err = cci_stream_write_int32 (reply, in_error); + err = k5_ipc_stream_write_int32 (reply, in_error); } if (!err) { @@ -144,14 +144,14 @@ cc_int32 cci_message_new_reply_header (cci_stream_t *out_reply, reply = NULL; } - cci_stream_release (reply); + k5_ipc_stream_release (reply); return cci_check_error (err); } /* ------------------------------------------------------------------------ */ -cc_int32 cci_message_read_reply_header (cci_stream_t in_reply, +cc_int32 cci_message_read_reply_header (k5_ipc_stream in_reply, cc_int32 *out_reply_error) { cc_int32 err = ccNoError; @@ -161,7 +161,7 @@ cc_int32 cci_message_read_reply_header (cci_stream_t in_reply, if (!out_reply_error) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_read_int32 (in_reply, &reply_err); + err = k5_ipc_stream_read_int32 (in_reply, &reply_err); } if (!err) { @@ -170,3 +170,45 @@ cc_int32 cci_message_read_reply_header (cci_stream_t in_reply, return cci_check_error (err); } + +#ifdef TARGET_OS_MAC +#pragma mark - +#endif + +/* ------------------------------------------------------------------------ */ + +uint32_t k5_ipc_stream_read_time (k5_ipc_stream io_stream, + cc_time_t *out_time) +{ + int32_t err = 0; + int64_t t = 0; + + if (!io_stream) { err = cci_check_error (ccErrBadParam); } + if (!out_time ) { err = cci_check_error (ccErrBadParam); } + + if (!err) { + err = k5_ipc_stream_read_int64 (io_stream, &t); + } + + if (!err) { + *out_time = t; + } + + return cci_check_error (err); +} + +/* ------------------------------------------------------------------------ */ + +uint32_t k5_ipc_stream_write_time (k5_ipc_stream io_stream, + cc_time_t in_time) +{ + int32_t err = 0; + + if (!io_stream) { err = cci_check_error (ccErrBadParam); } + + if (!err) { + err = k5_ipc_stream_write_int64 (io_stream, in_time); + } + + return cci_check_error (err); +} diff --git a/src/ccapi/common/cci_message.h b/src/ccapi/common/cci_message.h index 7cab2dc76..27ed9c1f2 100644 --- a/src/ccapi/common/cci_message.h +++ b/src/ccapi/common/cci_message.h @@ -31,18 +31,23 @@ cc_int32 cci_message_invalid_object_err (enum cci_msg_id_t in_request_name); -cc_int32 cci_message_new_request_header (cci_stream_t *out_request, +cc_int32 cci_message_new_request_header (k5_ipc_stream *out_request, enum cci_msg_id_t in_request_name, cci_identifier_t in_identifier); -cc_int32 cci_message_read_request_header (cci_stream_t in_request, +cc_int32 cci_message_read_request_header (k5_ipc_stream in_request, enum cci_msg_id_t *out_request_name, cci_identifier_t *out_identifier); -cc_int32 cci_message_new_reply_header (cci_stream_t *out_reply, +cc_int32 cci_message_new_reply_header (k5_ipc_stream *out_reply, cc_int32 in_error); -cc_int32 cci_message_read_reply_header (cci_stream_t in_reply, +cc_int32 cci_message_read_reply_header (k5_ipc_stream in_reply, cc_int32 *out_reply_error); +uint32_t k5_ipc_stream_read_time (k5_ipc_stream io_stream, + cc_time_t *out_time); +uint32_t k5_ipc_stream_write_time (k5_ipc_stream io_stream, + cc_time_t in_time); + #endif /* CCI_MESSAGE_H */ diff --git a/src/ccapi/common/cci_stream.c b/src/ccapi/common/cci_stream.c deleted file mode 100644 index 2f0678947..000000000 --- a/src/ccapi/common/cci_stream.c +++ /dev/null @@ -1,498 +0,0 @@ -/* - * $Header$ - * - * Copyright 2006, 2007 Massachusetts Institute of Technology. - * All Rights Reserved. - * - * Export of this software from the United States of America may - * require a specific license from the United States Government. - * It is the responsibility of any person or organization contemplating - * export to obtain such a license before exporting. - * - * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and - * distribute this software and its documentation for any purpose and - * without fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright notice and - * this permission notice appear in supporting documentation, and that - * the name of M.I.T. not be used in advertising or publicity pertaining - * to distribution of the software without specific, written prior - * permission. Furthermore if you modify this software you must label - * your software as modified software and not distribute it in such a - * fashion that it might be confused with the original M.I.T. software. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" without express - * or implied warranty. - */ - -#include "cci_common.h" -#include "k5-platform.h" /* for byte swapping */ - -#if !defined(htonll) -#define htonll(x) k5_htonll(x) -#endif - -#if !defined(ntohll) -#define ntohll(x) k5_ntohll(x) -#endif - -struct cci_stream_d { - char *data; - cc_uint64 size; - cc_uint64 max_size; -}; - -const struct cci_stream_d cci_stream_initializer = { NULL, 0, 0 }; - -#define CC_STREAM_SIZE_INCREMENT 128 - -/* ------------------------------------------------------------------------ */ - -static cc_uint32 cci_stream_reallocate (cci_stream_t io_stream, - cc_uint64 in_new_size) -{ - cc_int32 err = ccNoError; - cc_uint64 new_max_size = 0; - - if (!io_stream) { err = cci_check_error (ccErrBadParam); } - - if (!err) { - cc_uint64 old_max_size = io_stream->max_size; - new_max_size = io_stream->max_size; - - if (in_new_size > old_max_size) { - /* Expand the stream */ - while (in_new_size > new_max_size) { - new_max_size += CC_STREAM_SIZE_INCREMENT; - } - - - } else if ((in_new_size + CC_STREAM_SIZE_INCREMENT) < old_max_size) { - /* Shrink the array, but never drop below CC_LIST_COUNT_INCREMENT */ - while ((in_new_size + CC_STREAM_SIZE_INCREMENT) < new_max_size && - (new_max_size > CC_STREAM_SIZE_INCREMENT)) { - new_max_size -= CC_STREAM_SIZE_INCREMENT; - } - } - } - - if (!err && new_max_size != io_stream->max_size) { - char *data = io_stream->data; - - if (!data) { - data = malloc (new_max_size * sizeof (*data)); - } else { - data = realloc (data, new_max_size * sizeof (*data)); - } - - if (data) { - io_stream->data = data; - io_stream->max_size = new_max_size; - } else { - err = cci_check_error (ccErrNoMem); - } - } - - return cci_check_error (err); -} - -/* ------------------------------------------------------------------------ */ - -cc_int32 cci_stream_new (cci_stream_t *out_stream) -{ - cc_int32 err = ccNoError; - cci_stream_t stream = NULL; - - if (!out_stream) { err = cci_check_error (ccErrBadParam); } - - if (!err) { - stream = malloc (sizeof (*stream)); - if (stream) { - *stream = cci_stream_initializer; - } else { - err = cci_check_error (ccErrNoMem); - } - } - - if (!err) { - *out_stream = stream; - stream = NULL; - } - - cci_stream_release (stream); - - return cci_check_error (err); -} - - -/* ------------------------------------------------------------------------ */ - -cc_uint32 cci_stream_release (cci_stream_t io_stream) -{ - cc_int32 err = ccNoError; - - if (!err && io_stream) { - free (io_stream->data); - free (io_stream); - } - - return err; -} - -/* ------------------------------------------------------------------------ */ - -cc_uint64 cci_stream_size (cci_stream_t in_stream) -{ - return in_stream ? in_stream->size : 0; -} - - -/* ------------------------------------------------------------------------ */ - -const char *cci_stream_data (cci_stream_t in_stream) -{ - return in_stream ? in_stream->data : NULL; -} - -#ifdef TARGET_OS_MAC -#pragma mark - -#endif - -/* ------------------------------------------------------------------------ */ - -cc_uint32 cci_stream_read (cci_stream_t io_stream, - void *io_data, - cc_uint64 in_size) -{ - cc_int32 err = ccNoError; - - if (!io_stream) { err = cci_check_error (ccErrBadParam); } - if (!io_data ) { err = cci_check_error (ccErrBadParam); } - - if (!err) { - if (in_size > io_stream->size) { - err = cci_check_error (ccErrBadInternalMessage); - } - } - - if (!err) { - memcpy (io_data, io_stream->data, in_size); - memmove (io_stream->data, &io_stream->data[in_size], - io_stream->size - in_size); - - err = cci_stream_reallocate (io_stream, io_stream->size - in_size); - - if (!err) { - io_stream->size -= in_size; - } - } - - return cci_check_error (err); -} - -/* ------------------------------------------------------------------------ */ - -cc_uint32 cci_stream_write (cci_stream_t io_stream, - const void *in_data, - cc_uint64 in_size) -{ - cc_int32 err = ccNoError; - - if (!io_stream) { err = cci_check_error (ccErrBadParam); } - if (!in_data ) { err = cci_check_error (ccErrBadParam); } - - if (!err) { - /* Security check: Do not let the caller overflow the length */ - if (in_size > (UINT64_MAX - io_stream->size)) { - err = cci_check_error (ccErrBadParam); - } - } - - if (!err) { - err = cci_stream_reallocate (io_stream, io_stream->size + in_size); - } - - if (!err) { - memcpy (&io_stream->data[io_stream->size], in_data, in_size); - io_stream->size += in_size; - } - - return cci_check_error (err); -} - -#ifdef TARGET_OS_MAC -#pragma mark - -#endif - -/* ------------------------------------------------------------------------ */ - -cc_uint32 cci_stream_read_string (cci_stream_t io_stream, - char **out_string) -{ - cc_int32 err = ccNoError; - cc_uint32 length = 0; - char *string = NULL; - - if (!io_stream ) { err = cci_check_error (ccErrBadParam); } - if (!out_string) { err = cci_check_error (ccErrBadParam); } - - if (!err) { - err = cci_stream_read_uint32 (io_stream, &length); - } - - if (!err) { - string = malloc (length); - if (!string) { err = cci_check_error (ccErrNoMem); } - } - - if (!err) { - err = cci_stream_read (io_stream, string, length); - } - - if (!err) { - *out_string = string; - string = NULL; - } - - free (string); - - return cci_check_error (err); -} - -/* ------------------------------------------------------------------------ */ - -cc_uint32 cci_stream_write_string (cci_stream_t io_stream, - const char *in_string) -{ - cc_int32 err = ccNoError; - cc_uint32 length = 0; - - if (!io_stream) { err = cci_check_error (ccErrBadParam); } - if (!in_string) { err = cci_check_error (ccErrBadParam); } - - if (!err) { - length = strlen (in_string) + 1; - - err = cci_stream_write_uint32 (io_stream, length); - } - - if (!err) { - err = cci_stream_write (io_stream, in_string, length); - } - - return cci_check_error (err); -} - -#ifdef TARGET_OS_MAC -#pragma mark - -#endif - -/* ------------------------------------------------------------------------ */ - -cc_uint32 cci_stream_read_int32 (cci_stream_t io_stream, - cc_int32 *out_int32) -{ - cc_int32 err = ccNoError; - cc_int32 int32 = 0; - - if (!io_stream) { err = cci_check_error (ccErrBadParam); } - if (!out_int32) { err = cci_check_error (ccErrBadParam); } - - if (!err) { - err = cci_stream_read (io_stream, &int32, sizeof (int32)); - } - - if (!err) { - *out_int32 = ntohl (int32); - } - - return cci_check_error (err); -} - -/* ------------------------------------------------------------------------ */ - -cc_uint32 cci_stream_write_int32 (cci_stream_t io_stream, - cc_int32 in_int32) -{ - cc_int32 err = ccNoError; - cc_int32 int32 = htonl (in_int32); - - if (!io_stream) { err = cci_check_error (ccErrBadParam); } - - if (!err) { - err = cci_stream_write (io_stream, &int32, sizeof (int32)); - } - - return cci_check_error (err); -} - -#ifdef TARGET_OS_MAC -#pragma mark - -#endif - -/* ------------------------------------------------------------------------ */ - -cc_uint32 cci_stream_read_uint32 (cci_stream_t io_stream, - cc_uint32 *out_uint32) -{ - cc_int32 err = ccNoError; - cc_uint32 uint32 = 0; - - if (!io_stream) { err = cci_check_error (ccErrBadParam); } - if (!out_uint32) { err = cci_check_error (ccErrBadParam); } - - if (!err) { - err = cci_stream_read (io_stream, &uint32, sizeof (uint32)); - } - - if (!err) { - *out_uint32 = ntohl (uint32); - } - - return cci_check_error (err); -} - -/* ------------------------------------------------------------------------ */ - -cc_uint32 cci_stream_write_uint32 (cci_stream_t io_stream, - cc_uint32 in_uint32) -{ - cc_int32 err = ccNoError; - cc_int32 uint32 = htonl (in_uint32); - - if (!io_stream) { err = cci_check_error (ccErrBadParam); } - - if (!err) { - err = cci_stream_write (io_stream, &uint32, sizeof (uint32)); - } - - return cci_check_error (err); -} - -#ifdef TARGET_OS_MAC -#pragma mark - -#endif - -/* ------------------------------------------------------------------------ */ - -cc_uint32 cci_stream_read_int64 (cci_stream_t io_stream, - cc_int64 *out_int64) -{ - cc_int32 err = ccNoError; - cc_uint64 int64 = 0; - - if (!io_stream) { err = cci_check_error (ccErrBadParam); } - if (!out_int64) { err = cci_check_error (ccErrBadParam); } - - if (!err) { - err = cci_stream_read (io_stream, &int64, sizeof (int64)); - } - - if (!err) { - *out_int64 = ntohll (int64); - } - - return cci_check_error (err); -} - -/* ------------------------------------------------------------------------ */ - -cc_uint32 cci_stream_write_int64 (cci_stream_t io_stream, - cc_int64 in_int64) -{ - cc_int32 err = ccNoError; - cc_int64 int64 = htonll (in_int64); - - if (!io_stream) { err = cci_check_error (ccErrBadParam); } - - if (!err) { - err = cci_stream_write (io_stream, &int64, sizeof (int64)); - } - - return cci_check_error (err); -} - - -#ifdef TARGET_OS_MAC -#pragma mark - -#endif - -/* ------------------------------------------------------------------------ */ - -cc_uint32 cci_stream_read_uint64 (cci_stream_t io_stream, - cc_uint64 *out_uint64) -{ - cc_int32 err = ccNoError; - cc_uint64 uint64 = 0; - - if (!io_stream) { err = cci_check_error (ccErrBadParam); } - if (!out_uint64) { err = cci_check_error (ccErrBadParam); } - - if (!err) { - err = cci_stream_read (io_stream, &uint64, sizeof (uint64)); - } - - if (!err) { - *out_uint64 = ntohll (uint64); - } - - return cci_check_error (err); -} - -/* ------------------------------------------------------------------------ */ - -cc_uint32 cci_stream_write_uint64 (cci_stream_t io_stream, - cc_uint64 in_uint64) -{ - cc_int32 err = ccNoError; - cc_int64 uint64 = htonll (in_uint64); - - if (!io_stream) { err = cci_check_error (ccErrBadParam); } - - if (!err) { - err = cci_stream_write (io_stream, &uint64, sizeof (uint64)); - } - - return cci_check_error (err); -} - -#ifdef TARGET_OS_MAC -#pragma mark - -#endif - -/* ------------------------------------------------------------------------ */ - -cc_uint32 cci_stream_read_time (cci_stream_t io_stream, - cc_time_t *out_time) -{ - cc_int32 err = ccNoError; - cc_int64 t = 0; - - if (!io_stream) { err = cci_check_error (ccErrBadParam); } - if (!out_time ) { err = cci_check_error (ccErrBadParam); } - - if (!err) { - err = cci_stream_read_int64 (io_stream, &t); - } - - if (!err) { - *out_time = t; - } - - return cci_check_error (err); -} - -/* ------------------------------------------------------------------------ */ - -cc_uint32 cci_stream_write_time (cci_stream_t io_stream, - cc_time_t in_time) -{ - cc_int32 err = ccNoError; - - if (!io_stream) { err = cci_check_error (ccErrBadParam); } - - if (!err) { - err = cci_stream_write_int64 (io_stream, in_time); - } - - return cci_check_error (err); -} diff --git a/src/ccapi/common/cci_stream.h b/src/ccapi/common/cci_stream.h deleted file mode 100644 index 76df2c846..000000000 --- a/src/ccapi/common/cci_stream.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * $Header$ - * - * Copyright 2006 Massachusetts Institute of Technology. - * All Rights Reserved. - * - * Export of this software from the United States of America may - * require a specific license from the United States Government. - * It is the responsibility of any person or organization contemplating - * export to obtain such a license before exporting. - * - * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and - * distribute this software and its documentation for any purpose and - * without fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright notice and - * this permission notice appear in supporting documentation, and that - * the name of M.I.T. not be used in advertising or publicity pertaining - * to distribution of the software without specific, written prior - * permission. Furthermore if you modify this software you must label - * your software as modified software and not distribute it in such a - * fashion that it might be confused with the original M.I.T. software. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" without express - * or implied warranty. - */ - -#ifndef CCI_STREAM_H -#define CCI_STREAM_H - -#include "cci_types.h" - -cc_int32 cci_stream_new (cci_stream_t *out_stream); - -cc_uint32 cci_stream_release (cci_stream_t io_stream); - -cc_uint64 cci_stream_size (cci_stream_t in_stream); - -const char *cci_stream_data (cci_stream_t in_stream); - -cc_uint32 cci_stream_read (cci_stream_t in_stream, - void *io_data, - cc_uint64 in_size); -cc_uint32 cci_stream_write (cci_stream_t in_stream, - const void *in_data, - cc_uint64 in_size); - -cc_uint32 cci_stream_read_string (cci_stream_t io_stream, - char **out_string); -cc_uint32 cci_stream_write_string (cci_stream_t io_stream, - const char *in_string); - -cc_uint32 cci_stream_read_int32 (cci_stream_t io_stream, - cc_int32 *out_int32); -cc_uint32 cci_stream_write_int32 (cci_stream_t io_stream, - cc_int32 in_int32); - -cc_uint32 cci_stream_read_uint32 (cci_stream_t io_stream, - cc_uint32 *out_uint32); -cc_uint32 cci_stream_write_uint32 (cci_stream_t io_stream, - cc_uint32 in_uint32); - -cc_uint32 cci_stream_read_int64 (cci_stream_t io_stream, - cc_int64 *out_int64); -cc_uint32 cci_stream_write_int64 (cci_stream_t io_stream, - cc_int64 in_int64); - -cc_uint32 cci_stream_read_uint64 (cci_stream_t io_stream, - cc_uint64 *out_uint64); -cc_uint32 cci_stream_write_uint64 (cci_stream_t io_stream, - cc_uint64 in_uint64); - -cc_uint32 cci_stream_read_time (cci_stream_t io_stream, - cc_time_t *out_time); -cc_uint32 cci_stream_write_time (cci_stream_t io_stream, - cc_time_t in_time); - -#endif /* CCI_STREAM_H */ diff --git a/src/ccapi/common/cci_types.h b/src/ccapi/common/cci_types.h index 8ace67ce7..20c64701a 100644 --- a/src/ccapi/common/cci_types.h +++ b/src/ccapi/common/cci_types.h @@ -28,9 +28,7 @@ #define CCI_TYPES_H #include - -struct cci_stream_d; -typedef struct cci_stream_d *cci_stream_t; +#include typedef char *cci_uuid_string_t; diff --git a/src/ccapi/common/mac/cci_mig.defs b/src/ccapi/common/mac/cci_mig.defs deleted file mode 100644 index 3a573681a..000000000 --- a/src/ccapi/common/mac/cci_mig.defs +++ /dev/null @@ -1,54 +0,0 @@ -/* $Copyright: - * - * Copyright 2004-2006 by the Massachusetts Institute of Technology. - * - * All rights reserved. - * - * Export of this software from the United States of America may require a - * specific license from the United States Government. It is the - * responsibility of any person or organization contemplating export to - * obtain such a license before exporting. - * - * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute - * this software and its documentation for any purpose and without fee is - * hereby granted, provided that the above copyright notice appear in all - * copies and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of M.I.T. not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. Furthermore if you - * modify this software you must label your software as modified software - * and not distribute it in such a fashion that it might be confused with - * the original MIT software. M.I.T. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * Individual source code files are copyright MIT, Cygnus Support, - * OpenVision, Oracle, Sun Soft, FundsXpress, and others. - * - * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira, - * and Zephyr are trademarks of the Massachusetts Institute of Technology - * (MIT). No commercial use of these trademarks may be made without prior - * written permission of MIT. - * - * "Commercial use" means use of a name in a product or other for-profit - * manner. It does NOT prevent a commercial firm from referring to the MIT - * trademarks in order to convey information (although in doing so, - * recognition of their trademark status should be given). - * $ - */ - -#include -#include - -import "cci_mig_types.h"; - -/* Note the 1024 must be the same as kCCAPIMaxILMsgSize */ -type cci_mipc_inl_request_t = array [ * : 1024 ] of char; -type cci_mipc_ool_request_t = array [] of char; - -type cci_mipc_inl_reply_t = array [ * : 1024 ] of char; -type cci_mipc_ool_reply_t = array [] of char; diff --git a/src/ccapi/common/mac/cci_mig_reply.defs b/src/ccapi/common/mac/cci_mig_reply.defs deleted file mode 100644 index f500ef9ac..000000000 --- a/src/ccapi/common/mac/cci_mig_reply.defs +++ /dev/null @@ -1,58 +0,0 @@ -/* $Copyright: - * - * Copyright 2004-2006 by the Massachusetts Institute of Technology. - * - * All rights reserved. - * - * Export of this software from the United States of America may require a - * specific license from the United States Government. It is the - * responsibility of any person or organization contemplating export to - * obtain such a license before exporting. - * - * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute - * this software and its documentation for any purpose and without fee is - * hereby granted, provided that the above copyright notice appear in all - * copies and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of M.I.T. not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. Furthermore if you - * modify this software you must label your software as modified software - * and not distribute it in such a fashion that it might be confused with - * the original MIT software. M.I.T. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * Individual source code files are copyright MIT, Cygnus Support, - * OpenVision, Oracle, Sun Soft, FundsXpress, and others. - * - * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira, - * and Zephyr are trademarks of the Massachusetts Institute of Technology - * (MIT). No commercial use of these trademarks may be made without prior - * written permission of MIT. - * - * "Commercial use" means use of a name in a product or other for-profit - * manner. It does NOT prevent a commercial firm from referring to the MIT - * trademarks in order to convey information (although in doing so, - * recognition of their trademark status should be given). - * $ - */ - -#include "cci_mig.defs" - -subsystem cci 200; - -serverprefix cci_mipc_; -userprefix ccs_mipc_; - -/* ",dealloc" means that the vm_read() memory will be moved to - * the other process rather than copied. This is necessary on the - * client side because we can't know when server has copied our - * buffers so we can't vm_deallocate() them ourselves. */ - -simpleroutine reply (in_reply_port : mach_port_move_send_once_t; - in_inl_reply : cci_mipc_inl_reply_t; - in_ool_reply : cci_mipc_ool_reply_t, dealloc); diff --git a/src/ccapi/common/mac/cci_mig_request.defs b/src/ccapi/common/mac/cci_mig_request.defs deleted file mode 100644 index 45887e1a1..000000000 --- a/src/ccapi/common/mac/cci_mig_request.defs +++ /dev/null @@ -1,62 +0,0 @@ -/* $Copyright: - * - * Copyright 2004-2006 by the Massachusetts Institute of Technology. - * - * All rights reserved. - * - * Export of this software from the United States of America may require a - * specific license from the United States Government. It is the - * responsibility of any person or organization contemplating export to - * obtain such a license before exporting. - * - * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute - * this software and its documentation for any purpose and without fee is - * hereby granted, provided that the above copyright notice appear in all - * copies and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of M.I.T. not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. Furthermore if you - * modify this software you must label your software as modified software - * and not distribute it in such a fashion that it might be confused with - * the original MIT software. M.I.T. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * Individual source code files are copyright MIT, Cygnus Support, - * OpenVision, Oracle, Sun Soft, FundsXpress, and others. - * - * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira, - * and Zephyr are trademarks of the Massachusetts Institute of Technology - * (MIT). No commercial use of these trademarks may be made without prior - * written permission of MIT. - * - * "Commercial use" means use of a name in a product or other for-profit - * manner. It does NOT prevent a commercial firm from referring to the MIT - * trademarks in order to convey information (although in doing so, - * recognition of their trademark status should be given). - * $ - */ - -#include "cci_mig.defs" - -subsystem ccs 100; - -serverprefix ccs_mipc_; -userprefix cci_mipc_; - -routine create_client_connection (in_server_port : mach_port_t; - out out_connection_port : mach_port_t = MACH_MSG_TYPE_MAKE_SEND); - -/* ",dealloc" means that the vm_read() memory will be moved to - * the other process rather than copied. This is necessary on the - * server side because we can't know when client has copied our - * buffers so we can't vm_deallocate() them ourselves. */ - -simpleroutine request (in_connection_port : mach_port_t; - in_reply_port : mach_port_make_send_once_t; - in_inl_request : cci_mipc_inl_request_t; - in_ool_request : cci_mipc_ool_request_t, dealloc); diff --git a/src/ccapi/common/mac/cci_mig_types.h b/src/ccapi/common/mac/cci_mig_types.h deleted file mode 100644 index d82d5ac59..000000000 --- a/src/ccapi/common/mac/cci_mig_types.h +++ /dev/null @@ -1,56 +0,0 @@ -/* $Copyright: -* -* Copyright 2004-2006 by the Massachusetts Institute of Technology. -* -* All rights reserved. -* -* Export of this software from the United States of America may require a -* specific license from the United States Government. It is the -* responsibility of any person or organization contemplating export to -* obtain such a license before exporting. -* -* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute -* this software and its documentation for any purpose and without fee is -* hereby granted, provided that the above copyright notice appear in all -* copies and that both that copyright notice and this permission notice -* appear in supporting documentation, and that the name of M.I.T. not be -* used in advertising or publicity pertaining to distribution of the -* software without specific, written prior permission. Furthermore if you -* modify this software you must label your software as modified software -* and not distribute it in such a fashion that it might be confused with -* the original MIT software. M.I.T. makes no representations about the -* suitability of this software for any purpose. It is provided "as is" -* without express or implied warranty. -* -* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF -* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. -* -* Individual source code files are copyright MIT, Cygnus Support, -* OpenVision, Oracle, Sun Soft, FundsXpress, and others. -* -* Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira, -* and Zephyr are trademarks of the Massachusetts Institute of Technology -* (MIT). No commercial use of these trademarks may be made without prior -* written permission of MIT. -* -* "Commercial use" means use of a name in a product or other for-profit -* manner. It does NOT prevent a commercial firm from referring to the MIT -* trademarks in order to convey information (although in doing so, -* recognition of their trademark status should be given). -* $ -*/ - -#ifndef CCI_MIG_TYPES_H -#define CCI_MIG_TYPES_H - -#include "cci_common.h" - -#define kCCAPIMaxILMsgSize 1024 - -typedef const char cci_mipc_inl_request_t[kCCAPIMaxILMsgSize]; -typedef const char *cci_mipc_ool_request_t; -typedef char cci_mipc_inl_reply_t[kCCAPIMaxILMsgSize]; -typedef char *cci_mipc_ool_reply_t; - -#endif /* CCI_MIG_TYPES_H */ diff --git a/src/ccapi/common/win/tls.c b/src/ccapi/common/win/tls.c index 45020b570..5e0e11d7a 100644 --- a/src/ccapi/common/win/tls.c +++ b/src/ccapi/common/win/tls.c @@ -57,7 +57,7 @@ void tspdata_setRpcAState (struct tspdata* p, RPC_ASYNC_STATE* rpcState) void tspdata_setSST (struct tspdata* p, time_t t) {p->_sst = t;} -void tspdata_setStream (struct tspdata* p, cci_stream_t s) {p->_stream = s;} +void tspdata_setStream (struct tspdata* p, k5_ipc_stream s) {p->_stream = s;} BOOL tspdata_getConnected (const struct tspdata* p) {return p->_CCAPI_Connected;} @@ -66,7 +66,7 @@ HANDLE tspdata_getReplyEvent(const struct tspdata* p) {return p->_ time_t tspdata_getSST (const struct tspdata* p) {return p->_sst;} -cci_stream_t tspdata_getStream (const struct tspdata* p) {return p->_stream;} +k5_ipc_stream tspdata_getStream (const struct tspdata* p) {return p->_stream;} char* tspdata_getUUID (const struct tspdata* p) {return p->_uuid;} diff --git a/src/ccapi/common/win/tls.h b/src/ccapi/common/win/tls.h index 1a6086888..b6761c8bb 100644 --- a/src/ccapi/common/win/tls.h +++ b/src/ccapi/common/win/tls.h @@ -46,7 +46,7 @@ struct tspdata { RPC_ASYNC_STATE* _rpcState; HANDLE _replyEvent; time_t _sst; - cci_stream_t _stream; + k5_ipc_stream _stream; char _uuid[UUID_SIZE]; }; @@ -57,14 +57,14 @@ void tspdata_setConnected (struct tspdata* p, BOOL b); void tspdata_setReplyEvent(struct tspdata* p, HANDLE h); void tspdata_setRpcAState (struct tspdata* p, RPC_ASYNC_STATE* rpcState); void tspdata_setSST (struct tspdata* p, time_t t); -void tspdata_setStream (struct tspdata* p, cci_stream_t s); +void tspdata_setStream (struct tspdata* p, k5_ipc_stream s); void tspdata_setUUID (struct tspdata* p, unsigned char __RPC_FAR* uuidString); HANDLE tspdata_getReplyEvent(const struct tspdata* p); BOOL tspdata_getConnected(const struct tspdata* p); RPC_ASYNC_STATE* tspdata_getRpcAState(const struct tspdata* p); time_t tspdata_getSST (const struct tspdata* p); -cci_stream_t tspdata_getStream (const struct tspdata* p); +k5_ipc_stream tspdata_getStream (const struct tspdata* p); char* tspdata_getUUID (const struct tspdata* p); BOOL WINAPI PutTspData(DWORD tlsIndex, struct tspdata* dw); diff --git a/src/ccapi/lib/ccapi_ccache.c b/src/ccapi/lib/ccapi_ccache.c index cdef6a5d0..57c6f83aa 100644 --- a/src/ccapi/lib/ccapi_ccache.c +++ b/src/ccapi/lib/ccapi_ccache.c @@ -121,7 +121,7 @@ cc_int32 cci_ccache_new (cc_ccache_t *out_ccache, /* ------------------------------------------------------------------------ */ cc_int32 cci_ccache_write (cc_ccache_t in_ccache, - cci_stream_t in_stream) + k5_ipc_stream in_stream) { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) in_ccache; @@ -208,7 +208,7 @@ cc_int32 ccapi_ccache_get_credentials_version (cc_ccache_t in_ccache, { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) in_ccache; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; if (!in_ccache ) { err = cci_check_error (ccErrBadParam); } if (!out_credentials_version) { err = cci_check_error (ccErrBadParam); } @@ -221,10 +221,10 @@ cc_int32 ccapi_ccache_get_credentials_version (cc_ccache_t in_ccache, } if (!err) { - err = cci_stream_read_uint32 (reply, out_credentials_version); + err = k5_ipc_stream_read_uint32 (reply, out_credentials_version); } - cci_stream_release (reply); + k5_ipc_stream_release (reply); return cci_check_error (err); } @@ -236,7 +236,7 @@ cc_int32 ccapi_ccache_get_name (cc_ccache_t in_ccache, { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) in_ccache; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; char *name = NULL; if (!in_ccache) { err = cci_check_error (ccErrBadParam); } @@ -250,15 +250,15 @@ cc_int32 ccapi_ccache_get_name (cc_ccache_t in_ccache, } if (!err) { - err = cci_stream_read_string (reply, &name); + err = k5_ipc_stream_read_string (reply, &name); } if (!err) { err = cci_string_new (out_name, name); } - cci_stream_release (reply); - free (name); + k5_ipc_stream_release (reply); + k5_ipc_stream_free_string (name); return cci_check_error (err); } @@ -271,19 +271,19 @@ cc_int32 ccapi_ccache_get_principal (cc_ccache_t in_ccache, { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) in_ccache; - cci_stream_t request = NULL; - cci_stream_t reply = NULL; + k5_ipc_stream request = NULL; + k5_ipc_stream reply = NULL; char *principal = NULL; if (!in_ccache ) { err = cci_check_error (ccErrBadParam); } if (!out_principal) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { - err = cci_stream_write_uint32 (request, in_credentials_version); + err = k5_ipc_stream_write_uint32 (request, in_credentials_version); } if (!err) { @@ -294,16 +294,16 @@ cc_int32 ccapi_ccache_get_principal (cc_ccache_t in_ccache, } if (!err) { - err = cci_stream_read_string (reply, &principal); + err = k5_ipc_stream_read_string (reply, &principal); } if (!err) { err = cci_string_new (out_principal, principal); } - cci_stream_release (request); - cci_stream_release (reply); - free (principal); + k5_ipc_stream_release (request); + k5_ipc_stream_release (reply); + k5_ipc_stream_free_string (principal); return cci_check_error (err); } @@ -316,21 +316,21 @@ cc_int32 ccapi_ccache_set_principal (cc_ccache_t io_ccache, { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) io_ccache; - cci_stream_t request = NULL; + k5_ipc_stream request = NULL; if (!io_ccache ) { err = cci_check_error (ccErrBadParam); } if (!in_principal) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { - err = cci_stream_write_uint32 (request, in_credentials_version); + err = k5_ipc_stream_write_uint32 (request, in_credentials_version); } if (!err) { - err = cci_stream_write_string (request, in_principal); + err = k5_ipc_stream_write_string (request, in_principal); } if (!err) { @@ -340,7 +340,7 @@ cc_int32 ccapi_ccache_set_principal (cc_ccache_t io_ccache, NULL); } - cci_stream_release (request); + k5_ipc_stream_release (request); return cci_check_error (err); } @@ -352,13 +352,13 @@ cc_int32 ccapi_ccache_store_credentials (cc_ccache_t io_ccache, { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) io_ccache; - cci_stream_t request = NULL; + k5_ipc_stream request = NULL; if (!io_ccache ) { err = cci_check_error (ccErrBadParam); } if (!in_credentials_union) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { @@ -372,7 +372,7 @@ cc_int32 ccapi_ccache_store_credentials (cc_ccache_t io_ccache, NULL); } - cci_stream_release (request); + k5_ipc_stream_release (request); return cci_check_error (err); } @@ -384,13 +384,13 @@ cc_int32 ccapi_ccache_remove_credentials (cc_ccache_t io_ccache, { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) io_ccache; - cci_stream_t request = NULL; + k5_ipc_stream request = NULL; if (!io_ccache ) { err = cci_check_error (ccErrBadParam); } if (!in_credentials) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { @@ -404,7 +404,7 @@ cc_int32 ccapi_ccache_remove_credentials (cc_ccache_t io_ccache, NULL); } - cci_stream_release (request); + k5_ipc_stream_release (request); return cci_check_error (err); } @@ -416,7 +416,7 @@ cc_int32 ccapi_ccache_new_credentials_iterator (cc_ccache_t in_cc { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) in_ccache; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; cci_identifier_t identifier = NULL; if (!in_ccache ) { err = cci_check_error (ccErrBadParam); } @@ -437,7 +437,7 @@ cc_int32 ccapi_ccache_new_credentials_iterator (cc_ccache_t in_cc err = cci_credentials_iterator_new (out_credentials_iterator, identifier); } - cci_stream_release (reply); + k5_ipc_stream_release (reply); cci_identifier_release (identifier); return cci_check_error (err); @@ -453,13 +453,13 @@ cc_int32 ccapi_ccache_move (cc_ccache_t io_source_ccache, cc_int32 err = ccNoError; cci_ccache_t source_ccache = (cci_ccache_t) io_source_ccache; cci_ccache_t destination_ccache = (cci_ccache_t) io_destination_ccache; - cci_stream_t request = NULL; + k5_ipc_stream request = NULL; if (!io_source_ccache ) { err = cci_check_error (ccErrBadParam); } if (!io_destination_ccache) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { @@ -473,7 +473,7 @@ cc_int32 ccapi_ccache_move (cc_ccache_t io_source_ccache, NULL); } - cci_stream_release (request); + k5_ipc_stream_release (request); return cci_check_error (err); } @@ -486,20 +486,20 @@ cc_int32 ccapi_ccache_lock (cc_ccache_t io_ccache, { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) io_ccache; - cci_stream_t request = NULL; + k5_ipc_stream request = NULL; if (!io_ccache) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { - err = cci_stream_write_uint32 (request, in_lock_type); + err = k5_ipc_stream_write_uint32 (request, in_lock_type); } if (!err) { - err = cci_stream_write_uint32 (request, in_block); + err = k5_ipc_stream_write_uint32 (request, in_block); } if (!err) { @@ -509,7 +509,7 @@ cc_int32 ccapi_ccache_lock (cc_ccache_t io_ccache, NULL); } - cci_stream_release (request); + k5_ipc_stream_release (request); return cci_check_error (err); } @@ -540,7 +540,7 @@ cc_int32 ccapi_ccache_get_last_default_time (cc_ccache_t in_ccache, { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) in_ccache; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; if (!in_ccache ) { err = cci_check_error (ccErrBadParam); } if (!out_last_default_time) { err = cci_check_error (ccErrBadParam); } @@ -553,10 +553,10 @@ cc_int32 ccapi_ccache_get_last_default_time (cc_ccache_t in_ccache, } if (!err) { - err = cci_stream_read_time (reply, out_last_default_time); + err = k5_ipc_stream_read_time (reply, out_last_default_time); } - cci_stream_release (reply); + k5_ipc_stream_release (reply); return cci_check_error (err); } @@ -568,7 +568,7 @@ cc_int32 ccapi_ccache_get_change_time (cc_ccache_t in_ccache, { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) in_ccache; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; if (!in_ccache ) { err = cci_check_error (ccErrBadParam); } if (!out_change_time) { err = cci_check_error (ccErrBadParam); } @@ -581,10 +581,10 @@ cc_int32 ccapi_ccache_get_change_time (cc_ccache_t in_ccache, } if (!err) { - err = cci_stream_read_time (reply, out_change_time); + err = k5_ipc_stream_read_time (reply, out_change_time); } - cci_stream_release (reply); + k5_ipc_stream_release (reply); return cci_check_error (err); } @@ -595,17 +595,17 @@ cc_int32 ccapi_ccache_wait_for_change (cc_ccache_t in_ccache) { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) in_ccache; - cci_stream_t request = NULL; - cci_stream_t reply = NULL; + k5_ipc_stream request = NULL; + k5_ipc_stream reply = NULL; if (!in_ccache) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { - err = cci_stream_write_time (request, ccache->last_wait_for_change_time); + err = k5_ipc_stream_write_time (request, ccache->last_wait_for_change_time); } if (!err) { @@ -616,11 +616,11 @@ cc_int32 ccapi_ccache_wait_for_change (cc_ccache_t in_ccache) } if (!err) { - err = cci_stream_read_time (reply, &ccache->last_wait_for_change_time); + err = k5_ipc_stream_read_time (reply, &ccache->last_wait_for_change_time); } - cci_stream_release (request); - cci_stream_release (reply); + k5_ipc_stream_release (request); + k5_ipc_stream_release (reply); return cci_check_error (err); } @@ -656,18 +656,18 @@ cc_int32 ccapi_ccache_get_kdc_time_offset (cc_ccache_t in_ccache, { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) in_ccache; - cci_stream_t request = NULL; - cci_stream_t reply = NULL; + k5_ipc_stream request = NULL; + k5_ipc_stream reply = NULL; if (!in_ccache ) { err = cci_check_error (ccErrBadParam); } if (!out_time_offset) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { - err = cci_stream_write_uint32 (request, in_credentials_version); + err = k5_ipc_stream_write_uint32 (request, in_credentials_version); } if (!err) { @@ -678,11 +678,11 @@ cc_int32 ccapi_ccache_get_kdc_time_offset (cc_ccache_t in_ccache, } if (!err) { - err = cci_stream_read_time (reply, out_time_offset); + err = k5_ipc_stream_read_time (reply, out_time_offset); } - cci_stream_release (request); - cci_stream_release (reply); + k5_ipc_stream_release (request); + k5_ipc_stream_release (reply); return cci_check_error (err); } @@ -695,20 +695,20 @@ cc_int32 ccapi_ccache_set_kdc_time_offset (cc_ccache_t io_ccache, { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) io_ccache; - cci_stream_t request = NULL; + k5_ipc_stream request = NULL; if (!io_ccache) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { - err = cci_stream_write_uint32 (request, in_credentials_version); + err = k5_ipc_stream_write_uint32 (request, in_credentials_version); } if (!err) { - err = cci_stream_write_time (request, in_time_offset); + err = k5_ipc_stream_write_time (request, in_time_offset); } if (!err) { @@ -718,7 +718,7 @@ cc_int32 ccapi_ccache_set_kdc_time_offset (cc_ccache_t io_ccache, NULL); } - cci_stream_release (request); + k5_ipc_stream_release (request); return cci_check_error (err); } @@ -730,16 +730,16 @@ cc_int32 ccapi_ccache_clear_kdc_time_offset (cc_ccache_t io_ccache, { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) io_ccache; - cci_stream_t request = NULL; + k5_ipc_stream request = NULL; if (!io_ccache) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { - err = cci_stream_write_uint32 (request, in_credentials_version); + err = k5_ipc_stream_write_uint32 (request, in_credentials_version); } if (!err) { @@ -749,7 +749,7 @@ cc_int32 ccapi_ccache_clear_kdc_time_offset (cc_ccache_t io_ccache, NULL); } - cci_stream_release (request); + k5_ipc_stream_release (request); return cci_check_error (err); } diff --git a/src/ccapi/lib/ccapi_ccache.h b/src/ccapi/lib/ccapi_ccache.h index 73091b7a0..1a449c2fb 100644 --- a/src/ccapi/lib/ccapi_ccache.h +++ b/src/ccapi/lib/ccapi_ccache.h @@ -35,7 +35,7 @@ cc_int32 cci_ccache_new (cc_ccache_t *out_ccache, cc_int32 ccapi_ccache_release (cc_ccache_t io_ccache); cc_int32 cci_ccache_write (cc_ccache_t in_ccache, - cci_stream_t in_stream); + k5_ipc_stream in_stream); cc_int32 ccapi_ccache_destroy (cc_ccache_t io_ccache); diff --git a/src/ccapi/lib/ccapi_ccache_iterator.c b/src/ccapi/lib/ccapi_ccache_iterator.c index 1d4dd6c55..0f5d241f9 100644 --- a/src/ccapi/lib/ccapi_ccache_iterator.c +++ b/src/ccapi/lib/ccapi_ccache_iterator.c @@ -100,7 +100,7 @@ cc_int32 cci_ccache_iterator_new (cc_ccache_iterator_t *out_ccache_iterator, /* ------------------------------------------------------------------------ */ cc_int32 cci_ccache_iterator_write (cc_ccache_iterator_t in_ccache_iterator, - cci_stream_t in_stream) + k5_ipc_stream in_stream) { cc_int32 err = ccNoError; cci_ccache_iterator_t ccache_iterator = (cci_ccache_iterator_t) in_ccache_iterator; @@ -160,7 +160,7 @@ cc_int32 ccapi_ccache_iterator_next (cc_ccache_iterator_t in_ccache_iterator, { cc_int32 err = ccNoError; cci_ccache_iterator_t ccache_iterator = (cci_ccache_iterator_t) in_ccache_iterator; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; cci_identifier_t identifier = NULL; if (!in_ccache_iterator) { err = cci_check_error (ccErrBadParam); } @@ -193,7 +193,7 @@ cc_int32 ccapi_ccache_iterator_next (cc_ccache_iterator_t in_ccache_iterator, err = cci_ccache_new (out_ccache, identifier); } - cci_stream_release (reply); + k5_ipc_stream_release (reply); cci_identifier_release (identifier); return cci_check_error (err); @@ -206,7 +206,7 @@ cc_int32 ccapi_ccache_iterator_clone (cc_ccache_iterator_t in_ccache_iterator, { cc_int32 err = ccNoError; cci_ccache_iterator_t ccache_iterator = (cci_ccache_iterator_t) in_ccache_iterator; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; cc_uint32 initialized = 0; cci_identifier_t identifier = NULL; @@ -240,7 +240,7 @@ cc_int32 ccapi_ccache_iterator_clone (cc_ccache_iterator_t in_ccache_iterator, } cci_identifier_release (identifier); - cci_stream_release (reply); + k5_ipc_stream_release (reply); return cci_check_error (err); } diff --git a/src/ccapi/lib/ccapi_ccache_iterator.h b/src/ccapi/lib/ccapi_ccache_iterator.h index 8b07b0763..9556aa0eb 100644 --- a/src/ccapi/lib/ccapi_ccache_iterator.h +++ b/src/ccapi/lib/ccapi_ccache_iterator.h @@ -33,7 +33,7 @@ cc_int32 cci_ccache_iterator_new (cc_ccache_iterator_t *out_ccache_iterator, cci_identifier_t in_identifier); cc_int32 cci_ccache_iterator_write (cc_ccache_iterator_t in_ccache_iterator, - cci_stream_t in_stream); + k5_ipc_stream in_stream); cc_int32 ccapi_ccache_iterator_release (cc_ccache_iterator_t io_ccache_iterator); diff --git a/src/ccapi/lib/ccapi_context.c b/src/ccapi/lib/ccapi_context.c index 3e405679f..0f1712ea4 100644 --- a/src/ccapi/lib/ccapi_context.c +++ b/src/ccapi/lib/ccapi_context.c @@ -233,7 +233,7 @@ cc_int32 ccapi_context_get_change_time (cc_context_t in_context, { cc_int32 err = ccNoError; cci_context_t context = (cci_context_t) in_context; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; if (!in_context ) { err = cci_check_error (ccErrBadParam); } if (!out_change_time) { err = cci_check_error (ccErrBadParam); } @@ -248,11 +248,11 @@ cc_int32 ccapi_context_get_change_time (cc_context_t in_context, NULL, &reply); } - if (!err && cci_stream_size (reply) > 0) { + if (!err && k5_ipc_stream_size (reply) > 0) { cc_time_t change_time = 0; /* got a response from the server */ - err = cci_stream_read_time (reply, &change_time); + err = k5_ipc_stream_read_time (reply, &change_time); if (!err) { err = cci_context_change_time_update (context->identifier, @@ -264,7 +264,7 @@ cc_int32 ccapi_context_get_change_time (cc_context_t in_context, err = cci_context_change_time_get (out_change_time); } - cci_stream_release (reply); + k5_ipc_stream_release (reply); return cci_check_error (err); } @@ -275,17 +275,17 @@ cc_int32 ccapi_context_wait_for_change (cc_context_t in_context) { cc_int32 err = ccNoError; cci_context_t context = (cci_context_t) in_context; - cci_stream_t request = NULL; - cci_stream_t reply = NULL; + k5_ipc_stream request = NULL; + k5_ipc_stream reply = NULL; if (!in_context) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { - err = cci_stream_write_time (request, context->last_wait_for_change_time); + err = k5_ipc_stream_write_time (request, context->last_wait_for_change_time); } if (!err) { @@ -300,11 +300,11 @@ cc_int32 ccapi_context_wait_for_change (cc_context_t in_context) } if (!err) { - err = cci_stream_read_time (reply, &context->last_wait_for_change_time); + err = k5_ipc_stream_read_time (reply, &context->last_wait_for_change_time); } - cci_stream_release (request); - cci_stream_release (reply); + k5_ipc_stream_release (request); + k5_ipc_stream_release (reply); return cci_check_error (err); } @@ -316,7 +316,7 @@ cc_int32 ccapi_context_get_default_ccache_name (cc_context_t in_context, { cc_int32 err = ccNoError; cci_context_t context = (cci_context_t) in_context; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; char *reply_name = NULL; char *name = NULL; @@ -335,9 +335,9 @@ cc_int32 ccapi_context_get_default_ccache_name (cc_context_t in_context, } if (!err) { - if (cci_stream_size (reply) > 0) { + if (k5_ipc_stream_size (reply) > 0) { /* got a response from the server */ - err = cci_stream_read_string (reply, &reply_name); + err = k5_ipc_stream_read_string (reply, &reply_name); if (!err) { name = reply_name; @@ -351,8 +351,8 @@ cc_int32 ccapi_context_get_default_ccache_name (cc_context_t in_context, err = cci_string_new (out_name, name); } - cci_stream_release (reply); - free (reply_name); + k5_ipc_stream_release (reply); + k5_ipc_stream_free_string (reply_name); return cci_check_error (err); } @@ -365,8 +365,8 @@ cc_int32 ccapi_context_open_ccache (cc_context_t in_context, { cc_int32 err = ccNoError; cci_context_t context = (cci_context_t) in_context; - cci_stream_t request = NULL; - cci_stream_t reply = NULL; + k5_ipc_stream request = NULL; + k5_ipc_stream reply = NULL; cci_identifier_t identifier = NULL; if (!in_context ) { err = cci_check_error (ccErrBadParam); } @@ -374,11 +374,11 @@ cc_int32 ccapi_context_open_ccache (cc_context_t in_context, if (!out_ccache ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { - err = cci_stream_write_string (request, in_name); + err = k5_ipc_stream_write_string (request, in_name); } if (!err) { @@ -392,7 +392,7 @@ cc_int32 ccapi_context_open_ccache (cc_context_t in_context, &reply); } - if (!err && !(cci_stream_size (reply) > 0)) { + if (!err && !(k5_ipc_stream_size (reply) > 0)) { err = ccErrCCacheNotFound; } @@ -405,8 +405,8 @@ cc_int32 ccapi_context_open_ccache (cc_context_t in_context, } cci_identifier_release (identifier); - cci_stream_release (reply); - cci_stream_release (request); + k5_ipc_stream_release (reply); + k5_ipc_stream_release (request); return cci_check_error (err); } @@ -418,7 +418,7 @@ cc_int32 ccapi_context_open_default_ccache (cc_context_t in_context, { cc_int32 err = ccNoError; cci_context_t context = (cci_context_t) in_context; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; cci_identifier_t identifier = NULL; if (!in_context) { err = cci_check_error (ccErrBadParam); } @@ -435,7 +435,7 @@ cc_int32 ccapi_context_open_default_ccache (cc_context_t in_context, &reply); } - if (!err && !(cci_stream_size (reply) > 0)) { + if (!err && !(k5_ipc_stream_size (reply) > 0)) { err = ccErrCCacheNotFound; } @@ -448,7 +448,7 @@ cc_int32 ccapi_context_open_default_ccache (cc_context_t in_context, } cci_identifier_release (identifier); - cci_stream_release (reply); + k5_ipc_stream_release (reply); return cci_check_error (err); } @@ -463,8 +463,8 @@ cc_int32 ccapi_context_create_ccache (cc_context_t in_context, { cc_int32 err = ccNoError; cci_context_t context = (cci_context_t) in_context; - cci_stream_t request = NULL; - cci_stream_t reply = NULL; + k5_ipc_stream request = NULL; + k5_ipc_stream reply = NULL; cci_identifier_t identifier = NULL; if (!in_context ) { err = cci_check_error (ccErrBadParam); } @@ -473,19 +473,19 @@ cc_int32 ccapi_context_create_ccache (cc_context_t in_context, if (!out_ccache ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { - err = cci_stream_write_string (request, in_name); + err = k5_ipc_stream_write_string (request, in_name); } if (!err) { - err = cci_stream_write_uint32 (request, in_cred_vers); + err = k5_ipc_stream_write_uint32 (request, in_cred_vers); } if (!err) { - err = cci_stream_write_string (request, in_principal); + err = k5_ipc_stream_write_string (request, in_principal); } if (!err) { @@ -508,8 +508,8 @@ cc_int32 ccapi_context_create_ccache (cc_context_t in_context, } cci_identifier_release (identifier); - cci_stream_release (reply); - cci_stream_release (request); + k5_ipc_stream_release (reply); + k5_ipc_stream_release (request); return cci_check_error (err); } @@ -523,8 +523,8 @@ cc_int32 ccapi_context_create_default_ccache (cc_context_t in_context, { cc_int32 err = ccNoError; cci_context_t context = (cci_context_t) in_context; - cci_stream_t request = NULL; - cci_stream_t reply = NULL; + k5_ipc_stream request = NULL; + k5_ipc_stream reply = NULL; cci_identifier_t identifier = NULL; if (!in_context ) { err = cci_check_error (ccErrBadParam); } @@ -532,15 +532,15 @@ cc_int32 ccapi_context_create_default_ccache (cc_context_t in_context, if (!out_ccache ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { - err = cci_stream_write_uint32 (request, in_cred_vers); + err = k5_ipc_stream_write_uint32 (request, in_cred_vers); } if (!err) { - err = cci_stream_write_string (request, in_principal); + err = k5_ipc_stream_write_string (request, in_principal); } if (!err) { @@ -563,8 +563,8 @@ cc_int32 ccapi_context_create_default_ccache (cc_context_t in_context, } cci_identifier_release (identifier); - cci_stream_release (reply); - cci_stream_release (request); + k5_ipc_stream_release (reply); + k5_ipc_stream_release (request); return cci_check_error (err); } @@ -578,8 +578,8 @@ cc_int32 ccapi_context_create_new_ccache (cc_context_t in_context, { cc_int32 err = ccNoError; cci_context_t context = (cci_context_t) in_context; - cci_stream_t request = NULL; - cci_stream_t reply = NULL; + k5_ipc_stream request = NULL; + k5_ipc_stream reply = NULL; cci_identifier_t identifier = NULL; if (!in_context ) { err = cci_check_error (ccErrBadParam); } @@ -587,15 +587,15 @@ cc_int32 ccapi_context_create_new_ccache (cc_context_t in_context, if (!out_ccache ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { - err = cci_stream_write_uint32 (request, in_cred_vers); + err = k5_ipc_stream_write_uint32 (request, in_cred_vers); } if (!err) { - err = cci_stream_write_string (request, in_principal); + err = k5_ipc_stream_write_string (request, in_principal); } if (!err) { @@ -618,8 +618,8 @@ cc_int32 ccapi_context_create_new_ccache (cc_context_t in_context, } cci_identifier_release (identifier); - cci_stream_release (reply); - cci_stream_release (request); + k5_ipc_stream_release (reply); + k5_ipc_stream_release (request); return cci_check_error (err); } @@ -631,7 +631,7 @@ cc_int32 ccapi_context_new_ccache_iterator (cc_context_t in_context, { cc_int32 err = ccNoError; cci_context_t context = (cci_context_t) in_context; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; cci_identifier_t identifier = NULL; if (!in_context ) { err = cci_check_error (ccErrBadParam); } @@ -649,7 +649,7 @@ cc_int32 ccapi_context_new_ccache_iterator (cc_context_t in_context, } if (!err) { - if (cci_stream_size (reply) > 0) { + if (k5_ipc_stream_size (reply) > 0) { err = cci_identifier_read (&identifier, reply); } else { identifier = cci_identifier_uninitialized; @@ -660,7 +660,7 @@ cc_int32 ccapi_context_new_ccache_iterator (cc_context_t in_context, err = cci_ccache_iterator_new (out_iterator, identifier); } - cci_stream_release (reply); + k5_ipc_stream_release (reply); cci_identifier_release (identifier); return cci_check_error (err); @@ -674,20 +674,20 @@ cc_int32 ccapi_context_lock (cc_context_t in_context, { cc_int32 err = ccNoError; cci_context_t context = (cci_context_t) in_context; - cci_stream_t request = NULL; + k5_ipc_stream request = NULL; if (!in_context) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { - err = cci_stream_write_uint32 (request, in_lock_type); + err = k5_ipc_stream_write_uint32 (request, in_lock_type); } if (!err) { - err = cci_stream_write_uint32 (request, in_block); + err = k5_ipc_stream_write_uint32 (request, in_block); } if (!err) { @@ -701,7 +701,7 @@ cc_int32 ccapi_context_lock (cc_context_t in_context, NULL); } - cci_stream_release (request); + k5_ipc_stream_release (request); return cci_check_error (err); } @@ -773,7 +773,7 @@ static cc_int32 cci_context_sync (cci_context_t in_context, { cc_int32 err = ccNoError; cci_context_t context = (cci_context_t) in_context; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; cci_identifier_t new_identifier = NULL; if (!in_context) { err = cci_check_error (ccErrBadParam); } @@ -796,7 +796,7 @@ static cc_int32 cci_context_sync (cci_context_t in_context, } if (!err) { - if (cci_stream_size (reply) > 0) { + if (k5_ipc_stream_size (reply) > 0) { err = cci_identifier_read (&new_identifier, reply); } else { new_identifier = cci_identifier_uninitialized; @@ -828,7 +828,7 @@ static cc_int32 cci_context_sync (cci_context_t in_context, } cci_identifier_release (new_identifier); - cci_stream_release (reply); + k5_ipc_stream_release (reply); return cci_check_error (err); } diff --git a/src/ccapi/lib/ccapi_credentials.c b/src/ccapi/lib/ccapi_credentials.c index 3c40478fb..6a3b4cb91 100644 --- a/src/ccapi/lib/ccapi_credentials.c +++ b/src/ccapi/lib/ccapi_credentials.c @@ -61,7 +61,7 @@ cc_credentials_union cci_credentials_union_initializer = { /* ------------------------------------------------------------------------ */ cc_int32 cci_credentials_read (cc_credentials_t *out_credentials, - cci_stream_t in_stream) + k5_ipc_stream in_stream) { cc_int32 err = ccNoError; cci_credentials_t credentials = NULL; @@ -108,7 +108,7 @@ cc_int32 cci_credentials_read (cc_credentials_t *out_credentials, /* ------------------------------------------------------------------------ */ cc_int32 cci_credentials_write (cc_credentials_t in_credentials, - cci_stream_t in_stream) + k5_ipc_stream in_stream) { cc_int32 err = ccNoError; cci_credentials_t credentials = (cci_credentials_t) in_credentials; diff --git a/src/ccapi/lib/ccapi_credentials.h b/src/ccapi/lib/ccapi_credentials.h index bde0b2c03..9307e684b 100644 --- a/src/ccapi/lib/ccapi_credentials.h +++ b/src/ccapi/lib/ccapi_credentials.h @@ -30,10 +30,10 @@ #include "cci_common.h" cc_int32 cci_credentials_read (cc_credentials_t *out_credentials, - cci_stream_t in_stream); + k5_ipc_stream in_stream); cc_int32 cci_credentials_write (cc_credentials_t in_credentials, - cci_stream_t in_stream); + k5_ipc_stream in_stream); cc_int32 ccapi_credentials_compare (cc_credentials_t in_credentials, cc_credentials_t in_compare_to_credentials, diff --git a/src/ccapi/lib/ccapi_credentials_iterator.c b/src/ccapi/lib/ccapi_credentials_iterator.c index b6cd85c5d..4571b64f8 100644 --- a/src/ccapi/lib/ccapi_credentials_iterator.c +++ b/src/ccapi/lib/ccapi_credentials_iterator.c @@ -100,7 +100,7 @@ cc_int32 cci_credentials_iterator_new (cc_credentials_iterator_t *out_credential /* ------------------------------------------------------------------------ */ cc_int32 cci_credentials_iterator_write (cc_credentials_iterator_t in_credentials_iterator, - cci_stream_t in_stream) + k5_ipc_stream in_stream) { cc_int32 err = ccNoError; cci_credentials_iterator_t credentials_iterator = (cci_credentials_iterator_t) in_credentials_iterator; @@ -152,7 +152,7 @@ cc_int32 ccapi_credentials_iterator_next (cc_credentials_iterator_t in_credenti { cc_int32 err = ccNoError; cci_credentials_iterator_t credentials_iterator = (cci_credentials_iterator_t) in_credentials_iterator; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; if (!in_credentials_iterator) { err = cci_check_error (ccErrBadParam); } if (!out_credentials ) { err = cci_check_error (ccErrBadParam); } @@ -168,7 +168,7 @@ cc_int32 ccapi_credentials_iterator_next (cc_credentials_iterator_t in_credenti err = cci_credentials_read (out_credentials, reply); } - cci_stream_release (reply); + k5_ipc_stream_release (reply); return cci_check_error (err); } @@ -180,7 +180,7 @@ cc_int32 ccapi_credentials_iterator_clone (cc_credentials_iterator_t in_credent { cc_int32 err = ccNoError; cci_credentials_iterator_t credentials_iterator = (cci_credentials_iterator_t) in_credentials_iterator; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; cci_identifier_t identifier = NULL; if (!in_credentials_iterator ) { err = cci_check_error (ccErrBadParam); } @@ -201,7 +201,7 @@ cc_int32 ccapi_credentials_iterator_clone (cc_credentials_iterator_t in_credent err = cci_credentials_iterator_new (out_credentials_iterator, identifier); } - cci_stream_release (reply); + k5_ipc_stream_release (reply); cci_identifier_release (identifier); return cci_check_error (err); diff --git a/src/ccapi/lib/ccapi_credentials_iterator.h b/src/ccapi/lib/ccapi_credentials_iterator.h index 12647d4ee..84c3d2e22 100644 --- a/src/ccapi/lib/ccapi_credentials_iterator.h +++ b/src/ccapi/lib/ccapi_credentials_iterator.h @@ -33,7 +33,7 @@ cc_int32 cci_credentials_iterator_new (cc_credentials_iterator_t *out_credential cci_identifier_t in_identifier); cc_int32 cci_credentials_iterator_write (cc_credentials_iterator_t in_credentials_iterator, - cci_stream_t in_stream); + k5_ipc_stream in_stream); cc_int32 ccapi_credentials_iterator_release (cc_credentials_iterator_t io_credentials_iterator); diff --git a/src/ccapi/lib/ccapi_ipc.c b/src/ccapi/lib/ccapi_ipc.c index fe541db4e..43993dc76 100644 --- a/src/ccapi/lib/ccapi_ipc.c +++ b/src/ccapi/lib/ccapi_ipc.c @@ -46,12 +46,12 @@ void cci_ipc_thread_fini (void) static cc_int32 _cci_ipc_send (enum cci_msg_id_t in_request_name, cc_int32 in_launch_server, cci_identifier_t in_identifier, - cci_stream_t in_request_data, - cci_stream_t *out_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream *out_reply_data) { cc_int32 err = ccNoError; - cci_stream_t request = NULL; - cci_stream_t reply = NULL; + k5_ipc_stream request = NULL; + k5_ipc_stream reply = NULL; cc_int32 reply_error = 0; if (!in_identifier) { err = cci_check_error (ccErrBadParam); } @@ -65,15 +65,15 @@ static cc_int32 _cci_ipc_send (enum cci_msg_id_t in_request_name, } if (!err && in_request_data) { - err = cci_stream_write (request, - cci_stream_data (in_request_data), - cci_stream_size (in_request_data)); + err = k5_ipc_stream_write (request, + k5_ipc_stream_data (in_request_data), + k5_ipc_stream_size (in_request_data)); } if (!err) { err = cci_os_ipc (in_launch_server, request, &reply); - if (!err && cci_stream_size (reply) > 0) { + if (!err && k5_ipc_stream_size (reply) > 0) { err = cci_message_read_reply_header (reply, &reply_error); } } @@ -87,8 +87,8 @@ static cc_int32 _cci_ipc_send (enum cci_msg_id_t in_request_name, reply = NULL; /* take ownership */ } - cci_stream_release (request); - cci_stream_release (reply); + k5_ipc_stream_release (request); + k5_ipc_stream_release (reply); return cci_check_error (err); } @@ -97,8 +97,8 @@ static cc_int32 _cci_ipc_send (enum cci_msg_id_t in_request_name, cc_int32 cci_ipc_send (enum cci_msg_id_t in_request_name, cci_identifier_t in_identifier, - cci_stream_t in_request_data, - cci_stream_t *out_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream *out_reply_data) { return cci_check_error (_cci_ipc_send (in_request_name, 1, in_identifier, @@ -110,8 +110,8 @@ cc_int32 cci_ipc_send (enum cci_msg_id_t in_request_name, cc_int32 cci_ipc_send_no_launch (enum cci_msg_id_t in_request_name, cci_identifier_t in_identifier, - cci_stream_t in_request_data, - cci_stream_t *out_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream *out_reply_data) { return cci_check_error (_cci_ipc_send (in_request_name, 0, in_identifier, diff --git a/src/ccapi/lib/ccapi_ipc.h b/src/ccapi/lib/ccapi_ipc.h index 2ba7637ac..5b7d5d374 100644 --- a/src/ccapi/lib/ccapi_ipc.h +++ b/src/ccapi/lib/ccapi_ipc.h @@ -34,12 +34,12 @@ void cci_ipc_thread_fini (void); cc_int32 cci_ipc_send (enum cci_msg_id_t in_request_name, cci_identifier_t in_identifier, - cci_stream_t in_request_data, - cci_stream_t *out_reply_data); + k5_ipc_stream in_request_data, + k5_ipc_stream *out_reply_data); cc_int32 cci_ipc_send_no_launch (enum cci_msg_id_t in_request_name, cci_identifier_t in_identifier, - cci_stream_t in_request_data, - cci_stream_t *out_reply_data); + k5_ipc_stream in_request_data, + k5_ipc_stream *out_reply_data); #endif /* CCAPI_IPC_H */ diff --git a/src/ccapi/lib/ccapi_os_ipc.h b/src/ccapi/lib/ccapi_os_ipc.h index 0121adadb..b5e040599 100644 --- a/src/ccapi/lib/ccapi_os_ipc.h +++ b/src/ccapi/lib/ccapi_os_ipc.h @@ -33,7 +33,7 @@ cc_int32 cci_os_ipc_thread_init (void); void cci_os_ipc_thread_fini (void); cc_int32 cci_os_ipc (cc_int32 in_launch_server, - cci_stream_t in_request_stream, - cci_stream_t *out_reply_stream); + k5_ipc_stream in_request_stream, + k5_ipc_stream *out_reply_stream); #endif /* CCAPI_OS_IPC_H */ diff --git a/src/ccapi/lib/mac/ccapi_os_ipc.c b/src/ccapi/lib/mac/ccapi_os_ipc.c index bde357e16..e0a81d878 100644 --- a/src/ccapi/lib/mac/ccapi_os_ipc.c +++ b/src/ccapi/lib/mac/ccapi_os_ipc.c @@ -26,10 +26,7 @@ #include "ccapi_os_ipc.h" -#include -#include "cci_mig_request.h" -#include "cci_mig_replyServer.h" -#include "k5-thread.h" +#include "k5_mig_client.h" #define cci_server_bundle_id "edu.mit.Kerberos.CCacheServer" @@ -37,243 +34,26 @@ cc_int32 cci_os_ipc_thread_init (void) { - cc_int32 err = ccNoError; - - err = k5_key_register (K5_KEY_CCAPI_REQUEST_PORT, free); - - if (!err) { - err = k5_key_register (K5_KEY_CCAPI_REPLY_STREAM, NULL); - } - - if (!err) { - err = k5_key_register (K5_KEY_CCAPI_SERVER_DIED, NULL); - } - - return err; + /* k5_ipc_send_request handles all thread data for us */ + return 0; } /* ------------------------------------------------------------------------ */ void cci_os_ipc_thread_fini (void) -{ - k5_key_delete (K5_KEY_CCAPI_REQUEST_PORT); - k5_key_delete (K5_KEY_CCAPI_REPLY_STREAM); - k5_key_delete (K5_KEY_CCAPI_SERVER_DIED); -} - -#pragma mark - - -/* ------------------------------------------------------------------------ */ - -static boolean_t cci_server_demux (mach_msg_header_t *request, - mach_msg_header_t *reply) -{ - boolean_t handled = false; - - if (!handled && request->msgh_id == MACH_NOTIFY_NO_SENDERS) { - cc_int32 *server_died = k5_getspecific (K5_KEY_CCAPI_SERVER_DIED); - if (!server_died) { - *server_died = 1; - } - - handled = 1; /* server died */ - } - - if (!handled) { - handled = cci_server (request, reply); - } - - return handled; -} - -/* ------------------------------------------------------------------------ */ - -kern_return_t cci_mipc_reply (mach_port_t in_reply_port, - cci_mipc_inl_reply_t in_inl_reply, - mach_msg_type_number_t in_inl_replyCnt, - cci_mipc_ool_reply_t in_ool_reply, - mach_msg_type_number_t in_ool_replyCnt) { - kern_return_t err = KERN_SUCCESS; - cci_stream_t reply_stream = NULL; - - if (!err) { - reply_stream = k5_getspecific (K5_KEY_CCAPI_REPLY_STREAM); - if (!reply_stream) { err = cci_check_error (ccErrBadInternalMessage); } - } - - if (!err) { - if (in_inl_replyCnt) { - err = cci_stream_write (reply_stream, in_inl_reply, in_inl_replyCnt); - - } else if (in_ool_replyCnt) { - err = cci_stream_write (reply_stream, in_ool_reply, in_ool_replyCnt); - - } else { - err = cci_check_error (ccErrBadInternalMessage); - } - } - - if (in_ool_replyCnt) { vm_deallocate (mach_task_self (), (vm_address_t) in_ool_reply, in_ool_replyCnt); } - - return cci_check_error (err); + /* k5_ipc_send_request handles all thread data for us */ + return; } -#pragma mark - - /* ------------------------------------------------------------------------ */ cc_int32 cci_os_ipc (cc_int32 in_launch_server, - cci_stream_t in_request_stream, - cci_stream_t *out_reply_stream) + k5_ipc_stream in_request_stream, + k5_ipc_stream *out_reply_stream) { - cc_int32 err = ccNoError; - cc_int32 done = 0; - cc_int32 try_count = 0; - cc_int32 server_died = 0; - mach_port_t server_port = MACH_PORT_NULL; - mach_port_t *request_port = NULL; - mach_port_t reply_port = MACH_PORT_NULL; - const char *inl_request = NULL; /* char * so we can pass the buffer in directly */ - mach_msg_type_number_t inl_request_length = 0; - cci_mipc_ool_request_t ool_request = NULL; - mach_msg_type_number_t ool_request_length = 0; - cci_stream_t reply_stream = NULL; - - if (!in_request_stream) { err = cci_check_error (ccErrBadParam); } - if (!out_reply_stream ) { err = cci_check_error (ccErrBadParam); } - - if (!err) { - /* depending on how big the message is, use the fast inline buffer or - * the slow dynamically allocated buffer */ - mach_msg_type_number_t request_length = cci_stream_size (in_request_stream); - - if (request_length > kCCAPIMaxILMsgSize) { - cci_debug_printf ("%s choosing out of line buffer (size is %d)", - __FUNCTION__, request_length); - - err = vm_read (mach_task_self (), - (vm_address_t) cci_stream_data (in_request_stream), request_length, - (vm_address_t *) &ool_request, &ool_request_length); - } else { - //cci_debug_printf ("%s choosing in line buffer (size is %d)", - // __FUNCTION__, request_length); - - inl_request_length = request_length; - inl_request = cci_stream_data (in_request_stream); - } - } - - if (!err) { - request_port = k5_getspecific (K5_KEY_CCAPI_REQUEST_PORT); - - if (!request_port) { - request_port = malloc (sizeof (mach_port_t)); - if (!request_port) { err = cci_check_error (ccErrNoMem); } - - if (!err) { - *request_port = MACH_PORT_NULL; - err = k5_setspecific (K5_KEY_CCAPI_REQUEST_PORT, request_port); - } - } - } - - if (!err) { - err = mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE, &reply_port); - } - - if (!err) { - err = kipc_client_lookup_server (cci_server_bundle_id, - in_launch_server, TRUE, &server_port); - } - - while (!err && !done) { - if (!err && !MACH_PORT_VALID (*request_port)) { - err = cci_mipc_create_client_connection (server_port, request_port); - } - - if (!err) { - err = cci_mipc_request (*request_port, reply_port, - inl_request, inl_request_length, - ool_request, ool_request_length); - - } - - if (err == MACH_SEND_INVALID_DEST) { - if (try_count < 2) { - try_count++; - err = ccNoError; - } - - if (request_port && MACH_PORT_VALID (*request_port)) { - mach_port_mod_refs (mach_task_self(), *request_port, MACH_PORT_RIGHT_SEND, -1 ); - *request_port = MACH_PORT_NULL; - } - - /* Look up server name again without using the cached copy */ - err = kipc_client_lookup_server (cci_server_bundle_id, - in_launch_server, FALSE, &server_port); - - } else { - /* Talked to server, though we may have gotten an error */ - done = 1; - - /* Because we use ",dealloc" ool_request will be freed by mach. - * Don't double free it. */ - ool_request = NULL; - ool_request_length = 0; - } - } - - if (!err) { - err = cci_stream_new (&reply_stream); - } - - if (!err) { - err = k5_setspecific (K5_KEY_CCAPI_REPLY_STREAM, reply_stream); - } - - if (!err) { - err = k5_setspecific (K5_KEY_CCAPI_SERVER_DIED, &server_died); - } - - if (!err) { - mach_port_t old_notification_target = MACH_PORT_NULL; - - /* request no-senders notification so we can get a message when server dies */ - err = mach_port_request_notification (mach_task_self (), reply_port, - MACH_NOTIFY_NO_SENDERS, 1, reply_port, - MACH_MSG_TYPE_MAKE_SEND_ONCE, - &old_notification_target); - - if (!err && old_notification_target != MACH_PORT_NULL) { - mach_port_deallocate (mach_task_self (), old_notification_target); - } - } - - if (!err) { - err = mach_msg_server_once (cci_server_demux, kkipc_max_message_size, - reply_port, MACH_MSG_TIMEOUT_NONE); - } - - if (!err && server_died) { - err = cci_check_error (ccErrServerUnavailable); - } - - if (err == BOOTSTRAP_UNKNOWN_SERVICE && !in_launch_server) { - err = ccNoError; /* If the server is not running just return an empty stream. */ - } - - if (!err) { - *out_reply_stream = reply_stream; - reply_stream = NULL; - } - - k5_setspecific (K5_KEY_CCAPI_REPLY_STREAM, NULL); - k5_setspecific (K5_KEY_CCAPI_SERVER_DIED, NULL); - if (reply_port != MACH_PORT_NULL) { mach_port_destroy (mach_task_self (), reply_port); } - if (ool_request_length ) { vm_deallocate (mach_task_self (), (vm_address_t) ool_request, ool_request_length); } - if (reply_stream ) { cci_stream_release (reply_stream); } - - return cci_check_error (err); + return cci_check_error (k5_ipc_send_request (cci_server_bundle_id, + in_launch_server, + in_request_stream, + out_reply_stream)); } diff --git a/src/ccapi/lib/win/ccapi_os_ipc.cxx b/src/ccapi/lib/win/ccapi_os_ipc.cxx index 4b00e2de3..6ccd59b9a 100644 --- a/src/ccapi/lib/win/ccapi_os_ipc.cxx +++ b/src/ccapi/lib/win/ccapi_os_ipc.cxx @@ -68,9 +68,9 @@ static DWORD handle_exception(DWORD code); extern "C" { cc_int32 cci_os_ipc_msg( cc_int32 in_launch_server, - cci_stream_t in_request_stream, + k5_ipc_stream in_request_stream, cc_int32 in_msg, - cci_stream_t* out_reply_stream); + k5_ipc_stream* out_reply_stream); } /* ------------------------------------------------------------------------ */ @@ -128,8 +128,8 @@ void cci_os_ipc_thread_fini (void) /* ------------------------------------------------------------------------ */ cc_int32 cci_os_ipc (cc_int32 in_launch_server, - cci_stream_t in_request_stream, - cci_stream_t* out_reply_stream) { + k5_ipc_stream in_request_stream, + k5_ipc_stream* out_reply_stream) { return cci_os_ipc_msg( in_launch_server, in_request_stream, CCMSG_REQUEST, @@ -137,9 +137,9 @@ cc_int32 cci_os_ipc (cc_int32 in_launch_server, } extern "C" cc_int32 cci_os_ipc_msg( cc_int32 in_launch_server, - cci_stream_t in_request_stream, + k5_ipc_stream in_request_stream, cc_int32 in_msg, - cci_stream_t* out_reply_stream) { + k5_ipc_stream* out_reply_stream) { cc_int32 err = ccNoError; cc_int32 done = FALSE; @@ -207,8 +207,8 @@ extern "C" cc_int32 cci_os_ipc_msg( cc_int32 in_launch_server, in_msg, /* Message type */ (unsigned char*)&ptspdata, /* Our tspdata* will be sent back to the reply proc. */ (unsigned char*)uuid, - cci_stream_size(in_request_stream), - (unsigned char*)cci_stream_data(in_request_stream), /* Data buffer */ + k5_ipc_stream_size(in_request_stream), + (unsigned char*)k5_ipc_stream_data(in_request_stream), /* Data buffer */ sst, /* session start time */ (long*)(&err) ); /* Return code */ } diff --git a/src/ccapi/lib/win/ccs_reply_proc.c b/src/ccapi/lib/win/ccs_reply_proc.c index 79f45e4c8..8eb340836 100644 --- a/src/ccapi/lib/win/ccs_reply_proc.c +++ b/src/ccapi/lib/win/ccs_reply_proc.c @@ -47,17 +47,17 @@ void ccs_rpc_request_reply( HANDLE hEvent = openThreadEvent(uuid, REPLY_SUFFIX); DWORD* p = (DWORD*)(tspHandle); struct tspdata* tsp = (struct tspdata*)*p; - cci_stream_t stream; + k5_ipc_stream stream; long status = 0; #if 0 cci_debug_printf("%s! msg#:%d SST:%ld uuid:%s", __FUNCTION__, rpcmsg, srvStartTime, uuid); #endif if (!status) { - status = cci_stream_new (&stream); /* Create a stream for the request data */ + status = k5_ipc_stream_new (&stream); /* Create a stream for the request data */ } if (!status) { /* Put the data into the stream */ - status = cci_stream_write (stream, chIn, cbIn); + status = k5_ipc_stream_write (stream, chIn, cbIn); } if (!status) { /* Put the data into the stream */ diff --git a/src/ccapi/lib/win/debug.exports b/src/ccapi/lib/win/debug.exports index 0c3765325..d7fbcc152 100644 --- a/src/ccapi/lib/win/debug.exports +++ b/src/ccapi/lib/win/debug.exports @@ -3,9 +3,9 @@ cci_os_ipc cci_os_ipc_msg cci_os_ipc_thread_init - cci_stream_data - cci_stream_write - cci_stream_new + k5_ipc_stream_data + k5_ipc_stream_write + k5_ipc_stream_new ccs_authenticate diff --git a/src/ccapi/server/ccs_cache_collection.c b/src/ccapi/server/ccs_cache_collection.c index 1a312b90e..b09ae8d8e 100644 --- a/src/ccapi/server/ccs_cache_collection.c +++ b/src/ccapi/server/ccs_cache_collection.c @@ -137,7 +137,7 @@ cc_int32 ccs_cache_collection_compare_identifier (ccs_cache_collection_t in_cac cc_int32 ccs_cache_collection_changed (ccs_cache_collection_t io_cache_collection) { cc_int32 err = ccNoError; - cci_stream_t reply_data = NULL; + k5_ipc_stream reply_data = NULL; if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); } @@ -152,11 +152,11 @@ cc_int32 ccs_cache_collection_changed (ccs_cache_collection_t io_cache_collectio } if (!err) { - err = cci_stream_new (&reply_data); + err = k5_ipc_stream_new (&reply_data); } if (!err) { - err = cci_stream_write_time (reply_data, io_cache_collection->last_changed_time); + err = k5_ipc_stream_write_time (reply_data, io_cache_collection->last_changed_time); } if (!err) { @@ -181,7 +181,7 @@ cc_int32 ccs_cache_collection_changed (ccs_cache_collection_t io_cache_collectio err = ccs_os_notify_cache_collection_changed (io_cache_collection); } - cci_stream_release (reply_data); + k5_ipc_stream_release (reply_data); return cci_check_error (err); } @@ -572,8 +572,8 @@ cc_int32 ccs_cache_collection_set_default_ccache (ccs_cache_collection_t io_cac /* ------------------------------------------------------------------------ */ static cc_int32 ccs_cache_collection_context_release (ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; @@ -591,8 +591,8 @@ static cc_int32 ccs_cache_collection_context_release (ccs_cache_collection_t io_ /* ------------------------------------------------------------------------ */ static cc_int32 ccs_cache_collection_sync (ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; @@ -610,8 +610,8 @@ static cc_int32 ccs_cache_collection_sync (ccs_cache_collection_t io_cache_colle /* ------------------------------------------------------------------------ */ static cc_int32 ccs_cache_collection_get_change_time (ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; @@ -620,7 +620,7 @@ static cc_int32 ccs_cache_collection_get_change_time (ccs_cache_collection_t io_ if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_write_time (io_reply_data, io_cache_collection->last_changed_time); + err = k5_ipc_stream_write_time (io_reply_data, io_cache_collection->last_changed_time); } return cci_check_error (err); @@ -631,8 +631,8 @@ static cc_int32 ccs_cache_collection_get_change_time (ccs_cache_collection_t io_ static cc_int32 ccs_cache_collection_wait_for_change (ccs_pipe_t in_client_pipe, ccs_pipe_t in_reply_pipe, ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data, + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data, cc_uint32 *out_will_block) { cc_int32 err = ccNoError; @@ -646,12 +646,12 @@ static cc_int32 ccs_cache_collection_wait_for_change (ccs_pipe_t in if (!out_will_block ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_read_time (in_request_data, &last_wait_for_change_time); + err = k5_ipc_stream_read_time (in_request_data, &last_wait_for_change_time); } if (!err) { if (last_wait_for_change_time < io_cache_collection->last_changed_time) { - err = cci_stream_write_time (io_reply_data, io_cache_collection->last_changed_time); + err = k5_ipc_stream_write_time (io_reply_data, io_cache_collection->last_changed_time); } else { ccs_callback_t callback = NULL; @@ -685,8 +685,8 @@ static cc_int32 ccs_cache_collection_wait_for_change (ccs_pipe_t in /* ------------------------------------------------------------------------ */ static cc_int32 ccs_cache_collection_get_default_ccache_name (ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; cc_uint64 count = 0; @@ -709,7 +709,7 @@ static cc_int32 ccs_cache_collection_get_default_ccache_name (ccs_cache_collecti err = ccs_ccache_write_name (ccache, io_reply_data); } } else { - err = cci_stream_write_string (io_reply_data, + err = k5_ipc_stream_write_string (io_reply_data, k_cci_context_initial_ccache_name); } } @@ -720,8 +720,8 @@ static cc_int32 ccs_cache_collection_get_default_ccache_name (ccs_cache_collecti /* ------------------------------------------------------------------------ */ static cc_int32 ccs_cache_collection_open_ccache (ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; char *name = NULL; @@ -732,7 +732,7 @@ static cc_int32 ccs_cache_collection_open_ccache (ccs_cache_collection_t io_cach if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_read_string (in_request_data, &name); + err = k5_ipc_stream_read_string (in_request_data, &name); } if (!err) { @@ -744,7 +744,7 @@ static cc_int32 ccs_cache_collection_open_ccache (ccs_cache_collection_t io_cach err = ccs_ccache_write (ccache, io_reply_data); } - free (name); + k5_ipc_stream_free_string (name); return cci_check_error (err); } @@ -752,8 +752,8 @@ static cc_int32 ccs_cache_collection_open_ccache (ccs_cache_collection_t io_cach /* ------------------------------------------------------------------------ */ static cc_int32 ccs_cache_collection_open_default_ccache (ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; ccs_ccache_t ccache = NULL; @@ -777,8 +777,8 @@ static cc_int32 ccs_cache_collection_open_default_ccache (ccs_cache_collection_t /* ------------------------------------------------------------------------ */ static cc_int32 ccs_cache_collection_create_ccache (ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; char *name = NULL; @@ -791,15 +791,15 @@ static cc_int32 ccs_cache_collection_create_ccache (ccs_cache_collection_t io_ca if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_read_string (in_request_data, &name); + err = k5_ipc_stream_read_string (in_request_data, &name); } if (!err) { - err = cci_stream_read_uint32 (in_request_data, &cred_vers); + err = k5_ipc_stream_read_uint32 (in_request_data, &cred_vers); } if (!err) { - err = cci_stream_read_string (in_request_data, &principal); + err = k5_ipc_stream_read_string (in_request_data, &principal); } if (!err) { @@ -824,8 +824,8 @@ static cc_int32 ccs_cache_collection_create_ccache (ccs_cache_collection_t io_ca err = ccs_cache_collection_changed (io_cache_collection); } - free (name); - free (principal); + k5_ipc_stream_free_string (name); + k5_ipc_stream_free_string (principal); return cci_check_error (err); } @@ -833,8 +833,8 @@ static cc_int32 ccs_cache_collection_create_ccache (ccs_cache_collection_t io_ca /* ------------------------------------------------------------------------ */ static cc_int32 ccs_cache_collection_create_default_ccache (ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; cc_uint32 cred_vers; @@ -846,11 +846,11 @@ static cc_int32 ccs_cache_collection_create_default_ccache (ccs_cache_collection if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_read_uint32 (in_request_data, &cred_vers); + err = k5_ipc_stream_read_uint32 (in_request_data, &cred_vers); } if (!err) { - err = cci_stream_read_string (in_request_data, &principal); + err = k5_ipc_stream_read_string (in_request_data, &principal); } if (!err) { @@ -883,7 +883,7 @@ static cc_int32 ccs_cache_collection_create_default_ccache (ccs_cache_collection err = ccs_cache_collection_changed (io_cache_collection); } - free (principal); + k5_ipc_stream_free_string (principal); return cci_check_error (err); } @@ -891,8 +891,8 @@ static cc_int32 ccs_cache_collection_create_default_ccache (ccs_cache_collection /* ------------------------------------------------------------------------ */ static cc_int32 ccs_cache_collection_create_new_ccache (ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; cc_uint32 cred_vers; @@ -905,11 +905,11 @@ static cc_int32 ccs_cache_collection_create_new_ccache (ccs_cache_collection_t i if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_read_uint32 (in_request_data, &cred_vers); + err = k5_ipc_stream_read_uint32 (in_request_data, &cred_vers); } if (!err) { - err = cci_stream_read_string (in_request_data, &principal); + err = k5_ipc_stream_read_string (in_request_data, &principal); } if (!err) { @@ -931,7 +931,7 @@ static cc_int32 ccs_cache_collection_create_new_ccache (ccs_cache_collection_t i } free (name); - free (principal); + k5_ipc_stream_free_string (principal); return cci_check_error (err); } @@ -940,8 +940,8 @@ static cc_int32 ccs_cache_collection_create_new_ccache (ccs_cache_collection_t i static cc_int32 ccs_cache_collection_new_ccache_iterator (ccs_cache_collection_t io_cache_collection, ccs_pipe_t in_client_pipe, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; ccs_ccache_iterator_t ccache_iterator = NULL; @@ -968,9 +968,9 @@ static cc_int32 ccs_cache_collection_new_ccache_iterator (ccs_cache_collection_ static cc_int32 ccs_cache_collection_lock (ccs_pipe_t in_client_pipe, ccs_pipe_t in_reply_pipe, ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, + k5_ipc_stream in_request_data, cc_uint32 *out_will_block, - cci_stream_t io_reply_data) + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; cc_uint32 lock_type; @@ -983,11 +983,11 @@ static cc_int32 ccs_cache_collection_lock (ccs_pipe_t in_client_pip if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_read_uint32 (in_request_data, &lock_type); + err = k5_ipc_stream_read_uint32 (in_request_data, &lock_type); } if (!err) { - err = cci_stream_read_uint32 (in_request_data, &block); + err = k5_ipc_stream_read_uint32 (in_request_data, &block); } if (!err) { @@ -1003,8 +1003,8 @@ static cc_int32 ccs_cache_collection_lock (ccs_pipe_t in_client_pip static cc_int32 ccs_cache_collection_unlock (ccs_pipe_t in_client_pipe, ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; @@ -1031,13 +1031,13 @@ static cc_int32 ccs_cache_collection_unlock (ccs_pipe_t in_client_pi ccs_pipe_t in_reply_pipe, ccs_cache_collection_t io_cache_collection, enum cci_msg_id_t in_request_name, - cci_stream_t in_request_data, + k5_ipc_stream in_request_data, cc_uint32 *out_will_block, - cci_stream_t *out_reply_data) + k5_ipc_stream *out_reply_data) { cc_int32 err = ccNoError; cc_uint32 will_block = 0; - cci_stream_t reply_data = NULL; + k5_ipc_stream reply_data = NULL; if (!ccs_pipe_valid (in_client_pipe)) { err = cci_check_error (ccErrBadParam); } if (!ccs_pipe_valid (in_reply_pipe) ) { err = cci_check_error (ccErrBadParam); } @@ -1047,7 +1047,7 @@ static cc_int32 ccs_cache_collection_unlock (ccs_pipe_t in_client_pi if (!out_reply_data ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&reply_data); + err = k5_ipc_stream_new (&reply_data); } if (!err) { @@ -1124,7 +1124,7 @@ static cc_int32 ccs_cache_collection_unlock (ccs_pipe_t in_client_pi } } - cci_stream_release (reply_data); + k5_ipc_stream_release (reply_data); return cci_check_error (err); } diff --git a/src/ccapi/server/ccs_cache_collection.h b/src/ccapi/server/ccs_cache_collection.h index b3278f7db..f0507967b 100644 --- a/src/ccapi/server/ccs_cache_collection.h +++ b/src/ccapi/server/ccs_cache_collection.h @@ -66,8 +66,8 @@ cc_int32 ccs_cache_collection_handle_message (ccs_pipe_t in_client_ ccs_pipe_t in_reply_pipe, ccs_cache_collection_t io_cache_collection, enum cci_msg_id_t in_request_name, - cci_stream_t in_request_data, + k5_ipc_stream in_request_data, cc_uint32 *out_will_block, - cci_stream_t *out_reply_data); + k5_ipc_stream *out_reply_data); #endif /* CCS_CACHE_COLLECTION_H */ diff --git a/src/ccapi/server/ccs_callback.c b/src/ccapi/server/ccs_callback.c index 6a5281c2f..94e9d9b4b 100644 --- a/src/ccapi/server/ccs_callback.c +++ b/src/ccapi/server/ccs_callback.c @@ -156,7 +156,7 @@ cc_int32 ccs_callback_invalidate (ccs_callback_t io_callback) /* ------------------------------------------------------------------------ */ cc_int32 ccs_callback_reply_to_client (ccs_callback_t io_callback, - cci_stream_t in_stream) + k5_ipc_stream in_stream) { cc_int32 err = ccNoError; diff --git a/src/ccapi/server/ccs_callback.h b/src/ccapi/server/ccs_callback.h index 3ebe28d47..26526984e 100644 --- a/src/ccapi/server/ccs_callback.h +++ b/src/ccapi/server/ccs_callback.h @@ -47,7 +47,7 @@ cc_int32 ccs_callback_release (ccs_callback_t io_callback); cc_int32 ccs_callback_invalidate (ccs_callback_t io_callback); cc_int32 ccs_callback_reply_to_client (ccs_callback_t io_callback, - cci_stream_t in_stream); + k5_ipc_stream in_stream); cc_uint32 ccs_callback_is_pending (ccs_callback_t in_callback, cc_uint32 *out_pending); diff --git a/src/ccapi/server/ccs_ccache.c b/src/ccapi/server/ccs_ccache.c index 35f70903c..88cf1e0d9 100644 --- a/src/ccapi/server/ccs_ccache.c +++ b/src/ccapi/server/ccs_ccache.c @@ -315,7 +315,7 @@ cc_int32 ccs_ccache_changed (ccs_ccache_t io_ccache, ccs_cache_collection_t io_cache_collection) { cc_int32 err = ccNoError; - cci_stream_t reply_data = NULL; + k5_ipc_stream reply_data = NULL; if (!io_ccache ) { err = cci_check_error (ccErrBadParam); } if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); } @@ -335,11 +335,11 @@ cc_int32 ccs_ccache_changed (ccs_ccache_t io_ccache, } if (!err) { - err = cci_stream_new (&reply_data); + err = k5_ipc_stream_new (&reply_data); } if (!err) { - err = cci_stream_write_time (reply_data, io_ccache->last_changed_time); + err = k5_ipc_stream_write_time (reply_data, io_ccache->last_changed_time); } if (!err) { @@ -365,7 +365,7 @@ cc_int32 ccs_ccache_changed (ccs_ccache_t io_ccache, io_ccache->name); } - cci_stream_release (reply_data); + k5_ipc_stream_release (reply_data); return cci_check_error (err); } @@ -461,7 +461,7 @@ cc_int32 ccs_ccache_find_credentials_iterator (ccs_ccache_t in_cc /* ------------------------------------------------------------------------ */ cc_int32 ccs_ccache_write (ccs_ccache_t in_ccache, - cci_stream_t io_stream) + k5_ipc_stream io_stream) { cc_int32 err = ccNoError; @@ -479,7 +479,7 @@ cc_int32 ccs_ccache_write (ccs_ccache_t in_ccache, /* ------------------------------------------------------------------------ */ cc_int32 ccs_ccache_write_name (ccs_ccache_t in_ccache, - cci_stream_t io_stream) + k5_ipc_stream io_stream) { cc_int32 err = ccNoError; @@ -487,7 +487,7 @@ cc_int32 ccs_ccache_write_name (ccs_ccache_t in_ccache, if (!io_stream) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_write_string (io_stream, in_ccache->name); + err = k5_ipc_stream_write_string (io_stream, in_ccache->name); } return cci_check_error (err); @@ -502,8 +502,8 @@ cc_int32 ccs_ccache_write_name (ccs_ccache_t in_ccache, static cc_int32 ccs_ccache_destroy (ccs_ccache_t io_ccache, ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; @@ -529,8 +529,8 @@ static cc_int32 ccs_ccache_destroy (ccs_ccache_t io_ccache, static cc_int32 ccs_ccache_set_default (ccs_ccache_t io_ccache, ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; @@ -551,8 +551,8 @@ static cc_int32 ccs_ccache_set_default (ccs_ccache_t io_ccache, static cc_int32 ccs_ccache_get_credentials_version (ccs_ccache_t io_ccache, ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; @@ -562,7 +562,7 @@ static cc_int32 ccs_ccache_get_credentials_version (ccs_ccache_t io_cc if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_write_uint32 (io_reply_data, io_ccache->creds_version); + err = k5_ipc_stream_write_uint32 (io_reply_data, io_ccache->creds_version); } return cci_check_error (err); @@ -572,8 +572,8 @@ static cc_int32 ccs_ccache_get_credentials_version (ccs_ccache_t io_cc static cc_int32 ccs_ccache_get_name (ccs_ccache_t io_ccache, ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; @@ -583,7 +583,7 @@ static cc_int32 ccs_ccache_get_name (ccs_ccache_t io_ccache, if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_write_string (io_reply_data, io_ccache->name); + err = k5_ipc_stream_write_string (io_reply_data, io_ccache->name); } return cci_check_error (err); @@ -593,8 +593,8 @@ static cc_int32 ccs_ccache_get_name (ccs_ccache_t io_ccache, static cc_int32 ccs_ccache_get_principal (ccs_ccache_t io_ccache, ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; cc_uint32 version = 0; @@ -605,7 +605,7 @@ static cc_int32 ccs_ccache_get_principal (ccs_ccache_t io_ccache, if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_read_uint32 (in_request_data, &version); + err = k5_ipc_stream_read_uint32 (in_request_data, &version); } if (!err && version == cc_credentials_v4_v5) { @@ -614,10 +614,10 @@ static cc_int32 ccs_ccache_get_principal (ccs_ccache_t io_ccache, if (!err) { if (version == cc_credentials_v4) { - err = cci_stream_write_string (io_reply_data, io_ccache->v4_principal); + err = k5_ipc_stream_write_string (io_reply_data, io_ccache->v4_principal); } else if (version == cc_credentials_v5) { - err = cci_stream_write_string (io_reply_data, io_ccache->v5_principal); + err = k5_ipc_stream_write_string (io_reply_data, io_ccache->v5_principal); } else { err = cci_check_error (ccErrBadCredentialsVersion); @@ -631,8 +631,8 @@ static cc_int32 ccs_ccache_get_principal (ccs_ccache_t io_ccache, static cc_int32 ccs_ccache_set_principal (ccs_ccache_t io_ccache, ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; cc_uint32 version = 0; @@ -644,11 +644,11 @@ static cc_int32 ccs_ccache_set_principal (ccs_ccache_t io_ccache, if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_read_uint32 (in_request_data, &version); + err = k5_ipc_stream_read_uint32 (in_request_data, &version); } if (!err) { - err = cci_stream_read_string (in_request_data, &principal); + err = k5_ipc_stream_read_string (in_request_data, &principal); } if (!err) { @@ -681,7 +681,7 @@ static cc_int32 ccs_ccache_set_principal (ccs_ccache_t io_ccache, err = ccs_ccache_changed (io_ccache, io_cache_collection); } - free (principal); + k5_ipc_stream_free_string (principal); return cci_check_error (err); } @@ -690,8 +690,8 @@ static cc_int32 ccs_ccache_set_principal (ccs_ccache_t io_ccache, static cc_int32 ccs_ccache_store_credentials (ccs_ccache_t io_ccache, ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; ccs_credentials_t credentials = NULL; @@ -719,8 +719,8 @@ static cc_int32 ccs_ccache_store_credentials (ccs_ccache_t io_ccache, static cc_int32 ccs_ccache_remove_credentials (ccs_ccache_t io_ccache, ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; cci_identifier_t credentials_identifier = NULL; @@ -752,8 +752,8 @@ static cc_int32 ccs_ccache_remove_credentials (ccs_ccache_t io_ccache, static cc_int32 ccs_ccache_new_credentials_iterator (ccs_ccache_t io_ccache, ccs_cache_collection_t io_cache_collection, ccs_pipe_t in_client_pipe, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; ccs_credentials_iterator_t credentials_iterator = NULL; @@ -780,8 +780,8 @@ static cc_int32 ccs_ccache_new_credentials_iterator (ccs_ccache_t io_c static cc_int32 ccs_ccache_move (ccs_ccache_t io_ccache, ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; cci_identifier_t source_identifier = NULL; @@ -818,9 +818,9 @@ static cc_int32 ccs_ccache_lock (ccs_pipe_t in_client_pipe, ccs_pipe_t in_reply_pipe, ccs_ccache_t io_ccache, ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, + k5_ipc_stream in_request_data, cc_uint32 *out_will_block, - cci_stream_t io_reply_data) + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; cc_uint32 lock_type; @@ -834,11 +834,11 @@ static cc_int32 ccs_ccache_lock (ccs_pipe_t in_client_pipe, if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_read_uint32 (in_request_data, &lock_type); + err = k5_ipc_stream_read_uint32 (in_request_data, &lock_type); } if (!err) { - err = cci_stream_read_uint32 (in_request_data, &block); + err = k5_ipc_stream_read_uint32 (in_request_data, &block); } if (!err) { @@ -855,8 +855,8 @@ static cc_int32 ccs_ccache_lock (ccs_pipe_t in_client_pipe, static cc_int32 ccs_ccache_unlock (ccs_pipe_t in_client_pipe, ccs_ccache_t io_ccache, ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; @@ -877,8 +877,8 @@ static cc_int32 ccs_ccache_unlock (ccs_pipe_t in_client_pipe, static cc_int32 ccs_ccache_get_last_default_time (ccs_ccache_t io_ccache, ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; @@ -892,7 +892,7 @@ static cc_int32 ccs_ccache_get_last_default_time (ccs_ccache_t io_ccac } if (!err) { - err = cci_stream_write_time (io_reply_data, io_ccache->last_default_time); + err = k5_ipc_stream_write_time (io_reply_data, io_ccache->last_default_time); } return cci_check_error (err); @@ -902,8 +902,8 @@ static cc_int32 ccs_ccache_get_last_default_time (ccs_ccache_t io_ccac static cc_int32 ccs_ccache_get_change_time (ccs_ccache_t io_ccache, ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; @@ -913,7 +913,7 @@ static cc_int32 ccs_ccache_get_change_time (ccs_ccache_t io_ccache, if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_write_time (io_reply_data, io_ccache->last_changed_time); + err = k5_ipc_stream_write_time (io_reply_data, io_ccache->last_changed_time); } return cci_check_error (err); @@ -925,8 +925,8 @@ static cc_int32 ccs_ccache_wait_for_change (ccs_pipe_t in_client_pi ccs_pipe_t in_reply_pipe, ccs_ccache_t io_ccache, ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data, + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data, cc_uint32 *out_will_block) { cc_int32 err = ccNoError; @@ -941,13 +941,13 @@ static cc_int32 ccs_ccache_wait_for_change (ccs_pipe_t in_client_pi if (!out_will_block ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_read_time (in_request_data, &last_wait_for_change_time); + err = k5_ipc_stream_read_time (in_request_data, &last_wait_for_change_time); } if (!err) { if (last_wait_for_change_time < io_ccache->last_changed_time) { cci_debug_printf ("%s returning immediately", __FUNCTION__); - err = cci_stream_write_time (io_reply_data, io_ccache->last_changed_time); + err = k5_ipc_stream_write_time (io_reply_data, io_ccache->last_changed_time); } else { ccs_callback_t callback = NULL; @@ -983,8 +983,8 @@ static cc_int32 ccs_ccache_wait_for_change (ccs_pipe_t in_client_pi static cc_int32 ccs_ccache_get_kdc_time_offset (ccs_ccache_t io_ccache, ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; cc_uint32 cred_vers = 0; @@ -995,20 +995,20 @@ static cc_int32 ccs_ccache_get_kdc_time_offset (ccs_ccache_t io_ccache if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_read_uint32 (in_request_data, &cred_vers); + err = k5_ipc_stream_read_uint32 (in_request_data, &cred_vers); } if (!err) { if (cred_vers == cc_credentials_v4) { if (io_ccache->kdc_time_offset_v4_valid) { - err = cci_stream_write_time (io_reply_data, io_ccache->kdc_time_offset_v4); + err = k5_ipc_stream_write_time (io_reply_data, io_ccache->kdc_time_offset_v4); } else { err = cci_check_error (ccErrTimeOffsetNotSet); } } else if (cred_vers == cc_credentials_v5) { if (io_ccache->kdc_time_offset_v5_valid) { - err = cci_stream_write_time (io_reply_data, io_ccache->kdc_time_offset_v5); + err = k5_ipc_stream_write_time (io_reply_data, io_ccache->kdc_time_offset_v5); } else { err = cci_check_error (ccErrTimeOffsetNotSet); } @@ -1025,8 +1025,8 @@ static cc_int32 ccs_ccache_get_kdc_time_offset (ccs_ccache_t io_ccache static cc_int32 ccs_ccache_set_kdc_time_offset (ccs_ccache_t io_ccache, ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; cc_uint32 cred_vers = 0; @@ -1037,18 +1037,18 @@ static cc_int32 ccs_ccache_set_kdc_time_offset (ccs_ccache_t io_ccache if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_read_uint32 (in_request_data, &cred_vers); + err = k5_ipc_stream_read_uint32 (in_request_data, &cred_vers); } if (!err) { if (cred_vers == cc_credentials_v4) { - err = cci_stream_read_time (in_request_data, &io_ccache->kdc_time_offset_v4); + err = k5_ipc_stream_read_time (in_request_data, &io_ccache->kdc_time_offset_v4); if (!err) { io_ccache->kdc_time_offset_v4_valid = 1; } } else if (cred_vers == cc_credentials_v5) { - err = cci_stream_read_time (in_request_data, &io_ccache->kdc_time_offset_v5); + err = k5_ipc_stream_read_time (in_request_data, &io_ccache->kdc_time_offset_v5); if (!err) { io_ccache->kdc_time_offset_v5_valid = 1; @@ -1069,8 +1069,8 @@ static cc_int32 ccs_ccache_set_kdc_time_offset (ccs_ccache_t io_ccache static cc_int32 ccs_ccache_clear_kdc_time_offset (ccs_ccache_t io_ccache, ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; cc_uint32 cred_vers = 0; @@ -1081,7 +1081,7 @@ static cc_int32 ccs_ccache_clear_kdc_time_offset (ccs_ccache_t io_ccac if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_read_uint32 (in_request_data, &cred_vers); + err = k5_ipc_stream_read_uint32 (in_request_data, &cred_vers); } if (!err) { @@ -1116,13 +1116,13 @@ cc_int32 ccs_ccache_handle_message (ccs_pipe_t in_client_pipe, ccs_ccache_t io_ccache, ccs_cache_collection_t io_cache_collection, enum cci_msg_id_t in_request_name, - cci_stream_t in_request_data, + k5_ipc_stream in_request_data, cc_uint32 *out_will_block, - cci_stream_t *out_reply_data) + k5_ipc_stream *out_reply_data) { cc_int32 err = ccNoError; cc_uint32 will_block = 0; - cci_stream_t reply_data = NULL; + k5_ipc_stream reply_data = NULL; if (!ccs_pipe_valid (in_client_pipe)) { err = cci_check_error (ccErrBadParam); } if (!ccs_pipe_valid (in_reply_pipe) ) { err = cci_check_error (ccErrBadParam); } @@ -1132,7 +1132,7 @@ cc_int32 ccs_ccache_handle_message (ccs_pipe_t in_client_pipe, if (!out_reply_data ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&reply_data); + err = k5_ipc_stream_new (&reply_data); } if (!err) { @@ -1231,7 +1231,7 @@ cc_int32 ccs_ccache_handle_message (ccs_pipe_t in_client_pipe, } } - cci_stream_release (reply_data); + k5_ipc_stream_release (reply_data); return cci_check_error (err); } diff --git a/src/ccapi/server/ccs_ccache.h b/src/ccapi/server/ccs_ccache.h index 3e9f6ae85..21c9f410f 100644 --- a/src/ccapi/server/ccs_ccache.h +++ b/src/ccapi/server/ccs_ccache.h @@ -66,18 +66,18 @@ cc_int32 ccs_ccache_find_credentials_iterator (ccs_ccache_t in_cc ccs_credentials_iterator_t *out_credentials_iterator); cc_int32 ccs_ccache_write (ccs_ccache_t in_ccache, - cci_stream_t io_stream); + k5_ipc_stream io_stream); cc_int32 ccs_ccache_write_name (ccs_ccache_t in_ccache, - cci_stream_t io_stream); + k5_ipc_stream io_stream); cc_int32 ccs_ccache_handle_message (ccs_pipe_t in_client_pipe, ccs_pipe_t in_reply_pipe, ccs_ccache_t io_ccache, ccs_cache_collection_t io_cache_collection, enum cci_msg_id_t in_request_name, - cci_stream_t in_request_data, + k5_ipc_stream in_request_data, cc_uint32 *out_will_block, - cci_stream_t *out_reply_data); + k5_ipc_stream *out_reply_data); #endif /* CCS_CCACHE_H */ diff --git a/src/ccapi/server/ccs_ccache_iterator.c b/src/ccapi/server/ccs_ccache_iterator.c index 77d8eda45..0e0505644 100644 --- a/src/ccapi/server/ccs_ccache_iterator.c +++ b/src/ccapi/server/ccs_ccache_iterator.c @@ -30,8 +30,8 @@ static cc_int32 ccs_ccache_iterator_release (ccs_ccache_iterator_t io_ccache_iterator, ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; @@ -51,8 +51,8 @@ static cc_int32 ccs_ccache_iterator_release (ccs_ccache_iterator_t io_ccache_i static cc_int32 ccs_ccache_iterator_next (ccs_ccache_iterator_t io_ccache_iterator, ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; ccs_ccache_t ccache = NULL; @@ -77,8 +77,8 @@ static cc_int32 ccs_ccache_iterator_next (ccs_ccache_iterator_t io_ccache_iter static cc_int32 ccs_ccache_iterator_clone (ccs_ccache_iterator_t io_ccache_iterator, ccs_cache_collection_t io_cache_collection, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; ccs_ccache_iterator_t ccache_iterator = NULL; @@ -109,17 +109,17 @@ static cc_int32 ccs_ccache_iterator_clone (ccs_ccache_iterator_t io_ccache_ite cc_int32 ccs_ccache_iterator_handle_message (ccs_ccache_iterator_t io_ccache_iterator, ccs_cache_collection_t io_cache_collection, enum cci_msg_id_t in_request_name, - cci_stream_t in_request_data, - cci_stream_t *out_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream *out_reply_data) { cc_int32 err = ccNoError; - cci_stream_t reply_data = NULL; + k5_ipc_stream reply_data = NULL; if (!in_request_data) { err = cci_check_error (ccErrBadParam); } if (!out_reply_data ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&reply_data); + err = k5_ipc_stream_new (&reply_data); } if (!err) { @@ -151,7 +151,7 @@ static cc_int32 ccs_ccache_iterator_clone (ccs_ccache_iterator_t io_ccache_ite reply_data = NULL; /* take ownership */ } - cci_stream_release (reply_data); + k5_ipc_stream_release (reply_data); return cci_check_error (err); } diff --git a/src/ccapi/server/ccs_ccache_iterator.h b/src/ccapi/server/ccs_ccache_iterator.h index 8ec361a67..642ebcc5b 100644 --- a/src/ccapi/server/ccs_ccache_iterator.h +++ b/src/ccapi/server/ccs_ccache_iterator.h @@ -32,7 +32,7 @@ cc_int32 ccs_ccache_iterator_handle_message (ccs_ccache_iterator_t io_ccache_iterator, ccs_cache_collection_t io_cache_collection, enum cci_msg_id_t in_request_name, - cci_stream_t in_request_data, - cci_stream_t *out_reply_data); + k5_ipc_stream in_request_data, + k5_ipc_stream *out_reply_data); #endif /* CCS_CCACHE_ITERATOR_H */ diff --git a/src/ccapi/server/ccs_credentials.c b/src/ccapi/server/ccs_credentials.c index 72721e68a..56b5a5799 100644 --- a/src/ccapi/server/ccs_credentials.c +++ b/src/ccapi/server/ccs_credentials.c @@ -36,7 +36,7 @@ struct ccs_credentials_d ccs_credentials_initializer = { NULL, NULL }; /* ------------------------------------------------------------------------ */ cc_int32 ccs_credentials_new (ccs_credentials_t *out_credentials, - cci_stream_t in_stream, + k5_ipc_stream in_stream, cc_uint32 in_ccache_version, ccs_credentials_list_t io_credentials_list) { @@ -100,7 +100,7 @@ cc_int32 ccs_credentials_release (ccs_credentials_t io_credentials) /* ------------------------------------------------------------------------ */ cc_int32 ccs_credentials_write (ccs_credentials_t in_credentials, - cci_stream_t io_stream) + k5_ipc_stream io_stream) { cc_int32 err = ccNoError; diff --git a/src/ccapi/server/ccs_credentials.h b/src/ccapi/server/ccs_credentials.h index b9219aa40..24b279484 100644 --- a/src/ccapi/server/ccs_credentials.h +++ b/src/ccapi/server/ccs_credentials.h @@ -31,14 +31,14 @@ cc_int32 ccs_credentials_new (ccs_credentials_t *out_credentials, - cci_stream_t in_stream, + k5_ipc_stream in_stream, cc_uint32 in_ccache_version, ccs_credentials_list_t io_credentials_list); cc_int32 ccs_credentials_release (ccs_credentials_t io_credentials); cc_int32 ccs_credentials_write (ccs_credentials_t in_credentials, - cci_stream_t io_stream); + k5_ipc_stream io_stream); cc_int32 ccs_credentials_compare_identifier (ccs_credentials_t in_credentials, cci_identifier_t in_identifier, diff --git a/src/ccapi/server/ccs_credentials_iterator.c b/src/ccapi/server/ccs_credentials_iterator.c index b13a294b1..38e323c26 100644 --- a/src/ccapi/server/ccs_credentials_iterator.c +++ b/src/ccapi/server/ccs_credentials_iterator.c @@ -30,8 +30,8 @@ static cc_int32 ccs_credentials_iterator_release (ccs_credentials_iterator_t io_credentials_iterator, ccs_ccache_t io_ccache, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; @@ -51,8 +51,8 @@ static cc_int32 ccs_credentials_iterator_release (ccs_credentials_iterator_t io_ static cc_int32 ccs_credentials_iterator_next (ccs_credentials_iterator_t io_credentials_iterator, ccs_ccache_t io_ccache, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; ccs_credentials_t credentials = NULL; @@ -78,8 +78,8 @@ static cc_int32 ccs_credentials_iterator_next (ccs_credentials_iterator_t io_cre static cc_int32 ccs_credentials_iterator_clone (ccs_credentials_iterator_t io_credentials_iterator, ccs_ccache_t io_ccache, - cci_stream_t in_request_data, - cci_stream_t io_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; ccs_credentials_iterator_t credentials_iterator = NULL; @@ -111,17 +111,17 @@ static cc_int32 ccs_credentials_iterator_clone (ccs_credentials_iterator_t io_c cc_int32 ccs_credentials_iterator_handle_message (ccs_credentials_iterator_t io_credentials_iterator, ccs_ccache_t io_ccache, enum cci_msg_id_t in_request_name, - cci_stream_t in_request_data, - cci_stream_t *out_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream *out_reply_data) { cc_int32 err = ccNoError; - cci_stream_t reply_data = NULL; + k5_ipc_stream reply_data = NULL; if (!in_request_data) { err = cci_check_error (ccErrBadParam); } if (!out_reply_data ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&reply_data); + err = k5_ipc_stream_new (&reply_data); } if (!err) { @@ -153,7 +153,7 @@ static cc_int32 ccs_credentials_iterator_clone (ccs_credentials_iterator_t io_c reply_data = NULL; /* take ownership */ } - cci_stream_release (reply_data); + k5_ipc_stream_release (reply_data); return cci_check_error (err); } diff --git a/src/ccapi/server/ccs_credentials_iterator.h b/src/ccapi/server/ccs_credentials_iterator.h index af3cf1a18..84ff0ba00 100644 --- a/src/ccapi/server/ccs_credentials_iterator.h +++ b/src/ccapi/server/ccs_credentials_iterator.h @@ -32,7 +32,7 @@ cc_int32 ccs_credentials_iterator_handle_message (ccs_credentials_iterator_t io_credentials_iterator, ccs_ccache_t io_ccache, enum cci_msg_id_t in_request_name, - cci_stream_t in_request_data, - cci_stream_t *out_reply_data); + k5_ipc_stream in_request_data, + k5_ipc_stream *out_reply_data); #endif /* CCS_CREDENTIALS_ITERATOR_H */ diff --git a/src/ccapi/server/ccs_list.c b/src/ccapi/server/ccs_list.c index 2743994a1..c5b1eb421 100644 --- a/src/ccapi/server/ccs_list.c +++ b/src/ccapi/server/ccs_list.c @@ -199,7 +199,7 @@ cc_int32 ccs_ccache_list_release (ccs_ccache_list_t io_list) /* ------------------------------------------------------------------------ */ cc_int32 ccs_ccache_list_iterator_write (ccs_ccache_list_iterator_t in_list_iterator, - cci_stream_t in_stream) + k5_ipc_stream in_stream) { return ccs_list_iterator_write (in_list_iterator, in_stream); } @@ -322,7 +322,7 @@ cc_int32 ccs_credentials_list_release (ccs_credentials_list_t io_list) /* ------------------------------------------------------------------------ */ cc_int32 ccs_credentials_list_iterator_write (ccs_credentials_list_iterator_t in_list_iterator, - cci_stream_t in_stream) + k5_ipc_stream in_stream) { return ccs_list_iterator_write (in_list_iterator, in_stream); } diff --git a/src/ccapi/server/ccs_list.h b/src/ccapi/server/ccs_list.h index fff2f5421..e48d4c4f1 100644 --- a/src/ccapi/server/ccs_list.h +++ b/src/ccapi/server/ccs_list.h @@ -81,7 +81,7 @@ cc_int32 ccs_ccache_list_release (ccs_ccache_list_t io_list); cc_int32 ccs_ccache_list_iterator_write (ccs_ccache_list_iterator_t in_list_iterator, - cci_stream_t in_stream); + k5_ipc_stream in_stream); cc_int32 ccs_ccache_list_iterator_clone (ccs_ccache_list_iterator_t in_list_iterator, ccs_ccache_list_iterator_t *out_list_iterator); @@ -122,7 +122,7 @@ cc_int32 ccs_credentials_list_release (ccs_credentials_list_t io_list); cc_int32 ccs_credentials_list_iterator_write (ccs_credentials_list_iterator_t in_list_iterator, - cci_stream_t in_stream); + k5_ipc_stream in_stream); cc_int32 ccs_credentials_list_iterator_clone (ccs_credentials_list_iterator_t in_list_iterator, ccs_credentials_list_iterator_t *out_list_iterator); diff --git a/src/ccapi/server/ccs_list_internal.c b/src/ccapi/server/ccs_list_internal.c index 1a8d0c639..74bc45a6a 100644 --- a/src/ccapi/server/ccs_list_internal.c +++ b/src/ccapi/server/ccs_list_internal.c @@ -477,7 +477,7 @@ static cc_int32 ccs_list_iterator_new (ccs_list_iterator_t *out_list_iterator, /* ------------------------------------------------------------------------ */ cc_int32 ccs_list_iterator_write (ccs_list_iterator_t in_list_iterator, - cci_stream_t in_stream) + k5_ipc_stream in_stream) { cc_int32 err = ccNoError; diff --git a/src/ccapi/server/ccs_list_internal.h b/src/ccapi/server/ccs_list_internal.h index 1ab6aa4c1..d659fbe10 100644 --- a/src/ccapi/server/ccs_list_internal.h +++ b/src/ccapi/server/ccs_list_internal.h @@ -77,7 +77,7 @@ cc_int32 ccs_list_push_front (ccs_list_t io_list, cc_int32 ccs_list_iterator_write (ccs_list_iterator_t in_list_iterator, - cci_stream_t in_stream); + k5_ipc_stream in_stream); cc_int32 ccs_list_iterator_clone (ccs_list_iterator_t in_list_iterator, ccs_list_iterator_t *out_list_iterator); diff --git a/src/ccapi/server/ccs_os_server.h b/src/ccapi/server/ccs_os_server.h index c447ae4d0..8212028d6 100644 --- a/src/ccapi/server/ccs_os_server.h +++ b/src/ccapi/server/ccs_os_server.h @@ -36,6 +36,6 @@ cc_int32 ccs_os_server_cleanup (int argc, const char *argv[]); cc_int32 ccs_os_server_listen_loop (int argc, const char *argv[]); cc_int32 ccs_os_server_send_reply (ccs_pipe_t in_reply_pipe, - cci_stream_t in_reply_stream); + k5_ipc_stream in_reply_stream); #endif /* CCS_OS_SERVER_H */ diff --git a/src/ccapi/server/ccs_server.c b/src/ccapi/server/ccs_server.c index 5954d661c..c1bbe539a 100644 --- a/src/ccapi/server/ccs_server.c +++ b/src/ccapi/server/ccs_server.c @@ -207,9 +207,9 @@ static cc_int32 ccs_server_request_demux (ccs_pipe_t in_client_pipe ccs_cache_collection_t in_cache_collection, enum cci_msg_id_t in_request_name, cci_identifier_t in_request_identifier, - cci_stream_t in_request_data, + k5_ipc_stream in_request_data, cc_uint32 *out_will_block, - cci_stream_t *out_reply_data) + k5_ipc_stream *out_reply_data) { cc_int32 err = ccNoError; @@ -311,13 +311,13 @@ static cc_int32 ccs_server_request_demux (ccs_pipe_t in_client_pipe cc_int32 ccs_server_handle_request (ccs_pipe_t in_client_pipe, ccs_pipe_t in_reply_pipe, - cci_stream_t in_request) + k5_ipc_stream in_request) { cc_int32 err = ccNoError; enum cci_msg_id_t request_name = 0; cci_identifier_t request_identifier = NULL; cc_uint32 will_block = 0; - cci_stream_t reply_data = NULL; + k5_ipc_stream reply_data = NULL; if (!ccs_pipe_valid (in_client_pipe)) { err = cci_check_error (ccErrBadParam); } if (!ccs_pipe_valid (in_reply_pipe) ) { err = cci_check_error (ccErrBadParam); } @@ -366,7 +366,7 @@ cc_int32 ccs_server_handle_request (ccs_pipe_t in_client_pipe, } cci_identifier_release (request_identifier); - cci_stream_release (reply_data); + k5_ipc_stream_release (reply_data); return cci_check_error (err); } @@ -375,10 +375,10 @@ cc_int32 ccs_server_handle_request (ccs_pipe_t in_client_pipe, cc_int32 ccs_server_send_reply (ccs_pipe_t in_reply_pipe, cc_int32 in_reply_err, - cci_stream_t in_reply_data) + k5_ipc_stream in_reply_data) { cc_int32 err = ccNoError; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; if (!ccs_pipe_valid (in_reply_pipe) ) { err = cci_check_error (ccErrBadParam); } @@ -386,17 +386,17 @@ cc_int32 ccs_server_send_reply (ccs_pipe_t in_reply_pipe, err = cci_message_new_reply_header (&reply, in_reply_err); } - if (!err && in_reply_data && cci_stream_size (in_reply_data) > 0) { - err = cci_stream_write (reply, - cci_stream_data (in_reply_data), - cci_stream_size (in_reply_data)); + if (!err && in_reply_data && k5_ipc_stream_size (in_reply_data) > 0) { + err = k5_ipc_stream_write (reply, + k5_ipc_stream_data (in_reply_data), + k5_ipc_stream_size (in_reply_data)); } if (!err) { err = ccs_os_server_send_reply (in_reply_pipe, reply); } - cci_stream_release (reply); + k5_ipc_stream_release (reply); return cci_check_error (err); } diff --git a/src/ccapi/server/ccs_server.h b/src/ccapi/server/ccs_server.h index 670a74ee2..e059d86bc 100644 --- a/src/ccapi/server/ccs_server.h +++ b/src/ccapi/server/ccs_server.h @@ -43,10 +43,10 @@ cc_int32 ccs_server_client_is_valid (ccs_pipe_t in_client_pipe, cc_int32 ccs_server_handle_request (ccs_pipe_t in_client_pipe, ccs_pipe_t in_reply_pipe, - cci_stream_t in_request); + k5_ipc_stream in_request); cc_int32 ccs_server_send_reply (ccs_pipe_t in_reply_pipe, cc_int32 in_reply_err, - cci_stream_t in_reply_data); + k5_ipc_stream in_reply_data); #endif /* CCS_SERVER_H */ diff --git a/src/ccapi/server/mac/ccs_os_server.c b/src/ccapi/server/mac/ccs_os_server.c index c99547fe8..98bc6b30a 100644 --- a/src/ccapi/server/mac/ccs_os_server.c +++ b/src/ccapi/server/mac/ccs_os_server.c @@ -27,118 +27,33 @@ #include "ccs_common.h" #include -#include -#include "cci_mig_requestServer.h" -#include "cci_mig_reply.h" +#include "k5_mig_server.h" #include "ccs_os_server.h" - /* ------------------------------------------------------------------------ */ -static boolean_t ccs_server_demux (mach_msg_header_t *request, - mach_msg_header_t *reply) +int32_t k5_ipc_server_add_client (mach_port_t in_client_port) { - boolean_t handled = false; - - if (!handled) { - handled = ccs_server (request, reply); - } - - if (!handled && request->msgh_id == MACH_NOTIFY_NO_SENDERS) { - kern_return_t err = KERN_SUCCESS; - - err = ccs_server_remove_client (request->msgh_local_port); - - if (!err) { - /* Check here for a client in our table and free rights associated with it */ - err = mach_port_mod_refs (mach_task_self (), request->msgh_local_port, - MACH_PORT_RIGHT_RECEIVE, -1); - } - - if (!err) { - handled = 1; /* was a port we are tracking */ - } - - cci_check_error (err); - } - - return handled; + return cci_check_error (ccs_server_add_client (in_client_port)); } /* ------------------------------------------------------------------------ */ -kern_return_t ccs_mipc_create_client_connection (mach_port_t in_server_port, - mach_port_t *out_connection_port) +int32_t k5_ipc_server_remove_client (mach_port_t in_client_port) { - kern_return_t err = KERN_SUCCESS; - mach_port_t connection_port = MACH_PORT_NULL; - mach_port_t old_notification_target = MACH_PORT_NULL; - - if (!err) { - err = mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE, &connection_port); - } - - if (!err) { - err = mach_port_move_member (mach_task_self (), connection_port, kipc_server_get_listen_portset ()); - } - - if (!err) { - /* request no-senders notification so we can tell when client quits/crashes */ - err = mach_port_request_notification (mach_task_self (), connection_port, - MACH_NOTIFY_NO_SENDERS, 1, connection_port, - MACH_MSG_TYPE_MAKE_SEND_ONCE, &old_notification_target ); - } - - if (!err) { - err = ccs_server_add_client (connection_port); - } - - if (!err) { - *out_connection_port = connection_port; - connection_port = MACH_PORT_NULL; - } - - if (MACH_PORT_VALID (connection_port)) { mach_port_deallocate (mach_task_self (), connection_port); } - - return cci_check_error (err); + return cci_check_error (ccs_server_remove_client (in_client_port)); } + /* ------------------------------------------------------------------------ */ -kern_return_t ccs_mipc_request (mach_port_t in_connection_port, - mach_port_t in_reply_port, - cci_mipc_inl_request_t in_inl_request, - mach_msg_type_number_t in_inl_requestCnt, - cci_mipc_ool_request_t in_ool_request, - mach_msg_type_number_t in_ool_requestCnt) +kern_return_t k5_ipc_server_handle_request (mach_port_t in_connection_port, + mach_port_t in_reply_port, + k5_ipc_stream in_request_stream) { - kern_return_t err = KERN_SUCCESS; - cci_stream_t request_stream = NULL; - - if (!err) { - err = cci_stream_new (&request_stream); - } - - if (!err) { - if (in_inl_requestCnt) { - err = cci_stream_write (request_stream, in_inl_request, in_inl_requestCnt); - - } else if (in_ool_requestCnt) { - err = cci_stream_write (request_stream, in_ool_request, in_ool_requestCnt); - - } else { - err = cci_check_error (ccErrBadInternalMessage); - } - } - - if (!err) { - err = ccs_server_handle_request (in_connection_port, in_reply_port, request_stream); - } - - cci_stream_release (request_stream); - if (in_ool_requestCnt) { vm_deallocate (mach_task_self (), (vm_address_t) in_ool_request, in_ool_requestCnt); } - - return cci_check_error (err); + return cci_check_error (ccs_server_handle_request (in_connection_port, + in_reply_port, + in_request_stream)); } #pragma mark - @@ -152,8 +67,6 @@ cc_int32 ccs_os_server_initialize (int argc, const char *argv[]) openlog (argv[0], LOG_CONS | LOG_PID, LOG_AUTH); syslog (LOG_INFO, "Starting up."); - syslog (LOG_NOTICE, "Exiting: %s (%d)", kipc_error_string (err), err); - return cci_check_error (err); } @@ -163,10 +76,7 @@ cc_int32 ccs_os_server_cleanup (int argc, const char *argv[]) { cc_int32 err = 0; - openlog (argv[0], LOG_CONS | LOG_PID, LOG_AUTH); - syslog (LOG_INFO, "Starting up."); - - syslog (LOG_NOTICE, "Exiting: %s (%d)", kipc_error_string (err), err); + syslog (LOG_NOTICE, "Exiting."); return cci_check_error (err); } @@ -175,64 +85,14 @@ cc_int32 ccs_os_server_cleanup (int argc, const char *argv[]) cc_int32 ccs_os_server_listen_loop (int argc, const char *argv[]) { - /* Run the Mach IPC listen loop. - * This will call ccs_mipc_create_client_connection for new clients - * and ccs_mipc_request for existing clients */ - - return cci_check_error (kipc_server_run_server (ccs_server_demux)); + return cci_check_error (k5_ipc_server_listen_loop ()); } /* ------------------------------------------------------------------------ */ cc_int32 ccs_os_server_send_reply (ccs_pipe_t in_reply_pipe, - cci_stream_t in_reply_stream) + k5_ipc_stream in_reply_stream) { - kern_return_t err = KERN_SUCCESS; - cci_mipc_inl_reply_t inl_reply; - mach_msg_type_number_t inl_reply_length = 0; - cci_mipc_ool_reply_t ool_reply = NULL; - mach_msg_type_number_t ool_reply_length = 0; - - if (!ccs_pipe_valid (in_reply_pipe)) { err = cci_check_error (ccErrBadParam); } - if (!in_reply_stream ) { err = cci_check_error (ccErrBadParam); } - - if (!err) { - /* depending on how big the message is, use the fast inline buffer or - * the slow dynamically allocated buffer */ - mach_msg_type_number_t reply_length = cci_stream_size (in_reply_stream); - - if (reply_length > kCCAPIMaxILMsgSize) { - cci_debug_printf ("%s choosing out of line buffer (size is %d)", - __FUNCTION__, reply_length); - - err = vm_read (mach_task_self (), - (vm_address_t) cci_stream_data (in_reply_stream), reply_length, - (vm_address_t *) &ool_reply, &ool_reply_length); - cci_check_error (err); - - } else { - //cci_debug_printf ("%s choosing in line buffer (size is %d)", - // __FUNCTION__, reply_length); - - inl_reply_length = reply_length; - memcpy (inl_reply, cci_stream_data (in_reply_stream), reply_length); - } - } - - if (!err) { - err = ccs_mipc_reply (in_reply_pipe, - inl_reply, inl_reply_length, - ool_reply, ool_reply_length); - cci_check_error (err); - } - - if (!err) { - /* Because we use ",dealloc" ool_reply will be freed by mach. Don't double free it. */ - ool_reply = NULL; - ool_reply_length = 0; - } - - if (ool_reply_length) { vm_deallocate (mach_task_self (), (vm_address_t) ool_reply, ool_reply_length); } - - return cci_check_error (err); + return cci_check_error (k5_ipc_server_send_reply (in_reply_pipe, + in_reply_stream)); } diff --git a/src/ccapi/server/win/WorkItem.cpp b/src/ccapi/server/win/WorkItem.cpp index 7e6aeb1cb..2e9ebcc93 100644 --- a/src/ccapi/server/win/WorkItem.cpp +++ b/src/ccapi/server/win/WorkItem.cpp @@ -47,28 +47,28 @@ void deleteBuffer(char** buf) { // WorkItem contains a CountedBuffer which must be deleted, // so each WorkItem must be deleted. -WorkItem::WorkItem(cci_stream_t buf, WIN_PIPE* pipe, const long type, const long sst) +WorkItem::WorkItem(k5_ipc_stream buf, WIN_PIPE* pipe, const long type, const long sst) : _buf(buf), _rpcmsg(type), _pipe(pipe), _sst(sst) { } WorkItem::WorkItem(const WorkItem& item) : _buf(NULL), _rpcmsg(0), _pipe(NULL), _sst(0) { - cci_stream_t _buf = NULL; - cci_stream_new(&_buf); - cci_stream_write(_buf, - cci_stream_data(item.payload()), - cci_stream_size(item.payload()) ); + k5_ipc_stream _buf = NULL; + k5_ipc_stream_new(&_buf); + k5_ipc_stream_write(_buf, + k5_ipc_stream_data(item.payload()), + k5_ipc_stream_size(item.payload()) ); WorkItem(_buf, item._pipe, item._rpcmsg, item._sst); } WorkItem::WorkItem() : _buf(NULL), _rpcmsg(CCMSG_INVALID), _pipe(NULL), _sst(0) { } WorkItem::~WorkItem() { - if (_buf) cci_stream_release(_buf); + if (_buf) k5_ipc_stream_release(_buf); if (_pipe) ccs_win_pipe_release(_pipe); } -const cci_stream_t WorkItem::take_payload() { - cci_stream_t temp = payload(); +const k5_ipc_stream WorkItem::take_payload() { + k5_ipc_stream temp = payload(); _buf = NULL; return temp; } diff --git a/src/ccapi/server/win/WorkQueue.cpp b/src/ccapi/server/win/WorkQueue.cpp index 711ecc173..f16ad117e 100644 --- a/src/ccapi/server/win/WorkQueue.cpp +++ b/src/ccapi/server/win/WorkQueue.cpp @@ -39,14 +39,14 @@ EXTERN_C bool worklist_isEmpty() { EXTERN_C int worklist_add( const long rpcmsg, const ccs_pipe_t pipe, - const cci_stream_t stream, + const k5_ipc_stream stream, const time_t serverStartTime) { return worklist.add(new WorkItem(stream, pipe, rpcmsg, serverStartTime) ); } EXTERN_C int worklist_remove(long* rpcmsg, ccs_pipe_t* pipe, - cci_stream_t* stream, + k5_ipc_stream* stream, time_t* sst) { WorkItem* item = NULL; cc_int32 err = worklist.remove(&item); diff --git a/src/ccapi/server/win/WorkQueue.h b/src/ccapi/server/win/WorkQueue.h index eb4678019..42d0cf207 100644 --- a/src/ccapi/server/win/WorkQueue.h +++ b/src/ccapi/server/win/WorkQueue.h @@ -35,12 +35,12 @@ EXTERN_C BOOL worklist_isEmpty(); EXTERN_C void worklist_add( const long rpcmsg, const ccs_pipe_t pipe, - const cci_stream_t stream, + const k5_ipc_stream stream, const time_t serverStartTime); EXTERN_C int worklist_remove(long* rpcmsg, ccs_pipe_t* pipe, - cci_stream_t* stream, + k5_ipc_stream* stream, time_t* serverStartTime); #endif // _work_queue_h \ No newline at end of file diff --git a/src/ccapi/server/win/ccs_os_server.cpp b/src/ccapi/server/win/ccs_os_server.cpp index a6725b4ed..99854d113 100644 --- a/src/ccapi/server/win/ccs_os_server.cpp +++ b/src/ccapi/server/win/ccs_os_server.cpp @@ -231,12 +231,12 @@ cc_int32 ccs_os_server_listen_loop (int argc, const char *argv[]) { SleepEx(1000, TRUE); } else if (TRUE) { // Take next WorkItem from the queue: - cci_stream_t buf = NULL; + k5_ipc_stream buf = NULL; long rpcmsg = CCMSG_INVALID; time_t serverStartTime = 0xDEADDEAD; RPC_STATUS status = 0; char* uuid = NULL; - cci_stream_t stream = NULL; + k5_ipc_stream stream = NULL; ccs_pipe_t pipe = NULL; ccs_pipe_t pipe2 = NULL; @@ -279,8 +279,8 @@ cc_int32 ccs_os_server_listen_loop (int argc, const char *argv[]) { break; case CCMSG_PING: cci_debug_printf(" Processing PING"); - err = cci_stream_new (&stream); - err = cci_stream_write(stream, "This is a test of the emergency broadcasting system", 52); + err = k5_ipc_stream_new (&stream); + err = k5_ipc_stream_write(stream, "This is a test of the emergency broadcasting system", 52); err = ccs_os_server_send_reply(pipe, stream); break; default: @@ -288,7 +288,7 @@ cc_int32 ccs_os_server_listen_loop (int argc, const char *argv[]) { rpcmsg, uuid); break; } - if (buf) cci_stream_release(buf); + if (buf) k5_ipc_stream_release(buf); /* Don't free uuid, which was allocated here. A pointer to it is in the rpcargs struct which was passed to connectionListener which will be received by ccapi_listen when the client exits. ccapi_listen needs @@ -311,10 +311,10 @@ cc_int32 ccs_os_server_listen_loop (int argc, const char *argv[]) { /* ------------------------------------------------------------------------ */ cc_int32 ccs_os_server_send_reply (ccs_pipe_t in_pipe, - cci_stream_t in_reply_stream) { + k5_ipc_stream in_reply_stream) { /* ccs_pipe_t in_reply_pipe is a char* reply endpoint. - cci_stream_t in_reply_stream is the data to be sent. + k5_ipc_stream in_reply_stream is the data to be sent. */ cc_int32 err = 0; @@ -333,8 +333,8 @@ cc_int32 ccs_os_server_send_reply (ccs_pipe_t in_pipe, (unsigned char*)&h, /* client's tspdata* */ (unsigned char*)uuid, getMySST(), - cci_stream_size(in_reply_stream), /* Length of buffer */ - (const unsigned char*)cci_stream_data(in_reply_stream), /* Data buffer */ + k5_ipc_stream_size(in_reply_stream), /* Length of buffer */ + (const unsigned char*)k5_ipc_stream_data(in_reply_stream), /* Data buffer */ &status ); /* Return code */ } RpcExcept(1) { diff --git a/src/ccapi/server/win/ccs_request_proc.c b/src/ccapi/server/win/ccs_request_proc.c index e3c741bcc..8a0da03f4 100644 --- a/src/ccapi/server/win/ccs_request_proc.c +++ b/src/ccapi/server/win/ccs_request_proc.c @@ -43,7 +43,7 @@ void ccs_rpc_request( long* return_status ) { /* Return code */ cc_int32 status = 0; - cci_stream_t stream; + k5_ipc_stream stream; DWORD* p = (DWORD*)(tspHandle); WIN_PIPE* pipe = NULL; #if 0 @@ -52,11 +52,11 @@ void ccs_rpc_request( status = (rpcmsg != CCMSG_REQUEST) && (rpcmsg != CCMSG_PING); if (!status) { - status = cci_stream_new (&stream); /* Create a stream for the request data */ + status = k5_ipc_stream_new (&stream); /* Create a stream for the request data */ } if (!status) { /* Put the data into the stream */ - status = cci_stream_write (stream, pbRequest, lenRequest); + status = k5_ipc_stream_write (stream, pbRequest, lenRequest); } pipe = ccs_win_pipe_new(pszUUID, *p); diff --git a/src/ccapi/server/win/workitem.h b/src/ccapi/server/win/workitem.h index df1d7794a..105380669 100644 --- a/src/ccapi/server/win/workitem.h +++ b/src/ccapi/server/win/workitem.h @@ -11,12 +11,12 @@ extern "C" { class WorkItem { private: - cci_stream_t _buf; + k5_ipc_stream _buf; WIN_PIPE* _pipe; const long _rpcmsg; const long _sst; public: - WorkItem( cci_stream_t buf, + WorkItem( k5_ipc_stream buf, WIN_PIPE* pipe, const long type, const long serverStartTime); @@ -24,8 +24,8 @@ public: WorkItem(); ~WorkItem(); - const cci_stream_t payload() const {return _buf;} - const cci_stream_t take_payload(); + const k5_ipc_stream payload() const {return _buf;} + const k5_ipc_stream take_payload(); WIN_PIPE* take_pipe(); WIN_PIPE* pipe() const {return _pipe;} const long type() const {return _rpcmsg;} diff --git a/src/include/k5-ipc_stream.h b/src/include/k5-ipc_stream.h index 55397ef90..edbf5a4ad 100644 --- a/src/include/k5-ipc_stream.h +++ b/src/include/k5-ipc_stream.h @@ -74,9 +74,4 @@ uint32_t k5_ipc_stream_read_uint64 (k5_ipc_stream io_stream, uint32_t k5_ipc_stream_write_uint64 (k5_ipc_stream io_stream, uint64_t in_uint64); -uint32_t k5_ipc_stream_read_time (k5_ipc_stream io_stream, - time_t *out_time); -uint32_t k5_ipc_stream_write_time (k5_ipc_stream io_stream, - time_t in_time); - #endif /* K5_IPC_STREAM_H */ diff --git a/src/util/support/ipc_stream.c b/src/util/support/ipc_stream.c index 608e0fb37..4037fe87d 100644 --- a/src/util/support/ipc_stream.c +++ b/src/util/support/ipc_stream.c @@ -450,7 +450,7 @@ uint32_t k5_ipc_stream_read_uint64 (k5_ipc_stream io_stream, /* ------------------------------------------------------------------------ */ uint32_t k5_ipc_stream_write_uint64 (k5_ipc_stream io_stream, - uint64_t in_uint64) + uint64_t in_uint64) { int32_t err = 0; int64_t uint64 = htonll (in_uint64); @@ -463,45 +463,3 @@ uint32_t k5_ipc_stream_write_uint64 (k5_ipc_stream io_stream, return k5_check_error (err); } - -#ifdef TARGET_OS_MAC -#pragma mark - -#endif - -/* ------------------------------------------------------------------------ */ - -uint32_t k5_ipc_stream_read_time (k5_ipc_stream io_stream, - time_t *out_time) -{ - int32_t err = 0; - int64_t t = 0; - - if (!io_stream) { err = k5_check_error (EINVAL); } - if (!out_time ) { err = k5_check_error (EINVAL); } - - if (!err) { - err = k5_ipc_stream_read_int64 (io_stream, &t); - } - - if (!err) { - *out_time = t; - } - - return k5_check_error (err); -} - -/* ------------------------------------------------------------------------ */ - -uint32_t k5_ipc_stream_write_time (k5_ipc_stream io_stream, - time_t in_time) -{ - int32_t err = 0; - - if (!io_stream) { err = k5_check_error (EINVAL); } - - if (!err) { - err = k5_ipc_stream_write_int64 (io_stream, in_time); - } - - return k5_check_error (err); -} -- 2.26.2