1 #define _XOPEN_SOURCE 500
11 int main(int argc
, char **argv
) {
12 struct isds_ctx
*ctx
= NULL
;
14 struct isds_DbOwnerInfo
*db_owner_info
= NULL
;
16 setlocale(LC_ALL
, "");
20 printf("isds_init() failed: %s\n", isds_strerror(err
));
24 isds_set_logging(ILF_ALL
& ~ILF_HTTP
, ILL_ALL
);
26 ctx
= isds_ctx_create();
28 printf("isds_ctx_create() failed");
31 err
= isds_set_timeout(ctx
, 10000);
33 printf("isds_set_timeout() failed: %s\n", isds_strerror(err
));
36 /* err = isds_set_tls(ctx, ITLS_VERIFY_SERVER, 0);
38 printf("isds_set_tls(ITLS_VERIFY_SERVER) failed: %s\n",
42 err = isds_set_tls(ctx, ITLS_CA_FILE, "/etc/ssl/certs/ca-certificates.crt");
44 printf("isds_set_tls(ITLS_CA_FILE) failed: %s\n",
48 err
= isds_login(ctx
, url
, username
, password
, NULL
);
50 printf("isds_login() failed: %s: %s\n", isds_strerror(err
),
51 isds_long_message(ctx
));
53 printf("Logged in :)\n");
58 printf("Getting info about my box:\n");
59 err
= isds_GetOwnerInfoFromLogin(ctx
, &db_owner_info
);
61 printf("isds_GetOwnerInfoFromLogin() failed: %s: %s\n",
62 isds_strerror(err
), isds_long_message(ctx
));
64 printf("isds_GetOwnerInfoFromLogin() succeeded\n");
66 print_DbOwnerInfo(db_owner_info
);
70 /* Switch commecrial message receiving status */
73 struct isds_DbOwnerInfo
*new_db_owner_info
= NULL
;
74 char *refnumber
= NULL
;
76 if (db_owner_info
->dbOpenAddressing
)
77 allow
= !*db_owner_info
->dbOpenAddressing
;
81 printf("Switching commerical receiving status to: %s\n",
82 (allow
) ? "true" : "false");
83 err
= isds_switch_commercial_receiving(ctx
, db_owner_info
->dbID
, allow
,
86 printf("isds_switch_commercial_receiving() failed: %s: %s\n",
87 isds_strerror(err
), isds_long_message(ctx
));
89 printf("isds_switch_commercial_receiving() succeeded "
90 "as request #%s\n", refnumber
);
94 printf("Verifying info about my box:\n");
95 err
= isds_GetOwnerInfoFromLogin(ctx
, &new_db_owner_info
);
97 printf("isds_GetOwnerInfoFromLogin() failed: %s: %s\n",
98 isds_strerror(err
), isds_long_message(ctx
));
100 printf("isds_GetOwnerInfoFromLogin() succeeded\n");
101 printf("New status is: ");
102 print_bool(new_db_owner_info
->dbOpenAddressing
);
104 isds_DbOwnerInfo_free(&new_db_owner_info
);
107 isds_DbOwnerInfo_free(&db_owner_info
);
110 err
= isds_logout(ctx
);
112 printf("isds_logout() failed: %s\n", isds_strerror(err
));
116 err
= isds_ctx_free(&ctx
);
118 printf("isds_ctx_free() failed: %s\n", isds_strerror(err
));
122 err
= isds_cleanup();
124 printf("isds_cleanup() failed: %s\n", isds_strerror(err
));