Beispiel #1
0
static void evaluate_options( const Args *my_args, context *ctx )
{
    context_set_str( (char**)&(ctx->output_file),
                     get_str_option( my_args, OPTION_OUTPUT ) );
    context_set_str( (char**)&(ctx->dependency_file),
                     get_str_option( my_args, OPTION_DEPENDENCY ) );
    append_str_options( my_args, OPTION_INCLUDE, ctx->include_files );
    append_str_arguments( my_args, ctx->src_files );
}
Beispiel #2
0
rc_t make_trans_opt( trans_opt * opt, Args * args )
{
    uint32_t n1 = N_OFS, n2 = N_OFS;
    rc_t rc = get_str_option( args, OPTION_NAME, &opt->fname );
    if ( rc == 0 )
        rc = get_str_option( args, OPTION_REF, &opt->ref_name );
    if ( rc == 0 )
        rc = get_uint32_array( args, OPTION_RO, opt->ref_offset, &n1 );
    if ( rc == 0 )
        rc = get_uint32_array( args, OPTION_REFLEN, opt->ref_len, &n2 );
    opt->count = ( ( n1 > n2 ) ? n2 : n1 );
    return rc;
}
Beispiel #3
0
static void setup_compress_context( const Args * args, p_compress_context ctx )
{
    uint32_t count;
    const char *value = NULL;
    rc_t rc = ArgsParamCount( args, &count );
    DISP_RC( rc, "ArgsParamCount() failed" );
    if ( rc == 0 )
    {
        rc = ArgsParamValue( args, 0, &value );
        DISP_RC( rc, "ArgsParamValue() failed" );
        if ( rc == 0 )
            ctx->src_file = string_dup_measure( value, NULL );

        rc = ArgsParamValue( args, 1, &value );
        DISP_RC( rc, "ArgsParamValue() failed" );
        if ( rc == 0 )
            ctx->dst_file = string_dup_measure( value, NULL );
    }

    value = get_str_option( args, OPTION_DIRECTION );
    if ( value )
    {
        switch ( value[0] )
        {
        case 'c' :
        case 'C' : ctx->direction = KC_COMPRESS; break;
        case 'd' :
        case 'D' : ctx->direction = KC_DECOMPRESS; break;
        }
    }
    if ( ctx->direction == 0 )
        ctx->direction = KC_DECOMPRESS;

    value = get_str_option( args, OPTION_METHOD );
    if ( value )
    {
        switch ( value[0] )
        {
        case 'g' :
        case 'G' : ctx->method = KC_GZIP; break;
        case 'b' :
        case 'B' : ctx->method = KC_BZIP; break;
        case 's' :
        case 'S' : ctx->method = KC_SZIP; break;
        }
    }
    if ( ctx->method == 0 )
        ctx->method = KC_GZIP;
}
void spiceqxl_uinput_init(qxl_screen_t *qxl)
{
    int ret;
    int enabled;

    uinput_filename = get_str_option(qxl->options, OPTION_SPICE_VDAGENT_UINPUT_PATH,
               "XSPICE_VDAGENT_UINPUT_PATH");
    enabled = get_bool_option(qxl->options, OPTION_SPICE_VDAGENT_ENABLED, "XSPICE_VDAGENT_ENABLED");

    if (!enabled || uinput_filename == NULL) {
        return;
    }
    ret = mkfifo(uinput_filename, 0666);
    if (ret != 0) {
        fprintf(stderr, "spice: failed to create uinput fifo %s: %s\n",
                uinput_filename, strerror(errno));
        return;
    }
    spiceqxl_chown_agent_file(qxl, uinput_filename);
    uinput_fd = open(uinput_filename, O_RDONLY | O_NONBLOCK, 0666);
    if (uinput_fd == -1) {
        fprintf(stderr, "spice: failed creating uinput file %s: %s\n",
               uinput_filename, strerror(errno));
        return;
    }
}
Beispiel #5
0
rc_t get_common_options( Args * args, common_options *opts )
{
    rc_t rc = get_str_option( args, OPTION_OUTF, &opts->output_file );

    if ( rc == 0 )
        rc = get_str_option( args, OPTION_INF, &opts->input_file );

    if ( rc == 0 )
        rc = get_bool_option( args, OPTION_GZIP, &opts->gzip_output, false );

    if ( rc == 0 )
        rc = get_bool_option( args, OPTION_BZIP, &opts->bzip_output, false );

    if ( rc == 0 )
        rc = get_bool_option( args, OPTION_NO_MT, &opts->no_mt, false );
        
    if ( rc == 0 )
        rc = get_str_option( args, OPTION_SCHEMA, &opts->schema_file );

    if ( rc == 0 )
    {
        const char * table2use = NULL;
        rc = get_str_option( args, OPTION_TABLE, &table2use );
        opts->tab_select = primary_ats;
        if ( rc == 0 && table2use != NULL )
        {
            size_t l = string_size ( table2use );
            opts->tab_select = 0;
            if ( ( string_chr ( table2use, l, 'p' ) != NULL )||
                 ( string_chr ( table2use, l, 'P' ) != NULL ) )
            { opts->tab_select |= primary_ats; };

            if ( ( string_chr ( table2use, l, 's' ) != NULL )||
                 ( string_chr ( table2use, l, 'S' ) != NULL ) )
            { opts->tab_select |= secondary_ats; };

            if ( ( string_chr ( table2use, l, 'e' ) != NULL )||
                 ( string_chr ( table2use, l, 'E' ) != NULL ) )
            { opts->tab_select |= evidence_ats; };
        }
    }

    return rc;
}
Beispiel #6
0
static rc_t gather_options( const Args * args, struct sra_seq_count_options * options )
{
	rc_t rc;

	memset ( options, 0, sizeof *options );
	rc = get_str_option( args, OPTION_ID_ATTR, &options->id_attrib, DEFAULT_ID_ATTR );
	if ( rc == 0 )
		rc = get_str_option( args, OPTION_FEATURE_TYPE, &options->feature_type, DEFAULT_FEATURE_TYPE );
	if ( rc == 0 )
	{
		const char * mode;
		rc = get_str_option( args, OPTION_MODE, &mode, "norm" );
		if ( rc == 0 )
		{
			if ( mode[ 0 ] == 'd' && mode[ 1 ] == 'e' && mode[ 2 ] == 'b' && mode[ 3 ] == 'u' &&
				 mode[ 4 ] == 'g' && mode[ 5 ] == 0 )
			{
				options -> output_mode = SSC_MODE_DEBUG;
			}
		}
	}
	
	if ( rc == 0 )
	{
		uint32_t count;
		rc = ArgsParamCount( args, &count );
		if ( rc == 0 )
		{
			if ( count == 2 )
			{
				rc = ArgsParamValue( args, 0, (const void **)&options->sra_accession );
				if ( rc == 0 )
					rc = ArgsParamValue( args, 1, (const void **)&options->gtf_file );
				if ( rc == 0 )
					options -> valid = true;
			}
			else
			{
				UsageSummary ( UsageDefaultName );
			}
		}
	}
	return rc;
}
Beispiel #7
0
rc_t get_int32_option( const Args *args, const char *name,
                       int32_t *res, const int32_t def )
{
    const char * s;
    rc_t rc = get_str_option( args, name, &s );
    if ( rc == 0 && s != NULL )
        *res = atoi( s );
    else
        *res = def;
    return rc;
}
Beispiel #8
0
ErrorCode ReadCCMIO::load_neuset_data(CCMIOID problemID) 
{
  CCMIOSize_t i = CCMIOSIZEC(0);
  CCMIOID next;

    // make sure there are matsets
  if (newNeusets.empty()) return MB_SUCCESS;
  
  while (CCMIONextEntity(NULL, problemID, kCCMIOBoundaryRegion, &i, &next)
         == kCCMIONoErr) {
      // get index, corresponding set, and label with neumann set tag
    int mindex;
    CCMIOError error = kCCMIONoErr;
    CCMIOGetEntityIndex(&error, next, &mindex);
    std::map<int,EntityHandle>::iterator mit = newNeusets.find(mindex);
    if (mit == newNeusets.end()) 
        // no actual faces for this neuset; continue to next
      continue;
    
    EntityHandle dum_ent = mit->second;
    ErrorCode rval = mbImpl->tag_set_data(mNeumannSetTag, &dum_ent, 1, &mindex);
    CHKERR(rval, "Trouble setting neumann set tag.");

      // set name
    rval = get_str_option("BoundaryName", dum_ent, mNameTag, next, NAME_TAG_NAME);
    CHKERR(rval, "Trouble creating BoundaryName tag.");
    
      // BoundaryType
    rval = get_str_option("BoundaryType", dum_ent, mBoundaryTypeTag, next);
    CHKERR(rval, "Trouble creating BoundaryType tag.");

      // ProstarRegionNumber
    rval = get_int_option("ProstarRegionNumber", dum_ent, mProstarRegionNumberTag, next);
    CHKERR(rval, "Trouble creating ProstarRegionNumber tag.");
  }

  return MB_SUCCESS;
}
Beispiel #9
0
static rc_t get_int64_option( Args * args, const char * name, uint64_t def, uint64_t * value )
{
    const char * s;
    rc_t rc = get_str_option( args, name, &s );
    *value = def;
    if ( rc == 0 && s != NULL )
    {
        char *endp;
        *value = strtou32( s, &endp, 0 );
        if ( *endp != '\0' )
        {
            rc = RC( rcExe, rcArgv, rcProcessing, rcParam, rcInvalid );
            (void)PLOGERR( klogErr, ( klogErr, rc, "error converting string to integer option '$(t)'", "t=%s", name ) );
        }
        else if ( *value == 0 )
            *value = def;
    }
    return rc;
}
Beispiel #10
0
static rc_t get_int32_options( Args * args, const char * name, int32_t * value, bool * used )
{
    const char * s;
    rc_t rc = get_str_option( args, name, &s );
    if ( rc == 0 && s != NULL )
    {
        char *endp;
        *value = strtoi32( s, &endp, 0 );
        if ( *endp != '\0' )
        {
            rc = RC( rcExe, rcArgv, rcProcessing, rcParam, rcInvalid );
            (void)PLOGERR( klogErr, ( klogErr, rc, "error converting string to integer option '$(t)'", "t=%s", name ) );
        }
        else
        {
            *used = true;
        }
    }
    return rc;
}
Beispiel #11
0
ErrorCode ReadCCMIO::load_metadata(CCMIOID rootID, CCMIOID problemID,
                                   CCMIOID /* stateID */, CCMIOID processorID,
                                   const EntityHandle *file_set) 
{
    // Read the simulation title.
  CCMIOError error = kCCMIONoErr;
  ErrorCode rval = MB_SUCCESS;
  CCMIONode rootNode;
  if (kCCMIONoErr == CCMIOGetEntityNode(&error, rootID, &rootNode)) {
    char *name = NULL;
    CCMIOGetTitle(&error, rootNode, &name);

    if (NULL != name && strlen(name) != 0) {
        // make a tag for it and tag the read set
      Tag simname;
      rval = mbImpl->tag_get_handle("Title", strlen(name), MB_TYPE_OPAQUE,
                                    simname, MB_TAG_CREAT|MB_TAG_SPARSE);
      CHKERR(rval, "Simulation name tag not found or created.");
      EntityHandle set = file_set ? *file_set : 0;
      rval = mbImpl->tag_set_data(simname, &set, 1, name);
      CHKERR(rval, "Problem setting simulation name tag.");

    }
    if (name) free(name);
  }

    // creating program
  EntityHandle dumh = (file_set ? *file_set : 0);
  rval = get_str_option("CreatingProgram", dumh, mCreatingProgramTag, processorID);
  CHKERR(rval, "Trouble getting CreatingProgram tag.");

  rval = load_matset_data(problemID);
  CHKERR(rval, "Failure loading matset data.");
  
  rval = load_neuset_data(problemID);
  CHKERR(rval, "Failure loading neuset data.");
  
  return rval;
}
Beispiel #12
0
static void get_user_input( tool_ctx_t * tool_ctx, const Args * args )
{
    bool split_spot, split_file, split_3, whole_spot;
    
    /*
    tool_ctx -> compress = get_compress_t( get_bool_option( args, OPTION_GZIP ),
                                            get_bool_option( args, OPTION_BZIP2 ) ); helper.c */
    tool_ctx -> compress = ct_none;
    
    tool_ctx -> cursor_cache = get_size_t_option( args, OPTION_CURCACHE, DFLT_CUR_CACHE );            
    tool_ctx -> show_progress = get_bool_option( args, OPTION_PROGRESS );
    tool_ctx -> show_details = get_bool_option( args, OPTION_DETAILS );
    tool_ctx -> requested_temp_path = get_str_option( args, OPTION_TEMP, NULL );
    tool_ctx -> force = get_bool_option( args, OPTION_FORCE );        
    tool_ctx -> output_filename = get_str_option( args, OPTION_OUTPUT_F, NULL );
    tool_ctx -> output_dirname = get_str_option( args, OPTION_OUTPUT_D, NULL );
    tool_ctx -> buf_size = get_size_t_option( args, OPTION_BUFSIZE, DFLT_BUF_SIZE );
    tool_ctx -> mem_limit = get_size_t_option( args, OPTION_MEM, DFLT_MEM_LIMIT );
    tool_ctx -> num_threads = get_uint32_t_option( args, OPTION_THREADS, DFLT_NUM_THREADS );

    tool_ctx -> join_options . rowid_as_name = get_bool_option( args, OPTION_RIDN );
    tool_ctx -> join_options . skip_tech = !( get_bool_option( args, OPTION_INCL_TECH ) );
    tool_ctx -> join_options . print_read_nr = get_bool_option( args, OPTION_PRNR );
    tool_ctx -> join_options . print_name = true;
    tool_ctx -> join_options . min_read_len = get_uint32_t_option( args, OPTION_MINRDLEN, 0 );
    tool_ctx -> join_options . filter_bases = get_str_option( args, OPTION_BASE_FLT, NULL );
    tool_ctx -> join_options . terminate_on_invalid = get_bool_option( args, OPTION_STRICT );

    split_spot = get_bool_option( args, OPTION_SPLIT_SPOT );
    split_file = get_bool_option( args, OPTION_SPLIT_FILE );
    split_3    = get_bool_option( args, OPTION_SPLIT_3 );
    whole_spot = get_bool_option( args, OPTION_WHOLE_SPOT );
    
    tool_ctx -> fmt = get_format_t( get_str_option( args, OPTION_FORMAT, NULL ),
                            split_spot, split_file, split_3, whole_spot ); /* helper.c */
    if ( tool_ctx -> fmt == ft_fastq_split_3 )
        tool_ctx -> join_options . skip_tech = true;

    tool_ctx -> seq_tbl_name = get_str_option( args, OPTION_TABLE, dflt_seq_tabl_name );
}
void xspice_set_spice_server_options(OptionInfoPtr options)
{
    /* environment variables take precedense. If not then take
     * parameters from the config file. */
    int addr_flags;
    int len;
    spice_image_compression_t compression;
    spice_wan_compression_t wan_compr;
    int port = get_int_option(options, OPTION_SPICE_PORT, "XSPICE_PORT");
    int tls_port =
        get_int_option(options, OPTION_SPICE_TLS_PORT, "XSPICE_TLS_PORT");
    const char *password =
        get_str_option(options, OPTION_SPICE_PASSWORD, "XSPICE_PASSWORD");
    int disable_ticketing =
        get_bool_option(options, OPTION_SPICE_DISABLE_TICKETING, "XSPICE_DISABLE_TICKETING");
    const char *x509_dir =
        get_str_option(options, OPTION_SPICE_X509_DIR, "XSPICE_X509_DIR");
    int sasl = get_bool_option(options, OPTION_SPICE_SASL, "XSPICE_SASL");
    const char *x509_key_file_base =
        get_str_option(options, OPTION_SPICE_X509_KEY_FILE,
                       "XSPICE_X509_KEY_FILE");
    char *x509_key_file = NULL;
    const char *x509_cert_file_base =
        get_str_option(options, OPTION_SPICE_X509_CERT_FILE,
                       "XSPICE_X509_CERT_FILE");
    char *x509_cert_file = NULL;
    const char *x509_key_password =
        get_str_option(options, OPTION_SPICE_X509_KEY_PASSWORD,
                    "XSPICE_X509_KEY_PASSWORD");
    const char *tls_ciphers =
        get_str_option(options, OPTION_SPICE_TLS_CIPHERS,
                    "XSPICE_TLS_CIPHERS");
    const char *x509_cacert_file_base =
        get_str_option(options, OPTION_SPICE_CACERT_FILE,
                    "XSPICE_CACERT_FILE");
    char *x509_cacert_file = NULL;
    const char * addr =
        get_str_option(options, OPTION_SPICE_ADDR, "XSPICE_ADDR");
    int ipv4 =
        get_bool_option(options, OPTION_SPICE_IPV4_ONLY, "XSPICE_IPV4_ONLY");
    int ipv6 =
        get_bool_option(options, OPTION_SPICE_IPV6_ONLY, "XSPICE_IPV6_ONLY");
    const char *x509_dh_file =
        get_str_option(options, OPTION_SPICE_DH_FILE, "XSPICE_DH_FILE");
    int disable_copy_paste =
        get_bool_option(options, OPTION_SPICE_DISABLE_COPY_PASTE,
                        "XSPICE_DISABLE_COPY_PASTE");
    const char *image_compression =
        get_str_option(options, OPTION_SPICE_IMAGE_COMPRESSION,
                       "XSPICE_IMAGE_COMPRESSION");
    const char *jpeg_wan_compression =
        get_str_option(options, OPTION_SPICE_JPEG_WAN_COMPRESSION,
                       "XSPICE_JPEG_WAN_COMPRESSION");
    const char *zlib_glz_wan_compression =
        get_str_option(options, OPTION_SPICE_ZLIB_GLZ_WAN_COMPRESSION,
                       "XSPICE_ZLIB_GLZ_WAN_COMPRESSION");
    const char *streaming_video =
        get_str_option(options, OPTION_SPICE_STREAMING_VIDEO,
                       "XSPICE_STREAMING_VIDEO");
    int agent_mouse =
        get_bool_option(options, OPTION_SPICE_AGENT_MOUSE,
                        "XSPICE_AGENT_MOUSE");
    int playback_compression =
        get_bool_option(options, OPTION_SPICE_PLAYBACK_COMPRESSION,
                        "XSPICE_PLAYBACK_COMPRESSION");

    SpiceServer *spice_server = xspice_get_spice_server();

    if (!port && !tls_port) {
        printf("one of tls-port or port must be set\n");
        exit(1);
    }
    printf("xspice: port = %d, tls_port = %d\n", port, tls_port);
    spice_server_set_port(spice_server, port);
    if (disable_ticketing) {
        spice_server_set_noauth(spice_server);
    }
    if (tls_port) {
        if (NULL == x509_dir) {
            x509_dir = ".";
        }
        len = strlen(x509_dir) + 32;

        if (x509_key_file_base) {
            x509_key_file = strdup(x509_key_file_base);
        } else {
            x509_key_file = malloc(len);
            snprintf(x509_key_file, len, "%s/%s", x509_dir, X509_SERVER_KEY_FILE);
        }

        if (x509_cert_file_base) {
            x509_cert_file = strdup(x509_cert_file_base);
        } else {
            x509_cert_file = malloc(len);
            snprintf(x509_cert_file, len, "%s/%s", x509_dir, X509_SERVER_CERT_FILE);
        }

        if (x509_cacert_file_base) {
            x509_cacert_file = strdup(x509_cert_file_base);
        } else {
            x509_cacert_file = malloc(len);
            snprintf(x509_cacert_file, len, "%s/%s", x509_dir, X509_CA_CERT_FILE);
        }
    }

    addr_flags = 0;
    if (ipv4) {
        addr_flags |= SPICE_ADDR_FLAG_IPV4_ONLY;
    } else if (ipv6) {
        addr_flags |= SPICE_ADDR_FLAG_IPV6_ONLY;
    }

    spice_server_set_addr(spice_server, addr ? addr : "", addr_flags);
    if (port) {
        spice_server_set_port(spice_server, port);
    }
    if (tls_port) {
        spice_server_set_tls(spice_server, tls_port,
                             x509_cacert_file,
                             x509_cert_file,
                             x509_key_file,
                             x509_key_password,
                             x509_dh_file,
                             tls_ciphers);
    }
    if (password) {
        spice_server_set_ticket(spice_server, password, 0, 0, 0);
    }
    if (sasl) {
#if SPICE_SERVER_VERSION >= 0x000802 /* 0.8.2 */
        if (spice_server_set_sasl_appname(spice_server, "xspice") == -1 ||
            spice_server_set_sasl(spice_server, 1) == -1) {
            fprintf(stderr, "spice: failed to enable sasl\n");
            exit(1);
        }
#else
        fprintf(stderr, "spice: sasl is not available (spice >= 0.8.2 required)\n");
        exit(1);
#endif
    }
    if (disable_ticketing) {
        spice_server_set_noauth(spice_server);
    }

#if SPICE_SERVER_VERSION >= 0x000801
    /* we still don't actually support agent in xspice, but this
     * can't hurt for later, just copied from qemn/ui/spice-core.c */
    if (disable_copy_paste) {
        spice_server_set_agent_copypaste(spice_server, 0);
    }
#endif

    compression = SPICE_IMAGE_COMPRESS_AUTO_GLZ;
    if (image_compression) {
        compression = parse_compression(image_compression);
    }
    spice_server_set_image_compression(spice_server, compression);

    wan_compr = SPICE_WAN_COMPRESSION_AUTO;
    if (jpeg_wan_compression) {
        wan_compr = parse_wan_compression(jpeg_wan_compression);
    }
    spice_server_set_jpeg_compression(spice_server, wan_compr);

    wan_compr = SPICE_WAN_COMPRESSION_AUTO;
    if (zlib_glz_wan_compression) {
        wan_compr = parse_wan_compression(zlib_glz_wan_compression);
    }
    spice_server_set_zlib_glz_compression(spice_server, wan_compr);

    if (streaming_video) {
        int streaming_video_opt = parse_stream_video(streaming_video);
        spice_server_set_streaming_video(spice_server, streaming_video_opt);
    }

    spice_server_set_agent_mouse
        (spice_server, agent_mouse);
    spice_server_set_playback_compression
        (spice_server, playback_compression);

    free(x509_key_file);
    free(x509_cert_file);
    free(x509_cacert_file);
}
Beispiel #14
0
ErrorCode ReadCCMIO::load_matset_data(CCMIOID problemID) 
{
    // make sure there are matsets
  if (newMatsets.empty()) return MB_SUCCESS;
  
    // ... walk through each cell type
  CCMIOSize_t i = CCMIOSIZEC(0);
  CCMIOID next;
  std::string opt_string;
  CCMIOError error = kCCMIONoErr;
  
  while (CCMIONextEntity(NULL, problemID, kCCMIOCellType, &i, &next)
         == kCCMIONoErr) {
      // get index, corresponding set, and label with material set tag
    int mindex;
    CCMIOGetEntityIndex(&error, next, &mindex);
    std::map<int,EntityHandle>::iterator mit = newMatsets.find(mindex);
    if (mit == newMatsets.end()) 
        // no actual faces for this matset; continue to next
      continue;
    
    EntityHandle dum_ent = mit->second;
    ErrorCode rval = mbImpl->tag_set_data(mMaterialSetTag, &dum_ent, 1, &mindex);
    CHKERR(rval, "Trouble setting material set tag.");

      // set name
    CCMIOSize_t len;
    CCMIOEntityLabel(&error, next, &len, NULL);
    std::vector<char> opt_string2(GETINT32(len)+1, '\0');
    CCMIOEntityLabel(&error, next, NULL, &opt_string2[0]);
    if (opt_string2.size() >= NAME_TAG_SIZE) opt_string2[NAME_TAG_SIZE-1] = '\0';
    else (opt_string2.resize(NAME_TAG_SIZE, '\0'));
    rval = mbImpl->tag_set_data(mNameTag, &dum_ent, 1, &opt_string2[0]);
    CHKERR(rval, "Trouble setting name tag for material set.");

      // material id
    rval = get_int_option("MaterialId", dum_ent, mMaterialIdTag, next);
    CHKERR(rval, "Trouble getting MaterialId tag.");
    
    rval = get_str_option("MaterialType", dum_ent, mMaterialTypeTag, next);
    CHKERR(rval, "Trouble getting MaterialType tag.");
    
    rval = get_int_option("Radiation", dum_ent, mRadiationTag, next);
    CHKERR(rval, "Trouble getting Radiation option.");

    rval = get_int_option("PorosityId", dum_ent, mPorosityIdTag, next);
    CHKERR(rval, "Trouble getting PorosityId option.");

    rval = get_int_option("SpinId", dum_ent, mSpinIdTag, next);
    CHKERR(rval, "Trouble getting SpinId option.");

    rval = get_int_option("GroupId", dum_ent, mGroupIdTag, next);
    CHKERR(rval, "Trouble getting GroupId option.");

    rval = get_int_option("ColorIdx", dum_ent, mColorIdxTag, next);
    CHKERR(rval, "Trouble getting ColorIdx option.");

    rval = get_int_option("ProcessorId", dum_ent, mProcessorIdTag, next);
    CHKERR(rval, "Trouble getting ProcessorId option.");

    rval = get_int_option("LightMaterial", dum_ent, mLightMaterialTag, next);
    CHKERR(rval, "Trouble getting LightMaterial option.");

    rval = get_int_option("FreeSurfaceMaterial", dum_ent, mFreeSurfaceMaterialTag, next);
    CHKERR(rval, "Trouble getting FreeSurfaceMaterial option.");

    rval = get_dbl_option("Thickness", dum_ent, mThicknessTag, next);
    CHKERR(rval, "Trouble getting Thickness option.");
  }

  return MB_SUCCESS;
}
Beispiel #15
0
//-----------------------------------------------------------------------------
//	process_server_prefs
//-----------------------------------------------------------------------------
static int process_server_prefs(struct vpn_params *params)
{
    u_int32_t		lval, len;
    u_char            str[MAXPATHLEN];   
	int				err ;
	struct hostent	*hostent;
	
    get_int_option(params->serverRef, kRASEntServer, kRASPropServerMaximumSessions, &lval, 0);
    if (lval)
        params->max_sessions = lval;
	len = sizeof(str);
    get_str_option(params->serverRef, kRASEntServer, kRASPropServerLogfile, str, sizeof(str), &len, (u_char*)default_log_path);
    if (str[0])
        memcpy(params->log_path, str, len + 1);

    get_int_option(params->serverRef, kRASEntServer, kRASPropServerVerboseLogging, &lval, 0);
    if (lval)
        params->log_verbose = lval;

	// Load balancing parameters
	get_int_option(params->serverRef, kRASEntServer, kRASPropServerLoadBalancingEnabled, &lval, 0);
	if (lval) {
		params->lb_enable = 1;
		
		// will determine the interface from the cluster address
		//len = sizeof(str);
		//get_str_option(params->serverRef, kRASEntServer, kRASPropServerLoadBalancingInterface, str, sizeof(str), &len, "en1");
		//strncpy(params->lb_interface, str, sizeof(params->lb_interface));

		// is priority really useful ?
		//get_int_option(params->serverRef, kRASEntServer, kRASPropServerLoadBalancingPriority, &lval, 5);
		//if (lval < 1) lval = 1;
		//else if (lval > LB_MAX_PRIORITY) lval = LB_MAX_PRIORITY;
		//params->lb_priority = lval;
		
		get_int_option(params->serverRef, kRASEntServer, kRASPropServerLoadBalancingPort, &lval, LB_DEFAULT_PORT);
		params->lb_port = htons(lval);
		len = sizeof(str);
		get_str_option(params->serverRef, kRASEntServer, kRASPropServerLoadBalancingAddress, str, sizeof(str), &len, empty_str);
		// ask the system to look up the given name.
		hostent = getipnodebyname ((char*)str, AF_INET, 0, &err);
		if (!hostent) {
			vpnlog(LOG_ERR, "Incorrect Load Balancing address found '%s'\n", str);
			params->lb_enable = 0;
			
		}
		else {
			struct sockaddr_in src, dst;
			
			params->lb_cluster_address = *(struct in_addr *)hostent->h_addr_list[0];
			freehostent(hostent);
			
			bzero(&dst, sizeof(dst));
			dst.sin_family = PF_INET;
			dst.sin_len = sizeof(dst);
			dst.sin_addr = params->lb_cluster_address;
		
			// look for the interface and primary address of the cluster address			
			if (get_route_interface((struct sockaddr *)&src, (struct sockaddr *)&dst, params->lb_interface)) {
			
				vpnlog(LOG_ERR, "Cannot get load balancing redirect address and interface (errno = %d)\n", errno);
				params->lb_enable = 0;
			}

			params->lb_redirect_address = src.sin_addr;

			
		}
	}
	
    return 0;
}
Beispiel #16
0
static rc_t gather_string_options( Args * args, samdump_opts * opts )
{
    const char * s;
    uint32_t count;

    rc_t rc = get_str_option( args, OPT_PREFIX, &s );
    if ( rc == 0 && s != NULL )
    {
        opts->qname_prefix = string_dup_measure( s, NULL );
        if ( opts->qname_prefix == NULL )
        {
            rc = RC( rcExe, rcNoTarg, rcValidating, rcMemory, rcExhausted );
            (void)LOGERR( klogErr, rc, "error storing QNAME-PREFIX" );
        }
    }

    if ( rc == 0 )
    {
        rc = get_str_option( args, OPT_Q_QUANT, &s );
        if ( rc == 0 && s != NULL )
        {
            opts->qual_quant = string_dup_measure( s, NULL );
            if ( opts->qual_quant == NULL )
            {
                rc = RC( rcExe, rcNoTarg, rcValidating, rcMemory, rcExhausted );
                (void)LOGERR( klogErr, rc, "error storing QUAL-QUANT" );
            }
            else
            {
                bool bres = QualityQuantizerInitMatrix( opts->qual_quant_matrix, opts->qual_quant );
                if ( !bres )
                {
                    rc = RC( rcExe, rcNoTarg, rcValidating, rcParam, rcInvalid );
                    (void)LOGERR( klogErr, rc, "error initializing quality-quantizer-matrix" );
                }
            }
        }
    }

    if ( rc == 0 )
    {
        rc = get_str_option( args, OPT_OUTPUTFILE, &s );
        if ( rc == 0 && s != NULL )
        {
            opts->outputfile = string_dup_measure( s, NULL );
            if ( opts->outputfile == NULL )
            {
                rc = RC( rcExe, rcNoTarg, rcValidating, rcMemory, rcExhausted );
                (void)LOGERR( klogErr, rc, "error storing OUTPUTFILE" );
            }
        }
    }

    if ( rc == 0 )
    {
        rc = ArgsOptionCount( args, OPT_HDR_COMMENT, &count );
        if ( rc == 0 && count > 0 )
        {
            uint32_t i;
            rc = VNamelistMake( &opts->hdr_comments, 10 );
            for ( i = 0; i < count && rc == 0; ++i )
            {
                const char * src;
                rc = ArgsOptionValue( args, OPT_HDR_COMMENT, i, &src );
                if ( rc != 0 )
                {
                    (void)PLOGERR( klogErr, ( klogErr, rc, "error retrieving comandline option '$(t)' #$(n)", 
                                              "t=%s,n=%u", OPT_HDR_COMMENT, i ) );
                }
                else
                {
                    rc = VNamelistAppend( opts->hdr_comments, src );
                    if ( rc != 0 )
                    {
                        (void)PLOGERR( klogErr, ( klogErr, rc, "error appending hdr-comment '$(t)'", 
                                                  "t=%s", src ) );
                    }
                }
            }
            if ( rc != 0 )
            {
                VNamelistRelease( opts->hdr_comments );
                opts->hdr_comments = NULL;
            }
        }
    }

    if ( rc == 0 )
    {
        rc = ArgsParamCount( args, &count );
        if ( rc == 0 && count > 0 )
        {
            uint32_t i;
            rc = VNamelistMake( &opts->input_files, 10 );
            for ( i = 0; i < count && rc == 0; ++i )
            {
                const char * src;
                rc = ArgsParamValue( args, i, &src );
                if ( rc != 0 )
                {
                    (void)PLOGERR( klogErr, ( klogErr, rc, "error retrieving comandline param #$(n)", 
                                              "n=%u", i ) );
                }
                else
                {
                    rc = VNamelistAppend( opts->input_files, src );
                    if ( rc != 0 )
                    {
                        (void)PLOGERR( klogErr, ( klogErr, rc, "error appending input_file '$(t)'", 
                                                  "t=%s", src ) );
                    }
                }
            }
            if ( rc != 0 )
            {
                VNamelistRelease( opts->input_files );
                opts->input_files = NULL;
            }
        }
        opts->input_file_count = count;
    }

    rc = get_str_option( args, OPT_CIGAR_TEST, &s );
    if ( rc == 0 && s != NULL )
    {
        opts->cigar_test = string_dup_measure( s, NULL );
        if ( opts->cigar_test == NULL )
        {
            rc = RC( rcExe, rcNoTarg, rcValidating, rcMemory, rcExhausted );
            (void)LOGERR( klogErr, rc, "error storing CIGAR-TEST" );
        }
    }

    return rc;
}