#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 */
/* ------------------------------------------------------------------------ */
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;
}
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) {
/* ------------------------------------------------------------------------ */
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;
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);
/* ------------------------------------------------------------------------ */
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;
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) {
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);
}
}
/* ------------------------------------------------------------------------ */
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;
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);
/* ------------------------------------------------------------------------ */
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;
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) {
/* ------------------------------------------------------------------------ */
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;
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) {
/* ------------------------------------------------------------------------ */
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;
}
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) {
}
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) {
/* ------------------------------------------------------------------------ */
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;
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) {
}
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) {
/* ------------------------------------------------------------------------ */
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;
}
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) {
/* ------------------------------------------------------------------------ */
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;
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) {
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);
/* ------------------------------------------------------------------------ */
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;
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);
}
/* ------------------------------------------------------------------------ */
cc_uint32 cci_identifier_write (cci_identifier_t in_identifier,
- cci_stream_t io_stream)
+ k5_ipc_stream io_stream)
{
cc_int32 err = ccNoError;
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);
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 */
/* ------------------------------------------------------------------------ */
-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) {
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)
{
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) {
/* ------------------------------------------------------------------------ */
-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) {
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;
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) {
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);
+}
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 */
+++ /dev/null
-/*
- * $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);
-}
+++ /dev/null
-/*
- * $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 */
#define CCI_TYPES_H
#include <CredentialsCache.h>
-
-struct cci_stream_d;
-typedef struct cci_stream_d *cci_stream_t;
+#include <k5-ipc_stream.h>
typedef char *cci_uuid_string_t;
+++ /dev/null
-/* $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 <mach/std_types.defs>
-#include <mach/mach_types.defs>
-
-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;
+++ /dev/null
-/* $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);
+++ /dev/null
-/* $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);
+++ /dev/null
-/* $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 */
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;}
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;}
RPC_ASYNC_STATE* _rpcState;
HANDLE _replyEvent;
time_t _sst;
- cci_stream_t _stream;
+ k5_ipc_stream _stream;
char _uuid[UUID_SIZE];
};
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);
/* ------------------------------------------------------------------------ */
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;
{
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); }
}
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);
}
{
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); }
}
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);
}
{
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) {
}
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);
}
{
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) {
NULL);
}
- cci_stream_release (request);
+ k5_ipc_stream_release (request);
return cci_check_error (err);
}
{
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) {
NULL);
}
- cci_stream_release (request);
+ k5_ipc_stream_release (request);
return cci_check_error (err);
}
{
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) {
NULL);
}
- cci_stream_release (request);
+ k5_ipc_stream_release (request);
return cci_check_error (err);
}
{
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); }
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);
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) {
NULL);
}
- cci_stream_release (request);
+ k5_ipc_stream_release (request);
return cci_check_error (err);
}
{
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) {
NULL);
}
- cci_stream_release (request);
+ k5_ipc_stream_release (request);
return cci_check_error (err);
}
{
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); }
}
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);
}
{
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); }
}
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);
}
{
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) {
}
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);
}
{
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) {
}
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);
}
{
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) {
NULL);
}
- cci_stream_release (request);
+ k5_ipc_stream_release (request);
return cci_check_error (err);
}
{
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) {
NULL);
}
- cci_stream_release (request);
+ k5_ipc_stream_release (request);
return cci_check_error (err);
}
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);
/* ------------------------------------------------------------------------ */
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;
{
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); }
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);
{
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;
}
cci_identifier_release (identifier);
- cci_stream_release (reply);
+ k5_ipc_stream_release (reply);
return cci_check_error (err);
}
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);
{
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); }
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,
err = cci_context_change_time_get (out_change_time);
}
- cci_stream_release (reply);
+ k5_ipc_stream_release (reply);
return cci_check_error (err);
}
{
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) {
}
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);
}
{
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;
}
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;
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);
}
{
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); }
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) {
&reply);
}
- if (!err && !(cci_stream_size (reply) > 0)) {
+ if (!err && !(k5_ipc_stream_size (reply) > 0)) {
err = ccErrCCacheNotFound;
}
}
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);
}
{
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); }
&reply);
}
- if (!err && !(cci_stream_size (reply) > 0)) {
+ if (!err && !(k5_ipc_stream_size (reply) > 0)) {
err = ccErrCCacheNotFound;
}
}
cci_identifier_release (identifier);
- cci_stream_release (reply);
+ k5_ipc_stream_release (reply);
return cci_check_error (err);
}
{
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); }
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) {
}
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);
}
{
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); }
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) {
}
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);
}
{
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); }
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) {
}
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);
}
{
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); }
}
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;
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);
{
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) {
NULL);
}
- cci_stream_release (request);
+ k5_ipc_stream_release (request);
return cci_check_error (err);
}
{
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); }
}
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;
}
cci_identifier_release (new_identifier);
- cci_stream_release (reply);
+ k5_ipc_stream_release (reply);
return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
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;
/* ------------------------------------------------------------------------ */
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;
#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,
/* ------------------------------------------------------------------------ */
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;
{
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); }
err = cci_credentials_read (out_credentials, reply);
}
- cci_stream_release (reply);
+ k5_ipc_stream_release (reply);
return cci_check_error (err);
}
{
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); }
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);
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);
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); }
}
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);
}
}
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);
}
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,
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,
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 */
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 */
#include "ccapi_os_ipc.h"
-#include <Kerberos/kipc_client.h>
-#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"
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));
}
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 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,
}
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;
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 */
}
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 */
cci_os_ipc\r
cci_os_ipc_msg\r
cci_os_ipc_thread_init\r
- cci_stream_data\r
- cci_stream_write\r
- cci_stream_new\r
+ k5_ipc_stream_data\r
+ k5_ipc_stream_write\r
+ k5_ipc_stream_new\r
\r
ccs_authenticate\r
\r
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); }
}
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) {
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);
}
/* ------------------------------------------------------------------------ */
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;
/* ------------------------------------------------------------------------ */
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;
/* ------------------------------------------------------------------------ */
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;
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);
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;
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;
/* ------------------------------------------------------------------------ */
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;
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);
}
}
/* ------------------------------------------------------------------------ */
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;
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 = ccs_ccache_write (ccache, io_reply_data);
}
- free (name);
+ k5_ipc_stream_free_string (name);
return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
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;
/* ------------------------------------------------------------------------ */
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;
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) {
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);
}
/* ------------------------------------------------------------------------ */
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;
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) {
err = ccs_cache_collection_changed (io_cache_collection);
}
- free (principal);
+ k5_ipc_stream_free_string (principal);
return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
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;
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) {
}
free (name);
- free (principal);
+ k5_ipc_stream_free_string (principal);
return cci_check_error (err);
}
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;
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;
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) {
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;
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); }
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) {
}
}
- cci_stream_release (reply_data);
+ k5_ipc_stream_release (reply_data);
return cci_check_error (err);
}
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 */
/* ------------------------------------------------------------------------ */
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;
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);
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); }
}
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) {
io_ccache->name);
}
- cci_stream_release (reply_data);
+ k5_ipc_stream_release (reply_data);
return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
cc_int32 ccs_ccache_write (ccs_ccache_t in_ccache,
- cci_stream_t io_stream)
+ k5_ipc_stream io_stream)
{
cc_int32 err = ccNoError;
/* ------------------------------------------------------------------------ */
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;
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);
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;
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;
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;
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);
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;
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);
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;
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) {
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);
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;
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) {
err = ccs_ccache_changed (io_ccache, io_cache_collection);
}
- free (principal);
+ k5_ipc_stream_free_string (principal);
return cci_check_error (err);
}
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;
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;
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;
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;
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;
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) {
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;
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;
}
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);
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;
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);
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;
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;
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;
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);
}
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;
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;
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;
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) {
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); }
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) {
}
}
- cci_stream_release (reply_data);
+ k5_ipc_stream_release (reply_data);
return cci_check_error (err);
}
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 */
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;
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;
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;
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) {
reply_data = NULL; /* take ownership */
}
- cci_stream_release (reply_data);
+ k5_ipc_stream_release (reply_data);
return cci_check_error (err);
}
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 */
/* ------------------------------------------------------------------------ */
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_write (ccs_credentials_t in_credentials,
- cci_stream_t io_stream)
+ k5_ipc_stream io_stream)
{
cc_int32 err = ccNoError;
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,
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;
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;
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;
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) {
reply_data = NULL; /* take ownership */
}
- cci_stream_release (reply_data);
+ k5_ipc_stream_release (reply_data);
return cci_check_error (err);
}
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 */
/* ------------------------------------------------------------------------ */
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);
}
/* ------------------------------------------------------------------------ */
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);
}
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);
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);
/* ------------------------------------------------------------------------ */
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;
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);
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 */
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;
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); }
}
cci_identifier_release (request_identifier);
- cci_stream_release (reply_data);
+ k5_ipc_stream_release (reply_data);
return cci_check_error (err);
}
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); }
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);
}
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 */
#include "ccs_common.h"
#include <syslog.h>
-#include <Kerberos/kipc_server.h>
-#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 -
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);
}
{
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);
}
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));
}
\r
// WorkItem contains a CountedBuffer which must be deleted, \r
// so each WorkItem must be deleted.\r
-WorkItem::WorkItem(cci_stream_t buf, WIN_PIPE* pipe, const long type, const long sst) \r
+WorkItem::WorkItem(k5_ipc_stream buf, WIN_PIPE* pipe, const long type, const long sst) \r
: _buf(buf), _rpcmsg(type), _pipe(pipe), _sst(sst) { }\r
\r
WorkItem::WorkItem(const WorkItem& item) : _buf(NULL), _rpcmsg(0), _pipe(NULL), _sst(0) {\r
\r
- cci_stream_t _buf = NULL;\r
- cci_stream_new(&_buf);\r
- cci_stream_write(_buf, \r
- cci_stream_data(item.payload()),\r
- cci_stream_size(item.payload()) );\r
+ k5_ipc_stream _buf = NULL;\r
+ k5_ipc_stream_new(&_buf);\r
+ k5_ipc_stream_write(_buf, \r
+ k5_ipc_stream_data(item.payload()),\r
+ k5_ipc_stream_size(item.payload()) );\r
WorkItem(_buf, item._pipe, item._rpcmsg, item._sst);\r
}\r
\r
WorkItem::WorkItem() : _buf(NULL), _rpcmsg(CCMSG_INVALID), _pipe(NULL), _sst(0) { }\r
\r
WorkItem::~WorkItem() {\r
- if (_buf) cci_stream_release(_buf);\r
+ if (_buf) k5_ipc_stream_release(_buf);\r
if (_pipe) ccs_win_pipe_release(_pipe);\r
}\r
\r
-const cci_stream_t WorkItem::take_payload() {\r
- cci_stream_t temp = payload();\r
+const k5_ipc_stream WorkItem::take_payload() {\r
+ k5_ipc_stream temp = payload();\r
_buf = NULL;\r
return temp;\r
}\r
\r
EXTERN_C int worklist_add( const long rpcmsg, \r
const ccs_pipe_t pipe, \r
- const cci_stream_t stream, \r
+ const k5_ipc_stream stream, \r
const time_t serverStartTime) {\r
return worklist.add(new WorkItem(stream, pipe, rpcmsg, serverStartTime) );\r
}\r
\r
EXTERN_C int worklist_remove(long* rpcmsg,\r
ccs_pipe_t* pipe,\r
- cci_stream_t* stream,\r
+ k5_ipc_stream* stream,\r
time_t* sst) {\r
WorkItem* item = NULL;\r
cc_int32 err = worklist.remove(&item);\r
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
SleepEx(1000, TRUE);\r
}\r
else if (TRUE) { // Take next WorkItem from the queue:\r
- cci_stream_t buf = NULL;\r
+ k5_ipc_stream buf = NULL;\r
long rpcmsg = CCMSG_INVALID;\r
time_t serverStartTime = 0xDEADDEAD;\r
RPC_STATUS status = 0;\r
char* uuid = NULL;\r
- cci_stream_t stream = NULL;\r
+ k5_ipc_stream stream = NULL;\r
ccs_pipe_t pipe = NULL;\r
ccs_pipe_t pipe2 = NULL;\r
\r
break;\r
case CCMSG_PING:\r
cci_debug_printf(" Processing PING");\r
- err = cci_stream_new (&stream);\r
- err = cci_stream_write(stream, "This is a test of the emergency broadcasting system", 52);\r
+ err = k5_ipc_stream_new (&stream);\r
+ err = k5_ipc_stream_write(stream, "This is a test of the emergency broadcasting system", 52);\r
err = ccs_os_server_send_reply(pipe, stream);\r
break;\r
default:\r
rpcmsg, uuid);\r
break;\r
}\r
- if (buf) cci_stream_release(buf);\r
+ if (buf) k5_ipc_stream_release(buf);\r
/* Don't free uuid, which was allocated here. A pointer to it is in the \r
rpcargs struct which was passed to connectionListener which will be\r
received by ccapi_listen when the client exits. ccapi_listen needs \r
/* ------------------------------------------------------------------------ */\r
\r
cc_int32 ccs_os_server_send_reply (ccs_pipe_t in_pipe,\r
- cci_stream_t in_reply_stream) {\r
+ k5_ipc_stream in_reply_stream) {\r
\r
/* ccs_pipe_t in_reply_pipe is a char* reply endpoint.\r
- cci_stream_t in_reply_stream is the data to be sent.\r
+ k5_ipc_stream in_reply_stream is the data to be sent.\r
*/\r
\r
cc_int32 err = 0;\r
(unsigned char*)&h, /* client's tspdata* */\r
(unsigned char*)uuid,\r
getMySST(),\r
- cci_stream_size(in_reply_stream), /* Length of buffer */\r
- (const unsigned char*)cci_stream_data(in_reply_stream), /* Data buffer */\r
+ k5_ipc_stream_size(in_reply_stream), /* Length of buffer */\r
+ (const unsigned char*)k5_ipc_stream_data(in_reply_stream), /* Data buffer */\r
&status ); /* Return code */\r
}\r
RpcExcept(1) {\r
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
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);
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);
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;}
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 */
/* ------------------------------------------------------------------------ */
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);
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);
-}