AfDalNulData* afdal_sync_session_login gchar *  user,
gchar *  password,
gchar *  kernel_hostname,
gchar *  kernel_port

Synchronous login version for afdal_session_login function.

This function works pretty much like afdal_session_login function but blocking the caller until login process have finished.

As you can observe this function doesn't require you to set handlers to perform a login request. This is because this function will not need to notify its caller asynchronously.

Here is an example:

  gint main  (gint int, gchaar ** argv) {
     AfDalNulData * login_response;
     AfDalNulData * logout_response;
     // init Af-Arch environment
     afdal_init ();

     // make a login request using fixed data
     login_response = afdal_sync_session_login ("aspl", "test", 
                                                "titan.aspl", "55000");
     if (AFDAL_IS_OK (login_response)) {
          g_print ("Login process ok: %s\n", 
                   AFDAL_RESPONSE (login_response));
     }else {
          g_print ("Login process have failed: %s\n",
                   AFDAL_RESPONSE (login_response));

     // free login request response
     afdal_nul_free (login_response);

     // do some stuff against an Af-Arch server node

     // now, perform a logout request.
     logout_response = afdal_sync_session_logout ();
     if (AFDAL_IS_OK (logout_response)) {
          g_print ("Logout process is ok: %s\n",
                   AFDAL_RESPONSE (logout_response));
     }else {
          g_print ("Logout response have failed: %s\n",
                   AFDAL_RESPONSE (logout_response));
     // free logout request response
     afdal_nul_free (login_response);
     return 0;

As you can see, the code on this example is far more simple to understand and more linear than the example that can be found at afdal_session_login function.

This is mainly because the type of request method. In this case, synchronous request is being used, making caller to be blocked. Although there are some circumstances where Af-Arch synchronous programming is recommended (check afdal_session_login doc) it is usually not recommended.

The main question to note with this model is that making a request disables caller to keep on doing other things such as keep updated the interface while the process is going through.

You have to consider carefully what type of service invocation you will use for your Af-Arch application according to the interface requeriments. Again check afdal_session_login documentation for more info about this issue.

user The user login to be used on session login request.
password The password for the given user.
kernel_hostname The hostname where af-kernel is located.
kernel_port The TCP port where af-kernel host is running.
Returns a AfDalNulData object which holds request status.