当前位置: 首页>>代码示例>>C++>>正文


C++ show_msg函数代码示例

本文整理汇总了C++中show_msg函数的典型用法代码示例。如果您正苦于以下问题:C++ show_msg函数的具体用法?C++ show_msg怎么用?C++ show_msg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了show_msg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: g_ptr_array_sized_new

static void *correct_thread(void *data) {
	correct_aux_t *d = (correct_aux_t*) data;
	int i = 0;
	bwa_seq_t *s = NULL, *query = NULL, *seqs = d->ht->seqs;
	readarray *low_kmer_reads = d->low_kmer_reads;
	alignarray *aligns = NULL;

	aligns = g_ptr_array_sized_new(N_DEFAULT_ALIGNS);
	for (i = d->start; i < d->end; i++) {
		if (i % 10000 == 0)
			show_msg(__func__,
					"Thread %d correction progress: [%d,%d,%d]... \n", d->tid,
					d->start, i, d->end);
		s = g_ptr_array_index(low_kmer_reads, i);
		if (is_repetitive_q(s)) {
			s->status = USED;
			continue;
		}
		// Only the fresh reads, or the reads tried once would be corrected.
		if (s->status != FRESH)
			continue;
		query = new_seq(s, s->len - 8, 0);
		pe_aln_query(s, s->seq, d->ht, MISMATCHES, s->len, 0, aligns);
		pe_aln_query(s, s->rseq, d->ht, MISMATCHES, s->len, 1, aligns);
		if (aligns->len >= 4)
			correct_bases(seqs, s, aligns, d->tid);
		s->status = TRIED;
		reset_alg(aligns);
		bwa_free_read_seq(1, query);
		//if (i > 10000)
		//	break;
	}
	free_alg(aligns);
	show_msg(__func__, "Thread %d finished. \n", d->tid);
}
开发者ID:agongdai,项目名称:peta,代码行数:35,代码来源:correct.c

示例2: recv_buffer

static int recv_buffer(struct connreq *conn) {
   int rc = 0;

   show_msg(MSGDEBUG, "Reading from server (expecting %d bytes)\n", conn->datalen);
   while ((rc == 0) && (conn->datadone != conn->datalen)) {
      rc = recv(conn->sockid, conn->buffer + conn->datadone, 
                conn->datalen - conn->datadone, 0);
      if (rc > 0) {
         conn->datadone += rc;
         rc = 0;
      } else if (rc == 0) {
         show_msg(MSGDEBUG, "Peer has shutdown but we only read %d of %d bytes.\n",
            conn->datadone, conn->datalen);
         rc = ENOTCONN; /* ENOTCONN seems like the most fitting error message */
      } else {
         if (errno != EWOULDBLOCK)
            show_msg(MSGDEBUG, "Read failed, %s\n", strerror(errno));
         rc = errno;
      }
   }

   if (conn->datadone == conn->datalen)
      conn->state = conn->nextstate;

   show_msg(MSGDEBUG, "Received %d bytes of %d bytes expected, return code is %d\n",
            conn->datadone, conn->datalen, rc);
   return(rc);
}
开发者ID:Shouqun,项目名称:tsocks_for_mac,代码行数:28,代码来源:tsocks.c

示例3: handle_path

static int handle_path(struct parsedfile *config, int lineno, int nowords, char *words[]) {
    struct serverent *newserver;

    if ((nowords != 2) || (strcmp(words[1], "{"))) {
        show_msg(MSGERR, "Badly formed path open statement on line %d "
               "in configuration file (should look like "
               "\"path {\")\n", lineno);
    } else if (currentcontext != &(config->defaultserver)) {
        /* You cannot nest path statements so check that */
        /* the current context is defaultserver          */
        show_msg(MSGERR, "Path statements cannot be nested on line %d "
               "in configuration file\n", lineno);
    } else {
        /* Open up a new serverent, put it on the list   */
        /* then set the current context                  */
        if (((int) (newserver = (struct serverent *) malloc(sizeof(struct serverent)))) == -1)
            exit(-1);

        /* Initialize the structure */
        show_msg(MSGDEBUG, "New server structure from line %d in configuration file going "
                           "to 0x%08x\n", lineno, newserver);
        memset(newserver, 0x0, sizeof(*newserver));
        newserver->next = config->paths;
        newserver->lineno = lineno;
        config->paths = newserver;
        currentcontext = newserver;
    }
 
    return(0);
}
开发者ID:khKhKhEtelKhKhkh,项目名称:torsocks,代码行数:30,代码来源:parser.c

示例4: getpeername

/* If we are not done setting up the connection yet, return
 * -1 and ENOTCONN, otherwise call getpeername
 *
 * This is necessary since some applications, when using non-blocking connect,
 * (like ircII) use getpeername() to find out if they are connected already.
 *
 * This results in races sometimes, where the client sends data to the socket
 * before we are done with the socks connection setup.  Another solution would
 * be to intercept send().
 * 
 * This could be extended to actually set the peername to the peer the
 * client application has requested, but not for now.
 *
 * PP, Sat, 27 Mar 2004 11:30:23 +0100
 */
int getpeername(GETPEERNAME_SIGNATURE) {
   struct connreq *conn;
   int rc;

    if (realgetpeername == NULL) {
        show_msg(MSGERR, "Unresolved symbol: getpeername\n");
        return(-1);
    }

   show_msg(MSGDEBUG, "Call to getpeername for fd %d\n", __fd);


   rc = realgetpeername(__fd, __name, __namelen);
   if (rc == -1)
       return rc;

   /* Are we handling this connect? */
   if ((conn = find_socks_request(__fd, 1))) {
       /* While we are at it, we might was well try to do something useful */
       handle_request(conn);

       if (conn->state != DONE) {
           errno = ENOTCONN;
           return(-1);
       }
   }
   return rc;
}
开发者ID:Shouqun,项目名称:tsocks_for_mac,代码行数:43,代码来源:tsocks.c

示例5: handle_type

static int handle_type(struct parsedfile *config, int lineno, char *value) {

    if (currentcontext->type != 0) {
        if (currentcontext == &(config->defaultserver))
            show_msg(MSGERR, "Server type may only be specified "
                   "once for default server, at line %d "
                   "in configuration file\n", lineno);
        else
            show_msg(MSGERR, "Server type may only be specified "
                   "once per path on line %d in configuration "
                   "file. (Path begins on line %d)\n",
                   lineno, currentcontext->lineno);
    } else {
        errno = 0;
        currentcontext->type = (int) strtol(value, (char **)NULL, 10);
        if ((errno != 0) || (currentcontext->type == 0) ||
            ((currentcontext->type != 4) && (currentcontext->type != 5))) {
            show_msg(MSGERR, "Invalid server type (%s) "
                   "specified in configuration file "
                   "on line %d, only 4 or 5 may be "
                   "specified\n", value, lineno);
            currentcontext->type = 0;
        }
    }
    
    return(0);
}
开发者ID:khKhKhEtelKhKhkh,项目名称:torsocks,代码行数:27,代码来源:parser.c

示例6: our_gethostbyname

struct hostent * our_gethostbyname(dead_pool *pool, const char *name)
{
  int pos;
  static struct in_addr addr;
  static struct hostent he;
  static char *addrs[2];

  show_msg(MSGDEBUG, "our_gethostbyname: '%s' requested\n", name);

  pos = store_pool_entry(pool,(char *) name, &addr);
  if(pos == -1) {
      h_errno = HOST_NOT_FOUND;
      return NULL;
  }

  addrs[0] = (char *)&addr;
  addrs[1] = NULL;

  he.h_name      = pool->entries[pos].name;
  he.h_aliases   = NULL;
  he.h_length    = 4;
  he.h_addrtype  = AF_INET;
  he.h_addr_list = addrs;

  show_msg(MSGDEBUG, "our_gethostbyname: resolved '%s' to: '%s'\n", 
           name, inet_ntoa(*((struct in_addr *)he.h_addr)));

  return &he;
}
开发者ID:javerous,项目名称:TorProxifier,代码行数:29,代码来源:dead_pool.c

示例7: parse_socks4a_resolve_response

static int parse_socks4a_resolve_response(const char *response, size_t len, uint32_t *addr_out)
{
  uint8_t status;
  uint16_t port;

  if (len < RESPONSE_LEN) {
    show_msg(MSGWARN,"Truncated socks response.\n"); 
    return -1;
  }
  if (((uint8_t)response[0])!=0) { /* version: 0 */
    show_msg(MSGWARN,"Nonzero version in socks response: bad format.\n");
    return -1;
  }
  status = (uint8_t)response[1];

  memcpy(&port, response+2, sizeof(port));
  if (port!=0) { /* port: 0 */
    show_msg(MSGWARN,"Nonzero port in socks response: bad format.\n"); 
    return -1;
  }
  if (status != 90) {
    show_msg(MSGWARN,"Bad status: socks request failed.\n"); 
    return -1;
  }

  memcpy(addr_out, response+4, sizeof(*addr_out));

  return 0;
}
开发者ID:javerous,项目名称:TorProxifier,代码行数:29,代码来源:dead_pool.c

示例8: clock

bwa_seq_t *load_reads(const char *fa_fn, uint32_t *n_seqs) {
	bwa_seq_t *seqs, *part_seqs;
	bwa_seqio_t *ks;
	int n_part_seqs = 0, n_seqs_full = 0, n_seqs_loaded = 0;
	clock_t t = clock();

	ks = bwa_open_reads(BWA_MODE, fa_fn);
	n_seqs_full = N_CHUNK_SEQS;
	show_msg(__func__, "Loading reads from library %s...\n", fa_fn);
	seqs = (bwa_seq_t*) calloc (N_DF_MAX_SEQS, sizeof(bwa_seq_t));
	while ((part_seqs = bwa_read_seq(ks, N_CHUNK_SEQS, &n_part_seqs, BWA_MODE, 0))
			!= 0) {
		show_msg(__func__, "%d sequences loaded: %.2f sec... \n",
				n_seqs_loaded + n_part_seqs, fa_fn, (float) (clock() - t) / CLOCKS_PER_SEC);
		pe_reverse_seqs(part_seqs, n_part_seqs);

		if ((n_seqs_loaded + n_part_seqs) > n_seqs_full) {
			n_seqs_full += n_part_seqs + 2;
			kroundup32(n_seqs_full);
			seqs = (bwa_seq_t*) realloc(seqs, sizeof(bwa_seq_t) * n_seqs_full);
		}
		memmove(&seqs[n_seqs_loaded], part_seqs, sizeof(bwa_seq_t) * n_part_seqs);
		free(part_seqs);
		n_seqs_loaded += n_part_seqs;
	}
	bwa_seq_close(ks);
	if (n_seqs_loaded < 1) {
		err_fatal(__func__,
				"No sequence in file %s, make sure the format is correct! \n",
				fa_fn);
	}
	*n_seqs = n_seqs_loaded;
	return seqs;
}
开发者ID:agongdai,项目名称:peta,代码行数:34,代码来源:rnaseq.c

示例9: read_socksv4_req

static int read_socksv4_req(struct connreq *conn) {
   struct sockrep *thisrep;

   thisrep = (struct sockrep *) conn->buffer;

   if (thisrep->result != 90) {
      show_msg(MSGERR, "SOCKS V4 connect rejected:\n");
      conn->state = FAILED;
      switch(thisrep->result) {
         case 91:
            show_msg(MSGERR, "SOCKS server refused connection\n");
            return(ECONNREFUSED);
         case 92:
            show_msg(MSGERR, "SOCKS server refused connection "
                  "because of failed connect to identd "
                  "on this machine\n");
            return(ECONNREFUSED);
         case 93:
            show_msg(MSGERR, "SOCKS server refused connection "
                  "because identd and this library "
                  "reported different user-ids\n");
            return(ECONNREFUSED);
         default:
            show_msg(MSGERR, "Unknown reason\n");
            return(ECONNREFUSED);
      }
   }

   conn->state = DONE;

   return(0);
}
开发者ID:TamasSzerb,项目名称:tsocks,代码行数:32,代码来源:tsocks.c

示例10: handle_port

static int handle_port(struct parsedfile *config, int lineno, char *value) {

    if (currentcontext->port != 0) {
        if (currentcontext == &(config->defaultserver))
            show_msg(MSGERR, "Server port may only be specified "
                   "once for default server, at line %d "
                   "in configuration file\n", lineno);
        else
            show_msg(MSGERR, "Server port may only be specified "
                   "once per path on line %d in configuration "
                   "file. (Path begins on line %d)\n",
                   lineno, currentcontext->lineno);
    } else {
        errno = 0;
        currentcontext->port = (unsigned short int)
                  (strtol(value, (char **)NULL, 10));
        if ((errno != 0) || (currentcontext->port == 0)) {
            show_msg(MSGERR, "Invalid server port number "
                   "specified in configuration file "
                   "(%s) on line %d\n", value, lineno);
            currentcontext->port = 0;
        }
    }
    
    return(0);
}
开发者ID:khKhKhEtelKhKhkh,项目名称:torsocks,代码行数:26,代码来源:parser.c

示例11: connect_server

static int connect_server(struct connreq *conn) {
   int rc;

	/* Connect this socket to the socks server */
   show_msg(MSGDEBUG, "Connecting to %s port %d\n", 
            inet_ntoa(conn->serveraddr.sin_addr), ntohs(conn->serveraddr.sin_port));
   rc = realconnect(conn->sockid, (CONNECT_SOCKARG) &(conn->serveraddr),
                    sizeof(conn->serveraddr));
   show_msg(MSGDEBUG, "Connect returned %d, errno is %d\n", rc, errno); 
	if (rc) {
      if (errno != EINPROGRESS) {
         show_msg(MSGERR, "Error %d attempting to connect to SOCKS "
                  "server (%s)\n", errno, strerror(errno));
         conn->state = FAILED;
      } else {
         show_msg(MSGDEBUG, "Connection in progress\n");
         conn->state = CONNECTING;
      }
   } else {
      show_msg(MSGDEBUG, "Socket %d connected to SOCKS server\n", conn->sockid);
      conn->state = CONNECTED;
   }

   return((rc ? errno : 0));
}
开发者ID:TamasSzerb,项目名称:tsocks,代码行数:25,代码来源:tsocks.c

示例12: client_receive_smb

static ssize_t client_receive_smb(struct cli_state *cli, size_t maxlen)
{
	size_t len;

	for(;;) {
		NTSTATUS status;

		set_smb_read_error(&cli->smb_rw_error, SMB_READ_OK);

		status = receive_smb_raw(cli->fd, cli->inbuf, cli->bufsize,
					cli->timeout, maxlen, &len);
		if (!NT_STATUS_IS_OK(status)) {
			DEBUG(10,("client_receive_smb failed\n"));
			show_msg(cli->inbuf);

			if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) {
				set_smb_read_error(&cli->smb_rw_error,
						   SMB_READ_EOF);
				return -1;
			}

			if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
				set_smb_read_error(&cli->smb_rw_error,
						   SMB_READ_TIMEOUT);
				return -1;
			}

			set_smb_read_error(&cli->smb_rw_error, SMB_READ_ERROR);
			return -1;
		}

		/*
		 * I don't believe len can be < 0 with NT_STATUS_OK
		 * returned above, but this check doesn't hurt. JRA.
		 */

		if ((ssize_t)len < 0) {
			return len;
		}

		/* Ignore session keepalive packets. */
		if(CVAL(cli->inbuf,0) != SMBkeepalive) {
			break;
		}
	}

	if (cli_encryption_on(cli)) {
		NTSTATUS status = cli_decrypt_message(cli);
		if (!NT_STATUS_IS_OK(status)) {
			DEBUG(0, ("SMB decryption failed on incoming packet! Error %s\n",
				nt_errstr(status)));
			cli->smb_rw_error = SMB_READ_BAD_DECRYPT;
			return -1;
		}
	}

	show_msg(cli->inbuf);
	return len;
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:59,代码来源:clientgen.c

示例13: handle_line

static int handle_line(struct parsedfile *config, char *line, int lineno) {
	char *words[10];
	static char savedline[MAXLINE];
	int   nowords = 0, i;

	/* Save the input string */
	strncpy(savedline, line, MAXLINE - 1);
	savedline[MAXLINE - 1] = (char) 0;
	/* Tokenize the input string */
	nowords = tokenize(line, 10, words);	

	/* Set the spare slots to an empty string to simplify */
	/* processing                                         */
	for (i = nowords; i < 10; i++) 
		words[i] = "";

	if (nowords > 0) {
		/* Now this can either be a "path" block starter or */
		/* ender, otherwise it has to be a pair (<name> =   */
		/* <value>)                                         */
		if (!strcmp(words[0], "path")) {
			handle_path(config, lineno, nowords, words);
		} else if (!strcmp(words[0], "}")) {
			handle_endpath(config, lineno, nowords, words);
		} else {
			/* Has to be a pair */
			if ((nowords != 3) || (strcmp(words[1], "="))) {
				show_msg(MSGERR, "Malformed configuration pair "
					   "on line %d in configuration "
					   "file, \"%s\"\n", lineno, savedline);
			} else if (!strcmp(words[0], "reaches")) {
				handle_reaches(config, lineno, words[2]);
			} else if (!strcmp(words[0], "server")) {
				handle_server(config, lineno, words[2]);
			} else if (!strcmp(words[0], "server_port")) {
				handle_port(config, lineno, words[2]);
			} else if (!strcmp(words[0], "server_type")) {
				handle_type(config, lineno, words[2]);
			} else if (!strcmp(words[0], "default_user")) {
				handle_defuser(config, lineno, words[2]);
			} else if (!strcmp(words[0], "default_pass")) {
				handle_defpass(config, lineno, words[2]);
			} else if (!strcmp(words[0], "local")) {
				handle_local(config, lineno, words[2]);
			} else {
				show_msg(MSGERR, "Invalid pair type (%s) specified "
					   "on line %d in configuration file, "
					   "\"%s\"\n", words[0], lineno, 
					   savedline);
			}
		}
	}

	return(0);
}
开发者ID:Anakros,项目名称:tsocks,代码行数:55,代码来源:parser.c

示例14: send_socksv5_connect

static int send_socksv5_connect(struct connreq *conn) {
#ifdef USE_TOR_DNS
   int namelen = 0;
   char *name = NULL;
#endif
   char constring[] = { 0x05,    /* Version 5 SOCKS */
                        0x01,    /* Connect request */
                        0x00,    /* Reserved        */
                        0x01 };  /* IP Version 4    */

   show_msg(MSGDEBUG, "Constructing V5 connect request\n");
   conn->datadone = 0;
   conn->state = SENDING;
   conn->nextstate = SENTV5CONNECT;
   memcpy(conn->buffer, constring, sizeof(constring)); 
   conn->datalen = sizeof(constring);

#ifdef USE_TOR_DNS
   show_msg(MSGDEBUG, "send_socksv5_connect: looking for: %s\n",
            inet_ntoa(conn->connaddr.sin_addr));

   name = get_pool_entry(pool, &(conn->connaddr.sin_addr));
   if(name != NULL) {
       namelen = strlen(name);
       if(namelen > 255) {  /* "Can't happen" */
           name = NULL;
       }
   }
   if(name != NULL) {
       show_msg(MSGDEBUG, "send_socksv5_connect: found it!\n");
       /* Substitute the domain name from the pool into the SOCKS request. */
       conn->buffer[3] = 0x03;  /* Change the ATYP field */
       conn->buffer[4] = namelen;  /* Length of name */
       conn->datalen++;
       memcpy(&conn->buffer[conn->datalen], name, namelen);
       conn->datalen += namelen;
   } else {
       show_msg(MSGDEBUG, "send_socksv5_connect: ip address not found\n");
#endif
       /* Use the raw IP address */
       memcpy(&conn->buffer[conn->datalen], &(conn->connaddr.sin_addr.s_addr), 
              sizeof(conn->connaddr.sin_addr.s_addr));
       conn->datalen += sizeof(conn->connaddr.sin_addr.s_addr);
#ifdef USE_TOR_DNS
   }
#endif
   memcpy(&conn->buffer[conn->datalen], &(conn->connaddr.sin_port), 
        sizeof(conn->connaddr.sin_port));
   conn->datalen += sizeof(conn->connaddr.sin_port);

   return(0);
}			
开发者ID:Shouqun,项目名称:tsocks_for_mac,代码行数:52,代码来源:tsocks.c

示例15: handle_reaches

static int handle_reaches(int lineno, char *value) {
    int rc;
    struct netent *ent;

    rc = make_netent(value, &ent);
    switch(rc) {
        case 1:
            show_msg(MSGERR, "Local network specification (%s) is not validly "
                   "constructed in reach statement on line "
                   "%d in configuration "
                   "file\n", value, lineno);
            return(0);
            break;
        case 2:
            show_msg(MSGERR, "IP in reach statement "
                   "network specification (%s) is not valid on line "
                   "%d in configuration file\n", value, lineno);
            return(0);
            break;
        case 3:
            show_msg(MSGERR, "SUBNET in reach statement "
                   "network specification (%s) is not valid on "
                   "line %d in configuration file\n", value,
                   lineno);
            return(0);
            break;
        case 4:
            show_msg(MSGERR, "IP (%s) & ", inet_ntoa(ent->localip));
            show_msg(MSGERR, "SUBNET (%s) != IP on line %d in "
                   "configuration file, ignored\n",
                   inet_ntoa(ent->localnet), lineno);
            return(0);
         break;
        case 5:
            show_msg(MSGERR, "Start port in reach statement "
                    "network specification (%s) is not valid on line "
                    "%d in configuration file\n", value, lineno);
            return(0);
            break;
        case 6:
            show_msg(MSGERR, "End port in reach statement "
                    "network specification (%s) is not valid on line "
                    "%d in configuration file\n", value, lineno);
            return(0);
            break;
        case 7:
            show_msg(MSGERR, "End port in reach statement "
                    "network specification (%s) is less than the start "
                    "port on line %d in configuration file\n", value, 
                    lineno);
            return(0);
            break;
    }

    /* The entry is valid so add it to linked list */
    ent -> next = currentcontext -> reachnets;
    currentcontext -> reachnets = ent;

    return(0);
}
开发者ID:khKhKhEtelKhKhkh,项目名称:torsocks,代码行数:60,代码来源:parser.c


注:本文中的show_msg函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。