403 |
{ |
{ |
404 |
OPM_SCAN_T *scan; /* New scan for OPM_T */ |
OPM_SCAN_T *scan; /* New scan for OPM_T */ |
405 |
OPM_NODE_T *node; /* Node we'll add scan to when we link it to scans */ |
OPM_NODE_T *node; /* Node we'll add scan to when we link it to scans */ |
406 |
|
opm_inaddr in; |
407 |
|
|
408 |
if (LIST_SIZE(scanner->protocols) == 0 && |
if (LIST_SIZE(scanner->protocols) == 0 && |
409 |
LIST_SIZE(remote->protocols) == 0) |
LIST_SIZE(remote->protocols) == 0) |
410 |
return OPM_ERR_NOPROTOCOLS; |
return OPM_ERR_NOPROTOCOLS; |
411 |
|
|
412 |
scan = libopm_scan_create(scanner, remote); |
/* |
413 |
|
* XXX: libopm ideally shouldn't see an IP address in string representation. |
414 |
if (inet_pton(AF_INET, remote->ip, &(scan->addr.sa4.sin_addr)) <= 0) |
* Could have been stuffed into the _OPM_REMOTE struct by the caller that |
415 |
{ |
* already does getaddrinfo() anyway. |
416 |
libopm_scan_free(scan); |
*/ |
417 |
|
if (inet_pton(AF_INET, remote->ip, &in.in4) <= 0) |
418 |
return OPM_ERR_BADADDR; |
return OPM_ERR_BADADDR; |
419 |
} |
|
420 |
|
scan = libopm_scan_create(scanner, remote); |
421 |
|
memcpy(&scan->addr.sa4.sin_addr, &in.in4, sizeof(scan->addr.sa4.sin_addr)); |
422 |
|
|
423 |
node = libopm_node_create(scan); |
node = libopm_node_create(scan); |
424 |
libopm_list_add(scanner->queue, node); |
libopm_list_add(scanner->queue, node); |