Ejemplo n.º 1
0
static PyObject *
pyorbit_poa_deactivate_object(PyCORBA_Object *self, PyObject *args)
{
    CORBA_Environment ev;
    PortableServer_ObjectId *id;
    Py_ssize_t id_length;
    id = (PortableServer_ObjectId *)CORBA_sequence_CORBA_octet__alloc();
    id->_release = CORBA_FALSE;
    if (!PyArg_ParseTuple(args, "s#:POA.deactivate_object",
			  &id->_buffer, &id_length)) {
	CORBA_free(id);
	return NULL;
    }
    id->_length = id_length;
    id->_length++; /* account for nul termination */

    CORBA_exception_init(&ev);
    PortableServer_POA_deactivate_object((PortableServer_POA)self->objref,
					 id, &ev);
    CORBA_free(id);
    if (pyorbit_check_ex(&ev))
	return NULL;

    Py_INCREF(Py_None);
    return Py_None;
}
Ejemplo n.º 2
0
static PyObject *
pyorbit_poa_activate_object_with_id(PyCORBA_Object *self, PyObject *args)
{
    CORBA_Environment ev;
    PyPortableServer_Servant *pyservant;
    PortableServer_ServantBase *servant;
    PortableServer_ObjectId *id;
    Py_ssize_t id_length;

    id = (PortableServer_ObjectId *)CORBA_sequence_CORBA_octet__alloc();
    id->_release = CORBA_FALSE;
    if (!PyArg_ParseTuple(args, "s#O!:POA.activate_object_with_id",
			  &id->_buffer, &id_length,
			  &PyPortableServer_Servant_Type, &pyservant)) {
	CORBA_free(id);
	return NULL;
    }
    id->_length = id_length;
    id->_length++; /* account for nul termination */
    servant = PYSERVANT_TO_SERVANT(pyservant);

    CORBA_exception_init(&ev);
    PortableServer_POA_activate_object_with_id((PortableServer_POA)self->objref,
					       id, servant, &ev);
    CORBA_free(id);
    if (pyorbit_check_ex(&ev))
	return NULL;

    Py_INCREF(Py_None);
    return Py_None;
}
/* taken from Mico ORB */ 
static MateCORBA_ObjectKey*
matecorba_url_decode (const char * ptr)
{
	MateCORBA_ObjectKey *retval  = NULL;
	guchar * buf = NULL; 
	
        retval = CORBA_sequence_CORBA_octet__alloc ();
	retval->_length  = 0;
	retval->_maximum = strlen (ptr)+1;
	retval->_buffer  = CORBA_sequence_CORBA_octet_allocbuf (retval->_maximum);
	retval->_release = CORBA_TRUE;

	buf = retval->_buffer;

	while (*ptr) {
		if (*ptr == '%') {
			if (!isxdigit((unsigned char)ptr[1]) ||
			    !isxdigit((unsigned char)ptr[2])) {
				CORBA_free (retval);
				return NULL;
			}
			*buf = (matecorba_from_xdigit(ptr[1])<<4 |
				       matecorba_from_xdigit(ptr[2]));
			ptr += 3;
		}
		else {
			*buf = *ptr++;
		}
		buf++;
		(retval->_length)++;
	}
	
	/*
	 * Null-terminate the result so that it can be used as a
	 * string. The null is deliberately not added to the length,
	 * because it isn't part of the string.
	 */
	
	*buf = 0;

	return retval;
}