[PATCH] New function to deduce ORB capability
- From: Jules Colding <colding omesc com>
- To: ORBit2 <orbit-list gnome org>
- Subject: [PATCH] New function to deduce ORB capability
- Date: Tue, 04 Apr 2006 15:07:36 +0200
Hi,
The attached patch introduces the new function
ORBit_get_giop_recv_limit(). This function will return the maximum
allowed GIOP message size to client applications.
This value is needed if the application in question are attempting to
stream large data chunks (with a size exceeding the maximum) from a
server. The client application would then loop the stream until all data
has been received. A knowledge of the maximum GIOP message size is
needed to perform the loop effectively.
A sample function that illustrates this functionality is included below
the patch.
Please comment. I'll commit shortly if no-one objects.
Best regards,
jules
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/ORBit2/ChangeLog,v
retrieving revision 1.743
diff -u -r1.743 ChangeLog
--- ChangeLog 14 Mar 2006 15:01:17 -0000 1.743
+++ ChangeLog 4 Apr 2006 11:17:59 -0000
@@ -1,3 +1,19 @@
+2006-04-04 Jules Colding <colding omesc com>
+
+ * configure.in (ORBIT_VERSION): Version 1.14.1. The micro version must be
+ bumped as a new function has been added.
+
+ * src/orb/orb-core/orb-core-private.h: Declared ORBit_get_giop_recv_limit()
+
+ * include/orbit/orb-core/corba-orb.h: Added ORBit_get_giop_recv_limit()
+ to ORBIT2_EXTENSIONS section.
+
+ * src/orb/orb-core/corba-orb.c (ORBit_get_giop_recv_limit): Added function
+ to retrieve the maximum allowed GIOP receive limit.
+
+ * src/orb/GIOP/giop-recv-buffer.c (giop_recv_get_limit): New function.
+ Clients must be able to retrieve the maximum allowed GIOP receive limit.
+
2006-03-14 Gustavo J. A. M. Carneiro <gjc gnome org>
* configure.in: Version 2.14.0.
Index: configure.in
===================================================================
RCS file: /cvs/gnome/ORBit2/configure.in,v
retrieving revision 1.167
diff -u -r1.167 configure.in
--- configure.in 14 Mar 2006 15:01:18 -0000 1.167
+++ configure.in 4 Apr 2006 11:17:59 -0000
@@ -18,7 +18,7 @@
ORBIT_MAJOR_VERSION=2
ORBIT_MINOR_VERSION=14
-ORBIT_MICRO_VERSION=0
+ORBIT_MICRO_VERSION=1
ORBIT_VERSION=$ORBIT_MAJOR_VERSION.$ORBIT_MINOR_VERSION.$ORBIT_MICRO_VERSION
AC_SUBST(ORBIT_MAJOR_VERSION)
AC_SUBST(ORBIT_MINOR_VERSION)
Index: include/orbit/GIOP/giop.h
===================================================================
RCS file: /cvs/gnome/ORBit2/include/orbit/GIOP/giop.h,v
retrieving revision 1.23
diff -u -r1.23 giop.h
--- include/orbit/GIOP/giop.h 4 Mar 2004 17:49:35 -0000 1.23
+++ include/orbit/GIOP/giop.h 4 Apr 2006 11:17:59 -0000
@@ -24,6 +24,7 @@
GIOPThread *giop_thread_self (void);
void giop_invoke_async (GIOPMessageQueueEntry *ent);
void giop_recv_set_limit (glong limit);
+glong giop_recv_get_limit (void);
void giop_incoming_signal_T (GIOPThread *tdata, GIOPMsgType t);
typedef struct _GIOPQueue GIOPQueue;
Index: include/orbit/orb-core/corba-orb.h
===================================================================
RCS file: /cvs/gnome/ORBit2/include/orbit/orb-core/corba-orb.h,v
retrieving revision 1.13
diff -u -r1.13 corba-orb.h
--- include/orbit/orb-core/corba-orb.h 19 Sep 2005 10:04:35 -0000 1.13
+++ include/orbit/orb-core/corba-orb.h 4 Apr 2006 11:17:59 -0000
@@ -27,6 +27,13 @@
* method return FALSE.*/
gboolean ORBit_proto_use (const char *name);
+/* Will return the maximum allowed GIOP buffer size. You will
+ * need to know this if your are e.g. streaming large data chunks
+ * to an ORBit2 client. The return type should be gulong but we
+ * are bound by the type chosen internally by linc2.
+ */
+glong ORBit_get_giop_recv_limit (void);
+
#endif /* ORBIT2_EXTENSIONS */
#ifdef ORBIT2_INTERNAL_API
Index: src/orb/GIOP/giop-recv-buffer.c
===================================================================
RCS file: /cvs/gnome/ORBit2/src/orb/GIOP/giop-recv-buffer.c,v
retrieving revision 1.80
diff -u -r1.80 giop-recv-buffer.c
--- src/orb/GIOP/giop-recv-buffer.c 17 Jan 2006 12:58:45 -0000 1.80
+++ src/orb/GIOP/giop-recv-buffer.c 4 Apr 2006 11:18:00 -0000
@@ -932,6 +932,12 @@
giop_initial_msg_size_limit = limit;
}
+glong
+giop_recv_get_limit (void)
+{
+ return giop_initial_msg_size_limit;
+}
+
/**
* giop_recv_buffer_handle_fragmented:
* @buf: pointer to recv buffer pointer
Index: src/orb/orb-core/corba-orb.c
===================================================================
RCS file: /cvs/gnome/ORBit2/src/orb/orb-core/corba-orb.c,v
retrieving revision 1.116
diff -u -r1.116 corba-orb.c
--- src/orb/orb-core/corba-orb.c 8 Nov 2005 09:02:43 -0000 1.116
+++ src/orb/orb-core/corba-orb.c 4 Apr 2006 11:18:01 -0000
@@ -1384,6 +1384,12 @@
return FALSE;
}
+glong
+ORBit_get_giop_recv_limit (void)
+{
+ return giop_recv_get_limit ();
+}
+
const ORBit_option orbit_supported_options[] = {
{ "ORBid", ORBIT_OPTION_STRING, NULL }, /* FIXME: unimplemented */
{ "ORBImplRepoIOR", ORBIT_OPTION_STRING, NULL }, /* FIXME: unimplemented */
Index: src/orb/orb-core/orb-core-private.h
===================================================================
RCS file: /cvs/gnome/ORBit2/src/orb/orb-core/orb-core-private.h,v
retrieving revision 1.23
diff -u -r1.23 orb-core-private.h
--- src/orb/orb-core/orb-core-private.h 18 Apr 2005 06:54:51 -0000 1.23
+++ src/orb/orb-core/orb-core-private.h 4 Apr 2006 11:18:01 -0000
@@ -74,6 +74,9 @@
gboolean ORBit_proto_use (const char *name);
void _ORBit_object_init (void);
+glong ORBit_get_giop_recv_limit (void);
+
+
#ifdef G_OS_WIN32
extern const gchar *ORBit_win32_typelib_dir;
#undef ORBIT_TYPELIB_DIR
############## sample code exploiting the above patch ###############
BRUTUS_BRESULT
brutus_read_from_mapi_stream(BRUTUS_ISequentialStream stream,
BRUTUS_seq_octet **data,
CORBA_unsigned_long len,
CORBA_Environment *ev)
{
const CORBA_unsigned_long recv_limit = (CORBA_unsigned_long)ORBit_get_giop_recv_limit() - 48; // 48 = large enough message header size
CORBA_unsigned_long chunk_size;
BRUTUS_seq_octet *chunk = NULL;
BRUTUS_BRESULT retv = BRUTUS_BRUTUS_UNKNOWN_ERROR;
CORBA_unsigned_long n = 0;
*data = BRUTUS_seq_octet__alloc();
if (!(*data))
return BRUTUS_BRUTUS_MAPI_E_NOT_ENOUGH_MEMORY;
(*data)->_buffer = BRUTUS_seq_octet_allocbuf(len);
if (!(*data)->_buffer) {
CORBA_free(*data);
*data = NULL;
return BRUTUS_BRUTUS_MAPI_E_NOT_ENOUGH_MEMORY;
}
(*data)->_maximum = len;
(*data)->_length = 0;
CORBA_sequence_set_release(*data, CORBA_TRUE);
retv = BRUTUS_BRUTUS_MAPI_E_NOT_ENOUGH_MEMORY;
while (len) {
if (len > recv_limit) {
chunk_size = recv_limit;
len -= recv_limit;
} else {
chunk_size = len;
len = 0;
}
retv = BRUTUS_ISequentialStream_Read(stream,
&chunk,
chunk_size,
ev);
if (ORBIT2_EX(ev))
goto out;
if (BRUTUS_BRUTUS_S_OK != retv)
goto out;
if (chunk_size != chunk->_length) {
retv = BRUTUS_BRUTUS_MAPI_W_PARTIAL_COMPLETION;
goto out;
}
for (n = 0; n < chunk_size; n++)
(*data)->_buffer[(*data)->_length+n] = chunk->_buffer[n];
(*data)->_length += chunk_size;
CORBA_free(chunk);
chunk = NULL;
}
out:
CORBA_free(chunk);
return retv;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]