1 #define _XOPEN_SOURCE 500
10 void logger(isds_log_facility facility
, isds_log_level level
,
11 const char *message
, int length
, void *data
) {
12 printf("\033[32mLOG(%02d,%02d): ", facility
, level
);
13 printf("%.*s", length
, message
);
18 int main(int argc
, char **argv
) {
19 struct isds_ctx
*ctx
= NULL
;
22 setlocale(LC_ALL
, "");
26 printf("isds_init() failed: %s\n", isds_strerror(err
));
29 printf("isds_init() succeeded\n");
32 isds_set_log_callback(logger
, NULL
);
33 isds_set_logging(ILF_ALL
, ILL_ALL
);
35 ctx
= isds_ctx_create();
37 printf("isds_ctx_create() failed");
39 printf("isds_ctx_create() succeeded\n");
43 err
= isds_set_timeout(ctx
, 10000);
45 printf("isds_set_timeout() failed: %s\n", isds_strerror(err
));
47 printf("isds_set_timeout() succeeded\n");
51 err
= isds_login(ctx
, url
, username(), password(), NULL
, NULL
);
53 printf("isds_login() failed: %s: %s\n", isds_strerror(err
),
54 isds_long_message(ctx
));
56 printf("Logged in :)\n");
60 err
= isds_logout(ctx
);
62 printf("isds_logout() failed: %s\n", isds_strerror(err
));
64 printf("isds_logout() succeeded\n");
69 err
= isds_ctx_free(&ctx
);
71 printf("isds_ctx_free() failed: %s\n", isds_strerror(err
));
73 printf("isds_ctx_free() succeeded\n");
80 printf("isds_cleanup() failed: %s\n", isds_strerror(err
));
82 printf("isds_ctx_cleanup() succeeded\n");