8#include <cgreen/cgreen.h>
9#include <cgreen/mocks.h>
19Ensure (osp, osp_new_target_never_returns_null)
21 assert_that (
osp_target_new (NULL, NULL, NULL, 0, 0, 0), is_not_null);
29Ensure (osp, osp_get_vts_no_vts_ret_error)
32 assert_that (
osp_get_vts (conn, NULL), is_equal_to (1));
35Ensure (osp, osp_get_vts_no_conn_ret_error)
37 assert_that (
osp_get_vts (NULL, NULL), is_equal_to (1));
47 assert_true (target->
icmp);
50 assert_true (target->
arp);
60 gchar *expected_xml_string;
65 target_xml = g_string_sized_new (10240);
68 expected_xml_string =
"<target>"
69 "<hosts>127.0.0.1</hosts>"
70 "<exclude_hosts></exclude_hosts>"
71 "<finished_hosts></finished_hosts>"
73 "<alive_test_methods>"
75 "<tcp_syn>1</tcp_syn>"
76 "<tcp_ack>1</tcp_ack>"
78 "<consider_alive>0</consider_alive>"
79 "</alive_test_methods>"
82 assert_that (target_xml->str, is_equal_to_string (expected_xml_string));
90main (
int argc,
char **argv)
94 suite = create_test_suite ();
96 add_test_with_context (suite, osp, osp_new_target_never_returns_null);
97 add_test_with_context (suite, osp, osp_get_vts_no_conn_ret_error);
98 add_test_with_context (suite, osp, osp_get_vts_no_vts_ret_error);
99 add_test_with_context (suite, osp, osp_new_conn_ret_null);
104 return run_single_test (suite, argv[1], create_text_reporter ());
106 return run_test_suite (suite, create_text_reporter ());
API for Open Scanner Protocol communication.
void osp_target_add_alive_test_methods(osp_target_t *target, gboolean icmp, gboolean tcp_syn, gboolean tcp_ack, gboolean arp, gboolean consider_alive)
Add alive test methods to OSP target.
int osp_get_vts(osp_connection_t *connection, entity_t *vts)
Get all VTs from an OSP server.
void osp_target_free(osp_target_t *target)
Free an OSP target, including all added credentials.
static void target_append_as_xml(osp_target_t *target, GString *xml_string)
Concatenate a target as XML.
osp_target_t * osp_target_new(const char *hosts, const char *ports, const char *exclude_hosts, int alive_test, int reverse_lookup_unify, int reverse_lookup_only)
Create a new OSP target.
osp_connection_t * osp_connection_new(const char *, int, const char *, const char *, const char *)
int main(int argc, char **argv)
Ensure(osp, osp_new_target_never_returns_null)
Struct holding options for OSP connection.
Struct holding target information.