You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by jd...@apache.org on 2009/04/22 19:25:51 UTC
svn commit: r767594 [3/43] - in /incubator/etch/trunk/binding-c/runtime/c:
./ ext/ ext/hashtab/ ext/lib/ inc/ lib/ project/ project/$etchstop/
project/bin/ project/etch/ project/logcli/ project/logsrv/ project/notes/
project/test/ project/test/logcli/ ...
Added: incubator/etch/trunk/binding-c/runtime/c/inc/etch_connection.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-c/runtime/c/inc/etch_connection.h?rev=767594&view=auto
==============================================================================
--- incubator/etch/trunk/binding-c/runtime/c/inc/etch_connection.h (added)
+++ incubator/etch/trunk/binding-c/runtime/c/inc/etch_connection.h Wed Apr 22 17:25:43 2009
@@ -0,0 +1,170 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * etch_connection.h
+ * connection client and server classes - tcp, udp
+ */
+
+#ifndef ETCHCONNECTION_H
+#define ETCHCONNECTION_H
+
+#include "apr_thread_proc.h"
+#include <apr_network_io.h>
+#include <apr_thread_mutex.h>
+#include <apr_thread_cond.h>
+#include "etch_transportdata.h"
+#include "etch_transportint.h"
+#include "etch_sessionint.h"
+#include "etchthread.h"
+#include "etchmutex.h"
+#include "etch_url.h"
+
+typedef apr_socket_t etch_rawsocket;
+typedef etch_object etch_socket;
+typedef int (*etch_set_socket_options) (void* conxn);
+typedef int (*etch_connection_event_handler) (void* conxn, const int, int, void*);
+
+int etch_defconx_on_event(void* conxn, const int, int, void*);
+int etch_defconx_on_data (void* conxn, const int, int, void*);
+char* ETCHCONX;
+
+#define IS_ETCH_SOCKET_TIMEOUT(n) (APR_TIMEUP == n || 730060 == n)
+#define ETCH_CONX_DEFAULT_BUFSIZE (1024 * 32)
+#define ETCH_CONX_NO_LINGER FALSE
+#define ETCH_CONX_USE_LINGER TRUE
+#define ETCH_CONX_NOT_RECONNECTING FALSE
+#define ETCH_CONX_IS_RECONNECTING TRUE
+#define ETCH_THIS_END_CLOSED (-2)
+#define ETCH_OTHER_END_CLOSED (-3)
+#define ETCH_SHUTDOWN_NOTIFIED (-4)
+#define APR_THIS_END_CLOSED 730053
+#define APR_OTHER_END_CLOSED 730054
+
+
+/*
+ * etch_connection
+ * abstract base class, never instantiated so not an object
+ */
+typedef struct etch_connection
+{
+ unsigned sig;
+ unsigned conxid;
+ void* owner;
+ apr_socket_t* socket;
+ apr_sockaddr_t* sockdata;
+ apr_pool_t* aprpool;
+ etchmutex* mutex;
+ unsigned bufsize;
+ etch_object* listener;
+ etch_thread* thread;
+
+ unsigned char is_ownpool;
+ unsigned char is_started;
+ unsigned char is_closing;
+ unsigned char unused;
+
+ /* note that the java code from which this was translated has separate
+ * up/down waiter monitors on a connection and on a delivery service,
+ * both components separately implementing wait up and down methods.
+ */
+ etchwait* waiter; /* wait object - owned */
+ objmask* session; /* session data - not owned */
+ char* hostname; /* ansi string - owned */
+ int64 waitcond; /* up/down wait condition */
+ int port;
+ int delay;
+
+ etch_connection_event_handler on_data;
+ etch_connection_event_handler on_event;
+ etch_set_socket_options set_socket_options;
+
+} etch_connection;
+
+
+
+#define ETCH_DEFAULT_SOCKET_FAMILY APR_INET
+unsigned connection_id_farm;
+
+#define ETCH_CONNECTION_DEFLINGERTIME 30
+#define ETCH_CONNECTION_DEFNODELAY TRUE
+#define ETCH_CONNECTION_DEFRETRYATTEMPTS 0
+#define ETCH_CONNECTION_DEFRETRYDELAYMS 1000
+
+const wchar_t* ETCH_CONNECTION_RECONDELAY;
+const wchar_t* ETCH_CONNECTION_AUTOFLUSH;
+const wchar_t* ETCH_CONNECTION_KEEPALIVE;
+const wchar_t* ETCH_CONNECTION_LINGERTIME;
+const wchar_t* ETCH_CONNECTION_NODELAY;
+const wchar_t* ETCH_CONNECTION_TRAFCLASS;
+const wchar_t* ETCH_CONNECTION_BUFSIZE;
+const wchar_t* ETCH_TCPLISTENER_BACKLOG;
+
+#define ETCH_CONXEVT_CREATED 0x1
+#define ETCH_CONXEVT_CREATERR 0x2
+#define ETCH_CONXEVT_SHUTDOWN 0x3
+#define ETCH_CONXEVT_DATA 0x4
+#define ETCH_CONXEVT_RECEIVING 0x5
+#define ETCH_CONXEVT_RECEIVETIMEOUT 0x6
+#define ETCH_CONXEVT_RECEIVERR 0x7
+#define ETCH_CONXEVT_RECEIVED 0x8
+#define ETCH_CONXEVT_RECEIVEND 0x9
+#define ETCH_CONXEVT_SENDING 0xa
+#define ETCH_CONXEVT_SENDTIMEOUT 0xb
+#define ETCH_CONXEVT_SENDERR 0xc
+#define ETCH_CONXEVT_SENT 0xd
+#define ETCH_CONXEVT_SENDEND 0xe
+#define ETCH_CONXEVT_CONXCLOSED 0xf
+#define ETCH_CONXEVT_PEERCLOSED 0x10
+#define ETCH_CONXEVT_OPENING 0x11
+#define ETCH_CONXEVT_OPENERR 0x12
+#define ETCH_CONXEVT_OPENED 0x13
+#define ETCH_CONXEVT_STARTING 0x14
+#define ETCH_CONXEVT_STARTERR 0x15
+#define ETCH_CONXEVT_STARTED 0x16
+#define ETCH_CONXEVT_ACCEPTPUMPEXIT 0x1e
+#define ETCH_CONXEVT_ACCEPTPUMPEXITERR 0x1f
+#define ETCH_CONXEVT_RCVPUMP_START 0x20
+#define ETCH_CONXEVT_RCVPUMP_RECEIVING 0x21
+#define ETCH_CONXEVT_RCVPUMP_ERR 0x22
+#define ETCH_CONXEVT_RCVPUMP_STOP 0x23
+#define ETCH_CONXEVT_ACCEPTING 0x25
+#define ETCH_CONXEVT_ACCEPTERR 0x26
+#define ETCH_CONXEVT_ACCEPTED 0x27
+#define ETCH_CONXEVT_LISTENED 0x28
+#define ETCH_CONXEVT_UP 0x2a
+#define ETCH_CONXEVT_DOWN 0x2b
+#define ETCH_CONXEVT_SOCKOPTERR 0x2f
+#define ETCH_CONXEVT_STOPPING 0x30
+#define ETCH_CONXEVT_STOPERR 0x31
+#define ETCH_CONXEVT_STOPPED 0x32
+#define ETCH_CONXEVT_CLOSING 0x33
+#define ETCH_CONXEVT_CLOSERR 0x34
+#define ETCH_CONXEVT_CLOSED 0x35
+#define ETCH_CONXEVT_DESTRUCTOR 0x3a
+#define ETCH_CONXEVT_DESTROYING 0x3b
+#define ETCH_CONXEVT_DESTROYED 0x3c
+
+int etch_init_connection(etch_connection*, etch_rawsocket*, void* owner);
+int etch_destroy_connection(etch_connection*);
+etch_socket* new_etch_socket(etch_rawsocket*);
+int etchconx_wait_up (etch_connection*, int timeoutms);
+int etchconx_wait_down(etch_connection*, int timeoutms);
+void etchconx_init_waitstate (etch_connection*);
+
+#endif /* ETCHCONNECTION_H */
\ No newline at end of file
Added: incubator/etch/trunk/binding-c/runtime/c/inc/etch_defvalufact.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-c/runtime/c/inc/etch_defvalufact.h?rev=767594&view=auto
==============================================================================
--- incubator/etch/trunk/binding-c/runtime/c/inc/etch_defvalufact.h (added)
+++ incubator/etch/trunk/binding-c/runtime/c/inc/etch_defvalufact.h Wed Apr 22 17:25:43 2009
@@ -0,0 +1,154 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * etch_defvalufact.h
+ * default implementation of value factory
+ */
+
+#ifndef ETCH_DEFVALUFACT_H
+#define ETCH_DEFVALUFACT_H
+
+#include "etch_message.h"
+#include "etchexcp.h"
+
+#define ETCH_DEFVF_IDNMAP_DEFINITSIZE 64
+#define ETCH_DEVVF_C2TMAP_DEFINITSIZE 16
+#define ETCH_DEVVF_MIXINS_DEFINITSIZE 4
+
+typedef etch_hashtable vf_idname_map;
+typedef etch_hashtable class_to_type_map;
+
+
+/**
+ * default_value_factory
+ * value factory base implementation.
+ */
+typedef struct default_value_factory
+{
+ unsigned int hashkey;
+ unsigned short obj_type;
+ unsigned short class_id;
+ struct i_value_factory* vtab;
+ int (*destroy)(void*);
+ void*(*clone) (void*);
+ obj_gethashkey get_hashkey;
+ struct objmask* parent;
+ etchresult* result;
+ unsigned int refcount;
+ unsigned int length;
+ unsigned char is_null;
+ unsigned char is_copy;
+ unsigned char is_static;
+ unsigned char reserved;
+
+ objmask* impl;
+
+ class_to_type_map* class_to_type;
+ vf_idname_map* types;
+ etch_arraylist* mixins;
+
+ unsigned char is_own_types;
+ unsigned char is_own_class_to_type;
+
+} default_value_factory;
+
+
+default_value_factory* new_default_value_factory /* ctors */
+ (vf_idname_map* typemap, class_to_type_map* c2tmap);
+
+default_value_factory* new_default_value_factory_a(const int objsize,
+ vf_idname_map* typemap, class_to_type_map* c2tmap);
+
+int destroy_default_value_factory(default_value_factory*);
+
+/**
+ * defvf_statics
+ */
+typedef struct defvf_statics
+{
+ etch_type* _mt__etch_runtime_exception;
+ etch_type* _mt__etch_auth_exception;
+ etch_type* _mt__exception;
+ etch_type* _mt__etch_list;
+ etch_type* _mt__etch_map;
+ etch_type* _mt__etch_set;
+ etch_type* _mt__etch_datetime;
+
+ etch_field* _mf_msg;
+ etch_field* _mf__message_id;
+ etch_field* _mf__in_reply_to;
+ etch_field* _mf_result;
+
+} defvf_statics;
+
+
+/*
+ * built-in (etch-global, quasi-static) objects.
+ * these singleton objects are global to all vfs, instantiated with the
+ * initial vf, and destroyed at etch teardown.
+ */
+defvf_statics builtins;
+unsigned char is_builtins_instantiated;
+
+const wchar_t* str_etch_runtime_exception;
+const wchar_t* str_etch_auth_exception;
+const wchar_t* str_exception;
+const wchar_t* str_etch_list;
+const wchar_t* str_etch_map;
+const wchar_t* str_etch_set;
+const wchar_t* str_etch_datetime;
+
+const wchar_t* str_msg;
+const wchar_t* str_message_id;
+const wchar_t* str_in_reply_to;
+const wchar_t* str_result;
+
+const wchar_t* str_utf8;
+const wchar_t* str_keys;
+const wchar_t* str_values;
+const wchar_t* str_date_time;
+const wchar_t* str_keys_values;
+
+const wchar_t* str_msgizervf;
+const wchar_t* str_msgizerfmt;
+
+/*
+ * etchvf_free_builtins()
+ * frees memory for etch-global quasi-static builtin objects,
+ * and for the validators cache and its validator content.
+ * it should be invoked at etch teardown, after last vf is destroyed.
+ * unit tests will show memory leaks unless they invoke this after test.
+ */
+void etchvf_free_builtins();
+
+
+etch_type* etchtypemap_get_by_name(etch_hashtable*, const wchar_t* name);
+int defvf_add_mixin(default_value_factory*, etch_value_factory* mixedin_vf);
+int get_etch_string_encoding(etch_value_factory*);
+int etchtypelist_comparator(void* a, void* b);
+unsigned message_get_id32 (etch_message*);
+class_to_type_map* new_class_to_type_map(const int initialsize);
+etch_set* new_vf_types_collection(const int initialsize);
+vf_idname_map* new_vf_idname_map(const int initialsize);
+int class_to_type_map_put(class_to_type_map*, const unsigned, etch_type*);
+etch_type* class_to_type_map_get(class_to_type_map*, const unsigned);
+int message_throw_from (etch_message*, objmask*);
+int message_throw (etch_message*, excptype, wchar_t*);
+
+#endif /* #ifndef ETCH_DEFVALUFACT_H */
\ No newline at end of file
Added: incubator/etch/trunk/binding-c/runtime/c/inc/etch_encoding.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-c/runtime/c/inc/etch_encoding.h?rev=767594&view=auto
==============================================================================
--- incubator/etch/trunk/binding-c/runtime/c/inc/etch_encoding.h (added)
+++ incubator/etch/trunk/binding-c/runtime/c/inc/etch_encoding.h Wed Apr 22 17:25:43 2009
@@ -0,0 +1,35 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * etch_encoding.h -- character encoding
+ */
+
+#ifndef ETCH_ENCODING_H
+#define ETCH_ENCODING_H
+
+int etch_unicode_to_utf8(char** utf8_string_out, wchar_t* unicode_string_in);
+int etch_unicode_to_ansi(char** ansi_string_out, wchar_t* unicode_string_in);
+
+int etch_utf8_to_unicode(wchar_t** unicode_string_out, char* utf8_string_in);
+int etch_ansi_to_unicode(wchar_t** unicode_string_out, char* ansi_string_in);
+
+size_t etch_get_unicode_bytecount (wchar_t*);
+
+
+#endif /* #ifndef ETCH_ENCODING_H */
\ No newline at end of file
Added: incubator/etch/trunk/binding-c/runtime/c/inc/etch_field.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-c/runtime/c/inc/etch_field.h?rev=767594&view=auto
==============================================================================
--- incubator/etch/trunk/binding-c/runtime/c/inc/etch_field.h (added)
+++ incubator/etch/trunk/binding-c/runtime/c/inc/etch_field.h Wed Apr 22 17:25:43 2009
@@ -0,0 +1,49 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * etch_field.h -- defines the etch_field object.
+ * An etch_field is an etch_id_name representing a field of a struct or message
+ * (i.e. a key for a value).
+ */
+
+#ifndef ETCHFIELD_H
+#define ETCHFIELD_H
+
+#include "etch_id_name.h"
+
+/**
+ * etch_field
+ * We're simply typef'ing this for now, but we've left it open to later define
+ * an etch_field struct having an etch_id_name as a member.
+ */
+typedef etch_id_name etch_field;
+
+etch_field* new_field(const wchar_t* name);
+etch_field* new_static_field(const wchar_t* name);
+int destroy_static_field(etch_field*);
+
+#define clone_field clone_id_name
+#define destroy_field destroy_id_name
+#define is_good_field is_good_id_name
+#define is_equal_fields is_equal_id_names
+#define compute_field_id compute_id_name_id
+#define compute_field_id_from_widename compute_id_name_id_from_widename
+
+
+#endif /* #ifndef ETCHFIELD_H */
\ No newline at end of file
Added: incubator/etch/trunk/binding-c/runtime/c/inc/etch_global.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-c/runtime/c/inc/etch_global.h?rev=767594&view=auto
==============================================================================
--- incubator/etch/trunk/binding-c/runtime/c/inc/etch_global.h (added)
+++ incubator/etch/trunk/binding-c/runtime/c/inc/etch_global.h Wed Apr 22 17:25:43 2009
@@ -0,0 +1,119 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * etch_global.h -- logically global methods, "static" methods, etc.
+ * methods which can logically be executed from any context.
+ */
+
+#ifndef ETCHGLOBAL_H
+#define ETCHGLOBAL_H
+
+#include "etch_config.h"
+#include "etchhash.h"
+#include "etchmem.h"
+#include "etchrun.h"
+
+
+/**
+ * etch_runtime_init()
+ * global etch runtime startup initialization
+ * instantiates the global cache
+ */
+int etch_runtime_init(const int is_client);
+
+
+/**
+ * etch_runtime_cleanup()
+ * global etch runtime cleanup
+ * clears and frees the memory tracking table, and finally the global cache
+ */
+int etch_runtime_cleanup(int n, int m);
+
+
+/**
+ * global memory tracking table checkpoint
+ * clears all entries from the memory tracking table but leaves table intact.
+ * we would use this for example between unit tests which had memory leaks,
+ * but we did not want to carry forward the leaks to the next tests.
+ */
+int memtable_clear();
+
+wchar_t* new_wchar (const wchar_t*);
+size_t etch_strbytes(const wchar_t*);
+
+/**
+ * cached_etchobject_vtable
+ * static cache vtable for etchobject in order to avoid global cache lookup
+ */
+void* cached_etchobject_vtable;
+
+
+/**
+ * object type sequence for generated objects
+ */
+int g_etch_curr_objtype; /* current offset from ETCHTYPEB_USER */
+
+
+/**
+ * operating system specific implementation of java System.nanotime().
+ */
+int64 etch_system_nanotime();
+
+unsigned char is_runtime_initialized;
+
+unsigned char is_bad_pointer(void*);
+
+int waitkey(const int is_waitkey_enabled, const int result);
+
+/* empty string contants */
+wchar_t* etch_emptystru;
+char* etch_emptystra;
+
+/**
+ * class ID sequence for generated classes
+ */
+/* current offset from CLASSID_DYNAMIC_START (etchobjtypes.h) */
+unsigned short g_etch_curr_classid; /* current offset from CLASSID_DYNAMIC_START (etchobjtypes.h) */
+unsigned short get_dynamic_classid();
+unsigned short get_dynamic_classid_unique(unsigned short* globalid);
+
+
+/**
+ * malloc'ed global constants
+ */
+typedef struct etch_global_constants
+{
+ #if(0)
+ etch_string* emptystring_unicode;
+ etch_boolean boolean_true;
+ etch_boolean boolean_false;
+ #endif
+
+ wchar_t* etch_charsetname_us_ascii;
+ wchar_t* etch_charsetname_utf8;
+ wchar_t* etch_charsetname_utf16;
+
+ char* pctd; /* for "%d" sprintf mask */
+
+} etch_global_constants;
+
+etch_global_constants etchgc;
+
+
+#endif /* #ifndef ETCHGLOBAL_H */
\ No newline at end of file
Added: incubator/etch/trunk/binding-c/runtime/c/inc/etch_id_name.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-c/runtime/c/inc/etch_id_name.h?rev=767594&view=auto
==============================================================================
--- incubator/etch/trunk/binding-c/runtime/c/inc/etch_id_name.h (added)
+++ incubator/etch/trunk/binding-c/runtime/c/inc/etch_id_name.h Wed Apr 22 17:25:43 2009
@@ -0,0 +1,75 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * etch_id_name.h
+ * etch_id_name is base class for etch_field and etch_type. it binds
+ * together a type or field name with its associated id. The id is used
+ * for certain operations, such as the key in a map, comparisons, and
+ * binary encoding on the wire.
+*/
+
+#ifndef ETCHIDNAME_H
+#define ETCHIDNAME_H
+
+#include "etch.h"
+#include "etchobj.h"
+
+
+/**
+ * etch_id_name
+ */
+struct etch_id_name
+{
+ unsigned int hashkey;
+ unsigned short obj_type;
+ unsigned short class_id;
+ vtabmask* vtab;
+ int (*destroy)(void*);
+ void*(*clone) (void*);
+ obj_gethashkey get_hashkey;
+ struct objmask* parent;
+ etchresult* result;
+ unsigned int refcount;
+ unsigned int length;
+ unsigned char is_null;
+ unsigned char is_copy;
+ unsigned char is_static;
+ unsigned char reserved;
+
+ etch_object* impl; /* extension of id_name, if any */
+
+ unsigned id; /* wire ID, not a hashmap key */
+ size_t namebytelen; /* byte length including terminator */
+ wchar_t* name; /* owned */
+ char* aname; /* owned - 8-bit name 1st step in id_name conversion */
+};
+
+typedef struct etch_id_name etch_id_name;
+
+etch_id_name* new_id_name(const wchar_t* name);
+etch_id_name* clone_id_name(const etch_id_name*);
+int destroy_id_name(etch_id_name* thisp);
+
+int is_good_id_name(etch_id_name* thisp);
+int is_equal_id_names(etch_id_name*, etch_id_name*);
+int compute_id_name_id(const char*);
+int compute_id_name_id_from_widename(const wchar_t*);
+unsigned id_name_get_hashkey(objmask* idname);
+
+#endif /* #ifndef ETCHIDNAME_H */
\ No newline at end of file
Added: incubator/etch/trunk/binding-c/runtime/c/inc/etch_linklist.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-c/runtime/c/inc/etch_linklist.h?rev=767594&view=auto
==============================================================================
--- incubator/etch/trunk/binding-c/runtime/c/inc/etch_linklist.h (added)
+++ incubator/etch/trunk/binding-c/runtime/c/inc/etch_linklist.h Wed Apr 22 17:25:43 2009
@@ -0,0 +1,104 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * etch_linklist.h
+ * linked list implementation.
+ */
+
+#ifndef ETCHLINKLIST_H
+#define ETCHLINKLIST_H
+
+#include "etch_collection.h"
+
+#define ETCHLINKLIST_DEFSIZE 128
+#define ETCHLINKLIST_CONTENT_SIMPLE 0 /* content memory freed as a unit */
+#define ETCHLINKLIST_CONTENT_OBJECT 1 /* content is etchobject */
+#define ETCHLINKLIST_SYNCHRONIZED TRUE
+
+typedef int (*linklistcallback) (int, void*);
+
+
+/**
+ * linklist_node: an entry in an etch_linklist
+ */
+struct linklist_node
+{
+ char* content;
+ struct linklist_node* next;
+};
+
+typedef struct linklist_node linklist_node;
+
+
+/**
+ * etch_linklist: data structure encapsulating the linkist
+ */
+typedef struct etch_linklist
+{
+ unsigned int hashkey;
+ unsigned short obj_type;
+ unsigned short class_id;
+ struct vtabmask* vtab;
+ int (*destroy) (void*);
+ void*(*clone) (void*);
+ obj_gethashkey get_hashkey;
+ struct objmask* parent;
+ etchresult* result;
+ unsigned int refcount;
+ unsigned int length;
+ unsigned char is_null;
+ unsigned char is_copy;
+ unsigned char is_static;
+ unsigned char reserved;
+
+ void** impl;
+ unsigned short content_obj_type; /* etch obj_type of a native value */
+ unsigned short content_class_id; /* etch class_id of a native value */
+ unsigned int count;
+
+ /* this object may be masked by etch_collection_mask to determine content
+ * type and class, so do not add any fields above this comment */
+
+ linklist_node* head;
+ linklist_node* tail;
+
+ i_iterable iterable;
+
+ byte is_readonly;
+ byte content_type;
+
+ linklistcallback freehook; /* hoook for free list content */
+
+} etch_linklist;
+
+
+etch_linklist* new_linklist();
+linklist_node* linklist_get(etch_linklist* list, const unsigned i);
+int linklist_add (etch_linklist* list, void* content);
+int linklist_insert (etch_linklist* list, const unsigned i, void* content);
+int linklist_containsp(etch_linklist* list, void* content, const unsigned startat); /* pointer compare */
+int linklist_contains (etch_linklist* list, void* content, const unsigned startat, etch_comparator);
+int linklist_indexofp (etch_linklist* list, void* content, const unsigned startat); /* pointer compare */
+int linklist_indexof (etch_linklist* list, void* content, const unsigned startat, etch_comparator);
+int linklist_remove (etch_linklist* list, const unsigned i, const int is_free_content);
+void linklist_clear (etch_linklist* list, const int is_free_content);
+void linklist_destroy (etch_linklist* list, const int is_free_content);
+
+
+#endif /* #ifndef ETCHLINKLIST_H */
\ No newline at end of file
Added: incubator/etch/trunk/binding-c/runtime/c/inc/etch_mailboxint.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-c/runtime/c/inc/etch_mailboxint.h?rev=767594&view=auto
==============================================================================
--- incubator/etch/trunk/binding-c/runtime/c/inc/etch_mailboxint.h (added)
+++ incubator/etch/trunk/binding-c/runtime/c/inc/etch_mailboxint.h Wed Apr 22 17:25:43 2009
@@ -0,0 +1,292 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * etch_mailboxint.h
+ * mailbox interface
+ */
+#ifndef ETCHIMAILBOX_H
+#define ETCHIMAILBOX_H
+
+#include "etchobj.h"
+#include "etch_message.h"
+
+#define ETCH_MAILBOX_TIMEOUT (-2)
+#define ETCH_MAILBOX_DUPLICATE (-3)
+
+typedef struct i_mailbox i_mailbox;
+
+/**
+ * etch_mailbox_notify()
+ * notify interface callback to receive notification of mailbox status changes.
+ * @remarks accomodation is made for a single status listener only.
+ * @param thisx caller
+ * @param mb the mailbox whose status has changed.
+ * @param state the state object specified during callback registration.
+ * @param closed true if the mailbox timeout has expired and the mailbox is now closed to delivery,
+ * false if a message has arrived.
+ */
+typedef int (*etch_mailbox_notify) (void* thisx, i_mailbox* mb, void* state, const int is_closed);
+
+
+/**
+ * etch_mailbox_element
+ * this is for now an etch object, in case it needs to own the message
+ */
+typedef struct etch_mailbox_element
+{
+ unsigned int hashkey;
+ unsigned short obj_type;
+ unsigned short class_id;
+ struct objmask* vtab;
+ int (*destroy)(void*);
+ void*(*clone) (void*);
+ obj_gethashkey get_hashkey;
+ struct objmask* parent;
+ etchresult* result;
+ unsigned int refcount;
+ unsigned int length;
+ unsigned char is_null;
+ unsigned char is_copy;
+ unsigned char is_static;
+ unsigned char reserved;
+
+ etch_message* msg;
+ etch_who* whofrom;
+
+} etch_mailbox_element;
+
+
+/* - - - - - - - - - - - - - - - - -
+ * signatures of i_mailbox virtuals
+ * - - - - - - - - - - - - - - - - -
+ */
+
+/**
+ * etch_mailbox_message()
+ * queues the specified message to this mailbox.
+ * @param thisx caller
+ * @param msg the message to be received, caller relinquishes on success, retains on failure.
+ * @param whofrom sender, caller retains
+ * @return 0 success, -1 failure.
+ */
+typedef int (*etch_mailbox_message)(void* thisx, void* whofrom, void* msg);
+
+/**
+ * etch_mailbox_read()
+ * reads the next message from the mailbox, waiting indefinitely for a message to be delivered.
+ * @param thisx caller
+ * @param out location to receive the etch_mailbox_element* result.
+ * @return 0 success, -1 failure. on success, out location is populated with the requested message.
+ * if mailbox is empty and closed, result will be zero and *out will contain null.
+ * -1 this indicates an exception condition, not an empty condition.
+ */
+typedef int (*etch_mailbox_read) (void* thisx, etch_mailbox_element** out);
+
+/**
+ * etch_mailbox_read_withwait()
+ * reads the next message from the mailbox, waiting the specified time for a message to be delivered.
+ * @param thisx caller
+ * @param maxdelay the maximum amount of time in milliseconds to wait for a message when the
+ * mailbox is empty. zero indicates wait indefinitely, -1 indicates do not wait.
+ * @param out location to receive the etch_mailbox_element* result.
+ * @return 0 success, -1 failure. on success, out location is populated with the requested message.
+ * if mailbox is empty and closed, result will be zero and *out will contain null.
+ * -1 this indicates an exception condition, not an empty condition.
+ */
+typedef int (*etch_mailbox_read_withwait) (void* thisx, const int maxdelay, etch_mailbox_element** out);
+
+/**
+ * etch_mailbox_close_delivery()
+ * closes the mailbox such that no more messages can be delivered to it.
+ * any messages currently queued will continue to be processed.
+ * @param thisx caller
+ * @return 0 if mailbox was closed successfuly, -1 if mailbox was already closed or could not be closed.
+ */
+typedef int (*etch_mailbox_close_delivery) (void* thisx);
+
+/**
+ * etch_mailbox_close_read()
+ * closes the mailbox such that no more messages can be delivered to it or read from it.
+ * any messages currently queued will be delivered to a default handler.
+ * @param thisx caller
+ * @return 0 if mailbox was closed successfuly, -1 if mailbox was already closed or could not be closed.
+ */
+typedef int (*etch_mailbox_close_read) (void* thisx);
+
+/**
+ * etch_mailbox_register_notify()
+ * register a etch_mailbox_notify callback to receive notification of mailbox status changes.
+ * @param thisx caller
+ * @param notify pointer to a function conforming to the etch_mailbox_notify signature.
+ * @param state a value to pass through via the supplied notify callback.
+ * @param maxdelay the maximum amount of time in milliseconds to wait for delivery of the notification.
+ * zero indicates wait indefinitely, -1 indicates do not wait.
+ * @return 0 on success, -1 if a callback is already registered, or on exception condition.
+ */
+typedef int (*etch_mailbox_register_notify) (void* thisx, etch_mailbox_notify, void* state, const int maxdelay);
+
+/**
+ * etch_mailbox_unregister_notify()
+ * remove the specified etch_mailbox_notify callback. cancels any current timeout.
+ * @param thisx caller
+ * @param notify pointer to a function conforming to the etch_mailbox_notify signature.
+ * @return 0 if specified callback was unregistered or -1 is specified calback is not currently
+ * registered, or on exception condition.
+ */
+typedef int (*etch_mailbox_unregister_notify) (void* thisx, etch_mailbox_notify);
+
+/**
+ * etch_mailbox_is_empty()
+ * @return boolean value indicating if specified mailbox is empty
+ */
+typedef int (*etch_mailbox_is_empty) (void* thisx);
+
+/**
+ * etch_mailbox_is_closed()
+ * @return boolean value indicating if specified mailbox is closed
+ */
+typedef int (*etch_mailbox_is_closed) (void* thisx);
+
+/**
+ * etch_mailbox_is_full()
+ * @return boolean value indicating if specified mailbox is full
+ */
+typedef int (*etch_mailbox_is_full) (void* thisx);
+
+
+/** @return the message id of this mailbox */
+typedef int64 (*etch_mailbox_get_message_id) (void* thiz);
+
+
+/** @return the concrete etch_mailbox object for this mailbox */
+typedef struct etch_plainmailbox etch_mailbox;
+typedef etch_mailbox* (*etch_mailbox_get_implobj) (void*);
+
+
+/** @return the manager for this mailbox */
+typedef struct i_mailbox_manager i_mailbox_manager;
+typedef i_mailbox_manager* (*etch_mailbox_get_manager) (void*);
+
+
+
+/* - - - - - - - - - - - - - - - - -
+ * i_mailbox
+ * - - - - - - - - - - - - - - - - -
+ */
+
+/**
+ * i_mailbox
+ * mailbox interface
+ */
+typedef struct i_mailbox
+{
+ unsigned int hashkey;
+ unsigned short obj_type;
+ unsigned short class_id;
+ struct objmask* vtab;
+ int (*destroy)(void*);
+ void*(*clone) (void*);
+ obj_gethashkey get_hashkey;
+ struct objmask* parent;
+ etchresult* result;
+ unsigned int refcount;
+ unsigned int length;
+ unsigned char is_null;
+ unsigned char is_copy;
+ unsigned char is_static;
+ unsigned char reserved;
+
+ void* thisx; /* instantiating object */
+ etch_mailbox_get_implobj mailbox;
+ etch_mailbox_get_manager manager;
+
+ etch_mailbox_message message;
+ etch_mailbox_read read;
+ etch_mailbox_read_withwait read_withwait;
+ etch_mailbox_close_delivery close_delivery;
+ etch_mailbox_close_read close_read;
+ etch_mailbox_register_notify register_notify;
+ etch_mailbox_unregister_notify unregister_notify;
+ etch_mailbox_is_empty is_empty;
+ etch_mailbox_is_closed is_closed;
+ etch_mailbox_is_full is_full;
+ etch_mailbox_get_message_id get_message_id;
+
+} i_mailbox;
+
+
+
+/* - - - - - - - - - - - - - - - - -
+ * public methods
+ * - - - - - - - - - - - - - - - - -
+ */
+
+/**
+ * new_mailbox_element()
+ * etch_mailbox_element constructor
+ * @param msg todo document ownership
+ * @param whofrom todo document ownership
+ */
+etch_mailbox_element* new_mailbox_element(etch_message* msg, etch_who* whofrom);
+
+
+/**
+ * new_default_mailbox_interface()
+ * i_mailbox constructor
+ * populates all virtuals with stub methods.
+ * @param thisx instantiator object
+ */
+i_mailbox* new_default_mailbox_interface(void* thisx);
+
+
+/**
+ * etch_mailbox_get_implobj()
+ * verify and return the concrete mailbox implementation
+ */
+etch_mailbox* etchmbox_get_implobj(i_mailbox*);
+
+
+/**
+ * etch_mailbox_get_manager()
+ * verify and return the mailbox's mailbox manager
+ */
+i_mailbox_manager* etchmbox_get_manager(i_mailbox*);
+
+
+/**
+ * new_mailbox_interface()
+ * i_mailbox constructor
+ * populates virtuals with specified methods.
+ * @param thisx instantiator object.
+ * @param balance of parameters are pointers to virtual method implementations.
+ */
+i_mailbox* new_mailbox_interface(void* thisx,
+ etch_mailbox_message,
+ etch_mailbox_read,
+ etch_mailbox_read_withwait,
+ etch_mailbox_close_delivery,
+ etch_mailbox_close_read,
+ etch_mailbox_register_notify,
+ etch_mailbox_unregister_notify,
+ etch_mailbox_is_empty,
+ etch_mailbox_is_closed,
+ etch_mailbox_is_full,
+ etch_mailbox_get_message_id);
+
+#endif /* ETCHIMAILBOX_H */
Added: incubator/etch/trunk/binding-c/runtime/c/inc/etch_mailboxmgr.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-c/runtime/c/inc/etch_mailboxmgr.h?rev=767594&view=auto
==============================================================================
--- incubator/etch/trunk/binding-c/runtime/c/inc/etch_mailboxmgr.h (added)
+++ incubator/etch/trunk/binding-c/runtime/c/inc/etch_mailboxmgr.h Wed Apr 22 17:25:43 2009
@@ -0,0 +1,138 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * etch_mailboxmgr.h
+ * i_mailboxmgr interface
+ */
+#ifndef ETCHIMAILBOXMGR_H
+#define ETCHIMAILBOXMGR_H
+
+#if(0)
+
+ MAILBOXMANAGER
+ | transportCall(Who to, message)
+ | redeliver(Who from, message)
+ | unregister(mailbox)
+ |- SESSIONMESSAGE<SessionData>
+ | | sessionMessage(Who from, message)
+ | - SESSION
+ | sessionQuery(); sessionControl(); sessionNotify();
+ - TRANSPORTMESSAGE
+ | transportMessage(to, Message);
+ - TRANSPORT
+ transportQuery(); transportControl(); transportNotify();
+ getSession(); setSession();
+#endif
+
+#include "etch_mailboxint.h"
+#include "etch_sessionmsg.h"
+#include "etch_transportmsg.h"
+#include "etchmutex.h"
+
+typedef int (*etch_mbm_transport_call) (void* thisx, void* whoto, void* msg, void** out);
+typedef int (*etch_mbm_redeliver) (void* thisx, void* whofrom, void* msg);
+typedef int (*etch_mbm_unregister) (void* thisx, void* mailbox);
+
+
+/**
+ * i_mailbox_manager
+ * mailbox manager interface
+ */
+typedef struct i_mailbox_manager
+{
+ unsigned int hashkey;
+ unsigned short obj_type;
+ unsigned short class_id;
+ struct objmask* vtab;
+ int (*destroy)(void*);
+ void*(*clone) (void*);
+ obj_gethashkey get_hashkey;
+ struct objmask* parent;
+ etchresult* result;
+ unsigned int refcount;
+ unsigned int length;
+ unsigned char is_null;
+ unsigned char is_copy;
+ unsigned char is_static;
+ unsigned char reserved;
+
+ void* thisx; /* object which is the interface implementor */
+
+ /**
+ * transport_call()
+ * sends a message which begins a call after allocating a mailbox
+ * to receive responses.
+ * @param whoto recipient. caller retains.
+ * @param message the message which begins the call.
+ * caller relinquishes on success, retains on other than success.
+ * @param out pointer to location to return the i_mailbox which will
+ * receive responses to the call.
+ * @return 0 success, -1 error
+ */
+ etch_mbm_transport_call transport_call;
+
+ /**
+ * redeliver()
+ * redelivers messages extant from a closed mailbox.
+ * @param whofrom sender. caller retains.
+ * @param message. caller relinquishes on success, retains on other than success.
+ * @return 0 success, -1 error
+ */
+ etch_mbm_redeliver redeliver;
+
+ /**
+ * unregister()
+ * removes specified mailbox from the set of mailboxes receiving responses to messages.
+ * @param mailbox the mailbox to remove. caller does not own it.
+ * @return 0 success, -1 error
+ */
+ etch_mbm_unregister unregister;
+
+ /* implements session message interface */
+ i_sessionmessage* ism;
+ etch_session_message session_message;
+ etch_session_control session_control;
+ etch_session_notify session_notify;
+ etch_session_query session_query;
+
+ /* implements transport message interface */
+ i_transportmessage* itm;
+ etch_transport_message transport_message;
+ etch_transport_control transport_control;
+ etch_transport_notify transport_notify;
+ etch_transport_query transport_query;
+ etch_transport_get_session get_session;
+ etch_transport_set_session set_session;
+
+ etchmutex* rwlock; /* not owned */
+
+} i_mailbox_manager;
+
+
+/**
+ * new_mailboxmgr_interface()
+ * i_mailbox_manager constructor.
+ * @param thisx the mailbox manager object.
+ * @param itm transportmesssage interface, caller retains, can be null.
+ * @param ism sessionmessage interface, caller retains, can be null.
+ */
+i_mailbox_manager* new_mailboxmgr_interface(void* thisx,
+ i_transportmessage*, i_sessionmessage*);
+
+#endif /* ETCHIMAILBOXMGR_H */
\ No newline at end of file
Added: incubator/etch/trunk/binding-c/runtime/c/inc/etch_message.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-c/runtime/c/inc/etch_message.h?rev=767594&view=auto
==============================================================================
--- incubator/etch/trunk/binding-c/runtime/c/inc/etch_message.h (added)
+++ incubator/etch/trunk/binding-c/runtime/c/inc/etch_message.h Wed Apr 22 17:25:43 2009
@@ -0,0 +1,108 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * etch_message.h
+ * a message is modeled as a command and some arguments. command is an arbitrary
+ * integer value, and the arguments are key / value pairs, where the key is an
+ * arbitrary integer value and the value is any one of the standard java objects
+ * an array value, a struct value, or any type serializable by value factory.
+ */
+
+#ifndef ETCHMESSAGE_H
+#define ETCHMESSAGE_H
+
+#include "etch_structval.h"
+#include "etch_valufact.h"
+
+
+/*
+ * etch_message
+ * this class is "final"
+ */
+typedef struct etch_message
+{
+ unsigned int hashkey;
+ unsigned short obj_type;
+ unsigned short class_id;
+ struct objmask* vtab;
+ int (*destroy)(void*);
+ void*(*clone) (void*);
+ obj_gethashkey get_hashkey;
+ struct objmask* parent;
+ etchresult* result;
+ unsigned int refcount;
+ unsigned int length;
+ unsigned char is_null;
+ unsigned char is_copy;
+ unsigned char is_static;
+ unsigned char reserved;
+
+ etch_structvalue* sv; /* owned */
+ etch_value_factory* vf; /* not owned */
+
+} etch_message;
+
+
+/*
+ * etch_unwanted_message
+ */
+typedef struct etch_unwanted_message
+{
+ unsigned int hashkey;
+ unsigned short obj_type;
+ unsigned short class_id;
+ struct objmask* vtab;
+ int (*destroy)(void*);
+ void*(*clone) (void*);
+ obj_gethashkey get_hashkey;
+ struct objmask* parent;
+ etchresult* result;
+ unsigned int refcount;
+ unsigned int length;
+ unsigned char is_null;
+ unsigned char is_copy;
+ unsigned char is_static;
+ unsigned char reserved;
+
+ etch_message* message; /* owned */
+ etch_who* whofrom; /* not owned */
+
+} etch_unwanted_message;
+
+etch_unwanted_message* new_unwanted_message(etch_who* whofrom, etch_message* msg);
+
+
+etch_message* new_message (etch_type*, const int, etch_value_factory*);
+int destroy_message (etch_message*);
+
+objmask* message_get (etch_message*, etch_field* key);
+objmask* message_remove(etch_message*, etch_field* key);
+int message_put (etch_message*, etch_field* key, objmask* value);
+int message_putc (etch_message*, etch_field* key, void** valref);
+etch_message* message_reply (etch_message*, etch_type* type);
+etch_type* message_type (etch_message*);
+char* message_aname (etch_message*);
+etch_int64* message_get_id(etch_message*);
+etch_int64* message_get_in_reply_to(etch_message*);
+int message_set_in_reply_to(etch_message*, etch_int64* id);
+int message_set_id(etch_message*, etch_int64* id);
+int message_size (etch_message*);
+
+
+#endif /* #ifndef ETCHMESSAGE_H*/
\ No newline at end of file
Added: incubator/etch/trunk/binding-c/runtime/c/inc/etch_messagizer.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-c/runtime/c/inc/etch_messagizer.h?rev=767594&view=auto
==============================================================================
--- incubator/etch/trunk/binding-c/runtime/c/inc/etch_messagizer.h (added)
+++ incubator/etch/trunk/binding-c/runtime/c/inc/etch_messagizer.h Wed Apr 22 17:25:43 2009
@@ -0,0 +1,140 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * etch_msgizer.h
+ * messagizer accepts packets and translates them to messages,
+ * and it accepts messages and translates them to packets.
+ */
+
+#ifndef ETCHMSGIZER_H
+#define ETCHMSGIZER_H
+
+#include "apr_thread_proc.h"
+#include "etch_sessionmsg.h"
+#include "etch_sessionpkt.h"
+#include "etch_transportmsg.h"
+#include "etch_transportpkt.h"
+
+#include "etch_tagdata_inp.h"
+#include "etch_tagdata_out.h"
+
+#include "etchflexbuf.h"
+#include "etch_resources.h"
+#include "etchmutex.h"
+#include "etch_url.h"
+
+#if(0)
+
+ MESSAGIZER(TRANSPORTPACKET)
+ | tagdata_input* tdi;
+ | tagdata_output* tdo;
+ | transportPacket* transport;
+ | sessionPacket(from, buf); // override i_sessionpacket
+ | transportMessage(to, Message); // implement i_transportmsg
+ - SESSIONPACKET
+ | | int (*etch_session_packet) (void* thisx, void* whofrom, void* buffer);
+ | - SESSION
+ | sessionQuery(); sessionControl(); sessionNotify();
+ - TRANSPORTMESSAGE
+ | int transportMessage(to, Message);
+ - TRANSPORT
+ transportQuery(); transportControl(); transportNotify();
+#endif
+
+
+/*
+ * etch_messagizer
+ */
+typedef struct etch_messagizer
+{
+ unsigned int hashkey;
+ unsigned short obj_type;
+ unsigned short class_id;
+ struct objmask* vtab;
+ int (*destroy)(void*);
+ void*(*clone) (void*);
+ obj_gethashkey get_hashkey;
+ struct objmask* parent;
+ etchresult* result;
+ unsigned int refcount;
+ unsigned int length;
+ unsigned char is_null;
+ unsigned char is_copy;
+ unsigned char is_static;
+ unsigned char reserved;
+
+ /* i_transportpacket of next lower layer (packetizer) */
+ i_transportpacket* transport; /* not owned */
+
+ /* i_sessionmessage of next higher layer (mailbox manager) */
+ i_sessionmessage* session; /* not owned */
+
+ etch_flexbuffer* msgbuf; /* owned */
+ tagged_data_input* tdi; /* owned */
+ tagged_data_output* tdo; /* owned */
+
+ /* - - - - - - - - - - - - - - -
+ * i_transportmessage
+ * - - - - - - - - - - - - - - -
+ */
+
+ /**
+ * i_transportmessage::transport_message()
+ * delivers message to transport from session
+ * @param to recipient
+ * @return 0 success, -1 error
+ */
+ etch_transport_message transport_message;
+ i_transportmessage* transportmsg; /* owned */
+ etch_transport_control transport_control; /* i_transportmessage::itransport */
+ etch_transport_notify transport_notify; /* i_transportmessage::itransport */
+ etch_transport_query transport_query; /* i_transportmessage::itransport */
+ etch_transport_get_session get_session; /* i_transportmessage::itransport */
+ etch_transport_set_session set_session; /* i_transportmessage::itransport */
+
+ /* - - - - - - - - - - - - - - -
+ * i_sessionpacket
+ * - - - - - - - - - - - - - - -
+ */
+
+ /**
+ * i_sessionpacket::session_packet()
+ * delivers data to the session from the transport
+ * @param from from who sent the packet
+ * @param buffer the packet from the packet source
+ * @return 0 success, -1 error
+ */
+ etch_session_packet session_packet;
+ i_sessionpacket* sessionpkt; /* owned */
+ etch_session_control session_control; /* i_sessionpacket::isession */
+ etch_session_notify session_notify; /* i_sessionpacket::isession */
+ etch_session_query session_query; /* i_sessionpacket::isession */
+
+ etchmutex* msglock;
+
+} etch_messagizer;
+
+
+etch_messagizer* new_messagizer (i_transportpacket*, wchar_t* uri, etch_resources* resxmap);
+etch_messagizer* new_messagizer_a(i_transportpacket*, etch_url*, etch_resources*);
+i_sessionmessage* etch_msgizer_get_session(etch_messagizer*);
+void etch_msgizer_set_session(etch_messagizer*, i_sessionmessage*);
+
+
+#endif /* ETCHMSGIZER_H */
\ No newline at end of file
Added: incubator/etch/trunk/binding-c/runtime/c/inc/etch_objects.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-c/runtime/c/inc/etch_objects.h?rev=767594&view=auto
==============================================================================
--- incubator/etch/trunk/binding-c/runtime/c/inc/etch_objects.h (added)
+++ incubator/etch/trunk/binding-c/runtime/c/inc/etch_objects.h Wed Apr 22 17:25:43 2009
@@ -0,0 +1,59 @@
+/**
+ etch_objects.h
+ etch object wrappers definintion and construction
+*/
+
+#ifndef ETCHOBJECTS_H
+#define ETCHOBJECTS_H
+
+#include "etchobj.h"
+
+/**
+ * equate boxed object types to the object wrapper.
+ */
+typedef etchobject ETCH_INT;
+typedef etchobject ETCH_INT8;
+typedef etchobject ETCH_INT16;
+typedef etchobject ETCH_INT32;
+typedef etchobject ETCH_INT64;
+typedef etchobject ETCH_BYTE;
+typedef etchobject ETCH_BOOL;
+typedef etchobject ETCH_IEEE32;
+typedef etchobject ETCH_IEEE64;
+typedef etchobject ETCH_STRING;
+typedef etchobject ETCH_CLASS;
+typedef etchobject ETCH_HASHTABLE;
+
+typedef etchobject ETCH_TYPE;
+typedef etchobject ETCH_FIELD;
+typedef etchobject ETCH_ID_NAME;
+typedef etchobject ETCH_EXCEPTION;
+typedef etchobject ETCH_MESSAGE;
+typedef etchobject ETCH_STRUCTVALUE;
+typedef etchobject ETCH_ARRAYVALUE;
+typedef etchobject ETCH_VALUEFACTORY;
+typedef etchobject ETCH_TAGDATAINPUT;
+typedef etchobject ETCH_TAGDATAOUTPUT;
+typedef etchobject ETCH_ARRAYLIST;
+
+/**
+ * constructors for boxed primitives
+ */
+ETCH_INT32* new_etch_int32 (const int value);
+ETCH_INT8* new_etch_int8 (const signed char value);
+ETCH_INT16* new_etch_int16 (const short value);
+ETCH_INT64* new_etch_int64 (const int64 value);
+ETCH_BYTE* new_etch_byte (const unsigned char value);
+ETCH_BOOL* new_etch_bool (const unsigned char value);
+ETCH_IEEE32* new_etch_ieee32(const float value);
+ETCH_IEEE64* new_etch_ieee64(const double value);
+ETCH_STRING* new_etch_string(const wchar_t* value);
+ETCH_STRING* new_etch_static_string(const wchar_t* value);
+ETCH_ARRAYLIST* new_etch_arraylist
+ (const unsigned isize, const unsigned dsize, const unsigned is_readonly);
+
+void destroy_boxed_arraylist(ETCH_ARRAYLIST* thisp);
+
+
+
+#endif /* #ifndef ETCHOBJECTS_H */
\ No newline at end of file
Added: incubator/etch/trunk/binding-c/runtime/c/inc/etch_packetizer.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-c/runtime/c/inc/etch_packetizer.h?rev=767594&view=auto
==============================================================================
--- incubator/etch/trunk/binding-c/runtime/c/inc/etch_packetizer.h (added)
+++ incubator/etch/trunk/binding-c/runtime/c/inc/etch_packetizer.h Wed Apr 22 17:25:43 2009
@@ -0,0 +1,155 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * etch_packetizer.h
+ * packetizes a stream data source. Reads a packet header: 32-bit flag
+ * and 32-bit length, both big-endian, verifies the flag, using length from
+ * header, reads packet data and forwards it to the packet handler.
+ * as a packet source, accepts a packet and prepends a packet header to it
+ * prior to delivering it to a data source.
+ */
+
+#ifndef ETCHPACKETIZER_H
+#define ETCHPACKETIZER_H
+
+#include "apr_thread_proc.h"
+#include "etch_sessiondata.h"
+#include "etch_transportpkt.h"
+#include "etch_transportdata.h"
+#include "etch_sessionpkt.h"
+#include "etch_arraylist.h"
+#include "etch_resources.h"
+#include "etchflexbuf.h"
+#include "etchthread.h"
+#include "etch_url.h"
+#define ETCHPZR_HAS_MUTEX FALSE
+
+#if(0)
+
+ PACKETIZER(TRANSPORTDATA)
+ | transportData* transport;
+ | sessionData(from, buf); // override i_sessiondata
+ | transportPacket(to, buf); // implement i_transportpacket
+ - SESSIONDATA
+ | | int sessionData (whofrom, buffer);
+ | - SESSION
+ | sessionQuery(); sessionControl(); sessionNotify();
+ - TRANSPORTPACKET
+ | int transportPacket(to, buffer);
+ | int headerSize;
+ - TRANSPORT
+ transportQuery(); transportControl(); transportNotify();
+#endif
+
+const wchar_t* ETCH_PKTIZER_MAX_PKT_SIZE_TERM;
+const int ETCH_PKTIZER_DEFMAXPKTSIZE;
+const int ETCH_PKTIZER_HEADERSIZE;
+const int ETCH_PKTIZER_SIG;
+
+typedef struct etch_packetizer etch_packetizer;
+
+
+/*
+ * etch_packetizer
+ */
+typedef struct etch_packetizer
+{
+ unsigned int hashkey;
+ unsigned short obj_type;
+ unsigned short class_id;
+ struct objmask* vtab;
+ int (*destroy)(void*);
+ void*(*clone) (void*);
+ obj_gethashkey get_hashkey;
+ struct objmask* parent;
+ etchresult* result;
+ unsigned int refcount;
+ unsigned int length;
+ unsigned char is_null;
+ unsigned char is_copy;
+ unsigned char is_static;
+ unsigned char reserved;
+
+ /* transport of next lower layer of the stack (connection) */
+ i_transportdata* transport; /* not owned */
+
+ /* session of next higher layer of the stack (messagizer) */
+ i_sessionpacket* session; /* not owned */
+
+ /* - - - - - - - - - - - - - - -
+ * i_transportpacket
+ * - - - - - - - - - - - - - - -
+ */
+
+ /**
+ * i_transportpacket::transport_packet()
+ * delivers packet to the transport after adding packet header.
+ * @param to recipient
+ * @param buf flexbuffer positioned on the packet and including space for header.
+ * @return 0 success, -1 error
+ */
+ etch_transport_packet transport_packet; /* transport_packet() */
+ i_transportpacket* transportpkt; /* owned */
+ etch_transport_control transport_control; /* i_transportmessage::itransport */
+ etch_transport_notify transport_notify; /* i_transportmessage::itransport */
+ etch_transport_query transport_query; /* i_transportmessage::itransport */
+ etch_transport_get_session get_session; /* i_transportmessage::itransport */
+ etch_transport_set_session set_session; /* i_transportmessage::itransport */
+
+ /* - - - - - - - - - - - - - - -
+ * i_sessiondata
+ * - - - - - - - - - - - - - - -
+ */
+
+ /**
+ * i_sessiondata::session_data()
+ * delivers data to the session from the transport
+ * @param from from who sent the packet data
+ * @param buffer the packet from the packet source positioned at the data
+ * @return 0 success, -1 error
+ */
+ etch_session_data session_data; /* session_data() */
+ i_sessiondata* sessiondata; /* owned */
+ etch_session_control session_control; /* i_sessionpacket::isession */
+ etch_session_notify session_notify; /* i_sessionpacket::isession */
+ etch_session_query session_query; /* i_sessionpacket::isession */
+
+ int (*process_header) (etch_packetizer*, etch_flexbuffer*, const int is_reset);
+
+ etchmutex* datalock;
+
+ etch_flexbuffer* savebuf; /* owned */
+
+ size_t headersize;
+ size_t bodylength;
+ size_t maxpacketsize;
+ unsigned char is_wantheader; /* logic state flag: set true in ctor */
+
+} etch_packetizer;
+
+
+etch_packetizer* new_packetizer (i_transportdata*, wchar_t* uri, etch_resources*);
+etch_packetizer* new_packetizer_a(i_transportdata*, etch_url*, etch_resources*);
+
+i_sessionpacket* etch_pktizer_get_session(etch_packetizer*);
+void etch_pktizer_set_session(etch_packetizer*, i_sessionpacket*);
+int etch_pktizer_process_header (etch_packetizer*, etch_flexbuffer*, const int);
+
+
+#endif /* ETCHPACKETIZER_H */
\ No newline at end of file
Added: incubator/etch/trunk/binding-c/runtime/c/inc/etch_plainmailbox.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-c/runtime/c/inc/etch_plainmailbox.h?rev=767594&view=auto
==============================================================================
--- incubator/etch/trunk/binding-c/runtime/c/inc/etch_plainmailbox.h (added)
+++ incubator/etch/trunk/binding-c/runtime/c/inc/etch_plainmailbox.h Wed Apr 22 17:25:43 2009
@@ -0,0 +1,170 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * etch_plainmailbox.h
+ * standard mailbox using a fixed size queue
+ */
+
+#ifndef ETCHPLAINMBOX_H
+#define ETCHPLAINMBOX_H
+
+#include "etch_mailboxint.h"
+#include "etch_mailboxmgr.h"
+#include "etch_simpletimer.h"
+#include "etchthread.h"
+#include "etch_queue.h"
+
+#define MBOX_LIFETIME_UNTIL_CLOSE 0
+#define MBOX_DEFMAXMESSAGES 8
+#define ETCH_MAILBOX_RESULT_ALREADY_CLOSED 1
+
+#define ETCH_MAILBOX_STATE_INITIAL 0
+#define ETCH_MAILBOX_STATE_OPEN 2
+#define ETCH_MAILBOX_STATE_CLOSED_DELIVERY 4
+#define ETCH_MAILBOX_STATE_CLOSED_READ 6
+#define ETCH_MAILBOX_STATE_SHUTDOWN 8
+
+typedef etch_timer_callback etch_alarm_wakeup;
+
+
+#if(0)
+
+ PLAINMAILBOX(MAILBOXMANAGER)
+ |- ALARMLISTENER
+ | etch_alarm_wakeup()
+ - MAILBOX
+ | etch_mailbox_message()
+ | etch_mailbox_read()
+ | etch_mailbox_read_withwait()
+ | etch_mailbox_close_delivery()
+ | etch_mailbox_close_read()
+ | etch_mailbox_register_notify()
+ | etch_mailbox_unregister_notify()
+ | etch_mailbox_is_empty()
+ | etch_mailbox_is_closed()
+ | etch_mailbox_is_full()
+ | etch_mailbox_get_message_id()
+ -
+#endif
+
+typedef struct i_mailbox_manager i_mailbox_manager;
+
+
+/*
+ * etch_plainmailbox
+ * this object is instantiated, and is also a mask over any other mailbox
+ * class object which may be defined. etch_plainmailbox is therefore
+ * typedef'ed below as etch_mailbox.
+ */
+typedef struct etch_plainmailbox
+{
+ unsigned int hashkey;
+ unsigned short obj_type;
+ unsigned short class_id;
+ struct objmask* vtab;
+ int (*destroy)(void*);
+ void*(*clone) (void*);
+ obj_gethashkey get_hashkey;
+ struct objmask* parent;
+ etchresult* result;
+ unsigned int refcount;
+ unsigned int length;
+ unsigned char is_null;
+ unsigned char is_copy;
+ unsigned char is_static;
+ unsigned char reserved;
+
+ void* impl;
+ i_mailbox_manager* manager;
+
+ /* - - - - - - - - - - - - - - -
+ * notify interface
+ * - - - - - - - - - - - - - - -
+ */
+ etch_mailbox_notify notify;
+
+ /* - - - - - - - - - - - - - - -
+ * alarm listener interface
+ * - - - - - - - - - - - - - - -
+ */
+ etch_alarm_wakeup wakeup;
+
+ /* - - - - - - - - - - - - - - -
+ * i_mailbox interface
+ * - - - - - - - - - - - - - - -
+ */
+ i_mailbox* imailbox;
+
+ etch_mailbox_message message;
+ etch_mailbox_read read;
+ etch_mailbox_read_withwait read_withwait;
+ etch_mailbox_close_delivery close_delivery;
+ etch_mailbox_close_read close_read;
+ etch_mailbox_register_notify register_notify;
+ etch_mailbox_unregister_notify unregister_notify;
+ etch_mailbox_is_empty is_empty;
+ etch_mailbox_is_closed is_closed;
+ etch_mailbox_is_full is_full;
+ etch_mailbox_get_message_id get_message_id;
+
+ /* - - - - - - - - - - - - - - -
+ * etch_mailbox instance data
+ * - - - - - - - - - - - - - - -
+ */
+ int lifetime;
+ int max_messages;
+ int max_message_delay;
+ int64 message_id;
+ etch_queue* queue;
+ etch_timer* lifetimer;
+ etchmutex* rwlock; /* global read write lock - not owned */
+ etchmutex* readlock; /* unused - lose it */
+ objmask* notify_state;
+
+ unsigned char is_alarm_set;
+ unsigned char mailbox_state;
+ unsigned char unused_a;
+ unsigned char unused_b;
+
+ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * derivations must include all the above and define data following
+ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ */
+
+} etch_plainmailbox;
+
+
+typedef struct etch_plainmailbox etch_mailbox;
+
+
+etch_mailbox* new_mailbox
+ ( i_mailbox_manager*,
+ const int64 message_id,
+ const int max_msgdelay,
+ const int lifetime,
+ const int max_messages
+ );
+
+int etchmbox_contains_message(etch_mailbox*, etch_message*);
+int etchmbox_get_readlock (etch_plainmailbox*, const char*);
+int etchmbox_release_readlock (etch_plainmailbox*, const char*);
+int etchmbox_get_readlockex (etchmutex*, const char*);
+int etchmbox_release_readlockex (etchmutex*, const char*);
+
+#endif /* ETCHPLAINMBOX_H */
\ No newline at end of file
Added: incubator/etch/trunk/binding-c/runtime/c/inc/etch_plainmboxmgr.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-c/runtime/c/inc/etch_plainmboxmgr.h?rev=767594&view=auto
==============================================================================
--- incubator/etch/trunk/binding-c/runtime/c/inc/etch_plainmboxmgr.h (added)
+++ incubator/etch/trunk/binding-c/runtime/c/inc/etch_plainmboxmgr.h Wed Apr 22 17:25:43 2009
@@ -0,0 +1,135 @@
+/*
+ * etch_plainmailboxmgr.h
+ * mailbox manager accepts packets for potential delivery to a mailbox or to an
+ * alternate message handler if an appropriate mailbox is not available.
+ * a mailbox can be created on request keyed by the a message's ID.
+ */
+
+#ifndef ETCHPLAINMBOXMGR_H
+#define ETCHPLAINMBOXMGR_H
+
+#include "etch_mailboxmgr.h"
+#include "etch_resources.h"
+#include "etchmutex.h"
+#include "etch_url.h"
+
+#define ETCHMBMGR_DEFNUMMAILBOXES 8
+
+#if(0)
+
+ PLAINMAILBOXMGR
+ | register(mailbox)
+ | unregister(mailbox)
+ | unregisterAll();
+ | getMailbox(messageID);
+ - MAILBOXMANAGER
+ | transportCall(Who to, message)
+ | redeliver(Who from, message)
+ | unregister(mailbox)
+ |- SESSIONMESSAGE<SessionData>
+ | | sessionMessage(Who from, message)
+ | - SESSION
+ | sessionQuery(); sessionControl(); sessionNotify();
+ - TRANSPORTMESSAGE
+ | transportMessage(to, Message);
+ - TRANSPORT
+ transportQuery(); transportControl(); transportNotify();
+ getSession(); setSession();
+#endif
+
+typedef struct etch_plainmailboxmgr etch_plainmailboxmgr;
+typedef etch_plainmailboxmgr etch_mailbox_manager;
+
+
+/*
+ * etch_plainmailboxmgr
+ */
+typedef struct etch_plainmailboxmgr
+{
+ unsigned int hashkey;
+ unsigned short obj_type;
+ unsigned short class_id;
+ struct objmask* vtab;
+ int (*destroy)(void*);
+ void*(*clone) (void*);
+ obj_gethashkey get_hashkey;
+ struct objmask* parent;
+ etchresult* result;
+ unsigned int refcount;
+ unsigned int length;
+ unsigned char is_null;
+ unsigned char is_copy;
+ unsigned char is_static;
+ unsigned char reserved;
+
+ int max_delay;
+ etchmutex* xlock; /* owned - unused */
+ etchmutex* rwlock; /* not owned */
+ etch_hashtable* mailboxes; /* owned */
+ unsigned char is_connection_up;
+
+ /* - - - - - - - - - - - - - - -
+ * i_mailbox_manager interface
+ * - - - - - - - - - - - - - - -
+ */
+ i_mailbox_manager* imanager; /* owned */
+ etch_mbm_transport_call transport_call;
+ etch_mbm_redeliver redeliver;
+ etch_mbm_unregister unregister;
+
+ /* i_transportmessage of next lower layer (messagizer) */
+ i_transportmessage* transport; /* not owned */
+
+ /* i_sessionmessage of next higher layer (delivery service) */
+ i_sessionmessage* session; /* not owned */
+
+ /* - - - - - - - - - - - - - - -
+ * i_sessionmessage interface
+ * - - - - - - - - - - - - - - -
+ */
+ i_sessionmessage* isessionmsg; /* owned */
+ etch_session_message session_message;
+ etch_session_control session_control;
+ etch_session_notify session_notify;
+ etch_session_query session_query;
+
+ /* - - - - - - - - - - - - - - -
+ * i_transportmessage interface
+ * - - - - - - - - - - - - - - -
+ */
+ i_transportmessage* transportmsg; /* owned */
+ etch_transport_message transport_message;
+ etch_transport_control transport_control;
+ etch_transport_notify transport_notify;
+ etch_transport_query transport_query;
+ etch_transport_get_session get_session;
+ etch_transport_set_session set_session;
+
+} etch_plainmailboxmgr;
+
+
+typedef struct etch_plainmailboxmgr etch_mailboxmgr;
+int64 message_id_farm;
+etchmutex* g_atomiclock;
+int64 etch_generate_message_id();
+
+
+/**
+ * new_plain_mailbox_manager()
+ * etch_plainmailboxmgr constructor
+ * @param itm i_transportmessage interface object, caller retains ownership.
+ * @param uri url string, caller relinquishes ownership.
+ * @param resxmap caller retains ownership.
+ */
+etch_plainmailboxmgr* new_plain_mailbox_manager(i_transportmessage*,
+ wchar_t* uri, etch_resources*, etchmutex*);
+
+i_mailbox* pmboxmgr_get_mailbox(etch_plainmailboxmgr*, etch_int64* msgid);
+
+int pmboxmgr_register_mailbox(etch_plainmailboxmgr*, i_mailbox*);
+int pmboxmgr_unregister_all(etch_plainmailboxmgr*);
+etch_hashtable* new_pmboxmgr_mailboxmap();
+int pmboxmgr_size(etch_plainmailboxmgr*);
+
+
+#endif /* ETCHPLAINMBOXMGR_H */
\ No newline at end of file
Added: incubator/etch/trunk/binding-c/runtime/c/inc/etch_queue.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-c/runtime/c/inc/etch_queue.h?rev=767594&view=auto
==============================================================================
--- incubator/etch/trunk/binding-c/runtime/c/inc/etch_queue.h (added)
+++ incubator/etch/trunk/binding-c/runtime/c/inc/etch_queue.h Wed Apr 22 17:25:43 2009
@@ -0,0 +1,102 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * etch_queue.h
+ * synchronized FIFO queue
+ */
+#ifndef ETCHQUEUE_H
+#define ETCHQUEUE_H
+
+#include "etchobj.h"
+#include "etchthread.h"
+#include "etch_queue_apr.h"
+#include "etch_collection.h"
+
+#define ETCH_DEFQSIZE 32
+
+#define ETCHQUEUE_CONTENT_SIMPLE 0 /* content memory freed as a unit */
+#define ETCHQUEUE_CONTENT_OBJECT 1 /* content is etchobject */
+
+#define ETCH_QUEUE_OPERATION_TIMEOUT 1
+#define ETCH_QUEUE_OPERATION_CANCELED 2
+#define ETCH_QUEUE_EOF 3
+
+#define ETCHQUEUE_NEEDLOCK TRUE
+#define ETCHQUEUE_NOLOCK FALSE
+
+typedef int (*queuecallback) (int, void*); /* queue callback signature */
+
+
+
+/**
+ * etch_queue
+ */
+typedef struct etch_queue
+{
+ unsigned int hashkey;
+ unsigned short obj_type;
+ unsigned short class_id;
+ struct vtabmask* vtab;
+ int (*destroy) (void*);
+ void*(*clone) (void*);
+ obj_gethashkey get_hashkey;
+ struct objmask* parent;
+ etchresult* result;
+ unsigned int refcount;
+ unsigned int length;
+ unsigned char is_null;
+ unsigned char is_copy;
+ unsigned char is_static;
+ unsigned char reserved;
+
+ etch_apr_queue_t* aprq;
+ unsigned short content_obj_type; /* etch obj_type of a native value */
+ unsigned short content_class_id; /* etch class_id of a native value */
+ unsigned int qcapacity;
+
+ /* this object may be masked by etch_collection_mask to determine content
+ * type and class, so do not add any fields above this comment */
+
+ i_iterable iterable;
+ apr_pool_t* subpool;
+ queuecallback freehook;
+ unsigned char is_readonly;
+ unsigned char content_type;
+
+} etch_queue;
+
+
+etch_queue* new_queue(const int initialsize);
+int etchqueue_put(etch_queue*, void* item);
+int etchqueue_try_put(etch_queue*, void* item);
+int etchqueue_put_withwait(etch_queue*, const int waitms, void* item);
+int etchqueue_get(etch_queue*, void** itemout);
+int etchqueue_try_get(etch_queue*, void** itemout);
+int etchqueue_get_withwait(etch_queue*, const int waitms, void** itemout);
+int etchqueue_notify_all(etch_queue*);
+int etchqueue_lock(etch_queue*);
+int etchqueue_unlock(etch_queue*);
+int etchqueue_trylock(etch_queue*);
+int etchqueue_size(etch_queue*);
+int etchqueue_is_closed(etch_queue*);
+int etchqueue_is_full(etch_queue*);
+int etchqueue_close(etch_queue*, const int is_needlock);
+
+
+#endif /* ETCHQUEUE_H */
Added: incubator/etch/trunk/binding-c/runtime/c/inc/etch_queue_apr.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-c/runtime/c/inc/etch_queue_apr.h?rev=767594&view=auto
==============================================================================
--- incubator/etch/trunk/binding-c/runtime/c/inc/etch_queue_apr.h (added)
+++ incubator/etch/trunk/binding-c/runtime/c/inc/etch_queue_apr.h Wed Apr 22 17:25:43 2009
@@ -0,0 +1,82 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * etch_queue_apr.h
+ * based on apr_queue, with timeouts added on push and pop waits.
+ */
+
+#ifndef ETCHQUEUEAPR_H
+#define ETCHQUEUEAPR_H
+
+#define ETCHQUEUE_CLEARING_CLOSED_QUEUE (-2)
+
+#include "etchobj.h"
+#include "apr_thread_cond.h"
+
+
+/**
+ * etch_apr_queue_t
+ * same as the private apr_queue_t
+ */
+typedef struct etch_apr_queue_t
+{
+ void **data;
+ unsigned int nelts; /**< # elements */
+ unsigned int in; /**< next empty location */
+ unsigned int out; /**< next filled location */
+ unsigned int bounds;/**< max size of queue */
+ unsigned int full_waiters;
+ unsigned int empty_waiters;
+ apr_thread_mutex_t *one_big_mutex;
+ apr_thread_cond_t *not_empty;
+ apr_thread_cond_t *not_full;
+ int terminated;
+
+} etch_apr_queue_t;
+
+
+apr_status_t etch_apr_queue_create(etch_apr_queue_t **queue,
+ unsigned int queue_capacity, apr_pool_t *a);
+
+apr_status_t etch_apr_queue_push(etch_apr_queue_t *queue,
+ apr_interval_time_t timeout, void *data);
+
+apr_status_t etch_apr_queue_pop(etch_apr_queue_t *queue,
+ apr_interval_time_t timeout, void **data);
+
+apr_status_t etch_apr_queue_trypush(etch_apr_queue_t *queue, void *data);
+
+apr_status_t etch_apr_queue_trypop(etch_apr_queue_t *queue, void **data);
+
+unsigned int etch_apr_queue_size(etch_apr_queue_t*);
+
+apr_status_t etch_apr_queue_interrupt_all(etch_apr_queue_t*);
+
+apr_status_t etch_apr_queue_unsafe_interrupt_all(etch_apr_queue_t*);
+
+apr_status_t etch_apr_queue_term(etch_apr_queue_t *queue);
+
+apr_status_t etch_apr_queue_unsafeclose(etch_apr_queue_t*);
+
+apr_status_t etch_apr_queue_trylock(etch_apr_queue_t*);
+
+apr_status_t etch_apr_queue_lock(etch_apr_queue_t*);
+
+apr_status_t etch_apr_queue_unlock(etch_apr_queue_t*);
+
+
+#endif /* ETCHQUEUEAPR_H */
Added: incubator/etch/trunk/binding-c/runtime/c/inc/etch_remote.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-c/runtime/c/inc/etch_remote.h?rev=767594&view=auto
==============================================================================
--- incubator/etch/trunk/binding-c/runtime/c/inc/etch_remote.h (added)
+++ incubator/etch/trunk/binding-c/runtime/c/inc/etch_remote.h Wed Apr 22 17:25:43 2009
@@ -0,0 +1,62 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * etch_remote.h
+ * remote base
+ */
+
+#ifndef ETCH_REMOTE_H
+#define ETCH_REMOTE_H
+
+#include "etchobj.h"
+#include "etchthread.h"
+#include "etch_transport.h"
+#include "etch_sessionmsg.h"
+#include "etch_svcobj_masks.h"
+#include "etch_message.h"
+#include "etch_defvalufact.h"
+
+#define ETCH_REMOTETYPE_NONE 0
+#define ETCH_REMOTETYPE_CLIENT 1
+#define ETCH_REMOTETYPE_SERVER 2
+
+char* ETCHREMO;
+
+xxxx_remote* new_etch_remote_base (void* thisx, const int objsize,
+ const unsigned short class_id, i_delivery_service*,
+ etch_value_factory*, objmask*);
+
+etch_message* etchremote_new_message(xxxx_remote*, etch_type*);
+
+int etchremote_send(xxxx_remote*, etch_message*);
+void* etchremote_sendex(xxxx_remote*, etch_message*);
+int etchremote_begincall(xxxx_remote*, etch_message*, void**);
+int etchremote_endcall (xxxx_remote*, i_mailbox*, etch_type*, void**);
+int etchremote_transport_control(xxxx_remote*, etch_event*, etch_int32*);
+int etchremote_transport_notify (xxxx_remote*, etch_event*);
+void etchremote_set_session (xxxx_remote*, void* session);
+void* etchremote_get_session (xxxx_remote*);
+objmask* etchremote_transport_query (xxxx_remote*, objmask*);
+int etchremote_start_waitup (xxxx_remote*, const int);
+int etchremote_stop_waitdown (xxxx_remote*, const int);
+
+int is_etch_remote(void* x);
+
+
+#endif /* #ifndef ETCH_REMOTE_H */
\ No newline at end of file
Added: incubator/etch/trunk/binding-c/runtime/c/inc/etch_resources.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-c/runtime/c/inc/etch_resources.h?rev=767594&view=auto
==============================================================================
--- incubator/etch/trunk/binding-c/runtime/c/inc/etch_resources.h (added)
+++ incubator/etch/trunk/binding-c/runtime/c/inc/etch_resources.h Wed Apr 22 17:25:43 2009
@@ -0,0 +1,55 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * etch_resources.h
+ * resource map
+ * a string-to-etch-object-based hashtable
+ */
+
+#ifndef ETCHRESOURCES_H
+#define ETCHRESOURCES_H
+
+#include "etchhash.h"
+#define ETCH_RESOURCES_DEFSIZE 16
+
+const wchar_t* ETCH_RESXKEY_SOCKET;
+const wchar_t* ETCH_RESXKEY_ACCEPTED_CONX;
+const wchar_t* ETCH_RESXKEY_POOLTYPE_FREE;
+const wchar_t* ETCH_RESXKEY_POOLTYPE_QUEUED;
+const wchar_t* ETCH_RESXKEY_MSGIZER_FORMAT;
+const wchar_t* ETCH_RESXKEY_MSGIZER_VALUFACT;
+const wchar_t* ETCH_RESXVAL_XPORTFMT_BINARY;
+const wchar_t* ETCH_RESXVAL_XPORTFMT_XML;
+const wchar_t* ETCH_XFACTKEY_TCP;
+const wchar_t* ETCH_XPORTKEY_START;
+const wchar_t* ETCH_XPORTKEY_START_AND_WAIT_UP;
+const wchar_t* ETCH_XPORTKEY_IS_UP;
+const wchar_t* ETCH_XPORTKEY_STOP;
+const wchar_t* ETCH_XPORTKEY_STOP_AND_WAIT_DOWN;
+
+
+typedef etch_hashtable etch_resources;
+etch_resources* new_etch_resources (const int initialsize);
+objmask* etch_resources_get (etch_resources*, const wchar_t* key);
+int etch_resources_add (etch_resources*, const wchar_t* key, objmask* value);
+int etch_resources_replace (etch_resources*, const wchar_t* key, objmask* value);
+int etch_resources_clear (etch_resources*);
+
+
+#endif /* #ifndef ETCHRESOURCES_H */
\ No newline at end of file
Added: incubator/etch/trunk/binding-c/runtime/c/inc/etch_serializer.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-c/runtime/c/inc/etch_serializer.h?rev=767594&view=auto
==============================================================================
--- incubator/etch/trunk/binding-c/runtime/c/inc/etch_serializer.h (added)
+++ incubator/etch/trunk/binding-c/runtime/c/inc/etch_serializer.h Wed Apr 22 17:25:43 2009
@@ -0,0 +1,90 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * etch_serializer.h
+ * builtin custom type serializers
+ */
+
+#ifndef ETCH_SERIALIZER_H
+#define ETCH_SERIALIZER_H
+
+#include "etchobj.h"
+#include "etch_id_name.h"
+
+/* we restate typedefs stated elsewhere, here,
+ * since we can't include those headers in this one.
+ */
+typedef struct etch_id_name etch_type;
+typedef struct etch_id_name etch_field;
+typedef struct etch_hashtable etch_hashtable;
+typedef struct etch_validator etch_validator;
+typedef struct etch_serializer etch_serializer;
+typedef etch_serializer* (*etch_serializer_ctor) (etch_type*, etch_field*);
+
+
+/**
+ * etch_serializer
+ * import/export helper
+ */
+typedef struct etch_serializer
+{
+ unsigned int hashkey;
+ unsigned short obj_type;
+ unsigned short class_id;
+ struct i_value_factory* vtab;
+ int (*destroy)(void*);
+ void*(*clone) (void*);
+ obj_gethashkey get_hashkey;
+ struct objmask* parent;
+ etchresult* result;
+ unsigned int refcount;
+ unsigned int length;
+ unsigned char is_null;
+ unsigned char is_copy;
+ unsigned char is_static;
+ unsigned char reserved;
+
+ objmask* impl;
+
+ objmask* (*export_value) (struct etch_serializer* thisx, objmask* objval);
+
+ objmask* (*import_value) (struct etch_serializer* thisx, objmask* structval);
+
+ etch_id_name* type; /* not owned */
+ etch_id_name* field; /* not owned */
+
+} etch_serializer;
+
+
+etch_serializer* new_etch_serializer(const int objsize);
+
+int etch_serializer_init(etch_type*, const wchar_t*, const unsigned,
+ etch_hashtable*, etch_validator*, etch_serializer_ctor);
+
+
+int etch_serializer_exception_init(etch_type*, etch_hashtable* c2tmap);
+int etch_serializer_rtxcp_init (etch_type*, etch_hashtable* c2tmap);
+int etch_serializer_authxcp_init (etch_type*, etch_hashtable* c2tmap);
+int etch_serializer_list_init (etch_type*, etch_hashtable* c2tmap);
+int etch_serializer_map_init (etch_type*, etch_hashtable* c2tmap);
+int etch_serializer_set_init (etch_type*, etch_hashtable* c2tmap);
+int etch_serializer_date_init (etch_type*, etch_hashtable* c2tmap);
+
+
+#endif /* #ifndef ETCH_SERIALIZER_H */
\ No newline at end of file