void rpc_ss_update_callee_context ( rpc_ss_context_t callee_context, /* The user's local form of the context */ dce_uuid_t *p_uuid, /* Pointer to the equivalent UUID */ error_status_t *result /* Function result */ ) { callee_context_entry_t *this_link; #ifdef PERFMON RPC_SS_UPDATE_CALLEE_CONTEXT_N; #endif RPC_SS_THREADS_MUTEX_LOCK(&rpc_ss_context_table_mutex); DPRINT(("Seized context tables\n")); this_link = &context_table[dce_uuid_hash(p_uuid,result) % CALLEE_CONTEXT_TABLE_SIZE]; while ( ! dce_uuid_equal(p_uuid,&this_link->uuid,result) ) { this_link = this_link->next_context; if (this_link == NULL) { RPC_SS_THREADS_MUTEX_UNLOCK(&rpc_ss_context_table_mutex); DPRINT(("Released context tables\n")); DCETHREAD_RAISE( rpc_x_ss_context_mismatch); } } this_link->user_context = callee_context; RPC_SS_THREADS_MUTEX_UNLOCK(&rpc_ss_context_table_mutex); DPRINT(("Released context tables\n")); *result = error_status_ok; #ifdef PERFMON RPC_SS_UPDATE_CALLEE_CONTEXT_X; #endif }
/* Allocate callee client lookup table and initialize pointers to NULL. */ void rpc_ss_init_callee_client_table( void ) { #ifdef PERFMON RPC_SS_INIT_CALLEE_CLNT_TABLE_N; #endif assert(!client_table); /* Must not be called more than once. */ client_table = (callee_client_entry_t *)malloc( CALLEE_CLIENT_TABLE_SIZE * sizeof(callee_client_entry_t) ); if (!client_table) DCETHREAD_RAISE(rpc_x_no_memory); memset(client_table, 0, CALLEE_CLIENT_TABLE_SIZE * sizeof(callee_client_entry_t)); #ifdef PERFMON RPC_SS_INIT_CALLEE_CLNT_TABLE_X; #endif }
void rpc_ss_ndr_u_conf_cs_struct_hdr ( idl_byte *struct_defn_ptr, /* [in] Start of structure definition */ idl_byte *array_defn_ptr, /* [in] Points at start of bounds info */ idl_ulong_int *Z_values, /* [in] Unmarshalled Z value */ idl_ulong_int fixed_part_size, /* [in] size of structure excluding conformant array */ idl_boolean type_has_pointers, /* [in] */ idl_ulong_int conf_arr_shadow_index, /* [in] index in shadow of conformant array */ idl_boolean allocate, /* [in] TRUE=>structure must be allocated */ IDL_cs_shadow_elt_t *cs_shadow, /* [out] convert type and local value of [size_is] */ rpc_void_p_t *p_param_addr, /* [out] NULL or where to put address of allocated structure */ IDL_msp_t IDL_msp ) { idl_ulong_int sz_index; /* Index in shadow of [size_is] item */ idl_ulong_int cs_type_defn_index; idl_byte *cs_type_defn_ptr; idl_ulong_int routine_index; void (**routine_ptr)(); idl_ulong_int l_storage_len; idl_byte *base_type_defn_ptr; /* Pointer to base type of array */ /* Skip over lower bound entirely and upper bound kind and type */ array_defn_ptr += IDL_CONF_BOUND_PAIR_WIDTH/2 + 2; IDL_GET_LONG_FROM_VECTOR(sz_index, array_defn_ptr); sz_index--; /* array_defn_ptr is now pointing to the base type, which has [cs_char] */ base_type_defn_ptr = array_defn_ptr; array_defn_ptr += 2; /* IDL_DT_CS_TYPE and properties byte */ IDL_GET_LONG_FROM_VECTOR(cs_type_defn_index, array_defn_ptr); cs_type_defn_ptr = IDL_msp->IDL_type_vec + cs_type_defn_index; IDL_DISCARD_LONG_FROM_VECTOR(cs_type_defn_ptr); /* Size of local type */ IDL_GET_LONG_FROM_VECTOR(routine_index, cs_type_defn_ptr); routine_ptr = IDL_msp->IDL_rtn_vec + routine_index; /* Call ..._local_size */ (*(routine_ptr + IDL_RTN_LOCAL_SIZE_INDEX))(IDL_msp->IDL_h, *(IDL_msp->IDL_cs_tags_p->p_unmar_tag), *Z_values, &cs_shadow[conf_arr_shadow_index].IDL_convert_type, &l_storage_len, &(IDL_msp->IDL_status)); if (IDL_msp->IDL_status != error_status_ok) DCETHREAD_RAISE(rpc_x_ss_pipe_comm_error); cs_shadow[sz_index].IDL_data.IDL_value = l_storage_len; if (allocate) { rpc_ss_ndr_alloc_storage(fixed_part_size, 1, &l_storage_len, base_type_defn_ptr, p_param_addr, IDL_msp); if (type_has_pointers) { rpc_ss_init_new_struct_ptrs(IDL_DT_CONF_STRUCT, struct_defn_ptr, *p_param_addr, &l_storage_len, IDL_msp); } } }
void rpc_ss_ndr_u_param_cs_shadow ( idl_ulong_int type_index, /* [in] Index of start of definitions of parameter list */ IDL_cs_shadow_elt_t *cs_shadow, /* [in] Address of cs-shadow */ IDL_msp_t IDL_msp ) { idl_byte *type_vec_ptr; idl_byte type_byte; idl_ulong_int param_index; /* Loop over parameters. Exit when DT_RLSE_SHADOW found */ type_vec_ptr = (IDL_msp->IDL_type_vec) + type_index; for ( ; ; ) { IDL_GET_LONG_FROM_VECTOR(param_index,type_vec_ptr); do { type_byte = *type_vec_ptr; type_vec_ptr++; switch(type_byte) { case IDL_DT_CS_ATTRIBUTE: /* The local value of the attribute variable is taken from the shadow */ rpc_ss_put_typed_integer( cs_shadow[param_index-1].IDL_data.IDL_value, *type_vec_ptr, IDL_msp->IDL_param_vec[param_index]); type_vec_ptr++; /* attribute type */ break; /* For any other parameters we just need to move over them */ case IDL_DT_BYTE: case IDL_DT_CHAR: case IDL_DT_BOOLEAN: case IDL_DT_DOUBLE: case IDL_DT_ENUM: case IDL_DT_FLOAT: case IDL_DT_SMALL: case IDL_DT_SHORT: case IDL_DT_LONG: case IDL_DT_HYPER: case IDL_DT_USMALL: case IDL_DT_USHORT: case IDL_DT_ULONG: case IDL_DT_UHYPER: case IDL_DT_IGNORE: case IDL_DT_V1_ENUM: case IDL_DT_ERROR_STATUS: case IDL_DT_IN_CONTEXT: case IDL_DT_IN_OUT_CONTEXT: case IDL_DT_OUT_CONTEXT: break; case IDL_DT_FIXED_ARRAY: case IDL_DT_VARYING_ARRAY: case IDL_DT_CONF_ARRAY: case IDL_DT_OPEN_ARRAY: /* Properties byte */ type_vec_ptr++; IDL_DISCARD_LONG_FROM_VECTOR(type_vec_ptr); /* Full array definition */ IDL_DISCARD_LONG_FROM_VECTOR(type_vec_ptr); /* Flattened array definition */ break; case IDL_DT_FIXED_STRUCT: case IDL_DT_CONF_STRUCT: case IDL_DT_V1_CONF_STRUCT: case IDL_DT_ENC_UNION: case IDL_DT_N_E_UNION: case IDL_DT_FULL_PTR: case IDL_DT_UNIQUE_PTR: case IDL_DT_REF_PTR: case IDL_DT_TRANSMIT_AS: case IDL_DT_REPRESENT_AS: case IDL_DT_PIPE: case IDL_DT_CS_TYPE: /* Properties byte */ type_vec_ptr++; IDL_DISCARD_LONG_FROM_VECTOR(type_vec_ptr); break; case IDL_DT_ALLOCATE_REF: rpc_ss_discard_allocate_ref(&type_vec_ptr); break; case IDL_DT_CS_SHADOW: case IDL_DT_FREE_REP: IDL_DISCARD_LONG_FROM_VECTOR(type_vec_ptr); break; case IDL_DT_PASSED_BY_REF: case IDL_DT_STRING: case IDL_DT_ALLOCATE: case IDL_DT_V1_ARRAY: case IDL_DT_V1_STRING: case IDL_DT_DELETED_NODES: case IDL_DT_CS_ARRAY: break; case IDL_DT_CS_RLSE_SHADOW: rpc_ss_mem_item_free(&IDL_msp->IDL_mem_handle, (byte_p_t)cs_shadow); return; case IDL_DT_RANGE: IDL_DISCARD_LONG_FROM_VECTOR(type_vec_ptr); IDL_DISCARD_LONG_FROM_VECTOR(type_vec_ptr); break; case IDL_DT_EOL: break; default: #ifdef DEBUG_INTERP printf("rpc_ss_ndr_u_param_cs_shadow:unrecognized type %d\n", type_byte); exit(0); #endif DCETHREAD_RAISE(rpc_x_coding_error); } } while (type_byte != IDL_DT_EOL); } }
void rpc_ss_ndr_u_struct_cs_shadow ( rpc_void_p_t struct_addr, /* [in] Address of struct */ idl_byte struct_type ATTRIBUTE_UNUSED, /* [in] FIXED_STRUCT or CONF_STRUCT */ idl_ulong_int offset_index, /* [in] Start of struct's offset vec */ idl_byte *defn_vec_ptr, /* [in] Posn following shadow length */ IDL_cs_shadow_elt_t *cs_shadow, /* [in] Address of cs-shadow */ IDL_msp_t IDL_msp ) { idl_ulong_int *offset_vec_ptr; idl_byte type_byte; idl_ulong_int shadow_index; /* Index into cs-shadow */ offset_vec_ptr = IDL_msp->IDL_offset_vec + offset_index + 1; /* Skip over size at start of offsets */ shadow_index = 0; do { type_byte = *defn_vec_ptr; defn_vec_ptr++; switch(type_byte) { case IDL_DT_CS_ATTRIBUTE: /* The local value of the attribute variable is taken from the shadow */ rpc_ss_put_typed_integer( cs_shadow[shadow_index].IDL_data.IDL_value, *defn_vec_ptr, (rpc_void_p_t)((idl_byte *)struct_addr + *offset_vec_ptr)); defn_vec_ptr++; /* attribute type */ shadow_index++; offset_vec_ptr++; break; case IDL_DT_BYTE: case IDL_DT_CHAR: case IDL_DT_BOOLEAN: case IDL_DT_DOUBLE: case IDL_DT_ENUM: case IDL_DT_FLOAT: case IDL_DT_SMALL: case IDL_DT_SHORT: case IDL_DT_LONG: case IDL_DT_HYPER: case IDL_DT_USMALL: case IDL_DT_USHORT: case IDL_DT_ULONG: case IDL_DT_UHYPER: case IDL_DT_IGNORE: case IDL_DT_V1_ENUM: case IDL_DT_ERROR_STATUS: offset_vec_ptr++; shadow_index++; break; case IDL_DT_FIXED_ARRAY: case IDL_DT_VARYING_ARRAY: case IDL_DT_CONF_ARRAY: case IDL_DT_OPEN_ARRAY: /* Properties byte */ defn_vec_ptr++; IDL_DISCARD_LONG_FROM_VECTOR(defn_vec_ptr); /* Full array definition */ IDL_DISCARD_LONG_FROM_VECTOR(defn_vec_ptr); /* Flattened array definition */ offset_vec_ptr++; cs_shadow[shadow_index].IDL_release = idl_false; shadow_index++; break; case IDL_DT_ENC_UNION: case IDL_DT_N_E_UNION: case IDL_DT_FULL_PTR: case IDL_DT_UNIQUE_PTR: case IDL_DT_REF_PTR: case IDL_DT_TRANSMIT_AS: case IDL_DT_REPRESENT_AS: case IDL_DT_CS_TYPE: /* Properties byte */ defn_vec_ptr++; IDL_DISCARD_LONG_FROM_VECTOR(defn_vec_ptr); offset_vec_ptr++; shadow_index++; break; case IDL_DT_RANGE: IDL_DISCARD_LONG_FROM_VECTOR(defn_vec_ptr); IDL_DISCARD_LONG_FROM_VECTOR(defn_vec_ptr); break; case IDL_DT_STRING: case IDL_DT_NDR_ALIGN_2: case IDL_DT_NDR_ALIGN_4: case IDL_DT_NDR_ALIGN_8: case IDL_DT_BEGIN_NESTED_STRUCT: case IDL_DT_END_NESTED_STRUCT: case IDL_DT_V1_ARRAY: case IDL_DT_V1_STRING: case IDL_DT_CS_ARRAY: case IDL_DT_CS_RLSE_SHADOW: case IDL_DT_EOL: break; default: #ifdef DEBUG_INTERP printf("rpc_ss_ndr_u_struct_cs_shadow:unrecognized type %d\n", type_byte); exit(0); #endif DCETHREAD_RAISE(rpc_x_coding_error); } } while (type_byte != IDL_DT_EOL); /* Release the cs-shadow */ rpc_ss_mem_item_free(&IDL_msp->IDL_mem_handle, (byte_p_t)cs_shadow); }
void rpc_ss_ndr_unmar_cs_char ( rpc_void_p_t data_addr, /* [in] */ idl_ulong_int cs_type_defn_index, /* [in] */ IDL_msp_t IDL_msp ) { idl_byte *cs_type_defn_ptr; idl_ulong_int routine_index; void (**routine_ptr)(); /* Parameters for ..._net_size */ idl_ulong_int w_storage_len = 1; idl_cs_convert_t convert_type; /* Parameters for ..._to_netcs */ rpc_void_p_t wdata; cs_type_defn_ptr = IDL_msp->IDL_type_vec + cs_type_defn_index; IDL_DISCARD_LONG_FROM_VECTOR(cs_type_defn_ptr); /* Size of local type */ IDL_GET_LONG_FROM_VECTOR(routine_index, cs_type_defn_ptr); routine_ptr = IDL_msp->IDL_rtn_vec + routine_index; /* Call ..._local_size */ (*(routine_ptr + IDL_RTN_LOCAL_SIZE_INDEX))(IDL_msp->IDL_h, *(IDL_msp->IDL_cs_tags_p->p_unmar_tag), w_storage_len, &convert_type, NULL, &IDL_msp->IDL_status); if (IDL_msp->IDL_status != error_status_ok) DCETHREAD_RAISE(rpc_x_ss_pipe_comm_error); if (convert_type == idl_cs_new_buffer_convert) { /* Allocate a conversion buffer - cs_type_defn_ptr now points at network type */ wdata = (idl_void_p_t)rpc_ss_mem_alloc(&IDL_msp->IDL_mem_handle, rpc_ss_type_size(cs_type_defn_ptr, IDL_msp)); } else wdata = data_addr; rpc_ss_ndr_u_fix_or_conf_arr(1, &w_storage_len, cs_type_defn_ptr, wdata, 0, IDL_msp); if (convert_type != idl_cs_no_convert) { /* Call ..._from_netcs */ (*(routine_ptr + IDL_RTN_FROM_NETCS_INDEX))(IDL_msp->IDL_h, *(IDL_msp->IDL_cs_tags_p->p_unmar_tag), wdata, w_storage_len, w_storage_len, data_addr, NULL, &IDL_msp->IDL_status); if (IDL_msp->IDL_status != error_status_ok) DCETHREAD_RAISE(rpc_x_ss_codeset_conv_error); } if (convert_type == idl_cs_new_buffer_convert) { /* Release conversion buffer */ rpc_ss_mem_item_free(&IDL_msp->IDL_mem_handle, (byte_p_t)wdata); } }
void rpc_ss_ndr_unmar_cs_array ( rpc_void_p_t array_addr, /* [in] */ IDL_cs_shadow_elt_t *cs_shadow, /* [in] ignored for fixed array */ idl_ulong_int *Z_values, /* [in] ignored if array not conformant */ idl_ulong_int array_shadow_index, /* [in] ignored if array not conformant Position of array in cs-shadow */ idl_byte **p_defn_vec_ptr, /* [in] Points at DT_..._ARRAY [out] Points after array definition */ IDL_msp_t IDL_msp ) { idl_byte *defn_vec_ptr; idl_byte array_type; idl_boolean conformant; /* TRUE => array is conformant or open */ idl_ulong_int array_defn_index; idl_byte *array_defn_ptr; IDL_bound_pair_t *bounds_list; IDL_bound_pair_t range_data; idl_ulong_int cs_type_defn_index; idl_byte *cs_type_defn_ptr; idl_ulong_int routine_index; idl_ulong_int ln_index; /* Index in shadow of [length_is] item */ idl_ulong_int sz_index; /* Index in shadow of [size_is] item */ void (**routine_ptr)(); /* Parameters for ..._net_size */ idl_ulong_int l_storage_len; idl_ulong_int w_storage_len; idl_cs_convert_t convert_type; /* Parameters for ..._to_netcs */ idl_ulong_int l_data_len; rpc_void_p_t wdata; idl_ulong_int w_data_len; defn_vec_ptr = *p_defn_vec_ptr; array_type = *defn_vec_ptr; conformant = ! ((array_type == IDL_DT_FIXED_ARRAY) || (array_type == IDL_DT_VARYING_ARRAY)); defn_vec_ptr += 2; /* Array type and properties byte */ IDL_DISCARD_LONG_FROM_VECTOR(defn_vec_ptr); /* Full array definition */ IDL_GET_LONG_FROM_VECTOR(array_defn_index, defn_vec_ptr); array_defn_ptr = IDL_msp->IDL_type_vec + array_defn_index; array_defn_ptr++; /* dimensionality */ if ( ! conformant ) { if (IDL_msp->IDL_type_vec[TVEC_INT_REP_OFFSET] != NDR_LOCAL_INT_REP) rpc_ss_fixed_bounds_from_vector(1, array_defn_ptr, &bounds_list, IDL_msp); else bounds_list = (IDL_bound_pair_t *)array_defn_ptr; array_defn_ptr += IDL_FIXED_BOUND_PAIR_WIDTH; w_storage_len = bounds_list[0].upper - bounds_list[0].lower + 1; l_storage_len = w_storage_len; } else /* Conformant or open */ { /* Skip over lower bound entirely and upper bound kind and type */ array_defn_ptr += IDL_CONF_BOUND_PAIR_WIDTH/2 + 2; IDL_GET_LONG_FROM_VECTOR(sz_index, array_defn_ptr); sz_index--; l_storage_len = cs_shadow[sz_index].IDL_data.IDL_value; w_storage_len = *Z_values; } /* Data limit information */ if ((array_type == IDL_DT_VARYING_ARRAY) || (array_type == IDL_DT_OPEN_ARRAY)) { idl_ulong_int lower; /* Skip over lower data limit entirely and upper data limit kind */ array_defn_ptr += IDL_DATA_LIMIT_PAIR_WIDTH/2 + 1; IDL_GET_LONG_FROM_VECTOR(ln_index, array_defn_ptr); ln_index--; IDL_UNMAR_ULONG(&lower); /* A-value */ range_data.lower = lower; /* The B-value is the wire form of [length_is] */ IDL_UNMAR_ULONG(&w_data_len); range_data.upper = range_data.lower + w_data_len; } else w_data_len = w_storage_len; /* array_defn_ptr is now pointing to the base type, which has [cs_char] */ array_defn_ptr += 2; /* IDL_DT_CS_TYPE and properties byte */ IDL_GET_LONG_FROM_VECTOR(cs_type_defn_index, array_defn_ptr); cs_type_defn_ptr = IDL_msp->IDL_type_vec + cs_type_defn_index; IDL_DISCARD_LONG_FROM_VECTOR(cs_type_defn_ptr); /* Size of local type */ IDL_GET_LONG_FROM_VECTOR(routine_index, cs_type_defn_ptr); routine_ptr = IDL_msp->IDL_rtn_vec + routine_index; /* cs_type_defn_ptr now pointing at network type definition */ if ( conformant ) convert_type = cs_shadow[array_shadow_index].IDL_convert_type; else { /* Call ..._local_size */ (*(routine_ptr + IDL_RTN_LOCAL_SIZE_INDEX))(IDL_msp->IDL_h, *(IDL_msp->IDL_cs_tags_p->p_unmar_tag), w_storage_len, &convert_type, ( ! conformant ) ? NULL : &l_storage_len, &IDL_msp->IDL_status); if (IDL_msp->IDL_status != error_status_ok) DCETHREAD_RAISE(rpc_x_ss_pipe_comm_error); } if (convert_type == idl_cs_new_buffer_convert) { wdata = (rpc_void_p_t)rpc_ss_mem_alloc(&IDL_msp->IDL_mem_handle, w_storage_len * rpc_ss_type_size(cs_type_defn_ptr, IDL_msp)); } else wdata = array_addr; /* Unmarshall the wire form of the data */ if ((array_type == IDL_DT_FIXED_ARRAY) || (array_type == IDL_DT_CONF_ARRAY)) { rpc_ss_ndr_u_fix_or_conf_arr(1, &w_storage_len, cs_type_defn_ptr, wdata, 0, IDL_msp); w_data_len = w_storage_len; } else /* Varying or open */ { rpc_ss_ndr_u_var_or_open_arr(1, &w_storage_len, cs_type_defn_ptr, wdata, &range_data, 0, IDL_msp); } if (convert_type != idl_cs_no_convert) { /* Call ..._from_netcs */ (*(routine_ptr + IDL_RTN_FROM_NETCS_INDEX))(IDL_msp->IDL_h, *(IDL_msp->IDL_cs_tags_p->p_unmar_tag), wdata, w_data_len, l_storage_len, array_addr, ((array_type == IDL_DT_FIXED_ARRAY) || (array_type == IDL_DT_CONF_ARRAY)) ? NULL : &l_data_len, &IDL_msp->IDL_status); if (IDL_msp->IDL_status != error_status_ok) DCETHREAD_RAISE(rpc_x_ss_codeset_conv_error); } else { l_data_len = w_data_len; } if ((array_type == IDL_DT_VARYING_ARRAY) || (array_type == IDL_DT_OPEN_ARRAY)) { cs_shadow[ln_index].IDL_data.IDL_value = l_data_len; } if (convert_type == idl_cs_new_buffer_convert) { rpc_ss_mem_item_free(&IDL_msp->IDL_mem_handle, wdata); } *p_defn_vec_ptr = defn_vec_ptr; if (IDL_msp->IDL_type_vec[TVEC_INT_REP_OFFSET] != NDR_LOCAL_INT_REP) if ( ! conformant ) rpc_ss_mem_item_free(&IDL_msp->IDL_mem_handle, (byte_p_t)bounds_list); }
void rpc_ss_lkddest_callee_context ( dce_uuid_t *p_uuid, /* Pointer to UUID of context to be destroyed */ rpc_client_handle_t *p_close_client, /* Ptr to NULL or client to stop monitoring */ error_status_t *result /* Function result */ ) /* Returns error_status_ok unless the UUID is not in the lookup table */ { callee_context_entry_t *this_link, *next_link, *last_link; #ifdef PERFMON RPC_SS_LKDDEST_CALLEE_CONTEXT_N; #endif this_link = &context_table[dce_uuid_hash(p_uuid,(error_status_t *) result) % CALLEE_CONTEXT_TABLE_SIZE]; next_link = this_link->next_context; if ( dce_uuid_equal(p_uuid,&this_link->uuid, (error_status_t *) result) ) { /* Context to be destroyed is in home slot */ rpc_ss_take_from_callee_client(this_link,p_close_client,result); if (next_link == NULL) { /* There is no chain from the home slot */ dce_uuid_create_nil(&this_link->uuid, (error_status_t *) result); } else { /* Move the second item in the chain to the home slot */ memcpy( (char *)&this_link->uuid, (char *)&next_link->uuid, sizeof(dce_uuid_t) ); this_link->user_context = next_link->user_context; this_link->rundown = next_link->rundown; this_link->p_client_entry = next_link->p_client_entry; this_link->prev_in_client = next_link->prev_in_client; if (this_link->prev_in_client == NULL) { (this_link->p_client_entry)->first_context = this_link; } else { (this_link->prev_in_client)->next_in_client = this_link; } this_link->next_in_client = next_link->next_in_client; if (this_link->next_in_client == NULL) { (this_link->p_client_entry)->last_context = this_link; } else { (this_link->next_in_client)->prev_in_client = this_link; } this_link->next_context = next_link->next_context; /* And release the memory it was in */ free((char_p_t)next_link); } #ifdef PERFMON RPC_SS_LKDDEST_CALLEE_CONTEXT_X; #endif return; } else /* Context is further down chain */ { while (next_link != NULL) { last_link = this_link; this_link = next_link; next_link = this_link->next_context; if ( dce_uuid_equal(p_uuid,&this_link->uuid,(error_status_t *)result) ) { rpc_ss_take_from_callee_client(this_link,p_close_client,result); /* Relink chain to omit found entry */ last_link->next_context = next_link; /* And free the memory it occupied */ free((char_p_t)this_link); #ifdef PERFMON RPC_SS_LKDDEST_CALLEE_CONTEXT_X; #endif return; } } RPC_SS_THREADS_MUTEX_UNLOCK(&rpc_ss_context_table_mutex); DPRINT(("Released context tables\n")); DCETHREAD_RAISE( rpc_x_ss_context_mismatch); } }
void rpc_ss_ee_ctx_from_wire ( ndr_context_handle *p_wire_context, rpc_ss_context_t *p_context, /* The application context */ volatile error_status_t *p_st ) { dce_uuid_t *p_uuid; /* Pointer to the UUID that has come off the wire */ callee_context_entry_t *this_link; #ifdef PERFMON RPC_SS_EE_CTX_FROM_WIRE_N; #endif p_uuid = &p_wire_context->context_handle_uuid; #ifdef DEBUGCTX debug_context_lookup(p_uuid); debug_context_table(); #endif *p_st = error_status_ok; if ( dce_uuid_is_nil(p_uuid, (error_status_t *)p_st) ) { *p_context = NULL; #ifdef PERFMON RPC_SS_EE_CTX_FROM_WIRE_X; #endif return; } RPC_SS_THREADS_MUTEX_LOCK(&rpc_ss_context_table_mutex); DPRINT(("Seized context tables\n")); this_link = &context_table[dce_uuid_hash(p_uuid, (error_status_t *)p_st) % CALLEE_CONTEXT_TABLE_SIZE]; while ( ! dce_uuid_equal(p_uuid,&this_link->uuid, (error_status_t *)p_st) ) { this_link = this_link->next_context; if (this_link == NULL) { RPC_SS_THREADS_MUTEX_UNLOCK(&rpc_ss_context_table_mutex); DPRINT(("Released context tables\n")); #ifdef PERFMON RPC_SS_EE_CTX_FROM_WIRE_X; #endif DCETHREAD_RAISE( rpc_x_ss_context_mismatch ); return; } } *p_context = this_link->user_context; RPC_SS_THREADS_MUTEX_UNLOCK(&rpc_ss_context_table_mutex); DPRINT(("Released context tables\n")); #ifdef PERFMON RPC_SS_EE_CTX_FROM_WIRE_X; #endif return; }
void rpc_ss_create_callee_context ( rpc_ss_context_t callee_context,/* The user's local form of the context */ dce_uuid_t *p_uuid, /* Pointer to the equivalent UUID */ handle_t h, /* Binding handle */ ctx_rundown_fn_p_t ctx_rundown, /* Pointer to context rundown routine */ error_status_t *result /* Function result */ ) { rpc_client_handle_t ctx_client; /* ID of client owning context */ callee_context_entry_t *this_link, *next_link, * volatile new_link; ndr_boolean is_new_client; //DO_NOT_CLOBBER(new_link); #ifdef PERFMON RPC_SS_CREATE_CALLEE_CONTEXT_N; #endif /* If this is the first context to be created, initialization is needed */ RPC_SS_INIT_CONTEXT rpc_binding_inq_client(h, &ctx_client, (error_status_t *) result); if (*result != error_status_ok) return; RPC_SS_THREADS_MUTEX_LOCK(&rpc_ss_context_table_mutex); DPRINT(("Seized context tables\n")); this_link = &context_table[dce_uuid_hash(p_uuid,(error_status_t *)result) % CALLEE_CONTEXT_TABLE_SIZE]; if ( dce_uuid_is_nil(&this_link->uuid, (error_status_t *)result) ) { /* Home slot in the hash table is empty */ new_link = this_link; next_link = NULL; } else { /* Put the new item at the head of the overflow chain */ new_link = (callee_context_entry_t *) malloc(sizeof(callee_context_entry_t)); if (new_link == NULL) { RPC_SS_THREADS_MUTEX_UNLOCK(&rpc_ss_context_table_mutex); DPRINT(("Released context tables\n")); DCETHREAD_RAISE( rpc_x_no_memory ); } next_link = this_link->next_context; this_link->next_context = new_link; } /* Fill in fields of context entry */ memcpy( (char *)&new_link->uuid, (char *)p_uuid, sizeof(dce_uuid_t) ); new_link->user_context = callee_context; new_link->rundown = ctx_rundown; new_link->next_context = next_link; DCETHREAD_TRY rpc_ss_add_to_callee_client(ctx_client,new_link,&is_new_client, result); DCETHREAD_FINALLY RPC_SS_THREADS_MUTEX_UNLOCK(&rpc_ss_context_table_mutex); DPRINT(("Released context tables\n")); DCETHREAD_ENDTRY if ((*result == error_status_ok) && is_new_client) { rpc_network_monitor_liveness( h, ctx_client, rpc_ss_rundown_client, (error_status_t *) result ); #ifdef PERFMON RPC_SS_CREATE_CALLEE_CONTEXT_X; #endif } }
void rpc_ss_add_to_callee_client ( /* [in] */ rpc_client_handle_t ctx_client, /* Client for whom there is or will be a context */ /* [in] */ callee_context_entry_t *p_context, /* Pointer to the context, NULL if we are creating a client table entry to which we expect a context to be attached later */ /* [out] */ndr_boolean *p_is_new_client, /* TRUE => first context for client */ error_status_t *result /* Function result */ ) { int slot; /* Index of the slot in the lookup table the client should be in */ ndr_boolean creating_at_home; /* TRUE if new client being created in slot in lookup table */ callee_client_entry_t *this_client, *next_client, *new_client; #ifdef PERFMON RPC_SS_ADD_TO_CALLEE_CLIENT_N; #endif /* Now find which chain */ slot = HASH_CLIENT_ID(ctx_client); /* Look for the client in a chain based on the slot. Note the following possibilities exist for the slot: 1) Unoccupied. No chain. 2) Occupied. No chain. 3) Occupied. Chain exists. 4) Unoccupied. Chain exists. This is because once a client record is created it is constrained by the presence of threads machinery not to be moved */ this_client = &client_table[slot]; while (ndr_true) { if ( ctx_client == this_client->client ) { ++this_client->count; *p_is_new_client = (this_client->count == 1); /* Linkage of contexts within client */ p_context->p_client_entry = this_client; p_context->prev_in_client = this_client->last_context; p_context->next_in_client = NULL; if (this_client->first_context == NULL) { /* Client table entry created before manager was entered */ this_client->first_context = p_context; } else { (this_client->last_context)->next_in_client = p_context; } this_client->last_context = p_context; *result = error_status_ok; #ifdef PERFMON RPC_SS_ADD_TO_CALLEE_CLIENT_X; #endif return; } next_client = this_client->next_h_client; if (next_client == NULL) break; this_client = next_client; } /* Get here only if this is the first context for the client */ creating_at_home = (client_table[slot].client == NULL); if (creating_at_home) { /* The slot in the table is unoccupied */ new_client = &client_table[slot]; } else { new_client = (callee_client_entry_t *) malloc(sizeof(callee_client_entry_t)); if (new_client == NULL) { RPC_SS_THREADS_MUTEX_UNLOCK(&rpc_ss_context_table_mutex); DPRINT(("Released context tables\n")); DCETHREAD_RAISE( rpc_x_no_memory ); } this_client->next_h_client = new_client; new_client->prev_h_client = this_client; new_client->next_h_client = NULL; } new_client->client = ctx_client; new_client->rundown_pending = idl_false; RPC_SS_THREADS_CONDITION_CREATE(&(new_client->cond_var)); if (p_context == NULL) { /* New (locking) code. Client table entry created before manager entered */ new_client->count = 0; new_client->first_context = NULL; new_client->last_context = NULL; new_client->ref_count = 1; *p_is_new_client = ndr_false; } else { /* Old (non-locking) code. Client table entry created when non-null context marshalled after return from manager */ new_client->count = 1; new_client->first_context = p_context; new_client->last_context = p_context; new_client->ref_count = 0; p_context->p_client_entry = new_client; p_context->prev_in_client = NULL; p_context->next_in_client = NULL; *p_is_new_client = ndr_true; } *result = error_status_ok; #ifdef PERFMON RPC_SS_ADD_TO_CALLEE_CLIENT_X; #endif }
void rpc_ss_ndr_m_param_cs_shadow ( idl_byte *type_vec_ptr, /* [in] After shadow length */ idl_ulong_int param_index, /* [in] Index for first parameter */ /* Later used for index of current parameter */ idl_ulong_int shadow_length, /* [in] Size of cs-shadow */ IDL_cs_shadow_elt_t **p_cs_shadow, /* [out] Address of cs-shadow */ IDL_msp_t IDL_msp ) { idl_byte type_byte; IDL_cs_shadow_elt_t *cs_shadow; unsigned32 i; /* Allocate the cs-shadow */ cs_shadow = (IDL_cs_shadow_elt_t *)rpc_ss_mem_alloc (&IDL_msp->IDL_mem_handle, shadow_length * sizeof(IDL_cs_shadow_elt_t)); /* Initialize its "release" fields */ for (i=0; i<shadow_length; i++) cs_shadow[i].IDL_release = idl_false; /* Loop over parameters. Exit when DT_RLSE_SHADOW encountered */ for (i = 0; ; i++) { if (i != 0) { /* On entry we already have the parameter index the DT_CS_SHADOW was attached to */ IDL_GET_LONG_FROM_VECTOR(param_index,type_vec_ptr); } do { type_byte = *type_vec_ptr; type_vec_ptr++; switch(type_byte) { case IDL_DT_CS_ARRAY: rpc_ss_ndr_m_array_shadow(NULL, NULL, NULL, cs_shadow, param_index - 1, &type_vec_ptr, IDL_msp); break; /* For parameters that are not array of [cs_char], advance the definition pointer. And note they have no translation storage */ case IDL_DT_BYTE: case IDL_DT_CHAR: case IDL_DT_BOOLEAN: case IDL_DT_DOUBLE: case IDL_DT_ENUM: case IDL_DT_FLOAT: case IDL_DT_SMALL: case IDL_DT_SHORT: case IDL_DT_LONG: case IDL_DT_HYPER: case IDL_DT_USMALL: case IDL_DT_USHORT: case IDL_DT_ULONG: case IDL_DT_UHYPER: case IDL_DT_IGNORE: case IDL_DT_V1_ENUM: case IDL_DT_ERROR_STATUS: case IDL_DT_IN_CONTEXT: case IDL_DT_IN_OUT_CONTEXT: case IDL_DT_OUT_CONTEXT: break; case IDL_DT_FIXED_ARRAY: case IDL_DT_VARYING_ARRAY: case IDL_DT_CONF_ARRAY: case IDL_DT_OPEN_ARRAY: /* Properties byte */ type_vec_ptr++; IDL_DISCARD_LONG_FROM_VECTOR(type_vec_ptr); /* Full array definition */ IDL_DISCARD_LONG_FROM_VECTOR(type_vec_ptr); /* Flattened array definition */ break; case IDL_DT_FIXED_STRUCT: case IDL_DT_CONF_STRUCT: case IDL_DT_V1_CONF_STRUCT: case IDL_DT_ENC_UNION: case IDL_DT_N_E_UNION: case IDL_DT_FULL_PTR: case IDL_DT_UNIQUE_PTR: case IDL_DT_REF_PTR: case IDL_DT_TRANSMIT_AS: case IDL_DT_REPRESENT_AS: case IDL_DT_PIPE: case IDL_DT_CS_TYPE: /* Properties byte */ type_vec_ptr++; IDL_DISCARD_LONG_FROM_VECTOR(type_vec_ptr); break; case IDL_DT_ALLOCATE_REF: rpc_ss_discard_allocate_ref(&type_vec_ptr); break; case IDL_DT_FREE_REP: IDL_DISCARD_LONG_FROM_VECTOR(type_vec_ptr); break; case IDL_DT_PASSED_BY_REF: case IDL_DT_STRING: case IDL_DT_ALLOCATE: case IDL_DT_V1_ARRAY: case IDL_DT_V1_STRING: case IDL_DT_DELETED_NODES: case IDL_DT_CS_ATTRIBUTE: case IDL_DT_EOL: break; case IDL_DT_RANGE: IDL_DISCARD_LONG_FROM_VECTOR(type_vec_ptr); IDL_DISCARD_LONG_FROM_VECTOR(type_vec_ptr); break; case IDL_DT_CS_RLSE_SHADOW: *p_cs_shadow = cs_shadow; return; default: #ifdef DEBUG_INTERP printf("rpc_ss_ndr_m_param_cs_shadow:unrecognized type %d\n", type_byte); exit(0); #endif DCETHREAD_RAISE(rpc_x_coding_error); } } while (type_byte != IDL_DT_EOL); } }
static void rpc_ss_ndr_m_cs_farr_or_single ( rpc_void_p_t data_addr, /* [in] Address of array or char */ IDL_bound_pair_t *bounds_list, /* [in] - for array or char treated as array */ idl_ulong_int cs_type_defn_index, /* [in] */ idl_ulong_int l_storage_len, /* [in] number of elements */ IDL_msp_t IDL_msp ) { idl_byte *cs_type_defn_ptr; idl_ulong_int routine_index; void (**routine_ptr)(); /* Parameters for ..._net_size */ idl_cs_convert_t convert_type; /* Parameters for ..._to_netcs */ rpc_void_p_t wdata; cs_type_defn_ptr = IDL_msp->IDL_type_vec + cs_type_defn_index; IDL_DISCARD_LONG_FROM_VECTOR(cs_type_defn_ptr); /* Size of local type */ IDL_GET_LONG_FROM_VECTOR(routine_index, cs_type_defn_ptr); routine_ptr = IDL_msp->IDL_rtn_vec + routine_index; /* Call ..._net_size */ (*(routine_ptr + IDL_RTN_NET_SIZE_INDEX))(IDL_msp->IDL_h, *(IDL_msp->IDL_cs_tags_p->p_marsh_tag), l_storage_len, &convert_type, NULL, &IDL_msp->IDL_status); if (IDL_msp->IDL_status != error_status_ok) DCETHREAD_RAISE(rpc_x_ss_pipe_comm_error); if (convert_type == idl_cs_no_convert) { rpc_ss_ndr_m_fix_or_conf_arr(data_addr, 1, bounds_list, cs_type_defn_ptr, 0, IDL_msp); } else { /* Allocate a conversion buffer - cs_type_defn_ptr now points at network type */ wdata = (idl_void_p_t)rpc_ss_mem_alloc(&IDL_msp->IDL_mem_handle, l_storage_len * rpc_ss_type_size(cs_type_defn_ptr, IDL_msp)); /* Call ..._to_netcs */ (*(routine_ptr + IDL_RTN_TO_NETCS_INDEX))(IDL_msp->IDL_h, *(IDL_msp->IDL_cs_tags_p->p_marsh_tag), data_addr, l_storage_len, wdata, NULL, &IDL_msp->IDL_status); if (IDL_msp->IDL_status != error_status_ok) DCETHREAD_RAISE(rpc_x_ss_pipe_comm_error); /* Marshall the converted data */ rpc_ss_ndr_m_fix_or_conf_arr(wdata, 1, bounds_list, cs_type_defn_ptr, IDL_M_DO_NOT_POINT, IDL_msp); /* Release conversion buffer */ rpc_ss_mem_item_free(&IDL_msp->IDL_mem_handle, (byte_p_t)wdata); } }
void rpc_ss_ndr_m_struct_cs_shadow ( rpc_void_p_t struct_addr, /* [in] Address of struct */ idl_byte struct_type ATTRIBUTE_UNUSED, /* [in] FIXED_STRUCT or CONF_STRUCT */ idl_ulong_int shadow_length, /* [in] Number of structure fields */ idl_ulong_int offset_index, /* [in] Start of struct's offset vec */ idl_byte *defn_vec_ptr, /* [in] Posn following shadow length */ IDL_cs_shadow_elt_t **p_cs_shadow, /* [out] Address of cs-shadow */ IDL_msp_t IDL_msp ) { idl_ulong_int *struct_offset_vec_ptr; /* Start of offsets for this struct */ idl_ulong_int *offset_vec_ptr; idl_byte type_byte; IDL_cs_shadow_elt_t *cs_shadow; idl_ulong_int shadow_index; /* Index into cs-shadow */ /* Allocate the cs-shadow */ cs_shadow = (IDL_cs_shadow_elt_t *)rpc_ss_mem_alloc (&IDL_msp->IDL_mem_handle, shadow_length * sizeof(IDL_cs_shadow_elt_t)); struct_offset_vec_ptr = IDL_msp->IDL_offset_vec + offset_index; offset_vec_ptr = struct_offset_vec_ptr + 1; /* Skip over size at start of offsets */ shadow_index = 0; do { type_byte = *defn_vec_ptr; defn_vec_ptr++; switch(type_byte) { case IDL_DT_CS_ARRAY: rpc_ss_ndr_m_array_shadow(struct_addr, struct_offset_vec_ptr, offset_vec_ptr, cs_shadow, shadow_index, &defn_vec_ptr, IDL_msp); shadow_index++; offset_vec_ptr++; break; /* For fields that are not array of [cs_char], advance the definition and offset pointers and shadow index in step. And note they have no translation storage */ case IDL_DT_BYTE: case IDL_DT_CHAR: case IDL_DT_BOOLEAN: case IDL_DT_DOUBLE: case IDL_DT_ENUM: case IDL_DT_FLOAT: case IDL_DT_SMALL: case IDL_DT_SHORT: case IDL_DT_LONG: case IDL_DT_HYPER: case IDL_DT_USMALL: case IDL_DT_USHORT: case IDL_DT_ULONG: case IDL_DT_UHYPER: case IDL_DT_IGNORE: case IDL_DT_V1_ENUM: case IDL_DT_ERROR_STATUS: offset_vec_ptr++; cs_shadow[shadow_index].IDL_release = idl_false; shadow_index++; break; case IDL_DT_FIXED_ARRAY: case IDL_DT_VARYING_ARRAY: case IDL_DT_CONF_ARRAY: case IDL_DT_OPEN_ARRAY: /* Properties byte */ defn_vec_ptr++; IDL_DISCARD_LONG_FROM_VECTOR(defn_vec_ptr); /* Full array definition */ IDL_DISCARD_LONG_FROM_VECTOR(defn_vec_ptr); /* Flattened array definition */ offset_vec_ptr++; cs_shadow[shadow_index].IDL_release = idl_false; shadow_index++; break; case IDL_DT_ENC_UNION: case IDL_DT_N_E_UNION: case IDL_DT_FULL_PTR: case IDL_DT_UNIQUE_PTR: case IDL_DT_REF_PTR: case IDL_DT_TRANSMIT_AS: case IDL_DT_REPRESENT_AS: case IDL_DT_CS_TYPE: /* Properties byte */ defn_vec_ptr++; IDL_DISCARD_LONG_FROM_VECTOR(defn_vec_ptr); offset_vec_ptr++; cs_shadow[shadow_index].IDL_release = idl_false; shadow_index++; break; case IDL_DT_STRING: case IDL_DT_NDR_ALIGN_2: case IDL_DT_NDR_ALIGN_4: case IDL_DT_NDR_ALIGN_8: case IDL_DT_BEGIN_NESTED_STRUCT: case IDL_DT_END_NESTED_STRUCT: case IDL_DT_V1_ARRAY: case IDL_DT_V1_STRING: case IDL_DT_CS_ATTRIBUTE: case IDL_DT_CS_RLSE_SHADOW: break; case IDL_DT_RANGE: IDL_DISCARD_LONG_FROM_VECTOR(defn_vec_ptr); IDL_DISCARD_LONG_FROM_VECTOR(defn_vec_ptr); break; case IDL_DT_EOL: break; default: #ifdef DEBUG_INTERP printf("rpc_ss_ndr_m_struct_cs_shadow:unrecognized type %d\n", type_byte); exit(0); #endif DCETHREAD_RAISE(rpc_x_coding_error); } } while (type_byte != IDL_DT_EOL); /* Give the caller the address of the cs-shadow */ *p_cs_shadow = cs_shadow; }
static void rpc_ss_ndr_m_array_shadow ( rpc_void_p_t struct_addr, /* [in] Address of struct array is a field of. NULL if array is a parameter */ idl_ulong_int *struct_offset_vec_ptr, /* [in] Base of offset vector for structure. NULL if array is parameter */ idl_ulong_int *offset_vec_ptr, /* [in] NULL if array is parameter */ IDL_cs_shadow_elt_t *cs_shadow, /* [in] */ idl_ulong_int shadow_index, /* [in] index into cs-shadow */ idl_byte **p_defn_vec_ptr, /* [in] Points after IDL_DT_CS_ARRAY */ /* [out] Points after array defn indices */ IDL_msp_t IDL_msp ) { idl_byte *defn_vec_ptr; idl_byte array_type; idl_ulong_int array_defn_index; idl_byte *array_defn_ptr; idl_boolean allocate; /* TRUE => [in] size for [out] array */ IDL_bound_pair_t *bounds_list; idl_ulong_int cs_type_defn_index; idl_byte *cs_type_defn_ptr; idl_ulong_int routine_index; void (**routine_ptr)(); idl_byte ln_type = 0; /* Data type of [length_is] item */ idl_ulong_int ln_index; /* Index in shadow of [length_is] item */ idl_byte sz_type = 0; /* Data type of [size_is] item */ idl_ulong_int sz_index; /* Index in shadow of [size_is] item */ /* Parameters for ..._net_size */ idl_ulong_int l_storage_len; idl_ulong_int w_storage_len; idl_cs_convert_t convert_type; /* Parameters for ..._to_netcs */ rpc_void_p_t ldata; idl_ulong_int l_data_len; rpc_void_p_t wdata; idl_ulong_int w_data_len; /* begin */ defn_vec_ptr = *p_defn_vec_ptr; cs_shadow[shadow_index].IDL_release = idl_false; array_type = *defn_vec_ptr; defn_vec_ptr++; allocate = (array_type == IDL_DT_ALLOCATE); if (allocate) { array_type = *defn_vec_ptr; defn_vec_ptr++; } defn_vec_ptr++; /* Properties byte */ IDL_DISCARD_LONG_FROM_VECTOR(defn_vec_ptr); /* Full array definition */ IDL_GET_LONG_FROM_VECTOR(array_defn_index, defn_vec_ptr); if (array_type == IDL_DT_FIXED_ARRAY) { /* No shadow for fixed array of [cs_char] */ *p_defn_vec_ptr = defn_vec_ptr; return; } /* Address of local form of array */ if (struct_addr != NULL) ldata = (rpc_void_p_t)((idl_byte *)struct_addr + *offset_vec_ptr); else ldata = IDL_msp->IDL_param_vec[shadow_index + 1]; array_defn_ptr = IDL_msp->IDL_type_vec + array_defn_index; array_defn_ptr++; /* dimensionality */ /* Bounds information */ if (array_type == IDL_DT_VARYING_ARRAY) { if (IDL_msp->IDL_type_vec[TVEC_INT_REP_OFFSET] != NDR_LOCAL_INT_REP) rpc_ss_fixed_bounds_from_vector(1, array_defn_ptr, &bounds_list, IDL_msp); else bounds_list = (IDL_bound_pair_t *)array_defn_ptr; array_defn_ptr += IDL_FIXED_BOUND_PAIR_WIDTH; l_storage_len = bounds_list[0].upper - bounds_list[0].lower + 1; } else /* Conformant or open */ { /* Skip over lower bound entirely and upper bound kind */ array_defn_ptr += IDL_CONF_BOUND_PAIR_WIDTH/2 + 1; sz_type = *array_defn_ptr; IDL_GET_LONG_FROM_VECTOR(sz_index, array_defn_ptr); if (struct_addr != NULL) { l_storage_len = rpc_ss_get_typed_integer(sz_type, (rpc_void_p_t)((idl_byte *)struct_addr + *(struct_offset_vec_ptr + sz_index)), IDL_msp); } else { l_storage_len = rpc_ss_get_typed_integer(sz_type, IDL_msp->IDL_param_vec[sz_index], IDL_msp); } sz_index--; /* Shadow has one less elt than param or offset vec */ } /* Data limit information */ if ((array_type == IDL_DT_VARYING_ARRAY) || (array_type == IDL_DT_OPEN_ARRAY)) { /* Skip over lower data limit entirely and upper data limit kind */ array_defn_ptr += IDL_DATA_LIMIT_PAIR_WIDTH/2 + 1; ln_type = *array_defn_ptr; IDL_GET_LONG_FROM_VECTOR(ln_index, array_defn_ptr); if (struct_addr != NULL) { l_data_len = rpc_ss_get_typed_integer(ln_type, (rpc_void_p_t)((idl_byte *)struct_addr + *(struct_offset_vec_ptr + ln_index)), IDL_msp); } else { l_data_len = rpc_ss_get_typed_integer(ln_type, IDL_msp->IDL_param_vec[ln_index], IDL_msp); } ln_index--; /* Shadow has one less elt than param or offset vec */ } else l_data_len = l_storage_len; /* array_defn_ptr is now pointing to the base type, which has [cs_char] */ array_defn_ptr += 2; /* IDL_DT_CS_TYPE and properties byte */ IDL_GET_LONG_FROM_VECTOR(cs_type_defn_index, array_defn_ptr); cs_type_defn_ptr = IDL_msp->IDL_type_vec + cs_type_defn_index; IDL_DISCARD_LONG_FROM_VECTOR(cs_type_defn_ptr); /* Size of local type */ IDL_GET_LONG_FROM_VECTOR(routine_index, cs_type_defn_ptr); routine_ptr = IDL_msp->IDL_rtn_vec + routine_index; /* Call ..._net_size */ (*(routine_ptr + IDL_RTN_NET_SIZE_INDEX))(IDL_msp->IDL_h, *(IDL_msp->IDL_cs_tags_p->p_marsh_tag), l_storage_len, &convert_type, (array_type == IDL_DT_VARYING_ARRAY) ? NULL : &w_storage_len, &IDL_msp->IDL_status); if (IDL_msp->IDL_status != error_status_ok) DCETHREAD_RAISE(rpc_x_ss_pipe_comm_error); if ((array_type == IDL_DT_CONF_ARRAY) || (array_type == IDL_DT_OPEN_ARRAY)) { rpc_ss_put_typed_integer(w_storage_len, sz_type, (rpc_void_p_t)&cs_shadow[sz_index].IDL_data); } if (allocate) goto common_return; if (convert_type == idl_cs_no_convert) { cs_shadow[shadow_index].IDL_data.IDL_storage_p = ldata; w_data_len = l_data_len ; /* wire data length same as local */ goto alloc_return; } if (array_type == IDL_DT_VARYING_ARRAY) { w_storage_len = l_storage_len; } /* Allocate a conversion buffer - cs_type_defn_ptr now points at network type */ wdata = (idl_void_p_t)rpc_ss_mem_alloc(&IDL_msp->IDL_mem_handle, w_storage_len * rpc_ss_type_size(cs_type_defn_ptr, IDL_msp)); cs_shadow[shadow_index].IDL_data.IDL_storage_p = wdata; cs_shadow[shadow_index].IDL_release = true; /* Call ..._to_netcs */ (*(routine_ptr + IDL_RTN_TO_NETCS_INDEX))(IDL_msp->IDL_h, *(IDL_msp->IDL_cs_tags_p->p_marsh_tag), ldata, l_data_len, wdata, (array_type == IDL_DT_CONF_ARRAY) ? NULL : &w_data_len, &IDL_msp->IDL_status); if (IDL_msp->IDL_status != error_status_ok) DCETHREAD_RAISE(rpc_x_ss_pipe_comm_error); alloc_return:; if ((array_type == IDL_DT_VARYING_ARRAY) || (array_type == IDL_DT_OPEN_ARRAY)) { rpc_ss_put_typed_integer(w_data_len, ln_type, (rpc_void_p_t)&cs_shadow[ln_index].IDL_data); } common_return: ; *p_defn_vec_ptr = defn_vec_ptr; if (IDL_msp->IDL_type_vec[TVEC_INT_REP_OFFSET] != NDR_LOCAL_INT_REP) if (array_type == IDL_DT_VARYING_ARRAY) rpc_ss_mem_item_free(&IDL_msp->IDL_mem_handle, (byte_p_t)bounds_list); return ; }