本文整理汇总了C++中parse_address函数的典型用法代码示例。如果您正苦于以下问题:C++ parse_address函数的具体用法?C++ parse_address怎么用?C++ parse_address使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse_address函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: eth_topology
template<typename... Args> explicit
eth_topology(const Args&... args)
: super(args...),
m_source(m_source_buf),
m_destination(m_destination_buf),
m_neighbor(m_neighbor_buf),
m_helper(m_helper_buf),
m_two_hop(m_two_hop_buf)
{
constexpr const char *def = NULL;
const char *source_tmp = kwget(source, def, args...);
const char *destination_tmp = kwget(destination, def, args...);
const char *neighbor_tmp = kwget(neighbor, def, args...);
const char *helper_tmp = kwget(helper, def, args...);
const char *two_hop_tmp = kwget(two_hop, def, args...);
if (!parse_address(source_tmp, m_source))
m_source = NULL;
if (!parse_address(destination_tmp, m_destination))
m_destination = NULL;
if (!parse_address(neighbor_tmp, m_neighbor))
m_neighbor = NULL;
if (!parse_address(helper_tmp, m_helper))
m_helper = NULL;
if (!parse_address(two_hop_tmp, m_two_hop))
m_two_hop = NULL;
}
开发者ID:hundeboll,项目名称:netmix,代码行数:31,代码来源:eth_topology.hpp
示例2: execute_set_of_instructions
//Executes all commmands stored in 'command_arr'.
void execute_set_of_instructions(COMMAND* commands_arr, int* registers_arr, byte* mem, int* current_time, CONFIG* config, L1_CACHE* L1_cache, L2_CACHE* L2_cache ){
int instruction_counter = 1;
int pc = 0;
unsigned tag_L1;
unsigned index_L1;
unsigned offset_L1;
unsigned tag_L2;
unsigned index_L2;
unsigned offset_L2;
int way;
int mem_to_L2_end_time_last_trans;
while (strcmp(commands_arr[pc].cmd_type, "H") != 0){
parse_address(&offset_L1, &index_L1, &tag_L1, commands_arr[pc].inst_address, config->l1_block_size, config->l1_cache_size);
parse_address(&offset_L2, &index_L2, &tag_L2, commands_arr[pc].inst_address, config->l2_block_size, config->l2_cache_size);
if (!is_in_L1(index_L1, tag_L1,offset_L1,L1_cache, current_time, config)){
if (is_in_L2(index_L2, tag_L2,offset_L2,L2_cache,current_time,config)){
L2_to_L1_trans(L1_cache, offset_L1,index_L1,tag_L1,L2_cache,offset_L2,index_L2,tag_L2,*current_time,config,way,true);
}else{
MEM_to_L2_trans(mem, L2_cache, offset_L2, index_L2, tag_L2,*current_time,config,NULL,way,true);
way = !L2_cache->block_arr[index_L2].LRU;
mem_to_L2_end_time_last_trans = L2_cache->block_arr[index_L2].block_trans_end_time[way];
L2_to_L1_trans(L1_cache, offset_L1,index_L1,tag_L1,L2_cache,offset_L2,index_L2,tag_L2,mem_to_L2_end_time_last_trans,config,way,true);
}
}
execute_instruction(commands_arr[pc], commands_arr, registers_arr, mem, &pc);
instruction_counter++;
}
}
开发者ID:idansayag,项目名称:computer_architecture_part_A,代码行数:33,代码来源:simulator.cpp
示例3: load_word
//Returns the word that is stored in 'mem[address]'.
int load_word(unsigned address, byte* mem, L1_CACHE* L1_cache, L2_CACHE* L2_cache,CONFIG* config,int* current_time){
unsigned offset_L1;
unsigned index_L1;
unsigned tag_L1;
unsigned offset_L2;
unsigned index_L2;
unsigned tag_L2;
int way;
int mem_to_L2_end_time_last_trans;
byte* block;
parse_address(&offset_L1,&index_L1,&tag_L1,address,config->l1_block_size,config->l1_cache_size);
parse_address(&offset_L2,&index_L2,&tag_L2,address,config->l2_block_size,config->l2_cache_size);
if (is_in_L1(index_L1, tag_L1,offset_L1,L1_cache, current_time, config)){
block = L1_cache->block_arr[index_L1].block;
return block[offset_L1]<<24 | block[offset_L1+1]<<16 | block[offset_L1+2]<<8 | block[offset_L1+3];
}else if (is_in_L2(index_L2, tag_L2,offset_L2,L2_cache,current_time,config)){
way = !L2_cache->block_arr[index_L2].LRU;
block = L2_cache->block_arr[index_L1].block[way];
L2_to_L1_trans(L1_cache, offset_L1,index_L1,tag_L1,L2_cache,offset_L2,index_L2,tag_L2,*current_time,config,way);
return block[offset_L2]<<24 | block[offset_L2+1]<<16 | block[offset_L2+2]<<8 | block[offset_L2+3];
}else{
way = !L2_cache->block_arr[index_L2].LRU;
MEM_to_L2_trans(mem, L2_cache, offset_L2, index_L2, tag_L2,*current_time,config,address,way,false);
way = !L2_cache->block_arr[index_L2].LRU;
mem_to_L2_end_time_last_trans = L2_cache->block_arr[index_L2].block_trans_end_time[way];
L2_to_L1_trans(L1_cache, offset_L1,index_L1,tag_L1,L2_cache,offset_L2,index_L2,tag_L2,mem_to_L2_end_time_last_trans,config,way);
return mem[address] <<24 | mem[address+1]<<16 | mem[address+2]<<8 | mem[address+3];
}
}
开发者ID:idansayag,项目名称:computer_architecture_part_A,代码行数:33,代码来源:simulator.cpp
示例4: parse_ranges_property
static void
parse_ranges_property (struct hw *current,
const char *property_name,
const char *property_value)
{
int nr_ranges;
int range_nr;
range_property_spec *ranges;
const char *chp;
/* determine the number of ranges specified */
nr_ranges = count_entries (current, property_name, property_value, 3);
/* create a property of that size */
ranges = zalloc (nr_ranges * sizeof(*ranges));
/* fill it in */
chp = property_value;
for (range_nr = 0; range_nr < nr_ranges; range_nr++)
{
chp = parse_address (current, current,
chp, &ranges[range_nr].child_address);
chp = parse_address (current, hw_parent(current),
chp, &ranges[range_nr].parent_address);
chp = parse_size (current, current,
chp, &ranges[range_nr].size);
}
/* create it */
hw_add_range_array_property (current, property_name, ranges, nr_ranges);
free (ranges);
}
开发者ID:Claruarius,项目名称:stblinux-2.6.37,代码行数:33,代码来源:hw-tree.c
示例5: getip
static int
getip(int c, unsigned char **ip_r, int *af_r, gnc_t gnc, void *closure)
{
char *t;
unsigned char *ip;
unsigned char addr[16];
int af, rc;
c = getword(c, &t, gnc, closure);
if(c < -1)
return c;
rc = parse_address(t, addr, &af);
if(rc < 0) {
free(t);
return -2;
}
free(t);
ip = malloc(16);
if(ip == NULL) {
return -2;
}
memcpy(ip, addr, 16);
*ip_r = ip;
if(af_r)
*af_r = af;
return c;
}
开发者ID:guinness1,项目名称:Byzantium,代码行数:28,代码来源:config.c
示例6: parse_reg_property
static void
parse_reg_property (struct hw *current,
const char *property_name,
const char *property_value)
{
int nr_regs;
int reg_nr;
reg_property_spec *regs;
const char *chp;
/* determine the number of reg entries by counting tokens */
nr_regs = count_entries (current, property_name, property_value, 2);
/* create working space */
regs = zalloc (nr_regs * sizeof (*regs));
/* fill it in */
chp = property_value;
for (reg_nr = 0; reg_nr < nr_regs; reg_nr++)
{
chp = parse_address (current, hw_parent(current),
chp, ®s[reg_nr].address);
chp = parse_size (current, hw_parent(current),
chp, ®s[reg_nr].size);
}
/* create it */
hw_add_reg_array_property (current, property_name,
regs, nr_regs);
free (regs);
}
开发者ID:Claruarius,项目名称:stblinux-2.6.37,代码行数:32,代码来源:hw-tree.c
示例7: cockpit_channel_parse_stream
CockpitConnectable *
cockpit_channel_parse_stream (CockpitChannel *self)
{
CockpitConnectable *connectable;
GSocketConnectable *address;
gboolean local;
gchar *name;
address = parse_address (self, &name, &local);
if (!address)
return NULL;
connectable = g_new0 (CockpitConnectable, 1);
connectable->address = address;
connectable->name = name;
connectable->refs = 1;
connectable->local = local;
if (!parse_stream_options (self, connectable))
{
cockpit_connectable_unref (connectable);
connectable = NULL;
}
return connectable;
}
开发者ID:arilivigni,项目名称:cockpit,代码行数:26,代码来源:cockpitchannel.c
示例8: local_init_channel
/* init_channel:
* This function will be called when a channel is created, before any
* data is sent. It should at least set the channel's return address to
* something meaningful or at least to a valid string if the driver can't
* supply a return address. It can allocate memory, pointed to by the
* `data' field of the channel struct. Return zero if successful, non-zero
* otherwise.
*/
static int local_init_channel(NET_CHANNEL *chan, const char *addr)
{
channel_data_t *data;
port_t *port;
int num;
MUTEX_LOCK(port_list);
num = parse_address(addr);
if (num < 0) {
MUTEX_UNLOCK(port_list);
return -1;
}
port = create_port(num);
/* We don't need the lock any more because `create_port' incremented
* the usage counter on the port, so it won't vanish, and we're not
* dereferencing the pointer any more. */
MUTEX_UNLOCK(port_list);
if (!port)
return -1;
sprintf(chan->local_addr, "%d", num);
chan->data = data = malloc(sizeof *data);
data->port = port;
data->target = -1;
return 0;
}
开发者ID:haision,项目名称:GitHub_C,代码行数:40,代码来源:local.c
示例9: parse_reg_property
parse_reg_property(device *current,
const char *property_name,
const char *property_value)
{
int nr_regs;
int reg_nr;
reg_property_spec *regs;
const char *chp;
device *bus = device_parent(current);
/* determine the number of reg entries by counting tokens */
nr_regs = count_entries(current, property_name, property_value,
1 + (device_nr_size_cells(bus) > 0));
/* create working space */
regs = zalloc(nr_regs * sizeof(*regs));
/* fill it in */
chp = property_value;
for (reg_nr = 0; reg_nr < nr_regs; reg_nr++) {
chp = parse_address(current, bus, chp, ®s[reg_nr].address);
if (device_nr_size_cells(bus) > 0)
chp = parse_size(current, bus, chp, ®s[reg_nr].size);
else
memset(®s[reg_nr].size, 0, sizeof (®s[reg_nr].size));
}
/* create it */
device_add_reg_array_property(current, property_name,
regs, nr_regs);
zfree(regs);
}
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:33,代码来源:tree.c
示例10: strcpy
// ============================================================
void CFido::operator= (LPCSTR name)
// ============================================================
{
int ret;
isdigit=zone=net=node=point=0;
if (*name=='#') // it's a direct phone number
{
isdigit=1;
strcpy(asciibuf,name);
return;
}
// if number contains '~' than FileSystem has long filenames
if (strchr(name,'~'))
{
::MessageBox(NULL,"Detected problem with filename length!","Error",MB_OK);
return;
}
if (strchr(name,'_'))
{
ret=sscanf(name,"%d_%d_%d_%d",&zone,&net,&node,&point);
ASSERT((ret==3) || (ret==4));
}
else
{
ret=parse_address(name,&zone,&net,&node,&point);
ASSERT(ret==3 || ret==4);
}
// store this adress internally
make_address(asciibuf,zone,net,node,point);
}
开发者ID:kosfango,项目名称:fips,代码行数:35,代码来源:cfido.cpp
示例11: parse_address
int Parser::identifyLine(const char *aLine)
{
int res = 0;
res |= parse_address(aLine);
res |= parse_case(aLine);
// if(strchr(aLine,ICON_CHAR)) res |= P_PUSHBUTTON;
if(zip->match(aLine)) res |= (P_ZIP | P_ADDRESS);
if(label->match(aLine)) res |= P_LABEL;
if(address->match(aLine)) res |= P_ADDRESS;
if(res & (P_ADDRESS|P_EMAIL)){
/* Paper and electronic addresses cannot be telephone numbers */
res &= ~P_TELEPHONE;
}
else{
/* Things to check if we are not an address */
if(telephones->match(aLine)) res |= P_TELEPHONE;
if(notphone->match(aLine)) res &= ~P_TELEPHONE;
if(blankLine->match(aLine)) res |= P_BLANKLINE;
/* fix the bug with Office */
if(res & P_OFFICE){
if(telephones->match(aLine)){
res &= ~P_ADDRESS;
res |= P_TELEPHONE;
}
}
}
return res;
}
开发者ID:dpp,项目名称:SBook5,代码行数:33,代码来源:Parser.cpp
示例12: cmd_mail
int cmd_mail(struct client *client, const char *args)
{
const char *addr, *const *argv;
if (client->state.mail_from != NULL) {
client_send_line(client, "503 5.5.1 MAIL already given");
return 0;
}
if (strncasecmp(args, "FROM:", 5) != 0 ||
parse_address(args + 5, &addr, &args) < 0) {
client_send_line(client, "501 5.5.4 Invalid parameters");
return 0;
}
argv = t_strsplit(args, " ");
for (; *argv != NULL; argv++) {
if (strcasecmp(*argv, "BODY=7BIT") == 0)
client->state.mail_body_7bit = TRUE;
else if (strcasecmp(*argv, "BODY=8BITMIME") == 0)
client->state.mail_body_8bitmime = TRUE;
else {
client_send_line(client,
"501 5.5.4 Unsupported options");
return 0;
}
}
client->state.mail_from = p_strdup(client->state_pool, addr);
p_array_init(&client->state.rcpt_to, client->state_pool, 64);
client_send_line(client, "250 2.1.0 OK");
client_state_set(client, "MAIL FROM");
return 0;
}
开发者ID:jkerihuel,项目名称:dovecot,代码行数:34,代码来源:commands.c
示例13: board_impl
board_impl(const std::string& netaddr) {
std::string host;
unsigned short port;
boost::tie(host, port) = parse_address(netaddr);
pbus_.reset((port == 0 ?
new brd::bus::udp_bus(host) :
new brd::bus::udp_bus(host, port)));
}
开发者ID:feseal,项目名称:adp101e1ngu,代码行数:10,代码来源:b101e1ngu.cpp
示例14: ssdp_listener_init
/**
* Initialize a SSDP listener. This parses and sets the forwarder address,
* creates a socket and sets all applicable configuration values to it.
*
* @param listener The listener to initialize.
* @param conf The configuration to use.
* @param active TRUE if an active SSDP listener is to be initialized.
* @param port The port to listen on. 0 will set the port to the SSDP port.
* @param recv_timeout The timeout to set for receiveing/waiting for SSDP
* nodes to respond to a SEARCH query.
*
* @return 0 on success, errno otherwise.
*/
static int ssdp_listener_init(ssdp_listener_s *listener,
configuration_s *conf, BOOL is_active, int port, int recv_timeout) {
PRINT_DEBUG("ssdp_listener_init()");
SOCKET sock = SOCKET_ERROR;
if (!listener) {
PRINT_ERROR("No listener specified");
return 1;
}
memset(listener, 0, sizeof *listener);
/* If set, parse the forwarder address */
if (conf->forward_address) {
if (parse_address(conf->forward_address, &listener->forwarder)) {
PRINT_WARN("Errnoeous forward address");
return 1;
}
}
int listen_queue_len = is_active ? ACTIVE_LISTEN_QUEUE_LENGTH :
PASSIVE_LISTEN_QUEUE_LENGTH;
socket_conf_s sock_conf = {
conf->use_ipv6, // BOOL is_ipv6
TRUE, // BOOL is_udp
is_active, // BOOL is_multicast
conf->interface, // char interface
conf->ip, // the IP we want to bind to
NULL, // struct sockaddr_storage *sa
SSDP_ADDR, // The IP we wnat to send to
port, // The port we want to send to (?)
TRUE, // BOOL is_server
listen_queue_len, // the length of the listen queue
FALSE, // BOOL keepalive
conf->ttl, // time to live (router hops)
conf->enable_loopback,// see own messages on multicast
0, // set the send timeout for the socket (0 = default)
recv_timeout // set the receive timeout for the socket
};
sock = setup_socket(&sock_conf);
if (sock == SOCKET_ERROR) {
PRINT_DEBUG("[%d] %s", errno, strerror(errno));
return errno;
}
listener->sock = sock;
PRINT_DEBUG("ssdp_listener has been initialized");
return 0;
}
开发者ID:andreasbank,项目名称:abused,代码行数:65,代码来源:ssdp_listener.c
示例15: load_session_bus_address
static gchar*
load_session_bus_address (const char *filename)
{
FILE *fp = NULL;
size_t file_size = 0;
size_t bytes_read = 0;
char *buf = NULL;
gchar *address = NULL;
if (!filename)
return NULL;
if ((fp = fopen (filename, "r")) == NULL) {
N_DEBUG (LOG_CAT "no address file %s", filename);
return NULL;
}
fseek (fp, 0L, SEEK_END);
file_size = ftell (fp);
fseek (fp, 0L, SEEK_SET);
if (file_size > 0) {
if ((buf = (char*) g_try_malloc0 (sizeof (char) * file_size)) == NULL) {
N_WARNING (LOG_CAT "failed to allocate memory to read session bus "
"address file.");
fclose (fp);
return NULL;
}
bytes_read = fread (buf, sizeof (char), file_size, fp);
if (bytes_read != file_size) {
N_WARNING (LOG_CAT "failed to read the session bus address file.");
g_free (buf);
fclose (fp);
return NULL;
}
if ((address = parse_address (buf)) != NULL) {
N_DEBUG (LOG_CAT "parsed DBus session bus address: %s", address);
}
else {
N_WARNING (LOG_CAT "failed to parse DBus session bus address.");
}
g_free (buf);
}
fclose (fp);
return address;
}
开发者ID:plundstr,项目名称:ngfd,代码行数:51,代码来源:session.c
示例16: dlg
// ===========================================================================
// ASCII file import in format: xxxxxxxxxx ?:???/?.?
void receiver::OnImport()
// ===========================================================================
{
FILE *fp;
CString path,str;
char buf[300],fido[20];
int zone,net,node,point,ret;
char *p;
str.LoadString(IDS_TEXTFILT);
CFileDialog dlg(TRUE,NULL,NULL,OFN_HIDEREADONLY,str);
ret=dlg.DoModal();
restore_base_path();
if (ret!=IDOK) return;
BeginWaitCursor();
path=dlg.GetPathName();
fp=fopen(path,"rt");
if (fp)
{
while (fgets(buf,199,fp))
{
if (*buf==';') // comment
continue;
replace_tabs(buf); // remove TAB's
p=strchr(buf,':');
if (!p)
continue;
while (*p!=' ')
p--;
p++;
if (parse_address(p,&zone,&net,&node,&point)<3)
continue;
sscanf(p,"%s",fido);
*p=0;
m_edit_fido.SetWindowText(fido);
m_edit_name.SetWindowText(trim_all(buf));
OnAddMember();
}
fclose(fp);
}
else
ERR_MSG2_RET("E_CANOPIM",path);
EndWaitCursor();
}
开发者ID:kosfango,项目名称:fips,代码行数:52,代码来源:RECEIVER.CPP
示例17: parse_addr_spec
LPCSTR parse_addr_spec( LPCSTR s, LPSTR comment, size_t * commentlen,
size_t commentmax, PPerson addr )
{
char token[ 128 ];
size_t tokenlen = 0;
s = parse_address( s, token, &tokenlen, sizeof( token ) - 1, comment, commentlen, commentmax, addr );
if ( s && *s && *s != ',' && *s != ';' )
{
// RFC822Error = ERR_BAD_ADDR_SPEC;
return NULL;
}
return s;
}
开发者ID:Maximus5,项目名称:evil-programmers,代码行数:14,代码来源:Person.cpp
示例18: read_managers
static int read_managers(node *n, const char *nodesfile, endpointid **outids, int *outcount)
{
endpointid *managerids;
int count;
array *nodes = read_nodes(nodesfile);
int i;
*outids = NULL;
*outcount = 0;
if (NULL == nodes)
return -1;
count = array_count(nodes);
managerids = (endpointid*)calloc(count,sizeof(endpointid));
for (i = 0; i < count; i++) {
char *nodename = array_item(nodes,i,char*);
char *host = NULL;
int port = 0;
if (NULL == strchr(nodename,':')) {
host = strdup(nodename);
port = WORKER_PORT;
}
else if (0 > parse_address(nodename,&host,&port)) {
fprintf(stderr,"Invalid node address: %s\n",nodename);
array_free(nodes);
free(managerids);
return -1;
}
managerids[i].port = port;
managerids[i].localid = MANAGER_ID;
if (0 > lookup_address(host,&managerids[i].ip,NULL)) {
fprintf(stderr,"%s: hostname lookup failed\n",host);
array_free(nodes);
free(managerids);
return -1;
}
free(host);
}
*outids = managerids;
*outcount = count;
array_free(nodes);
return 0;
}
开发者ID:amirsalah,项目名称:cs2007,代码行数:49,代码来源:testchord.c
示例19: nodexists
l_slot nodexists(const char *name, const l_slot *Order)
{
char alias[4];
char locID[5];
Bool addrsearch = FALSE;
if (isaddress(name))
{
parse_address(name, alias, locID, 0);
addrsearch = TRUE;
}
// check to see if name is in log table
for (l_slot i = 0; i < cfg.MAXLOGTAB; i++)
{
l_slot S = Order ? Order[i] : i;
if (LogTab[S].IsInuse() && LogTab[S].IsNode())
{
if (addrsearch)
{
if ( // same alias and...
LogTab[S].IsSameAlias(alias) &&
// either...
(
// not searching locIDs or...
!*locID ||
// it matches, too
LogTab[S].IsSameLocID(locID)
)
)
{
return (i);
}
}
else
{
if (LogTab[S].IsSameName(name))
{
return (i);
}
}
}
}
return (CERROR);
}
开发者ID:dylancarlson,项目名称:citplus,代码行数:49,代码来源:log.cpp
示例20: parse_addr_spec
static const char *
parse_addr_spec (const char *s,
char *comment, size_t *commentlen, size_t commentmax,
ADDRESS *addr)
{
char token[LONG_STRING];
size_t tokenlen = 0;
s = parse_address (s, token, &tokenlen, sizeof (token) - 1, comment, commentlen, commentmax, addr);
if (s && *s && *s != ',' && *s != ';') {
RFC822Error = ERR_BAD_ADDR_SPEC;
return NULL;
}
return s;
}
开发者ID:tejux,项目名称:mutt-hacks,代码行数:15,代码来源:rfc822.c
注:本文中的parse_address函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论