From: joachim@kraut.bc.ca Subject: Re: Absolute Newbie Newsgroups: comp.object.corba Date: Wed, 10 Feb 1999 18:05:20 GMT janssen@parc.xerox.com (Bill Janssen) writes: > > I wonder if there's a version of the UNIX `patch' utility for > Windows There is! I'm sure it is available from several places, we got it as part of the CVS package. Version 1.10 of CVS for Windows can be downloaded from: http://download.cyclic.com/pub/cvs-1.10/windows/cvs-1.10-win.zip To use patch.exe you also need win32gnu.dll which comes in the same zip file. Joachim
% cd /usr/local/ilu/src % patch -p0 < /usr/local/ilu/src/this-patch [...various output from the patch program...] %
*** 1.15 1998/10/09 06:08:04 --- examples/httest/webserver.c 1999/01/26 17:48:52 *************** *** 797,803 **** print_request (p_http_req); } ! return server_iluhttp_Resource_GETorHEAD(http_obj, p_http_req, TRUE, ilu_env); } --- 797,803 ---- print_request (p_http_req); } ! return server_iluhttp_Resource_GETorHEAD(http_obj, p_http_req, ilu_TRUE, ilu_env); } *************** *** 813,819 **** print_request (p_http_req); } ! return server_iluhttp_Resource_GETorHEAD(http_obj, p_http_req, FALSE, ilu_env); } --- 813,819 ---- print_request (p_http_req); } ! return server_iluhttp_Resource_GETorHEAD(http_obj, p_http_req, ilu_FALSE, ilu_env); }
*** 1.26 1999/01/20 00:49:01 --- stubbers/python/util.c 1999/01/27 19:46:17 *************** *** 239,246 **** printf ("import %s ; %s['%s'] = %s; %s['ilu'] = %s;\n", nameModuleIlu, nameVarImports, nameModuleIlu, nameModuleIlu, nameVarImports, nameModuleIlu); #ifdef ILU_CORBA_PYTHON_MAPPING ! printf ("%s.CheckStubConsistency2('%s', '%s', ilu.TRUE);\n", nameModuleIlu, ! ILU_VERSION_STRING, ILU_TYPEUID_VERSION_STRING); #else printf ("%s.CheckStubConsistency('%s', '%s');\n", nameModuleIlu, ILU_VERSION_STRING, ILU_TYPEUID_VERSION_STRING); --- 239,246 ---- printf ("import %s ; %s['%s'] = %s; %s['ilu'] = %s;\n", nameModuleIlu, nameVarImports, nameModuleIlu, nameModuleIlu, nameVarImports, nameModuleIlu); #ifdef ILU_CORBA_PYTHON_MAPPING ! printf ("%s.CheckStubConsistency2('%s', '%s', %s.TRUE);\n", nameModuleIlu, ! ILU_VERSION_STRING, ILU_TYPEUID_VERSION_STRING, nameModuleIlu); #else printf ("%s.CheckStubConsistency('%s', '%s');\n", nameModuleIlu, ILU_VERSION_STRING, ILU_TYPEUID_VERSION_STRING);
*** 1.8 1999/01/20 23:07:40 --- etc/javaobv/javawin32.mak 1999/01/27 23:51:12 *************** *** 24,29 **** --- 24,32 ---- !IF "$(JAVA_HOME)" == "" ALL : NOJAVAMAKE !ELSE + !IF "$(JDK_HOME)" == "" + JDK_HOME = $(JAVA_HOME) + !END !IF "$(JAVASDK)" == "" !ERROR JAVASDK environment variable not set - should be one of Microsoft or Javasoft *************** *** 55,61 **** !IF "$(JAVASDK)" == "Microsoft" JAVAC = $(JAVA_HOME)\bin\jvc !ELSE ! JAVAC = $(JAVA_HOME)\bin\javac !ENDIF !IF "$(JAVASDK)" == "Microsoft" --- 58,64 ---- !IF "$(JAVASDK)" == "Microsoft" JAVAC = $(JAVA_HOME)\bin\jvc !ELSE ! JAVAC = $(JDK_HOME)\bin\javac !ENDIF !IF "$(JAVASDK)" == "Microsoft" *************** *** 80,90 **** set ILUPATH=.;..\..\stubbers\parser java-stubber ilujava.isl if not exist $(JAVA_CLASS_DIR)\nul mkdir $(JAVA_CLASS_DIR) ! set CLASSPATH=.;$(JAVA_CLASS_DIR);$(ILUHOME)\lib\classes;$(CLASSPATH) $(JAVAC) $(ILU_JAVAC_FLAGS) $(JAVA_STUBS_DIR)\xerox\ilujava\*.java $(JAVAC) $(ILU_JAVAC_FLAGS) jsrc\xerox\ilujava\IluOBVSetter.java jsrc\xerox\ilujava\IluOBVClassLoaderGetter.java jsrc\xerox\ilujava\IluOBVClassLoaderSetter.java jsrc\xerox\ilujava\IluOBV.java jsrc\xerox\ilujava\Holder.java jsrc\xerox\ilujava\IluOBVWireClassLoader.java jsrc\xerox\ilujava\ClassAccessorImplFromJar.java cd .\classes ! $(JAVA_HOME)\bin\jar -0cf ..\ilujavaobv.jar * cd .. # When know how to distinguish between 1.2 and 1.1.x, can conditionally add this line for 1.2 # before the jar file creation of course! --- 83,93 ---- set ILUPATH=.;..\..\stubbers\parser java-stubber ilujava.isl if not exist $(JAVA_CLASS_DIR)\nul mkdir $(JAVA_CLASS_DIR) ! set CLASSPATH=.;$(JAVA_CLASS_DIR);$(ILUHOME)\lib\classes;..\..\runtime\java\classes;$(CLASSPATH) $(JAVAC) $(ILU_JAVAC_FLAGS) $(JAVA_STUBS_DIR)\xerox\ilujava\*.java $(JAVAC) $(ILU_JAVAC_FLAGS) jsrc\xerox\ilujava\IluOBVSetter.java jsrc\xerox\ilujava\IluOBVClassLoaderGetter.java jsrc\xerox\ilujava\IluOBVClassLoaderSetter.java jsrc\xerox\ilujava\IluOBV.java jsrc\xerox\ilujava\Holder.java jsrc\xerox\ilujava\IluOBVWireClassLoader.java jsrc\xerox\ilujava\ClassAccessorImplFromJar.java cd .\classes ! $(JDK_HOME)\bin\jar -0cf ..\ilujavaobv.jar * cd .. # When know how to distinguish between 1.2 and 1.1.x, can conditionally add this line for 1.2 # before the jar file creation of course!
(1) The default object key exported by the CosNaming server root context is supposed to be "NameService". Actually, in the spec it says "NamingService", but I'm informed this is a typo, and will be fixed editorially.
(2) The spec introduces two new required URL forms, "iioploc:" and "iiopname:".
This isn't all that the INS spec introduces, but it's all that this patch covers.
*** 1.240 1999/01/18 17:28:48 --- runtime/kernel/iluntrnl.h 1999/01/27 03:25:28 *************** *** 1681,1686 **** --- 1681,1688 ---- /*L1, L2 unconstrained*/ extern ilu_boolean _ilu_IIOP_ParseIIOP (ilu_string, ilu_string *, ilu_string *, ilu_string *, ilu_string *, ilu_cardinal *, ilu_boolean *, ilu_Error *); + extern ilu_boolean _ilu_IIOP_ParseIIOPLoc (ilu_string, ilu_string *, ilu_string *, ilu_string *, ilu_string *, ilu_cardinal *, ilu_boolean *, ilu_Error *); + extern ilu_boolean _ilu_IIOP_ParseIIOPName (ilu_string, ilu_string *, ilu_string *, ilu_string *, ilu_string *, ilu_cardinal *, ilu_boolean *, ilu_Error *); extern ilu_boolean _ilu_IIOP_ParseIOR (ilu_string, ilu_string *, ilu_string *, ilu_string *, ilu_string *, ilu_cardinal *, ilu_boolean *, ilu_Error *); extern ilu_boolean _ilu_IIOP_ParseIOR2 (ilu_string, ilu_string *, ilu_string *, ilu_string *, ilu_string *, ilu_cardinal *, ilu_boolean *, ilu_Error *); *** 1.349 1998/12/05 02:48:37 --- runtime/kernel/iluxport.h 1999/01/27 22:09:19 *************** *** 4679,4684 **** --- 4679,4699 ---- * NIL if object is not exported through an IIOP ilu_Port. */ + /* Locking unconstrained */ + ILU_PUBLIC ilu_string /* PASS */ + ilu_IIOP_IHFromObjectKey (ilu_bytes, /* object key */ + ilu_cardinal, /* length of object key */ + ilu_Error *); + + /* Converts the CORBA object key specified to the ILU instance handle + which would be used with a "foreign" object key. This can be used + to create true instances which ILU doesn't recognize as ILU-ish, + and thus treats in a strictly CORBA fashion. It can also be used + to create the instance handles for true instances which must be + exported with a given object key, such as the "NameService" key for + the root context of CosNaming. The string return value is malloc'ed + and owned by the caller. Returns NIL on error. + */ #endif /* IIOP_PROTOCOL */ #ifdef HTTP_PROTOCOL *** 1.216 1998/11/26 01:23:28 --- runtime/kernel/iiop.c 1999/01/28 01:30:27 *************** *** 68,73 **** --- 68,76 ---- static ilu_boolean Initialized = ilu_FALSE; + static ilu_Class CosNaming_NamingContext = NIL; + static ilu_Method CosNaming_NamingContext_resolve = NIL; + #ifdef ENABLE_DEBUGGING static ilu_string encode (ilu_bytes key, ilu_cardinal len) { *************** *** 788,803 **** /*=========== Mapping to and from IIOP classes and methods =============*/ /*======================================================================*/ ! static ilu_Class FindClassFromObjectKey (ilu_bytes key, ilu_cardinal key_len) { /* treat "key" as URL of an object, return its class */ /* For an ILU object key marshalled over UNO, we have a full URL */ ilu_Class cl = NIL; if (strcmp((ilu_string) key, "ilu") != 0) { ILU_NOTE(IIOP_DEBUG, ! ("_IIOP_InterpretRequest: object key not an ILU object key\n")); } else cl = ilu_FindClassFromID((ilu_string)(key + 4)); --- 791,832 ---- /*=========== Mapping to and from IIOP classes and methods =============*/ /*======================================================================*/ ! static ilu_Class FindClassFromObjectKey (ilu_bytes key, ilu_cardinal key_len, ! ilu_Server s) { /* treat "key" as URL of an object, return its class */ /* For an ILU object key marshalled over UNO, we have a full URL */ ilu_Class cl = NIL; + ilu_Error lerr; if (strcmp((ilu_string) key, "ilu") != 0) { + char ih[2048]; + char *newkey; + ilu_Object kobj; + + #ifdef ENABLE_DEBUGGING + ilu_string encoded_key = encode (key, key_len); ILU_NOTE(IIOP_DEBUG, ! ("ILU(iiop.c:FindClassFromObjectKey): object key <%s> not an ILU object key\n", encoded_key)); ! ilu_free(encoded_key); ! #endif ! /* we assume that it's a "foreign" object key somehow placed in this server */ ! strcpy(ih, CORBA_NATIVE_OBJECT_IH_PREFIX); ! newkey = _ilu_EncodeBuffer((char *) key, key_len, &lerr); ! if (ILU_ERROK(lerr)) { ! strcat (ih, newkey); ! ilu_free(newkey); ! if ((kobj = _ilu_FindObjectInServer(ih, s)) != NIL) ! cl = object_class(kobj); ! else { ! ILU_NOTE(IIOP_DEBUG, ! ("ILU(iiop.c:FindClassFromObjectKey): no object in server <%s> with ih <%s>\n", ! server_id(s), ih)); ! } ! } else { ! ILU_HANDLED(lerr); ! } } else cl = ilu_FindClassFromID((ilu_string)(key + 4)); *************** *** 1001,1006 **** --- 1030,1050 ---- } } + ilu_string + ilu_IIOP_IHFromObjectKey (ilu_bytes key, ilu_cardinal key_len, + ilu_Error *err) + { + char *encoded_key; + char *ih = NIL; + encoded_key = _ilu_EncodeBuffer ((char *) key, key_len, err); + if (ILU_ERRNOK(*err)) return NIL; + ih = ilu_MallocE(strlen(encoded_key) + 1 + SIZEOF_CORBA_NATIVE_OBJECT_IH_PREFIX, err); + if (ILU_ERRNOK(*err)) { ilu_free(encoded_key); return NIL; }; + sprintf(ih, "%s%s", CORBA_NATIVE_OBJECT_IH_PREFIX, encoded_key); + ilu_free(encoded_key); + return ih; + } + static void FreeIORData (struct IIOP_IOR_IOR *ior) { ilu_cardinal i; *************** *** 2163,2168 **** --- 2207,3210 ---- } } + static unsigned int + strcharcount (char *str, char chr) + { + register unsigned int count = 0; + register char *p; + for (p = str; *p; p++) + if (*p == chr) count++; + return count; + } + + ilu_boolean _ilu_IIOP_ParseIIOPLoc (ilu_string iiop, ilu_string *ih, ilu_string *sid, + ilu_string *mstid, ilu_string *cinfo, ilu_cardinal *cinfolen, + ilu_boolean *pass_cinfo, ilu_Error *err) + { + /* Parse INS-style URL: + * + * iioploc://[iiopvers@][:]/ + */ + + char *p; + char *decoded_key = NIL; + char addresses[1024]; + char object_key[1024]; + char sid_hostname[1024]; + unsigned int sid_port, key_len; + unsigned int sid_major, sid_minor; + + if (strncmp(iiop, "iioploc:/", 9) == 0) + p = iiop + 8; + else if (strncmp(iiop, "iioploc:/", 9) == 0) + p = iiop + 8; + else + return ILU_ERR_CONS1(inv_objref, err, minor, ilu_iom_ior, ilu_FALSE); + + if (sscanf (p, "//%1023[^/]/%1023s", addresses, object_key) != 2) + return ILU_ERR_CONS1(inv_objref, err, minor, ilu_iom_ior, ilu_FALSE); + else if ((strlen(addresses) < 1) || (strlen(object_key) < 1)) + return ILU_ERR_CONS1(inv_objref, err, minor, ilu_iom_ior, ilu_FALSE); + ILU_NOTE(IIOP_DEBUG, + ("_ilu_IIOP_ParseIIOPLoc: addresses are <%s>, key is <%s>\n", + addresses, object_key)); + decoded_key = _ilu_DecodeBuffer(object_key, strlen(object_key), &key_len, err); + if (ILU_ERRNOK(*err)) return ilu_FALSE; + if (strcmp(decoded_key, "ilu") == 0) /* ILU object */ + { + /* We have an ILU object, go ahead and transform it */ + + ilu_cardinal comma_count = strcharcount(addresses, ',') + 1; + + if (mstid != NIL) + *mstid = _ilu_Strdup(decoded_key + 4); + if (sid != NIL) + *sid = _ilu_Strdup(decoded_key + 4 + strlen(decoded_key + 4) + 1); + if (ih != NIL) + *ih = _ilu_Strdup(decoded_key + 4 + strlen(decoded_key + 4) + 1 + strlen(decoded_key + 4 + strlen(decoded_key + 4) + 1) + 1); + if (cinfo != NIL) + { + static char cinfodivider[2] = { ILU_CINFO_DIVIDER, 0 }; + static char cinfomarker[2] = { ILU_CINFO_MARKER, 0 }; + char pinfobuf[1024]; + char tinfobuf[1024]; + char hostname[1024]; + int port; + int major_version, minor_version; + char *pinfo; + char *addr_ptr; + char *comma; + *cinfo = NULL; + if (ILU_ERRNOK(*err)) goto errout; + comma = strchr(addr_ptr, ','); + if (comma) *comma = 0; + major_version = 1; + minor_version = 0; + port = 9999; + if ((sscanf (addr_ptr, "%u.%u@%1024[^:]:%u", &major_version, &minor_version, hostname, &port) != 4) && + (sscanf (addr_ptr, "%u.%u@%1024[^:]", &major_version, &minor_version, hostname) != 3) && + (sscanf (addr_ptr, "%1024[^:]:%u", hostname, &port) != 2) && + (sscanf (addr_ptr, "%1024[^:]", hostname) != 1)) { + ILU_NOTE(IIOP_DEBUG, + ("_ilu_IIOP_ParseIIOPLoc: bad cinfo in URL <%s>\n", iiop)); + ILU_ERR_CONS1(inv_objref, err, minor, ilu_iom_ci, ilu_FALSE); + goto errout; + }; + sprintf (pinfobuf, "iiop_%u_%u_1@tcp_%s_%lu", major_version, minor_version, + hostname, port); + *cinfo = ilu_StrdupE(pinfobuf, err); + if (ILU_ERRNOK(*err)) goto errout; + if (cinfolen != NIL) + *cinfolen = strlen(*cinfo); + *pass_cinfo = ilu_TRUE; + } + else if (pass_cinfo != NIL) + *pass_cinfo = ilu_FALSE; + ilu_free(decoded_key); + return ilu_TRUE; + } + else + { + ilu_cardinal comma_count = strcharcount(addresses, ',') + 1; + + if (ih != NIL) { + *ih = _ilu_Strcat3(CORBA_NATIVE_OBJECT_IH_PREFIX, object_key, NIL); + if (*ih == NIL) { + ILU_ERR_CONS1(no_memory, err, nbytes, strlen(object_key) + SIZEOF_CORBA_NATIVE_OBJECT_IH_PREFIX + 1, ilu_FALSE); + goto errout; + }; + }; + if (mstid != NIL) { + *mstid = NIL; + }; + if (cinfo != NIL) + { + static char cinfodivider[2] = { ILU_CINFO_DIVIDER, 0 }; + static char cinfomarker[2] = { ILU_CINFO_MARKER, 0 }; + char pinfobuf[1024]; + char tinfobuf[1024]; + char hostname[1024]; + int port; + int major_version, minor_version; + char *pinfo; + char *addr_ptr; + char *comma; + *cinfo = NULL; + if (ILU_ERRNOK(*err)) goto errout; + for (addr_ptr = addresses; comma_count > 0; comma_count--) { + comma = strchr(addr_ptr, ','); + if (comma) *comma = 0; + major_version = 1; + minor_version = 0; + port = 9999; + if ((sscanf (addr_ptr, "%u.%u@%1024[^:]:%u", &major_version, &minor_version, hostname, &port) != 4) && + (sscanf (addr_ptr, "%u.%u@%1024[^:]", &major_version, &minor_version, hostname) != 3) && + (sscanf (addr_ptr, "%1024[^:]:%u", hostname, &port) != 2) && + (sscanf (addr_ptr, "%1024[^:]", hostname) != 1)) { + ILU_NOTE(IIOP_DEBUG, + ("_ilu_IIOP_ParseIIOPLoc: bad cinfo in URL <%s>\n", iiop)); + ILU_ERR_CONS1(inv_objref, err, minor, ilu_iom_ci, ilu_FALSE); + goto errout; + }; + if (sid != NIL) { + strcpy (sid_hostname, hostname); + sid_port = port; + sid_major = major_version; + sid_minor = minor_version; + }; + ILU_NOTE(IIOP_DEBUG, + ("_ilu_IIOP_ParseIIOPLoc: cinfo: IIOP %u.%u at %s:%u\n", + major_version, minor_version, hostname, port)); + sprintf (pinfobuf, "iiop_%u_%u_1_%s", major_version, minor_version, object_key); + pinfo = _ilu_EncodeBuffer(pinfobuf, strlen(pinfobuf), err); + sprintf (tinfobuf, "tcp_%s_%lu", hostname, ((unsigned long) port) & 0xFFFF); + if (*cinfo) + *cinfo = _ilu_Strcat5 (*cinfo, cinfomarker, pinfo, cinfodivider, tinfobuf); + else + *cinfo = _ilu_Strcat3(pinfo, cinfodivider, tinfobuf); + if (ILU_ERRNOK(*err)) goto errout; + if (cinfolen != NIL) + *cinfolen = strlen(*cinfo); + *pass_cinfo = ilu_TRUE; + if (comma) addr_ptr = comma + 1; + } + } + else if (pass_cinfo != NIL) + *pass_cinfo = ilu_FALSE; + if (sid != NIL) { + ilu_cardinal sid2[2]; + char pinfo_buf[1024]; + sprintf (pinfo_buf, "iiop_%u_%u_1", sid_major, sid_minor); + sid2[0] = ilu_CRC32((ilu_bytes) decoded_key, key_len); + sid2[1] = (1 << 24) + sid_port; + sid2[1] = ilu_CRC32WithAccum((ilu_bytes) pinfo_buf, strlen(pinfo_buf), sid2[1]); + sid2[1] = ilu_CRC32WithAccum((ilu_bytes) sid_hostname, strlen(sid_hostname), sid2[1]); + *sid = (ilu_string) _ilu_EncodeBuffer((char *) sid2, + 2 * sizeof(ilu_cardinal), err); + if (ILU_ERRNOK(*err)) + goto errout; + }; + ilu_free(decoded_key); + return ilu_TRUE; + } + errout: + if (decoded_key != NIL) + ilu_free(decoded_key); + return ilu_FALSE; + } + + typedef struct NameComponent_s { + char * id; + char * kind; + } NameComponent_s; + + typedef struct NameList_s { + int nnames; + NameComponent_s * names; + } * NameList; + + static int + CountNameListComponents (ilu_string n) + { + int count = 0; + char *p = n; + if (*p == '/') p++; + while (*p != 0) { + if (*p == '\\') + p++; + else if (*p == '/') + count++; + p++; + } + return count + 1; + } + + static char *FindComponentEnd (ilu_string n) + { + char *p = n; + while (*p != 0) { + if (*p == '\\') + p++; + else if (*p == '/') + return p; + p++; + } + return NIL; + } + + static char *FindComponentIDField (ilu_string n) + { + char *p = n; + while (*p != 0) { + if (*p == '\\') + p++; + else if (*p == '.') + return p; + p++; + } + return NIL; + } + + static NameList + ParsePathIntoNameList (ilu_string path, ilu_Error *err) + { + int components, i, j; + NameList n; + char *component, *ending, *possible_dot; + ilu_cardinal decoded_len; + + components = CountNameListComponents(path); + n = ilu_MallocE(sizeof(*n) + (components * sizeof(NameComponent_s)), err); + if (ILU_ERRNOK(*err)) return NIL; + n->names = (NameComponent_s *) (n + 1); + n->nnames = components; + for (component = path, i = 0; i < components; i++) { + ending = FindComponentEnd(component); + if (ending != NIL) *ending = 0; + n->names[i].id = _ilu_DecodeBuffer(component, strlen(component), &decoded_len, err); + if (ILU_ERRNOK(*err)) goto errexit; + if ((possible_dot = FindComponentIDField(n->names[i].id)) == NIL) { + n->names[i].kind = n->names[i].id + strlen(n->names[i].id); + } else { + *possible_dot = 0; + n->names[i].kind = possible_dot + 1; + } + if (ending != NIL) + component = ending + 1; + } + return n; + + errexit: + for (j = 0; j <= i; j++) + ilu_free(n->names[j].id); + ilu_free(n); + return NIL; + } + + static void + FreeNameList (NameList n) + { + int i; + + for (i = 0; i < n->nnames; i++) + ilu_free(n->names[i].id); + ilu_free(n); + } + + static ilu_cardinal + SizeOfNameList (ilu_Call call, NameList nl, ilu_Error *err) + { + ilu_cardinal size = 0; + int i; + + size = ilu_SizeOfSequence (call, nl->nnames, 0xFFFFFFFF, NIL, err); + if (ILU_ERRNOK(*err)) return 0; + for (i = 0; i < nl->nnames; i++) { + size += ilu_SizeOfString (call, nl->names[i].id, strlen(nl->names[i].id), 0xFFFFFFFFFF, err); + if (ILU_ERRNOK(*err)) return 0; + size += ilu_SizeOfString (call, nl->names[i].kind, strlen(nl->names[i].kind), 0xFFFFFFFFFF, err); + if (ILU_ERRNOK(*err)) return 0; + } + size += ilu_EndSequence (call, err); + if (ILU_ERRNOK(*err)) return 0; + return size; + } + + static void + OutputNameList (ilu_Call call, NameList nl, ilu_Error *err) + { + int i; + + ilu_OutputSequence (call, nl->nnames, 0xFFFFFFFF, NIL, err); + if (ILU_ERRNOK(*err)) return; + for (i = 0; i < nl->nnames; i++) { + ilu_OutputString (call, nl->names[i].id, strlen(nl->names[i].id), 0xFFFFFFFF, err); + if (ILU_ERRNOK(*err)) return; + ilu_OutputString (call, nl->names[i].kind, strlen(nl->names[i].kind), 0xFFFFFFFF, err); + if (ILU_ERRNOK(*err)) return; + } + ilu_EndSequence (call, err); + if (ILU_ERRNOK(*err)) return; + } + + static NameList + InputNameList (ilu_Call call, ilu_Error *err) + { + NameList n; + ilu_cardinal count; + int i, j; + + ilu_InputSequence (call, &count, 0xFFFFFFFF, NIL, err); + if (ILU_ERRNOK(*err)) return NIL; + n = ilu_MallocE(sizeof(*n) + (count * sizeof(NameComponent_s)), err); + if (ILU_ERRNOK(*err)) return NIL; + n->nnames = count; + for (i = 0; i < n->nnames; i++) { + n->names[i].id = NIL; + n->names[i].kind = NIL; + ilu_InputString (call, &n->names[i].id, &count, 0xFFFF, err); + if (ILU_ERRNOK(*err)) goto errout; + ilu_InputString (call, &n->names[i].kind, &count, 0xFFFF, err); + if (ILU_ERRNOK(*err)) goto errout; + } + ilu_EndSequence (call, err); + if (ILU_ERRNOK(*err)) goto errout; + return n; + + errout: + for (j = 0; j <= i; j++) { + if (n->names[j].id != NIL) + ilu_free(n->names[j].id); + if (n->names[j].kind != NIL) + ilu_free(n->names[j].kind); + }; + ilu_free(n); + return NIL; + } + + static ilu_string + StringifyNameList (NameList nl, ilu_Error *err) + { + int i; + char *p, *q, *s; + int size; + + for (size = 0, i = 0; i < nl->nnames; i++) { + size += strlen(nl->names[i].id) + 1; + size += strcharcount(nl->names[i].id, '/'); + size += strcharcount(nl->names[i].id, '.'); + if (nl->names[i].kind[0] != 0) { + size += strlen(nl->names[i].kind) + 1; + size += strcharcount(nl->names[i].kind, '/'); + size += strcharcount(nl->names[i].kind, '.'); + } + } + s = ilu_MallocE(size, err); + if (ILU_ERRNOK(*err)) return NIL; + for (q = s, i = 0; i < nl->nnames; i++) { + p = nl->names[i].id; + while (*p != 0) { + if (*p == '.') { + *q++ = '\\'; + *q++ = *p++; + } else { + *q++ = *p++; + } + } + if (nl->names[i].kind[0] != 0) { + *q++ = '.'; + p = nl->names[i].kind; + while (*p != 0) { + if (*p == '.') { + *q++ = '\\'; + *q++ = *p++; + } else { + *q++ = *p++; + } + } + } + if ((i + 1) < nl->nnames) + *q++ = '/'; + else + *q++ = 0; + } + return s; + } + + static void + Initialize_CosNaming_NamingContext (ilu_Error *err) + { + static ilu_boolean initialized = ilu_FALSE; + ilu_Exception ex_CosNaming_NamingContext_NotFound; + ilu_Exception ex_CosNaming_NamingContext_CannotProceed; + ilu_Exception ex_CosNaming_NamingContext_InvalidName; + ilu_Exception ex_CosNaming_NamingContext_AlreadyBound; + ilu_Exception ex_CosNaming_NamingContext_NotEmpty; + ilu_Error lerr; + ilu_Class cl; + ilu_Method m; + + if (initialized) + return; + + if (!ilu_EnterMutex(ilu_otmu, err)) + goto fail2; + + /* set up exceptions */ + + ex_CosNaming_NamingContext_NotFound = ilu_DefineException(ILU_NIL, "IDL:omg.org/CosNaming/NamingContext/NotFound:1.0", "IDL:omg.org/CosNaming/NamingContext/NotFound:1.0", err); + if (ILU_ERRNOK(*err)) + goto fail1; + ex_CosNaming_NamingContext_CannotProceed = ilu_DefineException(ILU_NIL, "IDL:omg.org/CosNaming/NamingContext/CannotProceed:1.0", "IDL:omg.org/CosNaming/NamingContext/CannotProceed:1.0", err); + if (ILU_ERRNOK(*err)) + goto fail1; + ex_CosNaming_NamingContext_InvalidName = ilu_DefineException(ILU_NIL, "IDL:omg.org/CosNaming/NamingContext/InvalidName:1.0", ILU_NIL, err); + if (ILU_ERRNOK(*err)) + goto fail1; + ex_CosNaming_NamingContext_AlreadyBound = ilu_DefineException(ILU_NIL, "IDL:omg.org/CosNaming/NamingContext/AlreadyBound:1.0", ILU_NIL, err); + if (ILU_ERRNOK(*err)) + goto fail1; + ex_CosNaming_NamingContext_NotEmpty = ilu_DefineException(ILU_NIL, "IDL:omg.org/CosNaming/NamingContext/NotEmpty:1.0", ILU_NIL, err); + if (ILU_ERRNOK(*err)) + goto fail1; + + { ilu_string supers[] = { + "IDL:omg.org/CORBA/Object:1.0", + NULL}; + cl = ilu_DefineObjectType("CosNaming.NamingContext", /*name*/ + NULL, /*no brand*/ + "IDL:omg.org/CosNaming/NamingContext:1.0", /*uid*/ + NULL, /*singleton*/ + ilu_TRUE, /* optional */ + ilu_FALSE, /* collectible */ + NULL, /*doc string*/ + 10, /*n methods*/ + 1, /*n supers*/ + supers, /* supers */ + err); + if (ILU_ERRNOK(*err)) + goto fail2; + CosNaming_NamingContext = cl; + } + { ilu_Exception exns[4]; + exns[0] = ex_CosNaming_NamingContext_NotFound; + exns[1] = ex_CosNaming_NamingContext_CannotProceed; + exns[2] = ex_CosNaming_NamingContext_InvalidName; + exns[3] = ex_CosNaming_NamingContext_AlreadyBound; + m = ilu_DefineMethod(cl, 0, + "bind", /*name*/ + 1, /*id*/ + 0, /*functional*/ + 0, /*asynch*/ + 4, /*n exns*/ + exns, /*exceptions*/ + 2, /*n args*/ + ILU_NIL, /*return type ID*/ + err); + if (ILU_ERRNOK(*err)) + goto fail2; + ilu_DefineMethodArg (m, 0, "n", ilu_FALSE, ilu_In, "IDL:omg.org/CosNaming/Name:1.0", err); + if (ILU_ERRNOK(*err)) + goto fail2; + ilu_DefineMethodArg (m, 1, "obj", ilu_FALSE, ilu_In, "IDL:omg.org/CORBA/Object:1.0", err); + if (ILU_ERRNOK(*err)) + goto fail2; + } + { ilu_Exception exns[3]; + exns[0] = ex_CosNaming_NamingContext_NotFound; + exns[1] = ex_CosNaming_NamingContext_CannotProceed; + exns[2] = ex_CosNaming_NamingContext_InvalidName; + m = ilu_DefineMethod(cl, 1, + "rebind", /*name*/ + 2, /*id*/ + 0, /*functional*/ + 0, /*asynch*/ + 3, /*n exns*/ + exns, /*exceptions*/ + 2, /*n args*/ + ILU_NIL, /*return type ID*/ + err); + if (ILU_ERRNOK(*err)) + goto fail2; + ilu_DefineMethodArg (m, 0, "n", ilu_FALSE, ilu_In, "IDL:omg.org/CosNaming/Name:1.0", err); + if (ILU_ERRNOK(*err)) + goto fail2; + ilu_DefineMethodArg (m, 1, "obj", ilu_FALSE, ilu_In, "IDL:omg.org/CORBA/Object:1.0", err); + if (ILU_ERRNOK(*err)) + goto fail2; + } + { ilu_Exception exns[4]; + exns[0] = ex_CosNaming_NamingContext_NotFound; + exns[1] = ex_CosNaming_NamingContext_CannotProceed; + exns[2] = ex_CosNaming_NamingContext_InvalidName; + exns[3] = ex_CosNaming_NamingContext_AlreadyBound; + m = ilu_DefineMethod(cl, 2, + "bind-context", /*name*/ + 3, /*id*/ + 0, /*functional*/ + 0, /*asynch*/ + 4, /*n exns*/ + exns, /*exceptions*/ + 2, /*n args*/ + ILU_NIL, /*return type ID*/ + err); + if (ILU_ERRNOK(*err)) + goto fail2; + ilu_DefineMethodArg (m, 0, "n", ilu_FALSE, ilu_In, "IDL:omg.org/CosNaming/Name:1.0", err); + if (ILU_ERRNOK(*err)) + goto fail2; + ilu_DefineMethodArg (m, 1, "nc", ilu_FALSE, ilu_In, "IDL:omg.org/CosNaming/NamingContext:1.0", err); + if (ILU_ERRNOK(*err)) + goto fail2; + } + { ilu_Exception exns[3]; + exns[0] = ex_CosNaming_NamingContext_NotFound; + exns[1] = ex_CosNaming_NamingContext_CannotProceed; + exns[2] = ex_CosNaming_NamingContext_InvalidName; + m = ilu_DefineMethod(cl, 3, + "rebind-context", /*name*/ + 4, /*id*/ + 0, /*functional*/ + 0, /*asynch*/ + 3, /*n exns*/ + exns, /*exceptions*/ + 2, /*n args*/ + ILU_NIL, /*return type ID*/ + err); + if (ILU_ERRNOK(*err)) + goto fail2; + ilu_DefineMethodArg (m, 0, "n", ilu_FALSE, ilu_In, "IDL:omg.org/CosNaming/Name:1.0", err); + if (ILU_ERRNOK(*err)) + goto fail2; + ilu_DefineMethodArg (m, 1, "nc", ilu_FALSE, ilu_In, "IDL:omg.org/CosNaming/NamingContext:1.0", err); + if (ILU_ERRNOK(*err)) + goto fail2; + } + { ilu_Exception exns[3]; + exns[0] = ex_CosNaming_NamingContext_NotFound; + exns[1] = ex_CosNaming_NamingContext_CannotProceed; + exns[2] = ex_CosNaming_NamingContext_InvalidName; + m = ilu_DefineMethod(cl, 4, + "resolve", /*name*/ + 5, /*id*/ + 0, /*functional*/ + 0, /*asynch*/ + 3, /*n exns*/ + exns, /*exceptions*/ + 1, /*n args*/ + "IDL:omg.org/CORBA/Object:1.0", /*return type ID*/ + err); + if (ILU_ERRNOK(*err)) + goto fail2; + ilu_DefineMethodArg (m, 0, "n", ilu_FALSE, ilu_In, "IDL:omg.org/CosNaming/Name:1.0", err); + if (ILU_ERRNOK(*err)) + goto fail2; + CosNaming_NamingContext_resolve = m; + } + { ilu_Exception exns[3]; + exns[0] = ex_CosNaming_NamingContext_NotFound; + exns[1] = ex_CosNaming_NamingContext_CannotProceed; + exns[2] = ex_CosNaming_NamingContext_InvalidName; + m = ilu_DefineMethod(cl, 5, + "unbind", /*name*/ + 6, /*id*/ + 0, /*functional*/ + 0, /*asynch*/ + 3, /*n exns*/ + exns, /*exceptions*/ + 1, /*n args*/ + ILU_NIL, /*return type ID*/ + err); + if (ILU_ERRNOK(*err)) + goto fail2; + ilu_DefineMethodArg (m, 0, "n", ilu_FALSE, ilu_In, "IDL:omg.org/CosNaming/Name:1.0", err); + if (ILU_ERRNOK(*err)) + goto fail2; + } + { ilu_Exception *exns = NULL; + m = ilu_DefineMethod(cl, 6, + "new-context", /*name*/ + 7, /*id*/ + 0, /*functional*/ + 0, /*asynch*/ + 0, /*n exns*/ + exns, /*exceptions*/ + 0, /*n args*/ + "IDL:omg.org/CosNaming/NamingContext:1.0", /*return type ID*/ + err); + if (ILU_ERRNOK(*err)) + goto fail2; + } + { ilu_Exception exns[4]; + exns[0] = ex_CosNaming_NamingContext_NotFound; + exns[1] = ex_CosNaming_NamingContext_CannotProceed; + exns[2] = ex_CosNaming_NamingContext_InvalidName; + exns[3] = ex_CosNaming_NamingContext_AlreadyBound; + m = ilu_DefineMethod(cl, 7, + "bind-new-context", /*name*/ + 8, /*id*/ + 0, /*functional*/ + 0, /*asynch*/ + 4, /*n exns*/ + exns, /*exceptions*/ + 1, /*n args*/ + "IDL:omg.org/CosNaming/NamingContext:1.0", /*return type ID*/ + err); + if (ILU_ERRNOK(*err)) + goto fail2; + ilu_DefineMethodArg (m, 0, "n", ilu_FALSE, ilu_In, "IDL:omg.org/CosNaming/Name:1.0", err); + if (ILU_ERRNOK(*err)) + goto fail2; + } + { ilu_Exception exns[1]; + exns[0] = ex_CosNaming_NamingContext_NotEmpty; + m = ilu_DefineMethod(cl, 8, + "destroy", /*name*/ + 9, /*id*/ + 0, /*functional*/ + 0, /*asynch*/ + 1, /*n exns*/ + exns, /*exceptions*/ + 0, /*n args*/ + ILU_NIL, /*return type ID*/ + err); + if (ILU_ERRNOK(*err)) + goto fail2; + } + { ilu_Exception *exns = NULL; + m = ilu_DefineMethod(cl, 9, + "list", /*name*/ + 10, /*id*/ + 0, /*functional*/ + 0, /*asynch*/ + 0, /*n exns*/ + exns, /*exceptions*/ + 3, /*n args*/ + ILU_NIL, /*return type ID*/ + err); + if (ILU_ERRNOK(*err)) + goto fail2; + ilu_DefineMethodArg (m, 0, "how-many", ilu_FALSE, ilu_In, "ilut:a9utKC9pScVOm5pXhcjtN2yJ5nO", err); + if (ILU_ERRNOK(*err)) + goto fail2; + ilu_DefineMethodArg (m, 1, "bl", ilu_FALSE, ilu_Out, "IDL:omg.org/CosNaming/BindingList:1.0", err); + if (ILU_ERRNOK(*err)) + goto fail2; + ilu_DefineMethodArg (m, 2, "bi", ilu_FALSE, ilu_Out, "IDL:omg.org/CosNaming/BindingIterator:1.0", err); + if (ILU_ERRNOK(*err)) + goto fail2; + } + fail1: + fail2: + ilu_ExitMutex(ilu_otmu, ilu_TRUE, &lerr); + return; + } + + typedef struct _ilu_ResolveIIOPNameErrs_s { + enum { + ilu_rine_Success, + ilu_rine_SystemError, + ilu_rine_NotFound, + ilu_rine_CannotProceed, + ilu_rine_InvalidName } whicherr; + union { + ilu_Error SystemError; + struct { + enum { + ilu_rine_nfe_missing_node, + ilu_rine_nfe_not_context, + ilu_rine_nfe_not_object } why; + ilu_string rest_of_name; + } NotFound; + struct { + ilu_string context_sbh; + ilu_string rest_of_name; + } CannotProceed; + } error_data; + } ilu_ResolveIIOPNameErrs_s; + + static ilu_Object + CosNamingResolve (ilu_Object ns, NameList namelist, ilu_ResolveIIOPNameErrs_s *errout, ilu_Error *err) + { + ilu_Call_s call_s; + ilu_Call call = &call_s; + ilu_cardinal reqSize; + ilu_cardinal estatus = 0; + ilu_ProtocolException internal; + ilu_Server s = object_server(ns); + ilu_Object result = NIL; + ilu_Connection newconn = NIL; + NameList nl; + + ILU_NOTE(OBJECT_DEBUG, + ("(iiop.c:CosNamingResolve): name service object %p\n", ns)); + + (void) ilu_StartCall(call, s, CosNaming_NamingContext, + CosNaming_NamingContext_resolve, 0, NIL, &newconn, err); + retry: + if (newconn != NIL) + (void) _ilu_HandOffNewConnection(newconn, err); + if (ILU_ERRNOK(*err)) + return ilu_FALSE; + _ilu_AcquireServerMutex(s); + reqSize = ilu_SizeOfObjectID(call, ns, ilu_TRUE, _ilu_rootClass, err); + _ilu_ReleaseServerMutex(s); + if (ILU_ERRNOK(*err)) + goto faild; + reqSize += SizeOfNameList (call, namelist, err); + if (ILU_ERRNOK(*err)) + goto faild; + if (!ilu_StartRequest(call, reqSize, err)) + goto faild; + ilu_EnterServer(s, object_class(ns)); + ilu_OutputObjectID(call, ns, ilu_TRUE, _ilu_rootClass, err); + if (ILU_ERRNOK(*err)) + goto faild; + OutputNameList (call, namelist, err); + if (ILU_ERRNOK(*err)) + goto faild; + if (!ilu_FinishRequest(call, err)) + goto faild; + internal = ilu_GetReply(call, &estatus, &newconn, err); + if (ILU_ERRNOK(*err) && + (err->ilu_type == ILU_ERRTYP(transient)) && + (ILU_ERRSEL(transient,*err).minor == ilu_tm_retry)) { + ILU_HANDLED(*err); + ILU_CLER(*err); + goto retry; + }; + if (ILU_ERRNOK(*err)) goto faild; + if (internal != ilu_ProtocolException_Success) { + errout->whicherr = ilu_rine_SystemError; + switch (internal) { + case ilu_ProtocolException_NoSuchClassAtServer: + ILU_ERR_CONS1(bad_typecode, &errout->error_data.SystemError, minor, ilu_btm_unknownType, 0); + break; + case ilu_ProtocolException_ClassVersionMismatch: + ILU_ERR_CONS1(bad_typecode, &errout->error_data.SystemError, minor, ilu_btm_unknownType, 0); + break; + case ilu_ProtocolException_NoSuchMethodOnClass: + ILU_ERR_CONS1(bad_operation, &errout->error_data.SystemError, minor, ilu_bom_noSuchOperationOnType, 0); + break; + case ilu_ProtocolException_GarbageArguments: + ILU_ERR_CONS1(marshal, &errout->error_data.SystemError, minor, ilu_mm_unknown, 0); + break; + case ilu_ProtocolException_RequestRejected: + case ilu_ProtocolException_Unknown: + ILU_ERR_CONS0(unknown, &errout->error_data.SystemError, 0); + break; + case ilu_ProtocolException_LostConnection: + ILU_ERR_CONS1(comm_failure, &errout->error_data.SystemError, minor, ilu_cfm_conn_lost, 0); + break; + case ilu_ProtocolException_RequestTimeout: + ILU_ERR_CONS0(no_response, &errout->error_data.SystemError, 0); + break; + default: + ILU_ERR_CONS0(unknown, &errout->error_data.SystemError, 0); + break; + } + } else if (estatus == 0) { /* successful completion */ + errout->whicherr = ilu_rine_Success; + ilu_InputObjectID(call, &result, ilu_FALSE, ilu_rootClass, err); + if (ILU_ERRNOK(*err)) + goto faild; + if (result != NIL) + ilu_ExitServer(object_server(result), object_class(result)); + ilu_ReplyRead(call, err); + goto faild; + } else if (estatus == 1) { + /* NotFound */ + ilu_shortcardinal which; + NameList nl; + errout->whicherr = ilu_rine_NotFound; + ilu_InputEnum (call, &which, NIL, err); + if (ILU_ERRNOK(*err)) goto faild; + switch (which) { + case 0: + errout->error_data.NotFound.why = ilu_rine_nfe_missing_node; + break; + case 1: + errout->error_data.NotFound.why = ilu_rine_nfe_not_context; + break; + case 2: + errout->error_data.NotFound.why = ilu_rine_nfe_not_object; + break; + default: + ILU_ERR_CONS1(marshal, err, minor, ilu_mm_enum_value, 0); + goto faild; + }; + nl = InputNameList(call, err); + if (ILU_ERRNOK(*err)) goto faild; + errout->error_data.NotFound.rest_of_name = StringifyNameList(nl, err); + FreeNameList(nl); + if (ILU_ERRNOK(*err)) goto faild; + } else if (estatus == 2) { + /* CannotProceed */ + ilu_Object nctx; + errout->whicherr = ilu_rine_CannotProceed; + ilu_InputObjectID (call, &nctx, ilu_FALSE, CosNaming_NamingContext, err); + if (ILU_ERRNOK(*err)) goto faild; + errout->error_data.CannotProceed.context_sbh = ilu_SBHOfObject(nctx); + ilu_ExitServer(object_server(nctx), CosNaming_NamingContext); + nl = InputNameList (call, err); + if (ILU_ERRNOK(*err)) goto faild; + errout->error_data.CannotProceed.rest_of_name = StringifyNameList(nl, err); + FreeNameList(nl); + if (ILU_ERRNOK(*err)) goto faild; + } else if (estatus == 3) { + /* InvalidName */ + errout->whicherr = ilu_rine_InvalidName; + } else { + ILU_ERR_CONS1(marshal, err, minor, ilu_mm_excn_id, 0); + goto faild; + } + faild: + ilu_FinishCall(call, err); + if (ILU_ERRNOK(*err)) { + ILU_HANDLED(*err); + } + return result; + } + + /* Returns object result of contacting the specified CosNaming service, + and doing "resolve" on the specified path. If an error occurs remotely, + returns NIL, with "err" indicating success, and sets "errout" + to indicate the error. If an error occurs + locally, returns NIL, and sets "err" to indicate the error. + */ + static ilu_Object + ResolveIIOPName (ilu_string iiopname, + ilu_ResolveIIOPNameErrs_s *errout, + ILU_ERRS((bad_locks, inv_objref, + no_resources, IoErrs)) * err) + { + char *p; + char addresses[1024]; + char object_path[1024]; + char ns_url[2048]; + ilu_Object ns_obj; + ilu_Object user_obj; + NameList namelist; + + Initialize_CosNaming_NamingContext (err); + if (ILU_ERRNOK(*err)) return NIL; + + if (strncmp(iiopname, "iiopname:/", 10) == 0) + p = iiopname + 9; + else + return ILU_ERR_CONS1(inv_objref, err, minor, ilu_iom_ior, NIL); + + if (sscanf (p, "//%1023[^/]/%1023s", addresses, object_path) != 2) + return ILU_ERR_CONS1(inv_objref, err, minor, ilu_iom_ior, NIL); + else if ((strlen(addresses) < 1) || (strlen(object_path) < 1)) + return ILU_ERR_CONS1(inv_objref, err, minor, ilu_iom_ior, NIL); + ILU_NOTE(IIOP_DEBUG, + ("ilu_IIOP_ResolveIIOPName: addresses are <%s>, path is <%s>\n", + addresses, object_path)); + + /* Form an iioploc: url for the NameService */ + sprintf(ns_url, "iioploc://%s/NameService", addresses); + + /* Turn the path into a list of name/extension pairs */ + namelist = ParsePathIntoNameList(object_path, err); + if (ILU_ERRNOK(*err)) return NIL; + + /* Get an object corresponding to the name service */ + ns_obj = ilu_ObjectOfSBH (ns_url, CosNaming_NamingContext, err); + if (ILU_ERRNOK(*err)) goto errout1; + ilu_DeltaHolds(ns_obj, +1); + ilu_ExitServer (object_server(ns_obj), CosNaming_NamingContext); + + /* call resolve on the name service */ + user_obj = CosNamingResolve (ns_obj, namelist, errout, err); + if (ILU_ERRNOK(*err)) goto errout2; + + /* free up the ns_obj, and the namelist */ + if (object_server(user_obj) != object_server(ns_obj)) + ilu_EnterServer (object_server(ns_obj), CosNaming_NamingContext); + _ilu_DeltaHolds(ns_obj, -1); + if (object_server(user_obj) != object_server(ns_obj)) + ilu_ExitServer (object_server(ns_obj), CosNaming_NamingContext); + FreeNameList(namelist); + + /* return the user_obj */ + return user_obj; + + /* return with an error */ + errout2: + ilu_EnterServer (object_server(ns_obj), CosNaming_NamingContext); + _ilu_DeltaHolds(ns_obj, -1); + ilu_ExitServer (object_server(ns_obj), CosNaming_NamingContext); + errout1: + FreeNameList (namelist); + return NIL; + } + + static void + FreeResolveIIOPNameErrs(ilu_ResolveIIOPNameErrs_s *err) + { + switch (err->whicherr) { + case ilu_rine_Success: + case ilu_rine_InvalidName: + break; + case ilu_rine_SystemError: + ILU_HANDLED(err->error_data.SystemError); + break; + case ilu_rine_NotFound: + ilu_free(err->error_data.NotFound.rest_of_name); + break; + case ilu_rine_CannotProceed: + ilu_free(err->error_data.CannotProceed.context_sbh); + ilu_free(err->error_data.CannotProceed.rest_of_name); + break; + default: + break; + } + } + + ilu_boolean _ilu_IIOP_ParseIIOPName (ilu_string iiopname, ilu_string *ih, ilu_string *sid, + ilu_string *mstid, ilu_string *cinfo, ilu_cardinal *cinfolen, + ilu_boolean *pass_cinfo, ilu_Error *err) + { + ilu_Object kobj; + ilu_ResolveIIOPNameErrs_s usererrs; + ilu_Server s; + + kobj = ResolveIIOPName (iiopname, &usererrs, err); + if (ILU_ERRNOK(*err)) return ilu_FALSE; + switch (usererrs.whicherr) { + case ilu_rine_Success: + { + s = object_server(kobj); + if (ih) { + *ih = ilu_StrdupE(object_ih(kobj), err); + if (ILU_ERRNOK(*err)) break; + }; + if (sid) { + *sid = ilu_StrdupE(server_id(s), err); + if (ILU_ERRNOK(*err)) break; + }; + if (mstid) + *mstid = NIL; + if (cinfo || cinfolen) { + if (cinfo) { + *cinfo = ilu_StrdupE(s->sr_cinfo.icb_base, err); + if (ILU_ERRNOK(*err)) break; + }; + if (*cinfolen) { + if (cinfo) + *cinfolen = strlen(*cinfo); + else + *cinfolen = s->sr_cinfo.icb_len; + }; + if (pass_cinfo) + *pass_cinfo = ilu_TRUE; + } + } + break; + case ilu_rine_SystemError: + *err = usererrs.error_data.SystemError; + break; + case ilu_rine_NotFound: + ILU_ERR_CONS1(inv_objref, err, minor, ilu_iom_CosNaming_NotFound, 0); + FreeResolveIIOPNameErrs(&usererrs); + break; + case ilu_rine_CannotProceed: + ILU_ERR_CONS1(inv_objref, err, minor, ilu_iom_CosNaming_CannotProceed, 0); + FreeResolveIIOPNameErrs(&usererrs); + break; + case ilu_rine_InvalidName: + ILU_ERR_CONS1(inv_objref, err, minor, ilu_iom_CosNaming_InvalidName, 0); + FreeResolveIIOPNameErrs(&usererrs); + break; + default: + ILU_ERR_CONS1(internal, err, minor, ilu_im_badEnumValue, 0); + FreeResolveIIOPNameErrs(&usererrs); + break; + } + return (ILU_ERROK(*err)); + } + static ilu_boolean _IIOP_ParseCDR (ilu_bytes iorbytes, ilu_cardinal nbytes, ilu_string *ih, ilu_string *sid, ilu_string *mstid, ilu_string *cinfo, ilu_cardinal *cinfo_len, *************** *** 3533,3541 **** if (key == NIL || strncmp((ilu_string) key, "ilu", 4) != 0) { ILU_NOTE(INCOMING_DEBUG, ("_IIOP_InputObjectID: incoming oid not an ILU object-key")); ! ILU_ERR_CONS1(marshal, err, minor, ilu_mm_alien_disc, 6); } else { --- 4575,4600 ---- if (key == NIL || strncmp((ilu_string) key, "ilu", 4) != 0) { + char ihbuf[2048]; + char *newkey; ILU_NOTE(INCOMING_DEBUG, ("_IIOP_InputObjectID: incoming oid not an ILU object-key")); ! /* we assume that it's a "foreign" object key somehow placed in this server */ ! strcpy(ihbuf, CORBA_NATIVE_OBJECT_IH_PREFIX); ! if (newkey = _ilu_EncodeBuffer((char *) key, keylen, err), ILU_ERROK(*err)) { ! strcat (ihbuf, newkey); ! ilu_free(newkey); ! ilu_EnterServer(server, static_type); ! if ((*h = _ilu_FindObjectInServer(ihbuf, server)) == NIL) { ! ILU_NOTE(IIOP_DEBUG, ! ("ILU(iiop.c:FindClassFromObjectKey): no object in server <%s> with ih <%s>\n", ! server_id(server), ihbuf)); ! ilu_ExitServer(server, static_type); ! ILU_ERR_CONS1(marshal, err, minor, ilu_mm_alien_disc, 6); ! } else { ! ILU_CLER(*err); ! } ! }; } else { *************** *** 7326,7332 **** } } _ilu_AcquireMutex(ilu_prmu); ! putative_class = FindClassFromObjectKey (iiop_objKey(call), iiop_objKeyLen(call)); _ilu_ReleaseMutex(ilu_prmu); if (putative_class == NIL) { --- 8385,8391 ---- } } _ilu_AcquireMutex(ilu_prmu); ! putative_class = FindClassFromObjectKey (iiop_objKey(call), iiop_objKeyLen(call), call_server(call)); _ilu_ReleaseMutex(ilu_prmu); if (putative_class == NIL) { *** 1.199 1998/12/09 16:37:42 --- runtime/kernel/object.c 1999/01/28 01:14:04 *************** *** 384,389 **** --- 384,391 ---- ilu_RegisterSBHParser ("ior", _ilu_IIOP_ParseIOR); ilu_RegisterSBHParser ("IOR2", _ilu_IIOP_ParseIOR2); ilu_RegisterSBHParser ("iiop", _ilu_IIOP_ParseIIOP); + ilu_RegisterSBHParser ("iioploc", _ilu_IIOP_ParseIIOPLoc); + ilu_RegisterSBHParser ("iiopname", _ilu_IIOP_ParseIIOPName); #endif #ifdef W3NG_PROTOCOL ilu_RegisterSBHParser ("w3ng", _ilu_w3ng_ParseURL); *************** *** 805,810 **** --- 807,815 ---- #ifdef IIOP_PROTOCOL if (strncmp(sbh, "IOR:", 4) == 0 || strncmp(sbh, "iiop:", 5) == 0 || + strncmp(sbh, "IOR2:", 5) == 0 || + strncmp(sbh, "iioploc:", 8) == 0 || + strncmp(sbh, "iiopname:", 9) == 0 || strncmp(sbh, "ior:", 4) == 0) { ILU_NOTE(OBJECT_DEBUG, *** 1.123 1998/12/05 02:49:27 --- runtime/kernel/iluerrs.h 1999/01/27 03:04:33 *************** *** 271,278 **** * set */ ilu_iom_char_codeset, /* unsupported character code set */ ilu_iom_relocate_loop, /* detection might be conservative */ ! ilu_iom_conc_serial /* serializer used when contact info * is concurrent */ } ilu_inv_objref_Minor; --- 271,281 ---- * set */ ilu_iom_char_codeset, /* unsupported character code set */ ilu_iom_relocate_loop, /* detection might be conservative */ ! ilu_iom_conc_serial, /* serializer used when contact info * is concurrent */ + ilu_iom_CosNaming_NotFound, /* CosNaming returned NotFound */ + ilu_iom_CosNaming_CannotProceed,/* CosNaming returned CannotProceed */ + ilu_iom_CosNaming_InvalidName /* CosNaming returned InvalidName */ } ilu_inv_objref_Minor; *************** *** 369,374 **** --- 372,380 ---- ilu_mm_cantConvertCharset, /* can't convert string to specified charset */ ilu_mm_mst_unreg, /* LSR can't make surrogate */ ilu_mm_fixedpoint_range, /* bounded fixedpoint value out-of-range */ + ilu_mm_excn_id, /* Exception reply has bad excn indicator */ + ilu_mm_enum_value, /* Value for enum out of range */ + ilu_mm_unknown, /* Unknown marshalling error */ ilu_mm_url_quoted_char /* Bad quoted hex char in URL form */ } ilu_marshal_Minor; *************** *** 437,443 **** ILU_DECL_PARMLESS_ERR(obj_adapter); /* not used */ ILU_DECL_PARMLESS_ERR(data_conversion); /* not used */ ! ILU_DECL_PARMLESS_ERR(codeset_incompatible); /* added in 2.1 revision */ /* This is the end of the prefix that corresponds to CORBA's list. */ --- 443,449 ---- ILU_DECL_PARMLESS_ERR(obj_adapter); /* not used */ ILU_DECL_PARMLESS_ERR(data_conversion); /* not used */ ! ILU_DECL_PARMLESS_ERR(codeset_incompatible); /* added in CORBA 2.1 revision */ /* This is the end of the prefix that corresponds to CORBA's list. */ *** 1.23 1998/10/08 21:48:22 --- etc/CosNaming/NamingImpl.c 1999/01/28 02:18:34 *************** *** 1005,1011 **** static void usage(char *pname) { ! fprintf (stderr, "Usage: %s [-f BACKING-FILE] [-p PORT] [-ior] [-sid SERVER-ID] [-ih ROOT-INST-HANDLE] [-h HOSTNAME-OR-IP-ADDR] [-sid_and_ih_from_IOR STRINGIFED-IOR]\n", pname); exit(1); } --- 1005,1011 ---- static void usage(char *pname) { ! fprintf (stderr, "Usage: %s [-f BACKING-FILE] [-p PORT] [-ior] [-object_key OBJECT-KEY] [-sid SERVER-ID] [-ih ROOT-INST-HANDLE] [-h HOSTNAME-OR-IP-ADDR] [-sid_and_ih_from_IOR STRINGIFED-IOR]\n", pname); exit(1); } *************** *** 1031,1041 **** char sid[1100]; char ih[1100]; unsigned long rawport; ! ilu_shortcardinal port; ilu_boolean ior = ilu_FALSE; int i = 1; ilu_boolean sid_set = ilu_FALSE; ilu_boolean ih_set = ilu_FALSE; gethostname(hostname, sizeof(hostname)); --- 1031,1042 ---- char sid[1100]; char ih[1100]; unsigned long rawport; ! ilu_shortcardinal port = 9999; ilu_boolean ior = ilu_FALSE; int i = 1; ilu_boolean sid_set = ilu_FALSE; ilu_boolean ih_set = ilu_FALSE; + char *object_key = "NameService"; gethostname(hostname, sizeof(hostname)); *************** *** 1100,1105 **** --- 1101,1111 ---- } else if (strcmp(av[i], "-ior") == 0) { ior = ilu_TRUE; i++; + } else if (strcmp(av[i], "-object_key") == 0) { + if (i++ < ac) + object_key = av[i++]; + else + usage(av[0]); } else if (strcmp(av[i], "-v") == 0) { Verbose = ilu_TRUE; i++; *************** *** 1109,1118 **** /* initialize simpbind interface */ CosNaming__InitializeServer(); ! if (!sid_set) ! sprintf (sid, "CosNaming_%s", hostname); ! if (!ih_set) ! strcpy (ih, "root"); sprintf (tcpinfo, "tcp_%s_%d", hostname, port); tinfo[0] = tcpinfo; LocalServerID = sid; --- 1115,1143 ---- /* initialize simpbind interface */ CosNaming__InitializeServer(); ! if ((!sid_set) && (!ih_set)) { ! /* Initialize to values compatible with INS submission */ ! ilu_Error err; ! ilu_string s = ilu_InventID(); ! strcpy (sid, s); ! ilu_free(s); ! s = ilu_IIOP_IHFromObjectKey ((ilu_bytes) object_key, ! strlen(object_key), &err); ! if (ILU_ERRNOK(err)) { ! fprintf(stderr, "Can't create instance handle for object key " ! "\"%s\". Error <%s>.\n", object_key, ILU_ERR_NAME(err)); ! ILU_HANDLED(err); ! exit(1); ! } ! strcpy (ih, s); ! ilu_free(s); ! } ! else { ! if (!sid_set) ! sprintf (sid, "CosNaming_%s", ilu_InventID()); ! if (!ih_set) ! strcpy (ih, "root"); ! } sprintf (tcpinfo, "tcp_%s_%d", hostname, port); tinfo[0] = tcpinfo; LocalServerID = sid;
*** 1.99 1999/01/20 01:55:07 --- stubbers/python/genstub.c 1999/01/28 03:36:01 *************** *** 1482,1494 **** switch (type_kind(t)) { case enumeration_Type: /* no special I/O */ break; ! case fixedpoint_Type: stFixedpointTypeIO(t); break; case record_Type: stRecordTypeIO(t); break; case union_Type: stUnionTypeIO(t); break; case array_Type: stArrayTypeIO(t); break; ! case sequence_Type: stSequenceTypeIO(t); break; case object_Type: /* built-in */ break; ! case optional_Type: stOptionalIO(t); break; case alias_Type: /* no special I/O */ break; default: /* null */ break; } --- 1482,1494 ---- switch (type_kind(t)) { case enumeration_Type: /* no special I/O */ break; ! case fixedpoint_Type: stFixedpointTypeIO(t); break; case record_Type: stRecordTypeIO(t); break; case union_Type: stUnionTypeIO(t); break; case array_Type: stArrayTypeIO(t); break; ! case sequence_Type: stSequenceTypeIO(t); break; case object_Type: /* built-in */ break; ! case optional_Type: stOptionalIO(t); break; case alias_Type: /* no special I/O */ break; default: /* null */ break; } *************** *** 1503,1509 **** switch (type_kind(t)) { case enumeration_Type: stEnumerationTypeClass(t); break; ! case fixedpoint_Type: stFixedpointTypeClass(t); break; case record_Type: stRecordTypeClass(t,0); break; case union_Type: stUnionTypeClass(t); break; case array_Type: /* no class needed */ break; --- 1503,1509 ---- switch (type_kind(t)) { case enumeration_Type: stEnumerationTypeClass(t); break; ! case fixedpoint_Type: stFixedpointTypeClass(t); break; case record_Type: stRecordTypeClass(t,0); break; case union_Type: stUnionTypeClass(t); break; case array_Type: /* no class needed */ break; *************** *** 1524,1534 **** switch (type_kind(t)) { case enumeration_Type: stEnumerationTypeReg(t); break; ! case fixedpoint_Type: stFixedpointTypeReg(t); break; case record_Type: stRecordTypeReg(t); break; case union_Type: stUnionTypeReg(t); break; case array_Type: stArrayTypeReg(t); break; ! case sequence_Type: stSequenceTypeReg(t); break; case object_Type: stClassReg(t); break; case optional_Type: stOptionalReg(t); break; case alias_Type: stAliasTypeReg(t); break; --- 1524,1534 ---- switch (type_kind(t)) { case enumeration_Type: stEnumerationTypeReg(t); break; ! case fixedpoint_Type: stFixedpointTypeReg(t); break; case record_Type: stRecordTypeReg(t); break; case union_Type: stUnionTypeReg(t); break; case array_Type: stArrayTypeReg(t); break; ! case sequence_Type: stSequenceTypeReg(t); break; case object_Type: stClassReg(t); break; case optional_Type: stOptionalReg(t); break; case alias_Type: stAliasTypeReg(t); break; *************** *** 2060,2065 **** --- 2060,2066 ---- { int nExceptions = 0; + list_enumerate (ns->types, (EnumProc) stTypeClass, NULL); list_enumerate (ns->types, (EnumProc) stTypeIO, NULL); list_enumerate (ns->types, (EnumProc) stTypeReg, NULL); list_enumerate (ns->exceptions, (EnumProc) stExcType, NULL); *** 1.12 1998/12/08 23:40:49 --- stubbers/python/name.c 1999/01/28 03:35:43 *************** *** 306,313 **** --- 306,315 ---- basename = (char *) list_ref(t->scoping, i); strcat (buffer, basename); } + /* fprintf (stderr, "scoped name for %s.%s is %s\n", interface_name(type_interface(t)), type_name(t), buffer); + */ translateNameString(buffer2, buffer); name_set_lang_name(t->name, corba_scoped, buffer2); result = name_lang_name(t->name, corba_scoped);
*** 1.69 1998/11/03 01:36:53 --- runtime/python/Imakefile 1999/01/30 02:12:26 *************** *** 247,250 **** all:: iluimport.py ! InstallRO(iluRt.py iluimport.py CORBA.py ilu.py ilu__skel.py ilu_tk.py SunRPCUNIXAuthUsername.py, $(DESTDIR)/lib) --- 247,250 ---- all:: iluimport.py ! InstallRO(iluRt.py iluimport.py CORBA.py CORBAExceptions.py ilu.py ilu__skel.py ilu_tk.py SunRPCUNIXAuthUsername.py, $(DESTDIR)/lib)
*** 1.10 1998/10/13 17:48:45 --- runtime/python/iluwin32.mak 1999/02/04 21:01:51 *************** *** 82,93 **** --- 82,95 ---- echo Building for Python 1.4 - read $(ILUSRC)\runtime\python\iluwin32.mak and echo $(ILUSRC)\stubbers\python\iluwin32.mak to change python version copy pythonversion14.win pythonversion.h + if exist iluimport.py.dist copy iluimport.py.dist iluimport.py nmake -f iluPr.mak CFG="$(CFG)" PMAKE15 : echo Building for Python 1.5.1 - read $(ILUSRC)\runtime\python\iluwin32.mak and echo $(ILUSRC)\stubbers\python\iluwin32.mak to change python version copy pythonversion15.win pythonversion.h + if exist iluimport.py.dist copy iluimport.py.dist iluimport.py nmake -f iluPr15.mak CFG="$(CFG)"
*** 1.3 1999/01/20 19:06:17 --- etc/javaobv/ilujava.isl.dist 1999/02/05 03:00:30 *************** *** 61,67 **** TYPE MarshalledObjectBase = (* Base type for "marshalled" java Object *) RECORD sb: ObjectBytes, (* State of this java.lang.Object instance *) ! accessMethod: String, (* Mechanism to choose the class loader *) accessor: ClassAccessor (* For the benefit of certain class loaders *) END; (* A "marshalled" java object (typicly serializable) --- 61,67 ---- TYPE MarshalledObjectBase = (* Base type for "marshalled" java Object *) RECORD sb: ObjectBytes, (* State of this java.lang.Object instance *) ! accessMethod: "String", (* Mechanism to choose the class loader *) accessor: ClassAccessor (* For the benefit of certain class loaders *) END; (* A "marshalled" java object (typicly serializable) *************** *** 80,95 **** TYPE ClassBytes = (* The bytecodes for a class *) SEQUENCE OF BYTE; ! TYPE String = (* Unicode *) SEQUENCE OF CHARACTER; ! EXCEPTION AccessError: String; (* class (bytecodes) not found *) TYPE ClassAccessor = (* input mechanism for certain class loaders *) OBJECT OPTIONAL DOCUMENTATION "Accessing the bytecodes of the class" METHODS ! GetBytes(classname: String): ClassBytes RAISES AccessError END END; TYPE JavaObjectBase = (* Base type for "life" java Object *) --- 80,95 ---- TYPE ClassBytes = (* The bytecodes for a class *) SEQUENCE OF BYTE; ! TYPE "String" = (* Unicode *) SEQUENCE OF CHARACTER; ! EXCEPTION AccessError: "String"; (* class (bytecodes) not found *) TYPE ClassAccessor = (* input mechanism for certain class loaders *) OBJECT OPTIONAL DOCUMENTATION "Accessing the bytecodes of the class" METHODS ! GetBytes(classname: "String"): ClassBytes RAISES AccessError END END; TYPE JavaObjectBase = (* Base type for "life" java Object *)
*** 1.15 1998/11/21 00:54:43 --- runtime/python/CORBA.py 1999/02/05 01:34:24 *************** *** 31,72 **** ####################################################################### import iluRt - InvalidName = "CORBA.InvalidName" - - InitialReferences = {} - - class ORB: - - def object_to_string (self, obj): - return iluRt.IOROfObject(obj) - - def string_to_object (self, str): - return iluRt.ObjectOfSBH(iluRt.CORBA_Object, str) - - def resolve_initial_references (self, str): - if (InitialReferences.has_key(str)): - return InitialReferences[str] - else: - raise InvalidName, str - - theORB = ORB() - - Object = iluRt.CORBA_Object - - def ORB_init (argv=(), orb_id='ilu'): - import os - if (os.environ.has_key("ILU_COS_NAMING_IOR")): - try: - import CosNaming - naming = iluRt.ObjectOfSBH(CosNaming.NamingContext, os.environ["ILU_COS_NAMING_IOR"]) - if naming: - InitialReferences["NameService"] = naming - except: - import sys - sys.stderr.write("CORBA.ORB_init: Note: Can't bind to COS Naming service specified in value of environment variable ILU_COS_NAMING_IOR.\n") - pass - return theORB - if iluRt.CORBAMapping: from CORBAExceptions import * --- 31,36 ---- *************** *** 102,107 **** --- 66,151 ---- class Any (iluRt.Pickle): def __init__(self, typecode, value): iluRt.Pickle.__init__(self, typecode, value) + + if iluRt.CORBAMapping: + class InvalidName (UserException): + # raised to indicate a bad name passed to resolve_initial_references + pass + else: + InvalidName = "CORBA.InvalidName" + + DefaultInitialReference = None + InitialReferences = {} + + import regex + InitRefPattern = regex.compile('\([^=]+\)=\(.*\)') + + class ORB: + + def object_to_string (self, obj): + return iluRt.IOROfObject(obj) + + def string_to_object (self, str): + return iluRt.ObjectOfSBH(iluRt.CORBA_Object, str) + + def resolve_initial_references (self, str): + import types + if (InitialReferences.has_key(str)): + value = InitialReferences[str] + if (type(value) == types.StringType): + return iluRt.ObjectOfSBH(iluRt.CORBA_Object, value) + elif (type(value) == types.InstanceType): + return value + else: + raise InvalidName + elif DefaultInitialReference: + value = DefaultInitialReference + '/' + str + return iluRt.ObjectOfSBH(iluRt.CORBA_Object, value) + else: + raise InvalidName + + theORB = ORB() + + Object = iluRt.CORBA_Object + + def ORB_init (argv=(), orb_id='ilu'): + import os + global DefaultInitialReference + if orb_id != 'ilu': + raise 'unknown orb_id', orb_id + if (os.environ.has_key("ILU_COS_NAMING_IOR")): + try: + import CosNaming + naming = iluRt.ObjectOfSBH(CosNaming.NamingContext, os.environ["ILU_COS_NAMING_IOR"]) + if naming: + InitialReferences["NameService"] = naming + except: + import sys + sys.stderr.write("CORBA.ORB_init: Note: Can't bind to COS Naming service specified in value of environment variable ILU_COS_NAMING_IOR.\n") + pass + i = 0 + while i < len(argv): + if argv[i] == '-ORBInitRef': + if (i + 1) >= len(argv): + raise 'bad ORB_init parameter list', argv + else: + import regex + i = i + 1 + if (InitRefPattern.match(argv[i]) < 0): + raise 'bad ORBInitRef parameter', argv[i] + matchname, matchurl = InitRefPattern.group(1,2) + InitialReferences[matchname] = matchurl + del argv[i-1:i+1] + elif argv[i] == '-ORBDefaultInitRef': + if (i + 1) >= len(argv): + raise 'bad ORB_init parameter list', argv + else: + i = i + 1 + DefaultInitialReference = argv[i] + del argv[i-1:i+1] + i = i + 1 + return theORB +
*** 1.28 1999/01/04 22:57:17 --- stubbers/java/context.c 1999/02/11 17:58:00 *************** *** 28,32 **** #include #include - #include #include "iluptype.h" #include "shared.h" --- 28,31 ----
*** etc/javaobv/javawin32.mak 1999/01/27 23:51:12 --- etc/javaobv/javawin32.mak 1999/02/12 21:33:42 *************** *** 26,32 **** !ELSE !IF "$(JDK_HOME)" == "" JDK_HOME = $(JAVA_HOME) ! !END !IF "$(JAVASDK)" == "" !ERROR JAVASDK environment variable not set - should be one of Microsoft or Javasoft --- 26,32 ---- !ELSE !IF "$(JDK_HOME)" == "" JDK_HOME = $(JAVA_HOME) ! !ENDIF !IF "$(JAVASDK)" == "" !ERROR JAVASDK environment variable not set - should be one of Microsoft or Javasoft
*** 1.62 1998/12/23 19:34:44 --- runtime/java/iluwin32.mak 1999/02/12 21:51:44 *************** *** 370,376 **** $(JAVAC) $(ILU_JAVAC_FLAGS) $(JAVA_SRC_DIR)\xerox\ilutools\GenIluTypeIds.java set CLASSPATH=.\classes;$(CLASSPATH) $(JAVAI) $(ILU_CLASSPATHARG) xerox.ilutools.gnh $(ILU_GNH_FLAGS) ilunative.in ! ..\..\..\bin\islscan -I ../../stubbers/parser build.isl >$(JAVA_BUILD_DIR)\typeids.scanned $(JAVAI) $(ILU_CLASSPATHARG) xerox.ilutools.GenIluTypeIds !IF "$(JAVAUSE12)" == "" !MESSAGE Compiling the omg classes --- 370,376 ---- $(JAVAC) $(ILU_JAVAC_FLAGS) $(JAVA_SRC_DIR)\xerox\ilutools\GenIluTypeIds.java set CLASSPATH=.\classes;$(CLASSPATH) $(JAVAI) $(ILU_CLASSPATHARG) xerox.ilutools.gnh $(ILU_GNH_FLAGS) ilunative.in ! $(ILUHOME)\bin\islscan -I ../../stubbers/parser build.isl >$(JAVA_BUILD_DIR)\typeids.scanned $(JAVAI) $(ILU_CLASSPATHARG) xerox.ilutools.GenIluTypeIds !IF "$(JAVAUSE12)" == "" !MESSAGE Compiling the omg classes
*** etc/CosNaming/javawin32.mak --- etc/CosNaming/javawin32.mak 1999/02/15 21:35:38 *************** *** 0 **** --- 1,99 ---- + # Top level makefile to build Win32 java version of ILU CosNaming feature + + !IF "$(CFG)" == "" + CFG=Win32 Release + !MESSAGE No configuration specified. Defaulting to Win32 Release. + !ENDIF + + !IF "$(CFG)" != "Win32 Release" && "$(CFG)" != "Win32 Debug" + !MESSAGE Invalid configuration "$(CFG)" specified. + !MESSAGE You can specify a configuration when running NMAKE on this makefile + !MESSAGE by defining the macro CFG on the command line. For example: + !MESSAGE + !MESSAGE NMAKE /f "javawin32.mak" CFG="Win32 Release" + !MESSAGE + !MESSAGE Possible choices for configuration are: + !MESSAGE + !MESSAGE "Win32 Release" + !MESSAGE "Win32 Debug" + !MESSAGE + !ERROR An invalid configuration is specified. + !ENDIF + + + !IF "$(JAVA_HOME)" == "" + ALL : NOJAVAMAKE + !ELSE + !IF "$(JDK_HOME)" == "" + JDK_HOME = $(JAVA_HOME) + !ENDIF + + !IF "$(JAVASDK)" == "" + !ERROR JAVASDK environment variable not set - should be one of Microsoft or Javasoft + !ENDIF + + JAVA_CLASS_DIR=.\classes + JAVA_STUBS_DIR=.\javastubs + + + !IF "$(CFG)" == "Win32 Release" + + !IF "$(JAVASDK)" == "Microsoft" + ILU_JAVAC_FLAGS= /d $(JAVA_CLASS_DIR) + !ELSE + ILU_JAVAC_FLAGS= -d $(JAVA_CLASS_DIR) + !ENDIF + + !ELSE + + !IF "$(JAVASDK)" == "Microsoft" + ILU_JAVAC_FLAGS= /g /d $(JAVA_CLASS_DIR) + !ELSE + ILU_JAVAC_FLAGS= -g -d $(JAVA_CLASS_DIR) + !ENDIF + + !ENDIF + + + !IF "$(JAVASDK)" == "Microsoft" + JAVAC = $(JAVA_HOME)\bin\jvc + !ELSE + JAVAC = $(JDK_HOME)\bin\javac + !ENDIF + + !IF "$(JAVASDK)" == "Microsoft" + ALL : JAVAMAKE + !ELSE + ALL : JAVAMAKE JAVAJAR + !ENDIF + + !ENDIF + + ################################################################################ + + + JAVAJAR : + cd .\classes + $(JDK_HOME)\bin\jar -0cf ..\iluCosNaming.jar * + cd .. + + NOJAVAMAKE : + echo JAVA_HOME environment variable not set, not building Java CosNaming + + + JAVAMAKE : + set ILUPATH=.;..\..\stubbers\parser + java-stubber -prefix xorg.omg CosNaming.idl + if not exist $(JAVA_CLASS_DIR)\nul mkdir $(JAVA_CLASS_DIR) + set CLASSPATH=.;$(JAVA_CLASS_DIR);$(ILUHOME)\lib\classes;..\..\runtime\java\classes;$(CLASSPATH) + $(JAVAC) $(ILU_JAVAC_FLAGS) $(JAVA_STUBS_DIR)\xorg\omg\CosNaming\*.java $(JAVA_STUBS_DIR)\xorg\omg\CosNaming\NamingContextPackage\*.java $(JAVA_STUBS_DIR)\xorg\omg\CosNaming\NamingContextExtPackage\*.java + + + + clean : + if exist $(JAVA_CLASS_DIR)\nul rmdir $(JAVA_CLASS_DIR) /s + if exist $(JAVA_STUBS_DIR)\nul rmdir $(JAVA_STUBS_DIR) /s + if exist iluCosNaming.jar del iluCosNaming.jar + + # End + ################################################################################ *** 1.31 1999/01/06 20:56:28 --- iluwin32.mak 1999/02/15 21:35:38 *************** *** 55,60 **** --- 55,61 ---- $(ILUHOME)\interfacefiles : $(ILUHOME)\interfaces xcopy $(ILUSRC)\stubbers\parser\ilu.isl $(ILUHOME)\interfaces /d xcopy $(ILUSRC)\stubbers\parser\iluhttp.isl $(ILUHOME)\interfaces /d + xcopy $(ILUSRC)\etc\CosNaming\CosNaming.idl $(ILUHOME)\interfaces /d $(ILUHOME)\includefiles : $(ILUHOME)\include *************** *** 99,104 **** --- 100,107 ---- if exist $(ILUSRC)\etc\javaobv\ilujavaobv.jar copy $(ILUSRC)\etc\javaobv\ilujavaobv.jar $(ILUHOME)\lib if exist $(ILUSRC)\etc\javaobv\ilujava.isl copy $(ILUSRC)\etc\javaobv\ilujava.isl $(ILUHOME)\interfaces if exist $(ILUSRC)\etc\javaobv\ilujava.map copy $(ILUSRC)\etc\javaobv\ilujava.map $(ILUHOME)\interfaces + if exist $(ILUSRC)\etc\CosNaming\classes xcopy $(ILUSRC)\etc\CosNaming\classes $(ILUHOME)\lib\classes /s /d + if exist $(ILUSRC)\etc\CosNaming\iluCosNaming.jar copy $(ILUSRC)\etc\CosNaming\iluCosNaming.jar $(ILUHOME)\lib CLEANOUT : *** 1.2 1997/10/28 18:56:34 --- etc/CosNaming/iluwin32.mak 1999/02/15 21:40:04 *************** *** 29,35 **** ################################################################################ ! ALL : $(ILUHOME) $(ILUHOME)\bin $(ILUHOME)\lib COSNAMEMAKE $(ILUHOME) : if not exist $(ILUHOME)\nul mkdir $(ILUHOME) --- 29,35 ---- ################################################################################ ! ALL : $(ILUHOME) $(ILUHOME)\bin $(ILUHOME)\lib COSNAMEMAKEC COSNAMEMAKEJAVA $(ILUHOME) : if not exist $(ILUHOME)\nul mkdir $(ILUHOME) *************** *** 40,49 **** $(ILUHOME)\bin : if not exist $(ILUHOME)\bin\nul mkdir $(ILUHOME)\bin ! COSNAMEMAKE : ! set ILUPATH=.;..\..\stubbers\parser ! c-stubber CosNaming.idl ! nmake -f ILUCosNaming.mak CFG="$(CFG)" clean : if exist WinDebug\nul del /q WinDebug\* --- 40,52 ---- $(ILUHOME)\bin : if not exist $(ILUHOME)\bin\nul mkdir $(ILUHOME)\bin ! COSNAMEMAKEC : ! set ILUPATH=.;..\..\stubbers\parser ! c-stubber -nodefaulttrueclassfor CosNaming.NamingContextExt CosNaming.idl ! nmake -f ILUCosNaming.mak CFG="$(CFG)" ! ! COSNAMEMAKEJAVA : ! nmake -f javawin32.mak CFG="$(CFG)" clean : if exist WinDebug\nul del /q WinDebug\*
*** 1.1 1998/11/27 20:47:52 --- runtime/java/build.isl 1999/02/15 21:33:12 *************** *** 1,5 **** INTERFACE CORBA; ! TYPE wstring = SEQUENCE OF CHARACTER; ! TYPE string = SEQUENCE OF SHORT CHARACTER; --- 1,5 ---- INTERFACE CORBA; ! TYPE "wstring" = SEQUENCE OF CHARACTER; ! TYPE "string" = SEQUENCE OF SHORT CHARACTER;
*** 1.11 1998/10/09 21:44:44 --- runtime/python/pythonthreads.h 1999/02/27 02:05:50 *************** *** 39,44 **** --- 39,49 ---- #else + #define PyThread_start_new_thread start_new_thread + #define PyThread_init_thread init_thread + #define PyThread_exit_thread exit_thread + #define PyThread_get_thread_ident get_thread_ident + #define EXIT_INTERPRETER(if_what) { PyObject *_save; { if (if_what) { _save = PyEval_SaveThread(); } } #define ENTER_INTERPRETER(if_what) { if (if_what) { PyEval_RestoreThread(_save); } } } #define NEW_THREAD_ENTER { { if (ilupython_threaded_operation) PyEval_RestoreThread(NULL); } *** 1.70 1999/01/30 02:12:26 --- runtime/python/Imakefile 1999/02/27 01:56:01 *************** *** 31,36 **** --- 31,41 ---- $(RM) pythonversion.h echo "#define ILUPYTHON_MAJOR_VERSION " PYTHON_MAJOR_VERSION >pythonversion.h echo "#define ILUPYTHON_MINOR_VERSION " PYTHON_MINOR_VERSION >>pythonversion.h + if test -r $(PYTHON_PREFIX)/include/$(PYTHON_INCLUDE_SUFFIX)/pythread.h ; then \ + echo '#include "pythread.h"' > pythonthreadheaderfile.h ;\ + else \ + echo '#include "thread.h"' > pythonthreadheaderfile.h ;\ + fi echo "#define ILU_PYTHON_THREADS 1" >>pythonversion.h #else *************** *** 39,45 **** $(RM) pythonversion.h echo "#define ILUPYTHON_MAJOR_VERSION " PYTHON_MAJOR_VERSION >pythonversion.h echo "#define ILUPYTHON_MINOR_VERSION " PYTHON_MINOR_VERSION >>pythonversion.h ! #endif /* (defined(ILU_OS_THREADED) && defined(ILU_PYTHON_HAS_THREADS)) */ CleanTarget(pythonversion.h) --- 44,50 ---- $(RM) pythonversion.h echo "#define ILUPYTHON_MAJOR_VERSION " PYTHON_MAJOR_VERSION >pythonversion.h echo "#define ILUPYTHON_MINOR_VERSION " PYTHON_MINOR_VERSION >>pythonversion.h ! echo "" > pythonthreadheaderfile.h #endif /* (defined(ILU_OS_THREADED) && defined(ILU_PYTHON_HAS_THREADS)) */ CleanTarget(pythonversion.h) *** 1.271 1999/02/26 01:11:30 --- runtime/python/iluPrmodule.c 1999/02/27 02:04:22 *************** *** 118,124 **** #include "oscalls.h" /* for OS_SLEEP */ ! #include "thread.h" /* from the Python include files */ static void bootstrapAlarm(ilu_private); static PyObject *ilupython_thread_push_call(PyObject *, PyObject *); --- 118,124 ---- #include "oscalls.h" /* for OS_SLEEP */ ! #include "pythonthreadheaderfile.h" /* either thread.h or pythread.h */ static void bootstrapAlarm(ilu_private); static PyObject *ilupython_thread_push_call(PyObject *, PyObject *); *************** *** 130,136 **** static void ilupython_watch_outgoing_connection(void *arg); /* start_new_thread is defined by Python but has no "Py_" synonym */ ! #define ilupython_fork_thread(proc, arg) (start_new_thread(proc, arg)) static PyObject *thread_call_stack_map; /* This flag is also accessed by ivobject.c */ --- 130,136 ---- static void ilupython_watch_outgoing_connection(void *arg); /* start_new_thread is defined by Python but has no "Py_" synonym */ ! #define ilupython_fork_thread(proc, arg) (PyThread_start_new_thread(proc, arg)) static PyObject *thread_call_stack_map; /* This flag is also accessed by ivobject.c */ *************** *** 150,156 **** static ilu_Mutex ilupython_MainLoopMutex = ILU_NIL; static ilu_Condition ilupython_MainLoopCondition = ILU_NIL; ! #define current_thread_id() PyInt_FromLong(get_thread_ident()) #if ((ILUPYTHON_MAJOR_VERSION >= 1) && (ILUPYTHON_MINOR_VERSION >= 5)) PyInterpreterState *_ilupython_interpreter_state = ILU_NIL; --- 150,156 ---- static ilu_Mutex ilupython_MainLoopMutex = ILU_NIL; static ilu_Condition ilupython_MainLoopCondition = ILU_NIL; ! #define current_thread_id() PyInt_FromLong(PyThread_get_thread_ident()) #if ((ILUPYTHON_MAJOR_VERSION >= 1) && (ILUPYTHON_MINOR_VERSION >= 5)) PyInterpreterState *_ilupython_interpreter_state = ILU_NIL; *************** *** 8477,8483 **** ilupython_threaded_operation = ilu_TRUE; PyEval_InitThreads(); ! init_thread(); Py_INCREF(Py_None); return Py_None; --- 8477,8483 ---- ilupython_threaded_operation = ilu_TRUE; PyEval_InitThreads(); ! PyThread_init_thread(); Py_INCREF(Py_None); return Py_None; *************** *** 9013,9019 **** ilupython_fork_thread(runConnection, (void *)conn); } ! exit_thread(); } static void --- 9013,9019 ---- ilupython_fork_thread(runConnection, (void *)conn); } ! PyThread_exit_thread(); } static void *************** *** 9076,9082 **** } } ! exit_thread(); } static BORROWED(PyObject *) --- 9076,9082 ---- } } ! PyThread_exit_thread(); } static BORROWED(PyObject *) *************** *** 9187,9193 **** ilu_OutgoingConnectionThreadProc(conn, &err); ILU_MUST_BE_SUCCESS(err); ! exit_thread(); } static void --- 9187,9193 ---- ilu_OutgoingConnectionThreadProc(conn, &err); ILU_MUST_BE_SUCCESS(err); ! PyThread_exit_thread(); } static void
*** 1.2 1998/10/09 21:44:43 --- runtime/python/ilugiobject.c 1999/03/10 21:56:16 *************** *** 60,72 **** return (PyObject *) v; } static int ilugi_print(PyObject *o, FILE *fp, int flags) { IlugiObject *v = (IlugiObject *) o; PyObject *retval; ilu_Error err; - gss_name_t name; ilu_boolean localp; ilu_string s; --- 60,78 ---- return (PyObject *) v; } + static int fleshout (IlugiObject *v, ilu_Error *err) + { + gss_name_t name; + return (ilu_DecodeGSSIdentity (v->id, &name, &v->good_till, ILU_NIL, &v->localp, ILU_NIL, err) && + (v->name = ilu_GSSNameToString (name, err), ILU_ERROK(*err))); + } + static int ilugi_print(PyObject *o, FILE *fp, int flags) { IlugiObject *v = (IlugiObject *) o; PyObject *retval; ilu_Error err; ilu_boolean localp; ilu_string s; *************** *** 78,85 **** } else if (v->name == ILU_NIL) { ! if (!ilu_DecodeGSSIdentity (v->id, &name, &v->good_till, ILU_NIL, &v->localp, ILU_NIL, &err) || ! !(v->name = ilu_GSSNameToString (name, &err), ILU_ERROK(err))) { fprintf (fp, " (error: %s)>", ILU_ERR_NAME(err)); ILU_HANDLED(err); --- 84,90 ---- } else if (v->name == ILU_NIL) { ! if (!fleshout(v, &err)) { fprintf (fp, " (error: %s)>", ILU_ERR_NAME(err)); ILU_HANDLED(err); *************** *** 91,96 **** --- 96,128 ---- return 0; } + static PyObject * + ilugi_getattr(PyObject *self, char *name) + { + ilu_Error err; + PyObject *retval; + IlugiObject *v = (IlugiObject *) self; + + if (v->id != ILU_NIL) { + if (v->name == ILU_NIL) { + if (!fleshout(v, &err)) + { + ILU_HANDLED(err); + Py_INCREF(Py_None); + return 0; + } + } + if (strcmp(name, "name") == 0) { + retval = PyString_FromString(v->name); + return retval; + } else if (strcmp(name, "local") == 0) { + retval = PyInt_FromLong ((long) v->localp); + return retval; + } + } + return 0; + } + PyTypeObject Ilugi_Type = { PyObject_HEAD_INIT(&PyType_Type) *************** *** 100,106 **** 0, ilugi_dealloc, /*tp_dealloc*/ ilugi_print, /*tp_print*/ ! 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ --- 132,138 ---- 0, ilugi_dealloc, /*tp_dealloc*/ ilugi_print, /*tp_print*/ ! ilugi_getattr, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ *** 1.44 1999/01/20 04:16:15 --- runtime/python/ilu.py 1999/03/10 21:07:55 *************** *** 38,43 **** --- 38,44 ---- Version, \ CORBAMapping, \ DictionaryPassing, \ + BuildDomain, \ TypeUIDVersion # Methods *** 1.273 1999/03/01 18:29:06 --- runtime/python/iluPrmodule.c 1999/03/10 21:07:31 *************** *** 78,88 **** static void cleanupUninterestingObjects (ilu_private junk); static void singleThreadedReadServiceRequest (ilu_refany); ! enum ContextSlots { ! ContextSlots_Serializer = 0, ! ContextSlots_Pipeline = 1, ! ContextSlots_Passport = 2 ! }; #define CORBA_COMPLETED_MAYBE 2 --- 78,86 ---- static void cleanupUninterestingObjects (ilu_private junk); static void singleThreadedReadServiceRequest (ilu_refany); ! #define ContextSlots_Serializer 0 ! #define ContextSlots_Pipeline 1 ! #define ContextSlots_Passport 2 #define CORBA_COMPLETED_MAYBE 2 *************** *** 1585,1590 **** --- 1583,1590 ---- static ilu_ObjectTable createObjectTable(PyObject *objectOfIh); static void setObjectTableServer(ilu_ObjectTable self, PyObject *server); + static PyObject * + ilumod_GetPassport (PyObject *self, PyObject *args); static PyObject * ilumod_CreateServer(PyObject *self, PyObject *args) *************** *** 1596,1601 **** --- 1596,1603 ---- PyObject * objectOfIh; PyObject * result; ilu_boolean trans_precious = ilu_FALSE; + PyObject * ppobj; + ilu_Passport pp = ILU_NIL; if (PyArg_Parse(args, "")) { *************** *** 1657,1664 **** } if (proto == 0) proto = getDefaultProtocol(); ! if ((result = createTrueServer(serverId, objTab, trans, proto, ILU_NIL)) == 0) { if (objTab) (*objTab->ot_free_self)(objTab); --- 1659,1669 ---- } if (proto == 0) proto = getDefaultProtocol(); + ppobj = ilumod_GetPassport(self, Py_None); + if (ilupp_Check(ppobj)) + pp = ilupp_AsPassport((IluppObject *) ppobj); ! if ((result = createTrueServer(serverId, objTab, trans, proto, pp)) == 0) { if (objTab) (*objTab->ot_free_self)(objTab); *************** *** 3913,3927 **** { static PyObject *tup = ILU_NIL; if (tup == ILU_NIL) { ! tup = PyTuple_New(3); if (tup == 0) return 0; Py_INCREF(Py_None); ! PyTuple_SetItem(tup, ContextSlots_Serializer, Py_None); Py_INCREF(Py_None); ! PyTuple_SetItem(tup, ContextSlots_Pipeline, Py_None); Py_INCREF(Py_None); ! PyTuple_SetItem(tup, ContextSlots_Passport, Py_None); } return tup; } --- 3918,3932 ---- { static PyObject *tup = ILU_NIL; if (tup == ILU_NIL) { ! tup = PyList_New(3); if (tup == 0) return 0; Py_INCREF(Py_None); ! PyList_SetItem(tup, ContextSlots_Serializer, Py_None); Py_INCREF(Py_None); ! PyList_SetItem(tup, ContextSlots_Pipeline, Py_None); Py_INCREF(Py_None); ! PyList_SetItem(tup, ContextSlots_Passport, Py_None); } return tup; } *************** *** 3978,3995 **** } if ((context = CurrentContext()) == 0) return 0; ! else if (!PyTuple_Check(context)) { PyErr_SetString(_ilupython_GeneralError, "Bad context in BeginCall"); return 0; } ! val = PyTuple_GetItem(context, ContextSlots_Pipeline); if (ilupl_Check(val)) pipeline = ilupl_AsPipeline((IluplObject *) val); ! val = PyTuple_GetItem(context, ContextSlots_Serializer); if (ilusz_Check(val)) serializer = ilusz_AsSerializer((IluszObject *) val); ! val = PyTuple_GetItem(context, ContextSlots_Passport); if (ilupp_Check(val)) passport = ilupp_AsPassport((IluppObject *) val); --- 3983,4000 ---- } if ((context = CurrentContext()) == 0) return 0; ! else if (!PyList_Check(context)) { PyErr_SetString(_ilupython_GeneralError, "Bad context in BeginCall"); return 0; } ! val = PyList_GetItem(context, ContextSlots_Pipeline); if (ilupl_Check(val)) pipeline = ilupl_AsPipeline((IluplObject *) val); ! val = PyList_GetItem(context, ContextSlots_Serializer); if (ilusz_Check(val)) serializer = ilusz_AsSerializer((IluszObject *) val); ! val = PyList_GetItem(context, ContextSlots_Passport); if (ilupp_Check(val)) passport = ilupp_AsPassport((IluppObject *) val); *************** *** 4263,4271 **** } if ((context = CurrentContext()) == 0) return 0; ! prev = PyTuple_GetItem(context, ContextSlots_Serializer); ! Py_INCREF(serializer); ! PyTuple_SetItem(context, ContextSlots_Serializer, serializer); return prev; } --- 4268,4278 ---- } if ((context = CurrentContext()) == 0) return 0; ! prev = PyList_GetItem(context, ContextSlots_Serializer); ! if (PyList_SetItem(context, ContextSlots_Serializer, serializer) < 0) ! return 0; ! else ! Py_INCREF(serializer); return prev; } *************** *** 4277,4283 **** if ((context = CurrentContext()) == 0) return 0; ! prev = PyTuple_GetItem(context, ContextSlots_Serializer); Py_INCREF(prev); return prev; } --- 4284,4290 ---- if ((context = CurrentContext()) == 0) return 0; ! prev = PyList_GetItem(context, ContextSlots_Serializer); Py_INCREF(prev); return prev; } *************** *** 4299,4307 **** } if ((context = CurrentContext()) == 0) return 0; ! prev = PyTuple_GetItem(context, ContextSlots_Pipeline); ! Py_INCREF(pipeline); ! PyTuple_SetItem(context, ContextSlots_Pipeline, pipeline); return prev; } --- 4306,4316 ---- } if ((context = CurrentContext()) == 0) return 0; ! prev = PyList_GetItem(context, ContextSlots_Pipeline); ! if (PyList_SetItem(context, ContextSlots_Pipeline, pipeline) < 0) ! return 0; ! else ! Py_INCREF(pipeline); return prev; } *************** *** 4313,4319 **** if ((context = CurrentContext()) == 0) return 0; ! prev = PyTuple_GetItem(context, ContextSlots_Pipeline); Py_INCREF(prev); return prev; } --- 4322,4328 ---- if ((context = CurrentContext()) == 0) return 0; ! prev = PyList_GetItem(context, ContextSlots_Pipeline); Py_INCREF(prev); return prev; } *************** *** 4344,4350 **** PyObject *passport; PyObject *context; PyObject *prev; ! ilu_Passport s; if (!PyArg_Parse(args, "O", &passport)) return 0; --- 4353,4360 ---- PyObject *passport; PyObject *context; PyObject *prev; ! PyObject *foo; ! int retval; if (!PyArg_Parse(args, "O", &passport)) return 0; *************** *** 4355,4363 **** } if ((context = CurrentContext()) == 0) return 0; ! prev = PyTuple_GetItem(context, ContextSlots_Passport); ! Py_INCREF(passport); ! PyTuple_SetItem(context, ContextSlots_Passport, passport); return prev; } --- 4365,4375 ---- } if ((context = CurrentContext()) == 0) return 0; ! prev = PyList_GetItem(context, ContextSlots_Passport); ! if (PyList_SetItem(context, ContextSlots_Passport, passport) < 0) ! return 0; ! else ! Py_INCREF(passport); return prev; } *************** *** 4370,4376 **** if ((context = CurrentContext()) == 0) return 0; ! prev = PyTuple_GetItem(context, ContextSlots_Passport); Py_INCREF(prev); return prev; } --- 4382,4388 ---- if ((context = CurrentContext()) == 0) return 0; ! prev = PyList_GetItem(context, ContextSlots_Passport); Py_INCREF(prev); return prev; } *************** *** 8827,8832 **** --- 8839,8845 ---- PyObject * Version; PyObject * RootClass; PyObject * RetryCall; + PyObject * BuildDomain; PyObject * TypeUIDVersion; PyObject * TypeKind_cardinal; PyObject * TypeKind_integer; *************** *** 8881,8886 **** --- 8894,8908 ---- Py_FatalError("ilu can't define Version"); Py_DECREF(Version); + #define STRINGIFIED_DOMAIN(x) #x + #define STRINGIFIED_DOMAIN1(x) STRINGIFIED_DOMAIN(x) + #define THIS_DOMAIN STRINGIFIED_DOMAIN1(FULLY_QUALIFIED_DOMAIN_NAME) + + if ((BuildDomain = PyString_FromString(THIS_DOMAIN)) == 0 || + PyDict_SetItemString(modDict, "BuildDomain", BuildDomain) < 0) + Py_FatalError("ilu can't define BuildDomain"); + Py_DECREF(BuildDomain); + if ((TypeUIDVersion = PyString_FromString(ilu_GetILUTypeUIDVersion())) == 0 || PyDict_SetItemString(modDict, "TypeUIDVersion", TypeUIDVersion) < 0) Py_FatalError("ilu can't define TypeUIDVersion"); *************** *** 9118,9132 **** return 0; tup = PyDict_GetItem(ilupython_ContextDict, tid); if (tup == 0) { ! tup = PyTuple_New(3); if (tup == 0) return 0; Py_INCREF(Py_None); ! PyTuple_SetItem(tup, ContextSlots_Serializer, Py_None); Py_INCREF(Py_None); ! PyTuple_SetItem(tup, ContextSlots_Pipeline, Py_None); Py_INCREF(Py_None); ! PyTuple_SetItem(tup, ContextSlots_Passport, Py_None); PyDict_SetItem(ilupython_ContextDict, tid, tup); } return tup; --- 9140,9154 ---- return 0; tup = PyDict_GetItem(ilupython_ContextDict, tid); if (tup == 0) { ! tup = PyList_New(3); if (tup == 0) return 0; Py_INCREF(Py_None); ! PyList_SetItem(tup, ContextSlots_Serializer, Py_None); Py_INCREF(Py_None); ! PyList_SetItem(tup, ContextSlots_Pipeline, Py_None); Py_INCREF(Py_None); ! PyList_SetItem(tup, ContextSlots_Passport, Py_None); PyDict_SetItem(ilupython_ContextDict, tid, tup); } return tup;
*** 1.65 1998/12/02 02:33:35 --- runtime/java/IluJava_IluPort.c 1999/03/12 02:19:49 *************** *** 756,762 **** } ! JAVAEXPORT(IluGssCred_nIluGssCredAquire, void) JIluGssCred jh_self, JString jh_principalName, Jint lifetimeSecs, --- 756,762 ---- } ! JAVAEXPORT(IluGssCred_nIluGssCredAcquire, void) JIluGssCred jh_self, JString jh_principalName, Jint lifetimeSecs, *** 1.12 1999/01/14 22:39:28 --- runtime/java/jsrc/xerox/ilu/IluGssCredId.java 1999/03/12 02:09:03 *************** *** 62,68 **** private IluGssCredId() { } //constructor ! /*friendly*/ native void nIluGssCredIdAquire( java.lang.String principalName, int lifetimeSecs, IluGssOid mechanism, --- 62,68 ---- private IluGssCredId() { } //constructor ! /*friendly*/ native void nIluGssCredIdAcquire( java.lang.String principalName, int lifetimeSecs, IluGssOid mechanism, *************** *** 72,86 **** /** * Constant value which can be used to specify ! * an indefinite lifetime in aquireForName */ public static final int GSS_INDEFINITE = -1; /** ! * Aquires a IluGssCredId. * [in ilu_kerneleese: AcquireGSSIdentity */ ! public static IluGssCredId aquireForName( java.lang.String principalName, int lifetimeSecs, IluGssOid mechanism, --- 72,86 ---- /** * Constant value which can be used to specify ! * an indefinite lifetime in acquireForName */ public static final int GSS_INDEFINITE = -1; /** ! * Acquires a IluGssCredId. * [in ilu_kerneleese: AcquireGSSIdentity */ ! public static IluGssCredId acquireForName( java.lang.String principalName, int lifetimeSecs, IluGssOid mechanism, *************** *** 93,104 **** throw new org.omg.CORBA.NO_PERMISSION("no mechanism"); } IluGssCredId ci = new IluGssCredId(); ! ci.nIluGssCredIdAquire( principalName, lifetimeSecs, mechanism, acceptOnly ); ci.state = 1; return ci; ! } //aquireForName /*friendly*/ native void nIluGssCredIdToIdentity(IluIdentity id); --- 93,104 ---- throw new org.omg.CORBA.NO_PERMISSION("no mechanism"); } IluGssCredId ci = new IluGssCredId(); ! ci.nIluGssCredIdAcquire( principalName, lifetimeSecs, mechanism, acceptOnly ); ci.state = 1; return ci; ! } //acquireForName /*friendly*/ native void nIluGssCredIdToIdentity(IluIdentity id); *************** *** 169,175 **** /** * Explicitely null-out any accumulated credentials ! * aquired */ public void free() { int oldstate = 0; --- 169,175 ---- /** * Explicitely null-out any accumulated credentials ! * acquired */ public void free() { int oldstate = 0; *** 1.10 1998/12/23 20:51:33 --- runtime/java/jsrc/xerox/ilu/IluGssCred.java 1999/03/12 02:09:08 *************** *** 63,69 **** private IluGssCred() { } //constructor ! /*friendly*/ native void nIluGssCredAquire( java.lang.String principalName, int lifetimeSecs, IluGssOid mechanism, --- 63,69 ---- private IluGssCred() { } //constructor ! /*friendly*/ native void nIluGssCredAcquire( java.lang.String principalName, int lifetimeSecs, IluGssOid mechanism, *************** *** 73,87 **** /** * Constant value which can be used to specify ! * an indefinite lifetime in aquireForName */ public static final int GSS_INDEFINITE = -1; /** ! * Aquires a IluGssCred. * [in ilu_kerneleese: AcquireGSSIdentity */ ! public static IluGssCred aquireForName( java.lang.String principalName, int lifetimeSecs, IluGssOid mechanism, --- 73,87 ---- /** * Constant value which can be used to specify ! * an indefinite lifetime in acquireForName */ public static final int GSS_INDEFINITE = -1; /** ! * Acquires a IluGssCred. * [in ilu_kerneleese: AcquireGSSIdentity */ ! public static IluGssCred acquireForName( java.lang.String principalName, int lifetimeSecs, IluGssOid mechanism, *************** *** 94,100 **** throw new org.omg.CORBA.BAD_OPERATION("no mechanism"); } IluGssCred ci = new IluGssCred(); ! ci.nIluGssCredAquire( principalName, lifetimeSecs, mechanism, acceptOnly ); ci.state = 1; --- 94,100 ---- throw new org.omg.CORBA.BAD_OPERATION("no mechanism"); } IluGssCred ci = new IluGssCred(); ! ci.nIluGssCredAcquire( principalName, lifetimeSecs, mechanism, acceptOnly ); ci.state = 1; *************** *** 104,110 **** ci.idt = ci.real_toIdentity(); // return ci; ! } //aquireForName /*friendly*/ native void nIluGssCredIdToIdentity(IluIdentity id); --- 104,110 ---- ci.idt = ci.real_toIdentity(); // return ci; ! } //acquireForName /*friendly*/ native void nIluGssCredIdToIdentity(IluIdentity id); *************** *** 184,190 **** /** * Explicitely null-out any accumulated credentials ! * aquired */ public void free() { int oldstate = 0; --- 184,190 ---- /** * Explicitely null-out any accumulated credentials ! * acquired */ public void free() { int oldstate = 0;
*** 1.81 1999/01/14 04:24:42 --- runtime/lisp/ilu-macros.lisp 1999/04/02 02:55:27 *************** *** 896,906 **** (dig-out-class-info ,the-info info-type)) (add-type ,type-uid ',name #'(lambda (call value) ! (object-size call value (find-class ',name))) #'(lambda (call value) ! (object-write call value (find-class ',name))) #'(lambda (call) ! (object-read (find-class ',name) call ',name))) ))) (defmacro define-class (name &optional c-class-get-fn) --- 896,906 ---- (dig-out-class-info ,the-info info-type)) (add-type ,type-uid ',name #'(lambda (call value) ! (object-size call value ',name)) #'(lambda (call value) ! (object-write call value ',name)) #'(lambda (call) ! (object-read ',name call ',name))) ))) (defmacro define-class (name &optional c-class-get-fn)
*** 1.37 1998/10/09 21:23:30 --- runtime/lisp/Imakefile 1999/04/06 00:00:38 *************** *** 93,99 **** OBJ_FILES=ilu-lisp-skin.o $(LispImplCFile).o ! SharedLibraryTarget(ilu-lisp, $(OBJ_FILES), ../kernel/libilu.a, $(SECURITYLIBS) $(ILU_ZLIB_LIBRARY)) pdefsys.lisp: pdefsys.lisp.dist Makefile sed -e 's;ANSI_C_LIBRARY;$(ANSI_C_LIBRARY);g' -e 's;ANSI_C_COMPILER;$(ANSI_C_COMPILER);g' pdefsys.lisp --- 93,99 ---- OBJ_FILES=ilu-lisp-skin.o $(LispImplCFile).o ! SharedLibraryTarget(ilu-lisp, $(OBJ_FILES), ../kernel/libilu.a, $(BUILD_SECURITY_LIBRARIES)) pdefsys.lisp: pdefsys.lisp.dist Makefile sed -e 's;ANSI_C_LIBRARY;$(ANSI_C_LIBRARY);g' -e 's;ANSI_C_COMPILER;$(ANSI_C_COMPILER);g' pdefsys.lisp
*** 1.8 1999/01/14 03:28:28 --- etc/testing/Imakefile 1999/04/02 18:39:05 *************** *** 24,35 **** all:: ILUTestingConfig.py ILUTestingConfigInstalled.py ILUTesting.py ILUTestingConfig.py: Makefile ILUTestingConfig.py.dist rm -f ILUTestingConfig.py ! $(SED) -e "s@ILU_C_CONFIGURATION_FILE@$(ILUSRC)/imake/iluconf.h@g" -e "s@ILU_C_IMAKEDEFS_FILE@$(ILUSRC)/imake/ilu.defs.new@g" < ILUTestingConfig.py.dist >ILUTestingConfig.py ILUTestingConfigInstalled.py: Makefile ILUTestingConfig.py.dist rm -f ILUTestingConfigInstalled.py ! $(SED) -e "s@ILU_C_CONFIGURATION_FILE@$(ILUHOME)/include/iluconf.h@g" -e "s@ILU_C_IMAKEDEFS_FILE@$(ILUHOME)/imake/ilu.defs.new@g" < ILUTestingConfig.py.dist >ILUTestingConfigInstalled.py CleanTarget(ILUTestingConfig.py ILUTestingConfigInstalled.py) InstallRO(ILUTesting.py ILUTestingMachinery.py, $(DESTDIR)/lib) --- 24,35 ---- all:: ILUTestingConfig.py ILUTestingConfigInstalled.py ILUTesting.py ILUTestingConfig.py: Makefile ILUTestingConfig.py.dist rm -f ILUTestingConfig.py ! $(SED) -e "s|ILU_C_CONFIGURATION_FILE|$(ILUSRC)/imake/iluconf.h|g" -e "s|ILU_C_IMAKEDEFS_FILE|$(ILUSRC)/imake/ilu.defs.new|g" < ILUTestingConfig.py.dist >ILUTestingConfig.py ILUTestingConfigInstalled.py: Makefile ILUTestingConfig.py.dist rm -f ILUTestingConfigInstalled.py ! $(SED) -e "s|ILU_C_CONFIGURATION_FILE|$(ILUHOME)/include/iluconf.h|g" -e "s|ILU_C_IMAKEDEFS_FILE|$(ILUHOME)/imake/ilu.defs.new|g" < ILUTestingConfig.py.dist >ILUTestingConfigInstalled.py CleanTarget(ILUTestingConfig.py ILUTestingConfigInstalled.py) InstallRO(ILUTesting.py ILUTestingMachinery.py, $(DESTDIR)/lib)
*** 1.84 1999/03/16 20:49:39 --- runtime/kernel/w3ng.c 1999/04/06 22:37:39 *************** *** 1343,1350 **** sidlen = strlen((const char *) sid); use_cached_sid = ilu_FALSE; if (instance_data->outgoing_last_sid != NIL) { ! use_cached_sid = (memcmp((void *) instance_data->outgoing_last_sid, (void *) sid, sidlen) ! == 0); if (!use_cached_sid) { /* new sid, so free old one */ ilu_free(instance_data->outgoing_last_sid); --- 1343,1350 ---- sidlen = strlen((const char *) sid); use_cached_sid = ilu_FALSE; if (instance_data->outgoing_last_sid != NIL) { ! use_cached_sid = (sidlen == instance_data->outgoing_last_sid_len) && ! (memcmp((void *) instance_data->outgoing_last_sid, (void *) sid, sidlen) == 0); if (!use_cached_sid) { /* new sid, so free old one */ ilu_free(instance_data->outgoing_last_sid);
*** Imakefile.orig Tue Apr 6 19:16:47 1999 --- examples/Imakefile Tue Apr 6 19:16:58 1999 *************** *** 96,98 **** --- 96,100 ---- #endif SUBDIRS = test1 $(M3_DIRS) $(LISP_DIRS) $(CORBACPP_DIRS) $(PYTHON_DIRS) $(C_DIRS) $(MULTLANG_DIR) $(TUT_DIRS) $(PYTHON_IIOP_DIR) $(IDL2ISL_PYTHON_IIOP_GRID_DIR) $(IDL2ISL_PYTHON_IIOP_BANK3_DIR) $(HTTEST_DIR) $(NGTEST_DIR) $(JAVA_DIR) $(IIOPTEST1_DIR) $(PYTHON_IIOP_PICKLE_DIR) $(W3MUX_DIR) $(FIXEDPOINT_DIR) $(JAVA_TESTJAVAOBV_DIR) + + InstallRO(Imakefile, $(DESTDIR)/examples)
*** 1.42 1999/01/14 18:22:11 --- imake/ilu.tmpl 1999/03/31 20:04:23 *************** *** 169,174 **** --- 169,176 ---- all:: dist:: + + ptest:: dependInstallClean:: depend install clean
*** 1.15 1999/01/20 00:49:01 --- stubbers/python/util.h 1999/04/07 20:34:05 *************** *** 58,64 **** extern void sprintTypeRef(char *buf, Type t); extern void printArgList(list argList, int nPrevArgs); extern void printClassVarName(Type t, const char *varName); ! extern void printExceptionName(Exception e); extern void printExceptionIDString(Exception e); extern void printTypeIoFuncName(Type t, const char *prefix); extern void printNameScopes(list scopes); --- 58,64 ---- extern void sprintTypeRef(char *buf, Type t); extern void printArgList(list argList, int nPrevArgs); extern void printClassVarName(Type t, const char *varName); ! extern void printFullExceptionName(Exception e); extern void printExceptionIDString(Exception e); extern void printTypeIoFuncName(Type t, const char *prefix); extern void printNameScopes(list scopes); *** 1.13 1999/01/28 03:35:42 --- stubbers/python/name.c 1999/04/07 20:34:37 *************** *** 98,103 **** --- 98,104 ---- static char language[] = "python"; static char corba_innermost[] = "corba_innermost"; static char corba_scoped[] = "corba_scoped"; + static char simple_exception[] = "simple_exception"; static char * setItemName(Name n, char *importInterface) *************** *** 177,183 **** fatal("getSimpleExceptionName: exception %s is external", exception_name(e)); return result; #else ! return getExceptionName(e); #endif } --- 178,198 ---- fatal("getSimpleExceptionName: exception %s is external", exception_name(e)); return result; #else ! char * result; ! char buffer[1024]; ! ! result = name_lang_name(e->name, simple_exception); ! if (result == 0) { ! char *basename = name_base_name(e->name); ! /* ! fprintf (stderr, "basename for %s.%s is %s\n", ! interface_name(e->interface), exception_name(e), basename); ! */ ! translateNameString(buffer, basename); ! name_set_lang_name(e->name, simple_exception, buffer); ! result = name_lang_name(e->name, simple_exception); ! }; ! return result; #endif } *** 1.27 1999/01/27 19:46:16 --- stubbers/python/util.c 1999/04/07 20:34:12 *************** *** 295,304 **** } void ! printExceptionName(Exception e) { printIfcPrefix(e->interface); ! printf("%s", getExceptionName(e)); } void --- 295,304 ---- } void ! printFullExceptionName(Exception e) { printIfcPrefix(e->interface); ! printf("%s", getSimpleExceptionName(e)); } void *** 1.102 1999/03/01 18:29:18 --- stubbers/python/genstub.c 1999/04/07 22:48:46 *************** *** 1677,1683 **** return; if (++*pCount == 1) newline(); ! printf ("__%s__ExcnID = ", getExceptionName(e)); printExceptionIDString(e); newline(); } --- 1677,1683 ---- return; if (++*pCount == 1) newline(); ! printf ("%s__ExcnID = ", getExceptionName(e)); printExceptionIDString(e); newline(); } *************** *** 1700,1706 **** printf ("%s = %s\n\n", getSimpleExceptionName(e), getExceptionName(e)); } #else ! printf ("%s = __%s__ExcnID", getExceptionName(e), getExceptionName(e)); newline(); #endif } --- 1700,1706 ---- printf ("%s = %s\n\n", getSimpleExceptionName(e), getExceptionName(e)); } #else ! printf ("%s = %s__ExcnID", getExceptionName(e), getExceptionName(e)); newline(); #endif } *************** *** 2089,2096 **** boolean idlish; idlish = (et != NULL) && isPrefixOf(prefixIdlExcType, type_name(et)); ! ! printf(" %sif %s == __%s__ExcnID:\n", ++*pCount > 1 ? "el" : "", nameVarExceptName, getExceptionName(e)); #ifdef ILU_CORBA_PYTHON_MAPPING printf("\t%s = ", nameVarExceptValue); --- 2089,2095 ---- boolean idlish; idlish = (et != NULL) && isPrefixOf(prefixIdlExcType, type_name(et)); ! printf(" %sif %s == %s__ExcnID:\n", ++*pCount > 1 ? "el" : "", nameVarExceptName, getExceptionName(e)); #ifdef ILU_CORBA_PYTHON_MAPPING printf("\t%s = ", nameVarExceptValue); *************** *** 2189,2203 **** list_enumerate (ns->subspaces, (EnumProc) genTypeIO, NULL); } - static void - enumerateExceptions (namespace ns, list l) - { - int i, lim; - for (i = 0, lim = list_size(ns->exceptions); i < lim; i++) - list_insert(l, list_ref(ns->exceptions, i)); - list_enumerate (ns->subspaces, (EnumProc) enumerateExceptions, l); - } - void generateStub (namespace ns) { --- 2188,2193 ---- *************** *** 2215,2223 **** genTypeIO (ns); list_enumerate (ns->subspaces, (EnumProc) stSpace, NULL); list_enumerate (ns->exceptions, (EnumProc) stException, &nExceptions); ! exceptions = new_list(); ! enumerateExceptions(ns, exceptions); ! stFuncCatchExceptions (exceptions); } #else --- 2205,2211 ---- genTypeIO (ns); list_enumerate (ns->subspaces, (EnumProc) stSpace, NULL); list_enumerate (ns->exceptions, (EnumProc) stException, &nExceptions); ! stFuncCatchExceptions (namespace_interface(ns)->exceptions); } #else *** 1.29 1998/12/01 19:49:49 --- stubbers/python/genskel.c 1999/04/07 20:33:48 *************** *** 93,99 **** char namebuf[2048]; printf(" except "); ! printExceptionName(e); if (et) printf(", %s", nameVarExceptValue); printf(":\n"); --- 93,99 ---- char namebuf[2048]; printf(" except "); ! printFullExceptionName(e); if (et) printf(", %s", nameVarExceptValue); printf(":\n");
*** 1.220 1999/02/25 20:54:58 --- runtime/kernel/iiop.c 1999/04/12 23:36:38 *************** *** 5778,5784 **** for (i = 0; i < n_arms; i++) { for (j = 0; j < arm_count; j++) { ! if (strcmp(rarms[j].base.name, arms[i].base.name) == 0) { rarms[j].values = (ilu_ConstantValue_s *) ilu_ReallocE(rarms[j].values, sizeof(ilu_ConstantValue_s) * (rarms[j].n_values + 1), err); if (ILU_ERRNOK(*err)) return; rarms[j].values[rarms[j].n_values] = arms[i].values[0]; --- 5798,5805 ---- for (i = 0; i < n_arms; i++) { for (j = 0; j < arm_count; j++) { ! if ((strcmp(rarms[j].base.name, arms[i].base.name) == 0) && ! (rarms[j].base.type == arms[i].base.type)) { rarms[j].values = (ilu_ConstantValue_s *) ilu_ReallocE(rarms[j].values, sizeof(ilu_ConstantValue_s) * (rarms[j].n_values + 1), err); if (ILU_ERRNOK(*err)) return; rarms[j].values[rarms[j].n_values] = arms[i].values[0]; *************** *** 6002,6030 **** --- 6049,6087 ---- ilu_byte foo; _cdr_get_u8(pk, &foo, err); arm->values[0].value.boolean_val = (foo != 0); + arm->values[0].kind = ilu_boolean_cvk; } break; case ilu_byte_tk: + _cdr_get_u8(pk, &arm->values[0].value.byte_val, err); + arm->values[0].kind = ilu_byte_cvk; + break; case ilu_shortcharacter_tk: _cdr_get_u8(pk, &arm->values[0].value.byte_val, err); + arm->values[0].kind = ilu_byte_cvk; break; case ilu_integer_tk: _cdr_get_s32(pk, &arm->values[0].value.integer_val, err); + arm->values[0].kind = ilu_integer_cvk; break; case ilu_shortinteger_tk: _cdr_get_s16(pk, &arm->values[0].value.shortinteger_val, err); + arm->values[0].kind = ilu_shortinteger_cvk; break; case ilu_cardinal_tk: _cdr_get_u32(pk, &arm->values[0].value.cardinal_val, err); + arm->values[0].kind = ilu_cardinal_cvk; break; case ilu_shortcardinal_tk: _cdr_get_u16(pk, &arm->values[0].value.shortcardinal_val, err); + arm->values[0].kind = ilu_shortcardinal_cvk; break; case ilu_enumeration_tk: _cdr_get_u32(pk, &enumcode, err); if (ILU_ERRNOK(*err)) break; arm->values[0].value.enumeration_val = FigureEnumVal((ilu_shortcardinal) enumcode, type_desc(t).Union.discriminant, err); + arm->values[0].kind = ilu_enumeration_cvk; break; default: ILU_ERR_CONS1(internal, err, minor, ilu_im_badTypeKind, 0);
*** 1.31 1999/03/24 02:38:40 --- runtime/kernel/pickle2.c 1999/04/15 20:21:50 *************** *** 90,95 **** --- 90,96 ---- #include "iluntrnl.h" #include "ilutypes.h" + #include "object.h" #include "call.h" #include "connect.h" #include "iluprotocol.h" *************** *** 849,854 **** --- 850,875 ---- return (0); } + /* ==================== object ==================== */ + + static ilu_boolean + _pickle_OutputObjectID(ilu_Call call, ilu_Object h, + ilu_boolean discriminator_p, + ilu_Class static_type, + ILU_ERRS((IoErrs)) * err) + { + unsigned typekind = PICKLE_TYPEKIND(PICKLE_BUF(call)[0]); + ilu_string type_string; + + if (typekind == OBJECT_TYPEKIND) { + type_string = _ilu_ClassToString((h == NIL) ? static_type : object_class(h)); + _pickle_OutputByteVec (call, (ilu_byte *) type_string, strlen(type_string) + 1, err); + ilu_free(type_string); + if (ILU_ERRNOK(*err)) return ilu_FALSE; + } + return _ilu_OutputObjectID (call, h, discriminator_p, static_type, err); + } + /* ==================== error trap ==================== */ static void catchErr (void) { *************** *** 1135,1141 **** #else /* objects */ ! _ilu_OutputObjectID, /* pr_output_object_id */ _ilu_InputObjectID, /* pr_input_object_id */ _ilu_SizeOfObjectID, /* pr_size_of_object_id */ --- 1156,1162 ---- #else /* objects */ ! _pickle_OutputObjectID, /* pr_output_object_id */ _ilu_InputObjectID, /* pr_input_object_id */ _ilu_SizeOfObjectID, /* pr_size_of_object_id */ *************** *** 1251,1256 **** --- 1272,1278 ---- call->ca_callee = NIL; call->ca_caller = NIL; call->ca_irq = ilu_FALSE; + call->ca_prbit1 = ilu_FALSE; call->ca_prdata1 = 0; call->ca_prdata2 = (void *) prefix_type; call->ca_msg = nomsg; *************** *** 1427,1434 **** ilu_Class objtype; ilu_byte version_typekind; ilu_Type t2; ! ilu_string type_string; ilu_boolean extensible_record_type; version_typekind = TypeKindCode(type_id, &needs_explicit_type_id, &objtype, &extensible_record_type); ILU_CLER(*err); --- 1449,1457 ---- ilu_Class objtype; ilu_byte version_typekind; ilu_Type t2; ! ilu_string type_string = NIL; ilu_boolean extensible_record_type; + ilu_boolean type_string_malloced = ilu_FALSE; version_typekind = TypeKindCode(type_id, &needs_explicit_type_id, &objtype, &extensible_record_type); ILU_CLER(*err); *************** *** 1442,1470 **** if (needs_explicit_type_id) { if (objtype != NIL) ! type_string = _ilu_ClassToString(objtype); #ifdef ADD_TYPE_REGISTRATION_SUPPORT else if (extensible_record_type) { type_string = _ilu_ExtensibleRecordTypesString (type_id, err); if (ILU_ERRNOK(*err)) return ilu_FALSE; } #endif ! else type_string = type_id; }; ! PICKLE_LEN(call) = argSize + 1 + (needs_explicit_type_id ? strlen(type_string) + 1 : 0); PICKLE_BUF(call) = ilu_MallocE(PICKLE_LEN(call), err); if (ILU_ERRNOK(*err)) return ilu_FALSE; PICKLE_NEXT(call) = 0; _pickle_OutputByte (call, version_typekind, err); ! if (needs_explicit_type_id) { ! if (ILU_ERRNOK(*err)) { ilu_free(PICKLE_BUF(call)); return ilu_FALSE; }; _pickle_OutputByteVec (call, (ilu_byte *) type_string, strlen(type_string) + 1, err); } ! if (ILU_ERRNOK(*err)) { ilu_free(PICKLE_BUF(call)); return ilu_FALSE; } else return ilu_TRUE; } ilu_string --- 1465,1502 ---- if (needs_explicit_type_id) { if (objtype != NIL) ! /* type_string = _ilu_ClassToString(objtype); */ ! type_string = NIL; #ifdef ADD_TYPE_REGISTRATION_SUPPORT else if (extensible_record_type) { type_string = _ilu_ExtensibleRecordTypesString (type_id, err); + type_string_malloced = ilu_TRUE; if (ILU_ERRNOK(*err)) return ilu_FALSE; } #endif ! else { type_string = type_id; + type_string_malloced = ilu_FALSE; + } }; ! PICKLE_LEN(call) = argSize + 1 + ((needs_explicit_type_id && (type_string != NIL)) ? strlen(type_string) + 1 : 0); PICKLE_BUF(call) = ilu_MallocE(PICKLE_LEN(call), err); if (ILU_ERRNOK(*err)) return ilu_FALSE; PICKLE_NEXT(call) = 0; _pickle_OutputByte (call, version_typekind, err); ! if (needs_explicit_type_id && (type_string != NIL)) { ! if (ILU_ERRNOK(*err)) goto errout; _pickle_OutputByteVec (call, (ilu_byte *) type_string, strlen(type_string) + 1, err); } ! if (ILU_ERRNOK(*err)) goto errout; else return ilu_TRUE; + + errout: + if (type_string && type_string_malloced) ilu_free(type_string); + ilu_free(PICKLE_BUF(call)); + return ilu_FALSE; } ilu_string *** 1.106 1998/11/26 01:23:49 --- runtime/kernel/type.c 1999/04/15 19:56:16 *************** *** 1319,1333 **** if (types != NIL) { c = _ilu_StringToClass(types); - #ifdef ENABLE_DEBUGGING - if (c == NIL) { - ilu_DebugPrintf("ILU Error: Unable to determine the object type of object <%s/%s>.\n", - server_id(object_server(o)), object_ih(o)); - ilu_DebugPrintf(" The specified type codes <%s> are unknown in this address space.\n", - types); - ilu_DebugPrintf(" This may indicate either an ILU version mismatch, or an ISL interface version mismatch.\n"); - }; - #endif FREETOKEN(types); } ILU_NOTE(OBJECT_DEBUG, --- 1319,1324 ---- *** 1.221 1999/04/12 23:53:01 --- runtime/kernel/iiop.c 1999/04/15 01:08:01 *************** *** 694,699 **** --- 694,713 ---- }; SetupCharsetsEncapsulations(err); + if (ILU_ERRNOK(*err)) return; + + #ifdef ADD_TYPE_REGISTRATION_SUPPORT + { + ilu_boolean newreg; + ilu_AcquireMutex(ilu_otmu); + ilu_RegisterObjectType ("Object", "ilu", + class_brand(ilu_rootClass), + class_unique_id(ilu_rootClass), + ilu_rootClass, &newreg, err); + ilu_ReleaseMutex(ilu_otmu); + if (ILU_ERRNOK(*err)) return; + } + #endif Initialized = ILU_ERROK(*err); } *************** *** 5833,5844 **** switch (ctk) { case CORBA_tk_object: ! type_kind(t) = ilu_object_tk; ! if (!GetHeader(pk, t, err)) break; ! type_desc(t).Object.objdesc = ilu_FindClassFromID(type_uid(t)); ! if (type_desc(t).Object.objdesc == NIL) ! ILU_ERR_CONS1(bad_param, err, minor, ilu_bpm_typeID, 0); ! break; case CORBA_tk_record: { --- 5868,5902 ---- switch (ctk) { case CORBA_tk_object: ! { ! ilu_string typeuid = NIL; ! ilu_string typename = NIL; ! ilu_cardinal len; ! ilu_Type t2 = NIL; ! ! type_kind(t) = ilu_object_tk; ! /* read type info */ ! _cdr_get_bytes(pk, (ilu_bytes *) &typeuid, &len, 0xFFFF, err); ! if (ILU_ERRNOK(*err)) break; ! _cdr_get_bytes(pk, (ilu_bytes *) &typename, &len, 0xFFFF, err); ! if (ILU_ERRNOK(*err)) break; ! ilu_free(typename); ! /* if we don't know the actual object type, we truncate it down to ! ilu.CORBA-Object. This will break later on if the object is not ! a descendant of CORBA-Object. */ ! if (((t2 = ilu_FindTypeByUID(typeuid, err)) == ILU_NIL) && ILU_ERROK(*err)) ! t2 = ilu_FindTypeByUID((char *) ilu_TypeID_ilu_CORBA_Object, err); ! ilu_free(typeuid); ! if (ILU_ERRNOK(*err)) ! ILU_ERR_CONS1(bad_param, err, minor, ilu_bpm_typeID, 0); ! else { ! type_uid(t) = _ilu_Strdup(type_uid(t2)); ! type_name(t) = _ilu_Strdup(type_name(t2)); ! type_interface_brand(t) = _ilu_Strdup(type_interface_brand(t2)); ! type_interface_name(t) = _ilu_Strdup(type_interface_name(t2)); ! } ! break; ! } case CORBA_tk_record: { *************** *** 6964,6969 **** --- 6964,6970 ---- if (tp == _IIOP_DefaultPickleType) { size += _IIOP_SizeOfBytes (call, pickle.pi_bytes, pickle.pi_len, 0, err); + ILU_CLER(lerr); } else { /* now figure out the size of the marshalled value by unpickling it on the fly, and then interpreting it */ *************** *** 7200,7206 **** if (ILU_ERRNOK(*err)) { if (h != NIL) ilu_ExitServer(object_server(h), ilu_rootClass); break; }; if ((h != NIL) && (!class_collectible(object_class(h))) && server_is_true(object_server(h))) ilu_ReleaseMutex(ilu_gcmu); ! oc = (h != NIL) ? object_class(h) : ilu_rootClass; protocol_output_object_id(call_proto(output_call), output_call, h, ilu_FALSE, oc, err); /* now outside server */ } --- 7214,7220 ---- if (ILU_ERRNOK(*err)) { if (h != NIL) ilu_ExitServer(object_server(h), ilu_rootClass); break; }; if ((h != NIL) && (!class_collectible(object_class(h))) && server_is_true(object_server(h))) ilu_ReleaseMutex(ilu_gcmu); ! oc = (h != NIL) ? object_class(h) : ilu_FindClassFromID (CORBA_OBJECT_TYPE_ID); protocol_output_object_id(call_proto(output_call), output_call, h, ilu_FALSE, oc, err); /* now outside server */ } *** 1.201 1999/02/16 02:32:36 --- runtime/kernel/object.c 1999/04/15 20:03:07 *************** *** 692,698 **** --- 692,708 ---- ilu_DeltaServerHolds(s, -1, err); if (cl != NIL) { object_class(o) = cl; + } else if (static_type == ilu_rootClass) { + object_class(o) = ilu_rootClass; } else { + #ifdef ENABLE_DEBUGGING + ilu_DebugPrintf("ILU Error: Unable to determine the object type of object <%s/%s>,\n", + server_id(object_server(o)), object_ih(o)); + ilu_DebugPrintf(" which means that this object cannot be instantiated in this address space!\n"); + ilu_DebugPrintf(" No object types for the type UID \"%s\" are registered.\n", + (mstid ? mstid : "NULL")); + ilu_DebugPrintf(" This *might* indicate either an ILU version mismatch, or an ISL interface version mismatch.\n"); + #endif ILU_NOTE(OBJECT_DEBUG, ("_ilu_FindOrCreateObject: Couldn't determine" " type for object %p, given mstid \"%s\".\n", *** 1.27 1999/02/25 20:58:15 --- runtime/kernel/pickle3.c 1999/04/15 20:49:13 *************** *** 40,45 **** --- 40,46 ---- #include "ilutypes.h" #include "call.h" #include "connect.h" + #include "object.h" #include "iluprotocol.h" #define CURRENT_VERSION 3 *************** *** 49,54 **** --- 50,57 ---- #define OBJECT_TYPEKIND ((unsigned) 15) #define PICKLE_BUF(call) ((call)->ca_msg.msg_base) + #define PICKLE_BUF_VERSION(call) ((((call)->ca_msg.msg_base[0]) >> 5) & 0x7) + #define PICKLE_BUF_TYPEKIND(call) ((call)->ca_msg.msg_base[1]) #define PICKLE_LEN(call) ((call)->ca_msg.msg_len) #define PICKLE_NEXT(call) ((call)->ca_prdata1) #define PICKLE_REMAINING(call) (PICKLE_LEN(call) - PICKLE_NEXT(call)) *************** *** 440,445 **** --- 443,449 ---- ilu_cardinal *current_encoding, ILU_ERRS((IoErrs)) * err) { + *current_encoding = expected_encoding; InputBytes (call, (ilu_bytes *) s, len, limit, err, ilu_TRUE); } *************** *** 723,728 **** --- 727,766 ---- return (0); } + /* ==================== record ==================== */ + + static void + OutputPickleHeader (ilu_Call call, unsigned version, unsigned typekind, + ilu_string type_string, ilu_Error *err) + { + _pickle_OutputCardinal (call, (version << 29) | (typekind << 16) | + (((typekind == 0) || + (typekind == OBJECT_TYPEKIND) || + (typekind == EXTENSIBLE_RECORD_TYPEKIND)) + ? strlen(type_string)+1 : 0), err); + if (ILU_ERRNOK(*err)) return; + if ((typekind == 0) || (typekind == OBJECT_TYPEKIND) || (typekind == EXTENSIBLE_RECORD_TYPEKIND)) { + _pickle_OutputByteVec (call, (ilu_byte *) type_string, strlen(type_string)+1, err); + } + } + + static ilu_boolean + _pickle_OutputObjectID(ilu_Call call, ilu_Object h, + ilu_boolean discriminator_p, + ilu_Class static_type, + ILU_ERRS((IoErrs)) * err) + { + ilu_string type_string; + + if (call->ca_prbit1) { + type_string = _ilu_ClassToString((h == NIL) ? static_type : object_class(h)); + OutputPickleHeader (call, 0x3, OBJECT_TYPEKIND, type_string, err); + ilu_free(type_string); + if (ILU_ERRNOK(*err)) return ilu_FALSE; + } + return _ilu_OutputObjectID (call, h, discriminator_p, static_type, err); + } + /* ==================== error trap ==================== */ static void catchErr (void) { *************** *** 1010,1016 **** #else /* objects */ ! _ilu_OutputObjectID, /* pr_output_object_id */ _ilu_InputObjectID, /* pr_input_object_id */ _ilu_SizeOfObjectID, /* pr_size_of_object_id */ --- 1048,1054 ---- #else /* objects */ ! _pickle_OutputObjectID, /* pr_output_object_id */ _ilu_InputObjectID, /* pr_input_object_id */ _ilu_SizeOfObjectID, /* pr_size_of_object_id */ *************** *** 1126,1131 **** --- 1164,1170 ---- call->ca_callee = NIL; call->ca_caller = NIL; call->ca_irq = ilu_FALSE; + call->ca_prbit1 = ilu_FALSE; /* TRUE if an object type */ call->ca_prdata1 = 0; call->ca_prdata2 = (void *) prefix_type; call->ca_msg = nomsg; *************** *** 1234,1240 **** { ilu_Class objtype; ilu_byte typekind; ! ilu_string type_string; #ifdef ADD_TYPE_REGISTRATION_SUPPORT ilu_Type the_type; #endif --- 1273,1280 ---- { ilu_Class objtype; ilu_byte typekind; ! ilu_string type_string = NIL; ! ilu_boolean type_string_malloced = ilu_FALSE; #ifdef ADD_TYPE_REGISTRATION_SUPPORT ilu_Type the_type; #endif *************** *** 1244,1250 **** if (typekind == 0) { if ((objtype = ilu_FindClassFromID(type_id)) != NIL) { typekind = OBJECT_TYPEKIND; ! type_string = _ilu_ClassToString(objtype); #ifdef ADD_TYPE_REGISTRATION_SUPPORT } else if (the_type = ilu_FindTypeByUID(type_id, err), ILU_ERRNOK(*err)) { return ilu_FALSE; --- 1284,1290 ---- if (typekind == 0) { if ((objtype = ilu_FindClassFromID(type_id)) != NIL) { typekind = OBJECT_TYPEKIND; ! type_string = ILU_NIL; #ifdef ADD_TYPE_REGISTRATION_SUPPORT } else if (the_type = ilu_FindTypeByUID(type_id, err), ILU_ERRNOK(*err)) { return ilu_FALSE; *************** *** 1254,1259 **** --- 1294,1300 ---- (type_desc(the_type).Record.supertype != NIL))) { typekind = EXTENSIBLE_RECORD_TYPEKIND; type_string = _ilu_ExtensibleRecordTypesString(type_id, err); + type_string_malloced = ilu_TRUE; if (ILU_ERRNOK(*err)) return ilu_FALSE; #endif } else { *************** *** 1262,1285 **** }; PICKLE_LEN(call) = argSize + 4 + (((typekind == 0) || - (typekind == OBJECT_TYPEKIND) || (typekind == EXTENSIBLE_RECORD_TYPEKIND)) ? PADDED_SIZE(strlen(type_string)+1) : 0); PICKLE_BUF(call) = ilu_MallocE(PICKLE_LEN(call), err); ! if (ILU_ERRNOK(*err)) return ilu_FALSE; PICKLE_NEXT(call) = 0; ! _pickle_OutputCardinal (call, (0x3 << 29) | (typekind << 16) | ! (((typekind == 0) || ! (typekind == OBJECT_TYPEKIND) || ! (typekind == EXTENSIBLE_RECORD_TYPEKIND)) ! ? strlen(type_string)+1 : 0), err); ! if ((typekind == 0) || (typekind == OBJECT_TYPEKIND) || (typekind == EXTENSIBLE_RECORD_TYPEKIND)) { ! if (ILU_ERRNOK(*err)) { ilu_free(PICKLE_BUF(call)); return ilu_FALSE; }; ! _pickle_OutputByteVec (call, (ilu_byte *) type_string, strlen(type_string)+1, err); } ! if (ILU_ERRNOK(*err)) { ilu_free(PICKLE_BUF(call)); return ilu_FALSE; } ! else return ilu_TRUE; } static void --- 1303,1329 ---- }; PICKLE_LEN(call) = argSize + 4 + (((typekind == 0) || (typekind == EXTENSIBLE_RECORD_TYPEKIND)) ? PADDED_SIZE(strlen(type_string)+1) : 0); PICKLE_BUF(call) = ilu_MallocE(PICKLE_LEN(call), err); ! if (ILU_ERRNOK(*err)) goto errout; PICKLE_NEXT(call) = 0; ! if (typekind != OBJECT_TYPEKIND) { ! OutputPickleHeader (call, 0x3 /* version */, typekind, type_string, err); ! if (ILU_ERRNOK(*err)) goto errout; ! } else { ! call->ca_prbit1 = ilu_TRUE; } ! if (type_string_malloced) ! ilu_free(type_string); ! return ilu_TRUE; ! ! errout: ! if (type_string_malloced) ! ilu_free(type_string); ! ilu_free(PICKLE_BUF(call)); ! return ilu_FALSE; } static void
*** 1.82 1999/04/26 22:38:27 --- runtime/lisp/ilu-macros.lisp 1999/05/11 03:29:51 *************** *** 1034,1056 **** (watch-outgoing-connection ,new-conn)) (ilu_start-request ,call ! (+ ,@(remove-nils (mapcar #'(lambda (dir type name) (if (or (eq dir :in) (eq dir :inout)) (make-size-form call type name))) other-arg-dirs other-arg-types other-arg-names)) ! ,(if singleton-p ! 0 ! `(object-id-size ! ,call (kernel-obj ,self) 1 ,class-record ! nil ;; signal to object-id-size not to release server lock ! )))) ! ;; since server lock is now held, can use ilu-cached-kernel-obj ! ;; instead of having to call kernel-obj again ,@(unless singleton-p `((object-id-write ! ,call (ilu-cached-kernel-obj ,self) 1 ,class-record))) ;; note that object-id-write releases the server mutex, ;; so now not Inside the server ,@(remove-nils --- 1034,1055 ---- (watch-outgoing-connection ,new-conn)) (ilu_start-request ,call ! (+ ,(if singleton-p ! 0 ! `(object-id-size ! ,call (kernel-obj ,self) 1 ,class-record ! (cons (ilu-server ,self) (ilu-class ,self)) ! )) ! ,@(remove-nils (mapcar #'(lambda (dir type name) (if (or (eq dir :in) (eq dir :inout)) (make-size-form call type name))) other-arg-dirs other-arg-types other-arg-names)) ! )) ,@(unless singleton-p `((object-id-write ! ,call (kernel-obj ,self) 1 ,class-record))) ;; note that object-id-write releases the server mutex, ;; so now not Inside the server ,@(remove-nils
*** runtime/kernel/iiop.c 1999/05/13 00:46:29 1.9 --- runtime/kernel/iiop.c 1999/05/14 16:50:45 1.10 *************** *** 3946,3952 **** ILU_ERR_CONS1(bad_param, err, minor, ilu_bpm_char_codeset, 0); return; }; ! _ilu_InputWString(call, s, len, limit, err); } /* ==================== string ==================== */ --- 3946,3952 ---- ILU_ERR_CONS1(bad_param, err, minor, ilu_bpm_char_codeset, 0); return; }; ! _ilu_InputWString(call, s, len, (limit == 0 ? 0 : limit + 1), err); } /* ==================== string ==================== */ *************** *** 4038,4044 **** ILU_ERRS((IoErrs)) *err) { *s = NIL; ! _cdr_get_bytes (iiop_packet(call), (ilu_byte **) s, len, limit, err); if (expected_encoding == 0) *current_encoding = figure_iana_charset(iiop_short_char_codeset(call)); else if ((expected_encoding == ILU_StringEncoding_Unicode_1_1) && --- 4038,4045 ---- ILU_ERRS((IoErrs)) *err) { *s = NIL; ! _cdr_get_bytes (iiop_packet(call), (ilu_byte **) s, len, ! (limit == 0 ? 0 : limit + 1), err); if (expected_encoding == 0) *current_encoding = figure_iana_charset(iiop_short_char_codeset(call)); else if ((expected_encoding == ILU_StringEncoding_Unicode_1_1) &&
*** 1.2 Thu May 20 13:04:53 1999 --- ./stubbers/python/util.c Thu May 20 19:31:49 1999 *************** *** 297,304 **** void printFullExceptionName(Exception e) { ! printIfcPrefix(e->interface); ! printf("%s", getSimpleExceptionName(e)); } void --- 297,304 ---- void printFullExceptionName(Exception e) { ! printIfcPrefix((e->importInterfaceName == NULL) ? e->interface : e->import->interface); ! printf("%s", getSimpleExceptionName((e->importInterfaceName == NULL) ? e : e->import)); } void
When a Python reserved word, e.g. 'from', is used as the name of a field in an IDL struct the python-stubber prepends the field name with an underscore, e.g. it uses the identifier '_from'. In the __init__ method of the class definition a second underscore is prepended to obtain an argument name. Such identifiers seem to conflict with internal names used by the Python runtime. The Python language specification states that identifiers beginning with two underscores are reserved for "class-private name mangling".
With the attached patch the python-stubber avoids this problem by prepending the string '_arg_' instead of '_' to obtain argument names for a struct initializer. Have not checked whether similar problems exist in other places.
*** stubbers/python/genstub.c 1999/04/19 19:25:15 1.3 --- stubbers/python/genstub.c 1999/05/26 23:10:08 1.4 *************** *** 613,619 **** initRecordField (Argument f, void *junk) { listFieldParam (f, " self."); ! listFieldParam (f, " = _"); printf (";\n"); } --- 613,619 ---- initRecordField (Argument f, void *junk) { listFieldParam (f, " self."); ! listFieldParam (f, " = _arg_"); printf (";\n"); } *************** *** 645,653 **** printf (" __ilu_type_name__ = '%s.%s'\n", interface_name(t->interface), type_name(t)); printf (" def __init__(self"); ! enumerateRecordFields (t, (EnumProc) listFieldParam, ", _"); printf ("):\n"); ! enumerateRecordFields (t, (EnumProc) initRecordField, ", _"); printf ("\n"); printf (" def __getinitargs__(self):\n"); printf (" return ("); --- 645,653 ---- printf (" __ilu_type_name__ = '%s.%s'\n", interface_name(t->interface), type_name(t)); printf (" def __init__(self"); ! enumerateRecordFields (t, (EnumProc) listFieldParam, ", _arg_"); printf ("):\n"); ! enumerateRecordFields (t, (EnumProc) initRecordField, 0); printf ("\n"); printf (" def __getinitargs__(self):\n"); printf (" return (");
Executing: metamail -m messages -z -x -d -q /tmp/MrH9LMYB0KGW82fQ9: 2>&1 The Franz Lisp mapping uses function ilufranz_OutputPossibleP in a polling loop when waiting for output on a file descriptor. This function is implemented using select. The function only used the 'write' fdset. It turns out that this function is also used to wait for a new connection to complete. In this case errors are reported via the 'except' fdset. When the peer dies during a connection attempt the Lisp mapping locks up because ilufranz_OutputPossibleP never returns true in this case.
The attached patch fixes this problem by modifying the call to select in ilufranz_OutputPossibleP to use both 'write' and 'except' fdsets.
*** runtime/lisp/ilu-franz-skin.c 1999/04/15 23:07:45 1.4 --- runtime/lisp/ilu-franz-skin.c 1999/05/26 23:31:45 1.5 *************** *** 71,84 **** ILU_RUNTIME_PUBLIC int ilufranz_OutputPossibleP (int fd) { fd_set writefds; int width, stat; static struct timeval to = { 0, 0 }; width = fd + 1; FD_ZERO(&writefds); FD_SET(fd, &writefds); ! stat = select (width, NULL, &writefds, NULL, &to); ! if (stat > 0 && FD_ISSET(fd, &writefds)) return 1; else return 0; --- 71,87 ---- ILU_RUNTIME_PUBLIC int ilufranz_OutputPossibleP (int fd) { fd_set writefds; + fd_set exceptfds; int width, stat; static struct timeval to = { 0, 0 }; width = fd + 1; FD_ZERO(&writefds); + FD_ZERO(&exceptfds); FD_SET(fd, &writefds); ! FD_SET(fd, &exceptfds); ! stat = select (width, NULL, &writefds, &exceptfds, &to); ! if (stat > 0 && (FD_ISSET(fd, &writefds) || FD_ISSET(fd, &exceptfds))) return 1; else return 0;
*** /dev/null Tue Jun 15 08:01:00 1999 --- runtime/kernel/zlib.c Tue Jun 15 10:56:58 1999 *************** *** 0 **** --- 1,1140 ---- + /* + BeginILUCopyright + + Copyright (c) 1991-1998 Xerox Corporation. All Rights Reserved. + + Unlimited use, reproduction, modification, and distribution of this + software and modified versions thereof is permitted. Permission is + granted to make derivative works from this software or a modified + version thereof. Any copy of this software, a modified version + thereof, or a derivative work must include both the above copyright + notice of Xerox Corporation and this paragraph. Any distribution of + this software, a modified version thereof, or a derivative work must + comply with all applicable United States export control laws. This + software is made available AS IS, and XEROX CORPORATION DISCLAIMS ALL + WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE, AND NOTWITHSTANDING ANY OTHER PROVISION CONTAINED HEREIN, ANY + LIABILITY FOR DAMAGES RESULTING FROM THE SOFTWARE OR ITS USE IS + EXPRESSLY DISCLAIMED, WHETHER ARISING IN CONTRACT, TORT (INCLUDING + NEGLIGENCE) OR STRICT LIABILITY, EVEN IF XEROX CORPORATION IS ADVISED + OF THE POSSIBILITY OF SUCH DAMAGES. + + EndILUCopyright + */ + /* + * Zlib Transport Filter for ILU + * + * Paul Bennett + * Thursday, 18 June 1998 + * + * Some bizarre BT copyright statement ought to appear here. + * + * RCS Id: zlib.c,v 1.12 1999/06/05 08:27:33 spreitze Exp + */ + /* Last edited by Mike Spreitzer September 13, 1998 9:27 pm PDT */ + + /* + * This is a compression transport filter for Xerox PARC's ILU system. + * The code has been developed as part of the World Wide Web Consortium's + * Hypertext Transfer Protocol - Next Generation (HTTP-NG) project. + * + * ILU: ftp://ftp.parc.xerox.com/pub/ilu/ilu.html + * HTTP-NG: http://www.w3.org/Protocols/HTTP-NG/ + * zlib: http://www.cdrom.com/pub/infozip/zlib/ + * + * Points where I've been particularly hacky and taken a short-cut + * or some such are marked !!!pab!!!. + * + * The canonical form is the name "zlib" followed by underscore-separeted + * parameters. The parameters are: + * + * boundaried - zlib is boundaried + * nonboundaried - zlib is not boundaried + * 0-9 - compression level; 0 worst -> 9 best + * 10+ - buffer size + * + * The zlib layer can be boundaried if and only if the lower layer is. + * + * If no parameters are specified, the zlib's compression level + * is Z_DEFAULT_COMPRESSION (defined in ), + * buffer size is 1024 (Z_BUFSZ, defined below), + * and the zlib is boundaried iff the lower layer is. + * + * Some examples: + * + * zlib_0 - default buffer size, no compression + * zlib_9_2048 - best compression, buffer size 2048 + * + * Note that some magic bytes are sent down the wire so that the decoding + * end can use the correct decompression level; thus it *is* possible that + * this transport will increase the on-the-wire byte size, but very unlikely + * unless you're using a compression level of 0. + * + * Also, there may be some scope in having asymmetric compression levels. + * Currently both streams (input and output) use the same compression level. + */ + + /* + * The code here is based on $ILUSRC/runtime/kernel/simptran.c by + * Bill Janssen of Xerox. The original copyright message follows. + */ + + /*======================================================================*/ + /* + */ + /*======================================================================*/ + + #include "iluntrnl.h" + + #include "ilutransport.h" + + #include + + #define MSGORNIL(m) ((m)?(m):"(null)") + + /* + * *SIGH* Zlib requires memory management routines with plain weird + * prototypes. We can't get away with just passing the ILU ones in, + * so we have to patch the calls here. + */ + static voidpf _zlibtran_alloc(voidpf opaque, uInt items, uInt size) + {return ilu_malloc(items*size);} + static void _zlibtran_free(voidpf opaque, voidpf address) + {ilu_free(address);} + + #define BUFFERSIZE 1024 + #define Z_BUFSZ 1024 + + typedef struct { + ilu_TransportCreator lower; + ilu_boolean lower_boundaried; + ilu_boolean boundaried; + ilu_cardinal compression_level; + ilu_cardinal buffer_size; + } *ZlibtranCreatorParms; + + typedef struct { + ilu_Mooring lower; + ilu_boolean lower_boundaried; + ilu_boolean boundaried; + ilu_cardinal compression_level; + ilu_cardinal buffer_size; + } *ZlibtranMooringParms; + + typedef struct { + + /* L2 >= {ymu} */ + + ilu_boolean busyIn; /* currently processing input msg? */ + ilu_TransportReport trLower; + + /* L2 >= {xmu} */ + + ilu_boolean busyOut; + + /* L2 unconstrained */ + + /* + * The unboundaried transport from which (self) is constructed. We + * don't want an exposed buffer in (lower). lower's xmu = self's + * xmu; same for ymu. + */ + ilu_Transport lower; + ilu_boolean lower_boundaried; + + /* + * These structures hold the state of the compression library + */ + z_stream *zstr_in; + z_stream *zstr_out; + + ilu_cardinal compression_level; + ilu_cardinal buffer_size; + + /* + * Buffers for use on the lower-level of the transport stack + * (these hold compressed bytes). + */ + ilu_bytes zbuf_in; /* holds uncompressed data */ + + ilu_bytes zbuf_out; + /* + * Holds compressed data. [zbuf_out, zstr_out->next_out) need to + * be written before any other output operations are performed. + */ + + } *ZlibtranParms; + /* What goes in the data field of a ilu_Transport. If boundaried, + while closed, exposed input buffer is empty. */ + + /*L1, L2 unconstrained*/ + + #define ACCESS_ZLIBTRAN_PARMS(a) ((ZlibtranParms)(a)) + + /*L1.sup < trmu; L2 unconstrained*/ + static ZlibtranCreatorParms + _zlibtran_InterpretInfo(ilu_TransportInfo info, + ILU_ERRS((no_memory, inv_objref)) * err) + { + ZlibtranCreatorParms cp; + ilu_TransportCreator lower; + + ilu_boolean boundaried = ilu_FALSE; + ilu_integer compression_level = Z_DEFAULT_COMPRESSION; + ilu_cardinal buffer_size = Z_BUFSZ; + + if (info[0] == NIL || info[1] == NIL || strncmp(info[0], "zlib", 4) != 0 + || !(info[0][4]=='_' || !info[0][4]) ) + /* We check info[1] because "zlib" is not a transport endpoint */ + return ILU_ERR_CONS1(inv_objref, err, minor, ilu_iom_ts, NIL); + + { + /* Break apart the tinfo. */ + char *next, *prev; + next = info[0]+4; + while (*next) { + int n; + prev = next+1; + next = strchr(prev, '_'); + if (next) + n = next - prev; + else + next = prev + (n = strlen(prev)); + if (strncmp(prev, "boundaried", n) == 0) + boundaried = ilu_TRUE; + else if (strncmp(prev, "nonboundaried", n) == 0) + boundaried = ilu_FALSE; + else { + long int i; + if (sscanf(prev, "%ld", &i) == 1) { + if (i <= Z_BEST_COMPRESSION) + compression_level = i; + else + buffer_size = i; + } else + return ILU_ERR_CONS1(inv_objref, err, minor, ilu_iom_ts, NIL); + } + } + } + + lower = _ilu_GetTransportCreator(info + 1, err); + if (ILU_ERRNOK(*err)) + return NIL; + if ((!lower->tcr_reliable) || (boundaried != lower->tcr_boundaried)) { + (*lower->tcr_close) (lower); + return ILU_ERR_CONS1(inv_objref, err, minor, ilu_iom_ts, NIL); + } + cp = (ZlibtranCreatorParms) ilu_MallocE(sizeof(*cp), err); + if (cp == NIL) { + (*lower->tcr_close) (lower); + return NIL; + } + cp->lower = lower; + cp->lower_boundaried = lower->tcr_boundaried; + cp->boundaried = boundaried; + cp->compression_level = compression_level; + cp->buffer_size = buffer_size; + return cp; + } + + /* L1.sup < trmu; L2 >= {xmu, ymu} */ + static ilu_boolean + _zlibtran_SetInputHandler(ilu_Transport self, ilu_TIH tih, + ILU_ERRS((no_memory, internal, no_resources)) * err) + { + ZlibtranParms p = ACCESS_ZLIBTRAN_PARMS(transport_data(self)); + if (p->zstr_in->avail_in) + return !ILU_CLER(*err); + return _ilu_SetTransportInputHandler(p->lower, tih, err); + } + + /* Main Invariant holds; L2 >= {ymu} */ + static ilu_boolean + _zlibtran_WaitForInput(ilu_Transport self, int *disabled, + ilu_FineTime * limit, + ILU_ERRS((broken_locks, interrupted)) * err) + { + ZlibtranParms p = ACCESS_ZLIBTRAN_PARMS(transport_data(self)); + if (p->zstr_in->avail_in) { + if (disabled) + *disabled = ilu_TRUE; + return ILU_CLER(*err); + } + return (transport_wait_for_input(p->lower, disabled, limit, err)); + } + + /* L1.sup < trmu; L2 >= {xmu} */ + static ilu_boolean + _zlibtran_InterruptST(ilu_Transport self, ILU_ERRS((bad_param)) * err) + { + ZlibtranParms p = ACCESS_ZLIBTRAN_PARMS(transport_data(self)); + return (transport_interruptST(p->lower, err)); + } + + /* L1 >= {cmu}; L1.sup < trmu; L2 >= {xmu} */ + + static ilu_boolean + _zlibtran_DisableWait(ilu_Transport self, + ILU_ERRS((broken_locks, bad_param, + internal)) * err) + { + ZlibtranParms p = ACCESS_ZLIBTRAN_PARMS(transport_data(self)); + return (transport_disableWait(p->lower, err)); + } + + static ilu_boolean + _zlibtran_EnableWait(ilu_Transport self, + ILU_ERRS((broken_locks, bad_param, + internal)) * err) + { + ZlibtranParms p = ACCESS_ZLIBTRAN_PARMS(transport_data(self)); + return (transport_enableWait(p->lower, err)); + } + + /* L1.sup < trmu; L2 unconstrained */ + + static ilu_integer + _zlibtran_FdUsage(ilu_TransportCreator self, ilu_boolean mooring) + { + ZlibtranCreatorParms cp = (ZlibtranCreatorParms) self->tcr_data; + return (*cp->lower->tcr_dfd) (cp->lower, mooring); + } + + /* mayBlock ? Main Invariant : L1.sup < trmu */ + /* L2 >= {xmu}; input => L2 >= {ymu} */ + + static ilu_boolean + ClearOut(ilu_Transport self, ZlibtranParms p, + ilu_boolean flush, ilu_boolean * flushed, + ilu_cardinal mayBlock, ILU_ERRS((IoErrs)) * err) + { + if (p->zstr_out->next_out > p->zbuf_out) { + ilu_cardinal nOut, wrote; + nOut = p->zstr_out->next_out - p->zbuf_out; + wrote = (transport_write_bytes_full + (p->lower, p->zbuf_out, nOut, flush, flushed, + mayBlock, err)); + ILU_NOTE(ZLIB_DEBUG, + ("zlib(%p) wrote %lu of %lu queued bytes%s.\n", + self, (long unsigned) wrote, (long unsigned) nOut, + flush ? (*flushed ? ", flushed" : ", not flushed") : "")); + if (wrote < nOut && ILU_ERROK(*err)) { + memmove((void *) p->zbuf_out, + (void *) (p->zbuf_out + wrote), + nOut - wrote); + p->zstr_out->avail_out += wrote; + } else { + p->zstr_out->next_out = p->zbuf_out; + p->zstr_out->avail_out = p->buffer_size; + } + return ILU_CLER(*err); + } else { + if (!flush) + ILU_CLER(*err); + else if (mayBlock) + *flushed = (*p->lower->tr_class->tc_push) (p->lower, err); + else + (void) ((*p->lower->tr_class->tc_write_bytes_nonblock) + (p->lower, NIL, 0, ilu_TRUE, flushed, err)); + return ILU_ERROK(*err); + } + } + + static ilu_ReadHeaderResultCode + _zlibtran_BeginMessage_Full(ilu_Transport self, + ilu_boolean input_p, + ilu_boolean mayBlock, + ILU_ERRS((IoErrs)) * err) + { + ZlibtranParms p = ACCESS_ZLIBTRAN_PARMS(transport_data(self)); + if (!self->tr_class->tc_boundaried) { + return ILU_ERR_CONS1(internal, err, minor, ilu_im_tcNotBoundaried, + ilu_rhrc_error); + } + if (p->busyIn || p->busyOut) + return ILU_ERR_CONS1(internal, err, minor, ilu_im_beginMessage, + ilu_rhrc_error); + if (!ilu_Check((p->zstr_out->next_out == p->zbuf_out + && p->lower_boundaried), + err)) + return ilu_rhrc_error; + if (!(input_p || mayBlock)) { + if (!transport_begin_output_nonblock(p->lower, err)) + return ilu_rhrc_error; + } else { + ilu_ReadHeaderResultCode result; + result = transport_begin_message(p->lower, input_p, err); + if (result != ilu_rhrc_ok) + return result; + } + if (input_p) { + p->busyIn = ilu_TRUE; + p->trLower.tr_eom = p->trLower.tr_eof = ilu_FALSE; + } else { + p->busyOut = ilu_TRUE; + self->tr_outLimit = BUFFERSIZE; + self->tr_outNext = 0; + } + ILU_CLER(*err); + ILU_NOTE(ZLIB_DEBUG, ("zlib(%p) %s message begun.\n", + self, input_p ? "input" : "output")); + return ilu_rhrc_ok; + } + + static ilu_ReadHeaderResultCode + _zlibtran_BeginMessage(ilu_Transport self, + ilu_boolean input_p, + ILU_ERRS((IoErrs)) * err) + { + return _zlibtran_BeginMessage_Full(self, input_p, ilu_TRUE, err); + } + + static ilu_boolean + _zlibtran_BeginOutputMessageNonblock(ilu_Transport self, + ILU_ERRS((IoErrs)) * err) + { + return (_zlibtran_BeginMessage_Full(self, ilu_FALSE, ilu_FALSE, err) + == ilu_rhrc_ok); + } + + static ilu_cardinal + WriteBuf(ilu_Transport self, ZlibtranParms p, ilu_bytes buf, + ilu_cardinal len, ilu_boolean flush, ilu_boolean * flushed, + ilu_cardinal mayBlock, ILU_ERRS((IoErrs)) * err) + { + z_stream *zout = p->zstr_out; + ilu_cardinal taken = 0, toWrite, dWrote, offset = zout->total_in; + ilu_boolean dun = ilu_FALSE; + if (!ilu_Check(zout->next_out == p->zbuf_out && + zout->avail_out == p->buffer_size, + err)) + return 0; + zout->next_in = buf; + zout->avail_in = len; + ILU_NOTE(ZLIB_DEBUG, + ("zlib(%p) compressing %lu bytes, %sflushing, may%s block.\n", + self, (long unsigned) len, + flush ? "" : "not ", + mayBlock ? "":" not")); + while (ILU_ERROK(*err) && !dun) { + int zerr; + long unsigned totOut0 = zout->total_out, nOut, wrote0; + long unsigned totIn0 = zout->total_in; + long unsigned avIn0 = zout->avail_in; + long unsigned avOut0 = zout->avail_out; + ilu_bytes nextOut0 = zout->next_out; + zerr = deflate(zout, flush ? Z_SYNC_FLUSH : Z_NO_FLUSH); + nOut = zout->next_out - nextOut0; + ILU_NOTE(ZLIB_DEBUG, + ("zlib(%p) compressor consumed plain bytes [%lu,same+%lu) out of same+%lu," + " produced compressed bytes [%lu,same+%lu) limited by same+%lu," + " returned code %d, msg=%s.\n", + self, totIn0, avIn0 - zout->avail_in, avIn0, + totOut0, nOut, avOut0, zerr, MSGORNIL(zout->msg))); + taken = len - zout->avail_in; + if (zerr != Z_OK) { + /* return ILU_ERR_CONS1(zlib, err, code, zerr, ret); */ + return ILU_ERR_CONS0(unknown, err, taken); + } + if (!ilu_Check(zout->avail_in == 0 || + zout->avail_out == 0, err)) + return taken; + toWrite = zout->next_out - p->zbuf_out; + wrote0 = zout->total_out - toWrite; + dWrote = (transport_write_bytes_full + (p->lower, p->zbuf_out, toWrite, flush, flushed, + mayBlock, err)); + ILU_NOTE(ZLIB_DEBUG, + ("zlib(%p) wrote compressed bytes [%lu,same+%lu) out of same+%lu.\n", + self, wrote0, (long unsigned) dWrote, toWrite)); + if (dWrote < toWrite && ILU_ERROK(*err)) { + memmove((void *) p->zbuf_out, + (void *) (p->zbuf_out + dWrote), + toWrite - dWrote); + zout->next_out -= dWrote; + zout->avail_out += dWrote; + break; + } + dun = (zout->avail_out && !zout->avail_in); + zout->next_out = p->zbuf_out; + zout->avail_out = p->buffer_size; + } + #ifdef ENABLE_DEBUGGING + if (((ilu_DebugLevel & PACKET_DEBUG) != 0) && + (taken > 0)) + _ilu_debug_DumpPacket_Offset(buf, taken, + offset, "uncompressed outgoing"); + #endif /* ENABLE_DEBUGGING */ + return taken; + } + + static ilu_boolean + _zlibtran_EndMessage_Full(ilu_Transport self, + ilu_boolean flush, + ilu_boolean * flushed, + ilu_Message * msgh, + ilu_boolean mayBlock, + ILU_ERRS((IoErrs)) * err) + { + ZlibtranParms p; + ilu_boolean ans, bytesDropped = ilu_FALSE; + if (!self->tr_class->tc_boundaried) { + return ILU_ERR_CONS1(internal, err, minor, ilu_im_tcNotBoundaried, + ilu_rhrc_error); + } + p = ACCESS_ZLIBTRAN_PARMS(transport_data(self)); + + if ((!p->busyOut) && (!p->busyIn)) + return ILU_ERR_CONS1(internal, err, minor, ilu_im_endMessage, + ilu_FALSE); + + if (p->busyOut) { + if (!ClearOut(self, p, flush && !self->tr_outNext, flushed, + mayBlock, err)) + return ilu_FALSE; + if (self->tr_outNext > 0) { + ilu_cardinal wrote; + wrote = WriteBuf(self, p, self->tr_outBuff, self->tr_outNext, + flush, flushed, mayBlock, err); + if (ILU_ERRNOK(*err)) + return ilu_FALSE; + } + self->tr_outNext = 0; + p->busyOut = ilu_FALSE; + ILU_NOTE(ZLIB_DEBUG, + ("zlib(%p) ended output message (flush=%d).\n", + self, flush)); + } else if (p->busyIn) { + ilu_TransportReport rpt = {ilu_FALSE}; + bytesDropped = self->tr_inNext < self->tr_inLimit; + self->tr_inNext = self->tr_inLimit = 0; + while (!rpt.tr_eom) { + ilu_cardinal nRead; + nRead = ((*self->tr_class->tc_read_bytes) + (self, NIL, 0, &rpt, err)); + if (nRead) + bytesDropped = ilu_TRUE; + if (ILU_ERRNOK(*err)) + return ilu_FALSE; + if (rpt.tr_eom) + break; + if (self->tr_inLimit) + self->tr_inLimit = 0; + else { + if (!_ilu_TransportWaitForInputNoClose(self, NIL, err)) + return ilu_FALSE; + } + }; + self->tr_inLimit = 0; + p->busyIn = ilu_FALSE; + ILU_NOTE(ZLIB_DEBUG, + ("zlib(%p) ended input message.\n", self)); + }; + ans = transport_end_message(p->lower, flush, msgh, err); + if (bytesDropped & ILU_ERROK(*err)) + ILU_ERR_CONS1(internal, err, minor, ilu_im_tcBytesDropped, (void) 6); + return ans; + } + + static ilu_boolean + _zlibtran_EndMessage(ilu_Transport self, + ilu_boolean flush, + ilu_Message * msgh, + ILU_ERRS((IoErrs)) * err) + { + ilu_boolean flushed; + return _zlibtran_EndMessage_Full(self, flush, &flushed, msgh, + ilu_TRUE, err); + } + + static ilu_TransportEndReport + _zlibtran_EndOutputMessageNonblock(ilu_Transport self, + ilu_boolean flush, + ilu_Message * msgh, + ILU_ERRS((IoErrs)) * err) + { + ilu_TransportEndReport ans; + ans.iluter_ended = (_zlibtran_EndMessage_Full + (self, flush, &ans.iluter_flushed, + msgh, ilu_TRUE, err)); + return ans; + } + + /*Main Invariant holds; L2 >= {xmu}*/ + + static ilu_boolean + _zlibtran_Push (ilu_Transport self, + ILU_ERRS((IoErrs)) * err) + { + return ((*self->tr_class->tc_write_bytes) + (self, NIL, 0, ilu_TRUE, err)); + } + + static ilu_boolean + _zlibtran_SendWholeMessage(ilu_Transport self, ilu_Message * msgh, + ILU_ERRS((IoErrs)) * err) + { + return ILU_ERR_CONS1(internal, err, minor, ilu_im_tcReliable, ilu_FALSE); + } + + /* mayBlock ? Main Invariant : L1.sup < trmu; L2 >= {xmu} */ + static ilu_cardinal + _zlibtran_WriteBytes_Full(ilu_Transport self, ilu_bytes b, + ilu_cardinal bufferSize, + ilu_boolean flush, + ilu_boolean * flushed, + ilu_boolean mayBlock, + ILU_ERRS((IoErrs)) * err) + { + ZlibtranParms p = ACCESS_ZLIBTRAN_PARMS(transport_data(self)); + ilu_cardinal wrote, taken = 0; + + if (self->tr_class->tc_boundaried && (!p->busyOut)) + return ILU_ERR_CONS1(internal, err, minor, ilu_im_bytesWithoutMsg, + 0); + if (!ClearOut(self, p, (flush + && !(self->tr_outBuff && self->tr_outNext) + && !bufferSize), + flushed, mayBlock, err)) + return 0; + if (self->tr_outBuff && self->tr_outNext) { + wrote = WriteBuf(self, p, self->tr_outBuff, self->tr_outNext, + flush && bufferSize == 0, flushed, + mayBlock, err); + if (wrote < self->tr_outNext) { + self->tr_outNext -= wrote; + memmove((void *) self->tr_outBuff, + (void *) (self->tr_outBuff + wrote), + self->tr_outNext); + return 0; + } + self->tr_outNext = 0; + } + if (bufferSize && p->zstr_out->next_out == p->zbuf_out) + taken = WriteBuf(self, p, b, bufferSize, flush, flushed, + mayBlock, err); + return taken; + } + + static ilu_boolean + _zlibtran_WriteBytes(ilu_Transport self, ilu_bytes b, + ilu_cardinal bufferSize, + ilu_boolean flush, + ILU_ERRS((IoErrs)) * err) + { + ilu_boolean flushed; + (void) _zlibtran_WriteBytes_Full(self, b, bufferSize, flush, &flushed, + ilu_TRUE, err); + return ILU_ERROK(*err); + } + + /*L1.sup < trmu; L2 >= {xmu}*/ + static ilu_cardinal + _zlibtran_WriteBytesNonblock(ilu_Transport self, ilu_bytes b, + ilu_cardinal bufferSize, + ilu_boolean flush, + ilu_boolean * flushed, + ILU_ERRS((IoErrs)) * err) + { + return _zlibtran_WriteBytes_Full(self, b, bufferSize, flush, flushed, + ilu_FALSE, err); + } + + /*Main Invariant holds; L2 >= {xmu, ymu}*/ + + static ilu_cardinal + _zlibtran_ReadBytes(ilu_Transport self, + ilu_bytes buffer, + ilu_cardinal len, + ilu_TransportReport * rpt, + ILU_ERRS((IoErrs,zlib)) * err) + { + ZlibtranParms p = ACCESS_ZLIBTRAN_PARMS(transport_data(self)); + z_stream *zin = p->zstr_in; + ilu_cardinal ans, effLen, offset = zin->total_out; + ilu_bytes dest; + if (self->tr_class->tc_boundaried && (!p->busyIn)) + return ILU_ERR_CONS1(internal, err, minor, ilu_im_bytesWithoutMsg, + 0); + if (self->tr_inNext < self->tr_inLimit) + return ILU_ERR_CONS1(internal, err, minor, ilu_im_tcInputSkipsBuff, + 0); + if (buffer) { + zin->next_out = dest = buffer; + zin->avail_out = effLen = len; + } else { + zin->next_out = dest = self->tr_inBuff; + zin->avail_out = effLen = p->buffer_size; + self->tr_inNext = self->tr_inLimit = 0; + } + rpt->tr_eom = rpt->tr_eof = ilu_FALSE; + if (zin->avail_out == 0) { + ILU_CLER(*err); + return 0; + } + /* Loop inspired by the one in gzread in gzio.c. */ + while (1) { + int zerr; + ilu_cardinal totIn0 = zin->total_in; + ilu_cardinal totOut0 = zin->total_out; + ilu_cardinal availIn0, dIn, dOut; + ilu_cardinal availOut0 = zin->avail_out; + /* Get more bytes from the lower layer if needed. */ + if (zin->avail_in == 0 && !p->trLower.tr_eom) { + zin->next_in = p->zbuf_in; + zin->avail_in = (transport_read_upto_bytes + (p->lower, zin->next_in, + p->buffer_size, &p->trLower, err)); + if (p->trLower.tr_eof) + p->trLower.tr_eom = ilu_TRUE; + ILU_NOTE(ZLIB_DEBUG, + ("zlib(%p) got %lu bytes from lower" + " (whose eom=%d, eof=%d).\n", + self, zin->avail_in, + p->trLower.tr_eom, p->trLower.tr_eof)); + if (ILU_ERRNOK(*err)) + goto dun; + } + availIn0 = zin->avail_in; + zerr = inflate(zin, Z_SYNC_FLUSH); + dIn = availIn0 - zin->avail_in; + dOut = availOut0 - zin->avail_out; + ILU_NOTE(ZLIB_DEBUG, + ("zlib(%p) expander consumed compressed bytes [%lu,same+%lu)" + " out of same+%lu," + " produced plain bytes [%lu,same+%lu) limited to same+%lu," + " returned code %d, msg=%s.\n", + self, totIn0, dIn, availIn0, + totOut0, dOut, availOut0, zerr, MSGORNIL(zin->msg))); + if (!(zerr == Z_OK || zerr==Z_BUF_ERROR && !availIn0 && !dOut)) { + ILU_ERR_CONS0(unknown, err, (void) 6); + goto dun; + } + if (!ilu_Check(zin->avail_in == 0 || zin->avail_out == 0, err)) + goto dun; + if (!zin->avail_out || !availIn0 + || ((!zin->avail_in) && p->trLower.tr_eom)) + break; + } + dun: + rpt->tr_eof = zin->avail_out && p->trLower.tr_eof; + if (self->tr_class->tc_boundaried) + rpt->tr_eom = zin->avail_out && p->trLower.tr_eom; + else + rpt->tr_eom = ilu_FALSE; + if (buffer) { + ans = zin->next_out - buffer; + } else { + ans = (self->tr_inLimit = zin->next_out - self->tr_inBuff); + } + ILU_NOTE(ZLIB_DEBUG, + ("zlib(%p) delivered plaintext bytes [%lu,same+%lu)" + " into buffer of size %lu.\n", + self, (long unsigned) offset, (long unsigned) ans, + (long unsigned) effLen)); + #ifdef ENABLE_DEBUGGING + if (((ilu_DebugLevel & PACKET_DEBUG) != 0) && + (ans > 0)) + _ilu_debug_DumpPacket_Offset(dest, ans, offset, + "uncompressed incoming"); + #endif /* ENABLE_DEBUGGING */ + return ans; + } + + /*L1.sup < trmu; L2 >= {xmu, ymu}*/ + + static ilu_boolean + _zlibtran_Close(ilu_Transport self, ilu_integer * dfd, + ILU_ERRS((bad_locks, broken_locks, internal)) * err) + { + ZlibtranParms p = ACCESS_ZLIBTRAN_PARMS(transport_data(self)); + ilu_Transport lt = p->lower; + int zerr; + + ILU_NOTE(ZLIB_DEBUG, ("zlib(%p) closing.\n", self)); + + /* + * Close down the zlib streams + */ + + if ((zerr = deflateEnd(p->zstr_out)) != Z_OK) + ILU_NOTE(ZLIB_DEBUG, + ("zlib(%p): deflateEnd(out) returned %d, msg=%s.\n", + self, zerr, MSGORNIL(p->zstr_out->msg))); + + if ((zerr = inflateEnd(p->zstr_in)) != Z_OK) + ILU_NOTE(ZLIB_DEBUG, + ("zlib(%p): inflateEnd(in) returned %d, msg=%s.\n", + self, zerr, MSGORNIL(p->zstr_in->msg))); + + ilu_free(p->zstr_out); + ilu_free(p->zstr_in); + ilu_free(p->zbuf_out); + ilu_free(p->zbuf_in); + + ilu_free(p); + ilu_free(self); + return transport_close(lt, dfd, err); + } + + /*L1, L2 unconstrained*/ + + static struct _ilu_TransportClass_s myclass = { + ilu_TRUE, /* boundaried */ + ilu_TRUE, /* reliable */ + _zlibtran_SetInputHandler, + _zlibtran_WaitForInput, + _zlibtran_InterruptST, + _zlibtran_DisableWait, + _zlibtran_EnableWait, + _zlibtran_BeginMessage, + _zlibtran_EndMessage, + _zlibtran_BeginOutputMessageNonblock, + _zlibtran_EndOutputMessageNonblock, + _zlibtran_Push, + _zlibtran_SendWholeMessage, + _zlibtran_WriteBytes, + _zlibtran_WriteBytesNonblock, + _zlibtran_ReadBytes, + _zlibtran_Close + }; + + static ilu_TransportClass + NewClass (ilu_boolean boundaried, ilu_Error *err) + { + ilu_TransportClass n; + + if ((n = (ilu_TransportClass) ilu_MallocE(sizeof(*n), err)) == NIL) + return NIL; + *n = myclass; + n->tc_boundaried = boundaried; + return n; + } + + /*L1.sup < trmu; L2 >= result's {xmu, ymu}*/ + static ilu_Transport + NewTrans(ilu_Transport lower, + ilu_boolean boundaried, ilu_boolean lower_boundaried, + ilu_cardinal compression_level, ilu_cardinal buffer_size, + ilu_integer * dfd, + ILU_ERRS((no_memory, bad_param)) * err) + { + ilu_Transport ans = NIL; + ZlibtranParms parms = NIL; + + if (boundaried && !lower_boundaried) + return ILU_ERR_CONS1(bad_param, err, minor, ilu_bpm_duh, NIL); + parms = (ZlibtranParms) ilu_MallocE(sizeof(*parms), err); + if (parms == NIL) + return NIL; + parms->lower = lower; + parms->lower_boundaried = lower_boundaried; + parms->busyIn = ilu_FALSE; + parms->busyOut = ilu_FALSE; + parms->trLower.tr_eof = parms->trLower.tr_eom = ilu_FALSE; + + /* + * Zlib initialisation. First the algorithm parameters + * - these should really be taken from the tinfo. + */ + parms->compression_level = compression_level; + parms->buffer_size = buffer_size; + + /* Next the malloc'ing */ + + parms->zstr_in = parms->zstr_out = NIL; + parms->zbuf_in = parms->zbuf_out = NIL; + + if ( NIL == (parms->zstr_in = + (z_stream *) ilu_MallocE(sizeof(*parms->zstr_in), err)) + || NIL == (parms->zstr_out = + (z_stream *) ilu_MallocE(sizeof(*parms->zstr_out), err)) + || NIL == (parms->zbuf_in = + (ilu_bytes) ilu_MallocE(parms->buffer_size, err)) + || NIL == (parms->zbuf_out = + (ilu_bytes) ilu_MallocE(parms->buffer_size, err))) + goto fale_2; + + /* Now initialise the zstreams */ + + parms->zstr_in->zalloc = parms->zstr_out->zalloc = _zlibtran_alloc; + parms->zstr_in->zfree = parms->zstr_out->zfree = _zlibtran_free; + parms->zstr_in->opaque = parms->zstr_out->opaque = 0; + + parms->zstr_in->next_in = parms->zbuf_in; + parms->zstr_in->avail_in = 0; + parms->zstr_out->next_in = NIL; + parms->zstr_out->avail_in = 0; + + if (Z_OK != deflateInit(parms->zstr_out, parms->compression_level)) + goto fale_1; + if (Z_OK != inflateInit(parms->zstr_in)) + goto fale0; + + parms->zstr_out->next_out = parms->zbuf_out; + parms->zstr_out->avail_out = parms->buffer_size; + + /* + * That's it for the zlib stuff... back to the main plot. + */ + + ans = (ilu_Transport) ilu_MallocE(sizeof(*ans), err); + if (ans == NIL) + goto fale1; + ans->tr_outBuff = (unsigned char *) ilu_MallocE(BUFFERSIZE, err); + if (ans->tr_outBuff == NIL) { goto fale2; }; + ans->tr_inBuff = NIL; + ans->tr_inNext = ans->tr_inLimit = 0; + ans->tr_outNext = 0; + ans->tr_outLimit = BUFFERSIZE; + if ((ans->tr_class = NewClass(boundaried, err)) == NIL) + goto fale3; + ans->tr_data = parms; + ans->tr_wc = lower->tr_wc; + ans->tr_estFDs = lower->tr_estFDs; + ILU_CLER(*err); + ILU_NOTE(ZLIB_DEBUG, + ("zlib(%p) created, lower=%p, level=%d.\n", + ans, lower, parms->compression_level)); + return ans; + fale3: + ilu_free(ans->tr_outBuff); + fale2: + ilu_free(ans); + + /* zlib failure */ + fale1: + inflateEnd(parms->zstr_in); + fale0: + deflateEnd(parms->zstr_out); + fale_1: + if (parms->zbuf_out != NIL) ilu_free(parms->zbuf_out); + if (parms->zbuf_in != NIL) ilu_free(parms->zbuf_in); + if (parms->zstr_out != NIL) ilu_free(parms->zstr_out); + if (parms->zstr_in != NIL) ilu_free(parms->zstr_in); + /* back to the main story */ + + fale_2:{ + ILU_ERRS((bad_locks, broken_locks, internal)) cerr; + ilu_integer cdfd = 0; + ilu_free(parms); + transport_close(lower, &cdfd, &cerr); + ILU_HANDLED(cerr); + *dfd += cdfd; + return NIL; + } + } + + /* Main Invariant holds */ + static ilu_Transport + _zlibtran_CreateTransport(ilu_TransportCreator self, ilu_boolean buffer, + ilu_integer *dfd, ilu_Passport pp, + ILU_ERRS((IoErrs)) * err) + { + ZlibtranCreatorParms cp = (ZlibtranCreatorParms) self->tcr_data; + ilu_Transport lower; + lower = (*cp->lower->tcr_createTransport) (cp->lower, buffer, dfd, pp, err); + if (ILU_ERRNOK(*err)) + return NIL; + if (!transport_reliable(lower)) + /* He promised! (We checked earlier) */ + return ILU_ERR_CONS1(internal, err, minor, ilu_im_tcBug, NIL); + + /* + * Initialise the zlib stream objects + */ + + /* pretend to acquire result's xmu, ymu */ + return NewTrans(lower, cp->boundaried, cp->lower_boundaried, + cp->compression_level, cp->buffer_size, dfd, err); + /* pretend to release result's xmu, ymu */ + } + + /*L1.sup < trmu; L2 >= {xmu, ymu}*/ + static ilu_integer + _zlibtran_MooringDFd(ilu_Mooring self, ilu_boolean add) + { + ZlibtranMooringParms mp = (ZlibtranMooringParms) self->mo_data; + return ((*mp->lower->mo_dfd) (mp->lower, add)); + } + + /*L1.sup < trmu; L2 >= {xmu, ymu}*/ + static ilu_boolean + _zlibtran_SetReqHandler(ilu_Mooring self, + ilu_TIH tih, + ILU_ERRS((no_memory, imp_limit, no_resources, + broken_locks, internal)) * err) + { + ZlibtranMooringParms mp = (ZlibtranMooringParms) self->mo_data; + return ((*mp->lower->mo_set_req_handler) (mp->lower, tih, err)); + } + + /* Main Invariant holds; L2 >= {ymu} */ + static ilu_boolean + _zlibtran_WaitForReq(ilu_Mooring self, int *disabled, + ILU_ERRS((interrupted, broken_locks)) * err) + { + ZlibtranMooringParms mp = (ZlibtranMooringParms) self->mo_data; + return ((*mp->lower->mo_wait_for_req) (mp->lower, disabled, err)); + } + + /* L1 >= {cmu}; L1.sup < trmu; L2 >= {xmu} */ + + static ilu_boolean + _zlibtran_DisableReqWait(ilu_Mooring self, + ILU_ERRS((broken_locks, bad_param, internal)) * err) + { + ZlibtranMooringParms mp = (ZlibtranMooringParms) self->mo_data; + return ((*mp->lower->mo_disableWait) (mp->lower, err)); + } + + static ilu_boolean + _zlibtran_EnableReqWait(ilu_Mooring self, + ILU_ERRS((broken_locks, bad_param, internal)) * err) + { + ZlibtranMooringParms mp = (ZlibtranMooringParms) self->mo_data; + return ((*mp->lower->mo_enableWait) (mp->lower, err)); + } + + /* Main Invariant holds; L2 >= self's {xmu, ymu} */ + + static ilu_Transport + _zlibtran_AcceptClient(ilu_Mooring self, ilu_string * tinfo_out, + ilu_integer *dfd, ilu_Passport pp, + ILU_ERRS((IoErrs)) * err) + { + ZlibtranMooringParms mp = (ZlibtranMooringParms) self->mo_data; + ilu_Transport lower; + ilu_string subtinfo = NIL; + ilu_Transport ans = NIL; + lower = ((*mp->lower->mo_accept_connection) + (mp->lower, tinfo_out ? &subtinfo : NIL, dfd, pp, err)); + if (ILU_ERRNOK(*err) || lower == NIL) + goto dun; + if (tinfo_out) { + *tinfo_out = ilu_Strcat3E("zlib", " over ", subtinfo, err); + if (ILU_ERRNOK(*err)) + goto dun; + } + ans = NewTrans(lower, mp->boundaried, lower->tr_class->tc_boundaried, + mp->compression_level, mp->buffer_size, dfd, err); + dun: + if (subtinfo) + ilu_free(subtinfo); + return ans; + } + + /*L1.sup < trmu; L2 >= {xmu, ymu}*/ + static ilu_boolean + _zlibtran_CloseMooring(ilu_Mooring self, ilu_integer * dfd, + ILU_ERRS((bad_locks, broken_locks, + internal)) * err) + { + ZlibtranMooringParms mp = (ZlibtranMooringParms) self->mo_data; + if (!(*mp->lower->mo_close) (mp->lower, dfd, err)) + return ilu_FALSE; + ilu_free(mp); + ilu_free(self); + return ilu_TRUE; + } + + /*L1, L2 unconstrained*/ + + static struct _ilu_Mooring_s mooringProto = { + _zlibtran_MooringDFd, + _zlibtran_SetReqHandler, + _zlibtran_WaitForReq, + _zlibtran_DisableReqWait, + _zlibtran_EnableReqWait, + _zlibtran_AcceptClient, + _zlibtran_CloseMooring, + NIL /* data */ + }; + + /*L1.sup < trmu*/ + static ilu_Mooring + _zlibtran_CreateMooring(ilu_TransportCreator self, + ilu_TransportInfo * tinfo_out, + ilu_boolean buffer, + ilu_integer *dfd, + ilu_Passport pp, /* unused here */ + ILU_ERRS((no_memory)) * err) + { + ZlibtranCreatorParms cp = (ZlibtranCreatorParms) self->tcr_data; + ZlibtranMooringParms mp; + ilu_Mooring lower, ans; + ilu_TransportInfo subtinfo = NIL; + lower = ((*cp->lower->tcr_createMooring) + (cp->lower, tinfo_out ? &subtinfo : NIL, buffer, dfd, pp, err)); + if (ILU_ERRNOK(*err)) + return NIL; + ans = (ilu_Mooring) ilu_MallocE(sizeof(*ans), err); + if (ans == NIL) + return NIL; + mp = (ZlibtranMooringParms) ilu_MallocE(sizeof(*mp), err); + if (mp == NIL) { ilu_free(ans); return NIL; }; + if (tinfo_out) { + char buf[1024]; /* !!!pab!!! Don't hard-code it */ + sprintf (buf, "zlib_%s", cp->boundaried ? "boundaried" : "nonboundaried"); + if (cp->compression_level != Z_DEFAULT_COMPRESSION) + sprintf(strchr(buf,'\0'), "_%d", cp->compression_level); + if (cp->buffer_size != Z_BUFSZ) + sprintf(strchr(buf,'\0'), "_%d", cp->buffer_size); + *tinfo_out = _ilu_ConcatTinfo (buf, subtinfo, err); + if (ILU_ERRNOK(*err)) + return NIL; + else + ilu_free(subtinfo); + } + *ans = mooringProto; + mp->lower = lower; + mp->lower_boundaried = cp->lower_boundaried; + mp->boundaried = cp->boundaried; + mp->compression_level = cp->compression_level; + mp->buffer_size = cp->buffer_size; + ans->mo_data = mp; + return (ans); + } + + static void _zlibtran_CloseCreator(ilu_TransportCreator self) + { + ZlibtranCreatorParms cp = (ZlibtranCreatorParms) self->tcr_data; + (*cp->lower->tcr_close) (cp->lower); + ilu_free(cp); + ilu_free(self); + return; + } + + static struct _ilu_TransportCreator_s myCreatorProto = { + ilu_TRUE, /* boundaried */ + ilu_TRUE, /* reliable */ + 0, /* tcr_holds */ + ilu_FALSE, /* tcr_wantClose */ + _zlibtran_FdUsage, + _zlibtran_CreateTransport, + _zlibtran_CreateMooring, + _zlibtran_CloseCreator, + NIL /* data */ + }; + + /*L1.sup < trmu*/ + ilu_TransportCreator + _ilu_zlib_TransportCreator(ilu_TransportInfo tinfo, + ILU_ERRS((no_memory, + inv_objref)) * err) + { + ilu_TransportCreator ans; + ZlibtranCreatorParms cp; + cp = _zlibtran_InterpretInfo(tinfo, err); + if (ILU_ERRNOK(*err)) + return NIL; + ans = (ilu_TransportCreator) ilu_MallocE(sizeof(*ans), err); + if (ans == NIL) + return NIL; + *ans = myCreatorProto; + ans->tcr_data = cp; + ans->tcr_boundaried = cp->boundaried; + ILU_CLER(*err); + return ans; + }
*** 1.20 1999/01/20 19:16:43 --- examples/test2/fprog.c 1999/06/16 00:35:16 *************** *** 354,360 **** char *progname = argv[0]; ilu_boolean threadit = ilu_FALSE; ILU_C_ENVIRONMENT env = {0}; ! unsigned fds, setFds, gotFds = 0; argv++; argc--; --- 354,360 ---- char *progname = argv[0]; ilu_boolean threadit = ilu_FALSE; ILU_C_ENVIRONMENT env = {0}; ! unsigned fds, setFds=0, gotFds = 0; argv++; argc--; *************** *** 412,417 **** --- 412,418 ---- fds, gotFds); exit(1); } + printf("Asked for ILU FD budget of %u, got %u.\n", fds, gotFds); } if (threadit) { #ifdef ILU_OS_THREADED
*** 1.1 1999/07/21 00:15:50 --- runtime/python/iluPrmodule.c 1999/07/21 00:17:15 *************** *** 8335,8350 **** } #endif - ilu_NewConnectionGetterForked(&err); - ilupython_fork_thread(ilupython_collect_outgoing_connections, NULL); - - if (!ILU_ERROK(err)) - return _ilupython_RaiseILUGeneralError(&err); - ilupython_threaded_operation = ilu_TRUE; PyEval_InitThreads(); PyThread_init_thread(); Py_INCREF(Py_None); return Py_None; --- 8335,8353 ---- } #endif ilupython_threaded_operation = ilu_TRUE; PyEval_InitThreads(); PyThread_init_thread(); + + ilu_NewConnectionGetterForked(&err); + + if (!ILU_ERROK(err)) { + ilupython_threaded_operation = ilu_FALSE; + return _ilupython_RaiseILUGeneralError(&err); + }; + + ilupython_fork_thread(ilupython_collect_outgoing_connections, NULL); Py_INCREF(Py_None); return Py_None;
I am working on a distributed application with ILU clients and omniORB2 servers. The ILU client is running 2.0alpha13, which I ported to VAXELN. The omniORB version is 2.6.1, running on RedHat 5.2.
From the ILU client I make a CreateFromSBH call, and in some cases omniORB returns the OBJECT_NOT_EXIST exception which is unknown to ILU. The client program then hangs in the CreateFromSBH call.
I traced through the ILU source code, and found that the FigureExceptionIndexFromIDLName function in iiop.c is returning 0 if the exception is unknown to ILU. 0 corresponds to ilu_ProtocolException_Success. I think this leads the ILU code to think everything is ok, and then it hangs somewhere in the ilu_InputBoolean call from the IsOfTypeViaRPC function.
I checked the alpha14 source code, and it also returns 0 in the case of unknown exceptions.
I changed FigureExceptionIndexFromIDLName to return ilu_ProtocolException_Unknown instead of 0 if it comes across an unknown exception. That seems to clear up the problem - at least the program doesn't hang anymore.
*** 1.1 1999/07/22 00:37:49 --- runtime/kernel/iiop.c 1999/07/22 00:41:52 *************** *** 1002,1008 **** } ILU_NOTE(IIOP_DEBUG, ("(FigureExceptionIndexFromIDLName): no standard exception '%s' known.\n", rep_id)); ! return 0; } } --- 1002,1008 ---- } ILU_NOTE(IIOP_DEBUG, ("(FigureExceptionIndexFromIDLName): no standard exception '%s' known.\n", rep_id)); ! return ilu_ProtocolException_Unknown; } } *************** *** 8615,8622 **** return ilu_ProtocolException_Not; *exception_code = minor; ILU_NOTE(IIOP_DEBUG, ! ("_IIOP_InterpretReply: system exception <%s> received, minor code %lu," ! " completed %s\n", ilu_PEName(i), (unsigned long) minor, (completed == 0) ? "YES" : ((completed == 1) ? "NO" : ((completed == 2) ? "MAYBE" : "INVALID")))); return (i); } --- 8615,8622 ---- return ilu_ProtocolException_Not; *exception_code = minor; ILU_NOTE(IIOP_DEBUG, ! ("_IIOP_InterpretReply: system exception <%s> (mapped to protocol error %s) received, minor code %lu," ! " completed %s\n", exception_name, ilu_PEName(i), (unsigned long) minor, (completed == 0) ? "YES" : ((completed == 1) ? "NO" : ((completed == 2) ? "MAYBE" : "INVALID")))); return (i); }
End of patches