void DDBE_init_server_pipes ( FILE *fid, AST_operation_n_t *p_operation, long *p_first_pipe /* ptr to index and direction of first pipe */ ) { long first_in_pipe; /* index of first [in] pipe */ long first_out_pipe; /* index of first [out] pipe */ long curr_pipe_index; long next_in_pipe_index; long next_out_pipe_index; AST_parameter_n_t *p_parameter; char const *p_pipe_type_name; /* Establish indices of first pipes */ first_in_pipe = 0; first_out_pipe = 0; curr_pipe_index = 0; for ( p_parameter = p_operation->parameters; p_parameter != NULL; p_parameter = p_parameter->next ) { if ( (p_parameter->type->kind == AST_pipe_k) || ((p_parameter->type->kind == AST_pointer_k) && (p_parameter->type->type_structure.pointer->pointee_type ->kind == AST_pipe_k)) ) { curr_pipe_index++; if ( AST_IN_SET(p_parameter) ) { if (first_in_pipe == 0) first_in_pipe = curr_pipe_index; } if ( AST_OUT_SET(p_parameter) ) { if (first_out_pipe == 0) first_out_pipe = curr_pipe_index; } } } if ( first_in_pipe != 0 ) *p_first_pipe = first_in_pipe; else *p_first_pipe = -first_out_pipe; /* Emit initialization code */ curr_pipe_index = 0; for ( p_parameter = p_operation->parameters; p_parameter != NULL; p_parameter = p_parameter->next ) { if ( (p_parameter->type->kind == AST_pipe_k) || ((p_parameter->type->kind == AST_pointer_k) && (p_parameter->type->type_structure.pointer->pointee_type ->kind == AST_pipe_k)) ) { AST_type_n_t *pipe_t = p_parameter->type; /* Find pipe type, if passed by reference */ if (pipe_t->kind == AST_pointer_k) pipe_t = pipe_t->type_structure.pointer->pointee_type; curr_pipe_index++; BE_get_pipe_type_name( p_parameter, &p_pipe_type_name ); /* Hook the push and pull routines */ fprintf( fid, "%s.push=(",BE_get_name(p_parameter->name) ); CSPELL_pipe_struct_routine_decl(fid, pipe_t, BE_pipe_push_k, TRUE); fprintf( fid, ")rpc_ss_ndr_ee_marsh_pipe_chunk;\n"); fprintf( fid, "%s.pull=(",BE_get_name(p_parameter->name) ); CSPELL_pipe_struct_routine_decl(fid, pipe_t, BE_pipe_pull_k, TRUE); fprintf( fid, ")rpc_ss_ndr_ee_unmar_pipe_chunk;\n"); /* Initialize the state block */ next_in_pipe_index = 0; next_out_pipe_index = 0; if ( AST_IN_SET(p_parameter) ) { BE_get_next_pipe_index( p_parameter, AST_IN, curr_pipe_index, &next_in_pipe_index ); if (next_in_pipe_index == 0) { /* Next pipe is [out] */ if (first_out_pipe != 0) next_in_pipe_index = -first_out_pipe; else next_in_pipe_index = BE_FINISHED_WITH_PIPES; } } if ( AST_OUT_SET(p_parameter) ) { BE_get_next_pipe_index( p_parameter, AST_OUT, curr_pipe_index, &next_out_pipe_index ); if (next_out_pipe_index == 0 ) next_out_pipe_index = BE_FINISHED_WITH_PIPES; else next_out_pipe_index = -next_out_pipe_index; } fprintf( fid, "rpc_ss_mts_init_callee_pipe(%ld,%ld,%ld,&IDL_current_pipe,&IDL_ms,\n", curr_pipe_index, next_in_pipe_index, next_out_pipe_index ); fprintf( fid, "%ld,(rpc_ss_mts_ee_pipe_state_t**)&%s.state);\n", (p_parameter->type->kind == AST_pipe_k) ? p_parameter->type->be_info.dd_type->type_vec_p->index : p_parameter->type->type_structure.pointer->pointee_type ->be_info.dd_type->type_vec_p->index, BE_get_name(p_parameter->name) ); } } }
/* ** C H K _ p a r a m _ c s ** ** Checks a parameter node's I-char ([cs_*]) attributes. ** The passed type node is the dereferenced parameter type if the ** parameter is passed by reference. */ void CHK_param_cs ( AST_parameter_n_t *param_p, /* [in] Ptr to AST parameter node */ AST_type_n_t *type_p /* [in] Parameter type */ ) { AST_parameter_n_t *pp; AST_field_attr_n_t *fattr_p; fattr_p = param_p->field_attrs; /* Operation with [in] [cs_char] data requires [cs_stag] parameter */ if (AST_IN_SET(param_p) && (type_p->cs_char_type != NULL || FE_TEST(type_p->fe_info->flags, FE_CT_CS_CHAR))) { for (pp = param_p->uplink->parameters; pp != NULL; pp = pp->next) { if (AST_CS_STAG_SET(pp)) break; } if (pp == NULL) CHECKER_acf_error(param_p, NIDL_OPINCSCHAR); } /* Operation with [out] [cs_char] data requires [cs_rtag] parameter */ if (AST_OUT_SET(param_p) && (type_p->cs_char_type != NULL || FE_TEST(type_p->fe_info->flags, FE_CT_CS_CHAR))) { for (pp = param_p->uplink->parameters; pp != NULL; pp = pp->next) { if (AST_CS_RTAG_SET(pp)) break; } if (pp == NULL) CHECKER_acf_error(param_p, NIDL_OPOUTCSCHAR); } /* A [cs_stag] parameter must have the [in] attribute */ if (AST_CS_STAG_SET(param_p) && !AST_IN_SET(param_p)) { ASTP_attr_flag_t attr2 = ASTP_IN; CHECKER_error(param_p, NIDL_PRMDEPATTR, "cs_stag", KEYWORDS_lookup_text(AST_attribute_to_token(&attr2))); } /* A [cs_drtag] parameter must have the [in] attribute */ if (AST_CS_DRTAG_SET(param_p) && !AST_IN_SET(param_p)) { ASTP_attr_flag_t attr2 = ASTP_IN; CHECKER_error(param_p, NIDL_PRMDEPATTR, "cs_drtag", KEYWORDS_lookup_text(AST_attribute_to_token(&attr2))); } /* A [cs_rtag] parameter must have the [out] attribute */ if (AST_CS_RTAG_SET(param_p) && !AST_OUT_SET(param_p)) { ASTP_attr_flag_t attr2 = ASTP_OUT; CHECKER_error(param_p, NIDL_PRMDEPATTR, "cs_rtag", KEYWORDS_lookup_text(AST_attribute_to_token(&attr2))); } /* Array attr can't be used for both [cs_char] and non-[cs_char] arrays */ if (FE_TEST(param_p->fe_info->flags, FE_USED_AS_CS_FLD_ATTR) && FE_TEST(param_p->fe_info->flags, FE_USED_AS_REG_FLD_ATTR)) CHECKER_error(param_p, NIDL_ARRATTRSHR); /* A [size_is] or [max_is] attr can't be applied to ptr to [cs_char] type */ if (type_p->kind == AST_pointer_k && type_p->type_structure.pointer->pointee_type->cs_char_type != NULL && fattr_p != NULL && (fattr_p->max_is_vec != NULL || fattr_p->size_is_vec != NULL)) CHECKER_error(param_p, NIDL_CSARRSYN); /* An array with [cs_char] base type cannot have [ptr] or [unique] attrs */ if (type_p->kind == AST_array_k && type_p->type_structure.array->element_type->cs_char_type != NULL && (AST_PTR_SET(param_p) || AST_UNIQUE_SET(param_p))) CHECKER_error(param_p, NIDL_ARRPTRUNIQ, "cs_char"); /* A [cs_stag] param must precede any [in] [cs_char] data in a param list */ if (AST_CS_STAG_SET(param_p)) { for (pp = param_p->uplink->parameters; pp != param_p; pp = pp->next) { if (AST_IN_SET(pp) && (pp->type->cs_char_type != NULL || FE_TEST(pp->type->fe_info->flags, FE_CT_CS_CHAR))) break; } if (pp != param_p) CHECKER_error(param_p, NIDL_TAGBEFDATA); } /* A [cs_rtag] param must precede any [out][cs_char] data in a param list */ if (AST_CS_RTAG_SET(param_p)) { for (pp = param_p->uplink->parameters; pp != param_p; pp = pp->next) { if (AST_OUT_SET(pp) && (pp->type->cs_char_type != NULL || FE_TEST(pp->type->fe_info->flags, FE_CT_CS_CHAR))) break; } if (pp != param_p) CHECKER_error(param_p, NIDL_TAGAFTDATA); } /* A [handle] binding parameter cannot contain a [cs_char] type */ if (AST_HANDLE_SET(type_p) && param_p == param_p->uplink->parameters /* first param */ && (type_p->cs_char_type != NULL || FE_TEST(type_p->fe_info->flags, FE_CT_CS_CHAR))) CHECKER_error(param_p, NIDL_HANCTYPE, "cs_char"); /* Arrays of [cs_char] can only use the [size_is] and [length_is] attrs */ if (type_p->kind == AST_array_k && type_p->type_structure.array->element_type->cs_char_type != NULL && (AST_STRING_SET(type_p) || AST_STRING_SET(param_p) || (fattr_p != NULL && (fattr_p->min_is_vec != NULL || fattr_p->max_is_vec != NULL || fattr_p->first_is_vec != NULL || fattr_p->last_is_vec != NULL)))) CHECKER_error(param_p, NIDL_ARRTYPATTR, "cs_char"); /* Tag params must have type unsigned long int passed by value or ref */ if ( (AST_CS_STAG_SET(param_p) || AST_CS_DRTAG_SET(param_p) || AST_CS_RTAG_SET(param_p)) && type_p->kind != AST_long_unsigned_k ) CHECKER_error(param_p, NIDL_TAGPRMTYPE); /* Use of [cs_stag] attribute requires -standard extended */ if (AST_CS_STAG_SET(param_p) && (*(int *)CMD_vals[opt_standard] < opt_standard_dce_1_1)) CHECKER_acf_warning(param_p, NIDL_NOPORTATTR, "cs_stag", OPT_STD_EXTENDED); /* Use of [cs_drtag] attribute requires -standard extended */ if (AST_CS_DRTAG_SET(param_p) && (*(int *)CMD_vals[opt_standard] < opt_standard_dce_1_1)) CHECKER_acf_warning(param_p, NIDL_NOPORTATTR, "cs_drtag", OPT_STD_EXTENDED); /* Use of [cs_rtag] attribute requires -standard extended */ if (AST_CS_RTAG_SET(param_p) && (*(int *)CMD_vals[opt_standard] < opt_standard_dce_1_1)) CHECKER_acf_warning(param_p, NIDL_NOPORTATTR, "cs_rtag", OPT_STD_EXTENDED); }