X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=apps%2Fsilcer%2Fsrc%2Fsilcerapp.cc;h=e04ee1d629efe91a7bd649665508841140099634;hb=a818c5b5411bbc4436d1c5f011236985c96bb787;hp=b73ceb492b2ae4f8c331c23b5558c0429d1cf719;hpb=0f3eb694d54c9319d738f8c14a1da9abb0cc2248;p=silc.git diff --git a/apps/silcer/src/silcerapp.cc b/apps/silcer/src/silcerapp.cc index b73ceb49..e04ee1d6 100644 --- a/apps/silcer/src/silcerapp.cc +++ b/apps/silcer/src/silcerapp.cc @@ -27,6 +27,8 @@ #include #include +#include "silcversion.h" + // Pointer to the application SilcerApp *Silcer_App; string package = "silcer"; @@ -46,7 +48,7 @@ silc_create_key_pair(char *pkcs_name, int bits, char *path, SilcPrivateKey prv_key; SilcRng rng; unsigned char *key; - uint32 key_len; + SilcUInt32 key_len; char pkfile[256], prvfile[256]; if (!pkcs_name || !path) @@ -142,7 +144,7 @@ void silc_disconnect(SilcClient client, SilcClientConnection conn) static void silc_auth_meth(SilcClient client, SilcClientConnection conn, - char *hostname, uint16 port, + char *hostname, SilcUInt16 port, SilcGetAuthMeth completion, void *context) { completion(TRUE, SILC_AUTH_NONE, NULL, 0, context); @@ -151,7 +153,7 @@ void silc_auth_meth(SilcClient client, static void silc_verify_public_key(SilcClient client, SilcClientConnection conn, SilcSocketType conn_type, unsigned char *pk, - uint32 pk_len, SilcSKEPKType pk_type, + SilcUInt32 pk_len, SilcSKEPKType pk_type, SilcVerifyPublicKey completion, void *context) { completion(TRUE, context); @@ -211,21 +213,34 @@ SilcerApp::SilcerApp(int argc, char **argv) // Initialize SILC Client Library */ silc_client = silc_client_alloc(&ops, NULL, NULL, "SILC-1.0-0.6.2"); - silc_client->realname = "pekka riikonen"; - silc_client->username = "priikone"; - silc_client->hostname = "mun.oma.kone"; + silc_client->realname = "Foo T. Bar"; + silc_client->username = "foobar"; + silc_client->hostname = "foo.bar.foobar.com"; silc_cipher_register_default(); silc_pkcs_register_default(); silc_hash_register_default(); silc_hmac_register_default(); - silc_create_key_pair("rsa", 1024, "kk", "UN=priikone, " - "HN=pelle.kuo.fi.ssh.com", + + // XXXXX + // In real application at this point it would be of course checked + // whether ~/.silc direectory or something exists and key pair exists. + // If not then some firstsetup-wizard would be lauched that creates + // the keypair. In our example we'll always create a key pair. :( + silc_create_key_pair("rsa", 1024, "kk", "UN=foobar, " + "HN=foo.bar.foobar.com", &silc_client->public_key, &silc_client->private_key); + + // We are ready to initialize the SILC Client library. silc_client_init(silc_client); - // Setup SILC scheduler as timeout task + // Setup SILC scheduler as timeout task. This will handle the SILC + // client library every 50 milliseconds. It will actually make the + // SILC client work on background. Gnome::Main::timeout.connect(slot(this, &SilcerApp::silc_scheduler), 50); + // XXXXX + // This is now used to directly connect to silc.silcnet.org router + // XXXXX silc_schedule_task_add(silc_client->schedule, 0, connect_client, silc_client, 0, 1, SILC_TASK_TIMEOUT, SILC_TASK_PRI_NORMAL); @@ -278,6 +293,10 @@ GladeXML *SilcerApp::load_resource(const char *name, const char *filename) gint SilcerApp::silc_scheduler() { + // Run the SILC client once, and return immediately. This function + // is called every 50 milliseconds by the Gnome main loop, to process + // SILC stuff. This function will read data, and write data to network, + // etc. Makes the client library tick! :) silc_client_run_one(silc_client); return 1; }