Back to index

citadel  8.12
Functions | Variables
ipc_c_tcp.c File Reference
#include "sysdep.h"
#include <assert.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/un.h>
#include <netdb.h>
#include <string.h>
#include <pwd.h>
#include <errno.h>
#include <stdarg.h>
#include <libcitadel.h>
#include "citadel.h"
#include "citadel_ipc.h"
#include "citadel_decls.h"
#include "snprintf.h"
#include "commands.h"

Go to the source code of this file.

Functions

void setIPCDeathHook (void(*hook)(void))
void setIPCErrorPrintf (int(*func)(char *s,...))
void connection_died (CtdlIPC *ipc, int using_ssl)

Variables

static void(* deathHook )(void) = NULL
int(* error_printf )(char *s,...) = (int (*)(char *, ...))printf

Function Documentation

void connection_died ( CtdlIPC ipc,
int  using_ssl 
)

Definition at line 45 of file ipc_c_tcp.c.

                                                  {
       if (deathHook != NULL) {
              deathHook();
       }

       stty_ctdl(SB_RESTORE);
       fprintf(stderr, "\r\n\n\n");
       fprintf(stderr, "Your connection to %s is broken.\n", ipc->ServInfo.humannode);

#ifdef HAVE_OPENSSL
       if (using_ssl) {
              fprintf(stderr, "Last error: %s\n", ERR_reason_error_string(ERR_get_error()));
              SSL_free(ipc->ssl);
              ipc->ssl = NULL;
       } else
#endif
              fprintf(stderr, "Last error: %s\n", strerror(errno));

       fprintf(stderr, "Please re-connect and log in again.\n");
       fflush(stderr);
       fflush(stdout);
       shutdown(ipc->sock, 2);
       ipc->sock = -1;
        exit(1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void setIPCDeathHook ( void(*)(void)  hook)

Definition at line 37 of file ipc_c_tcp.c.

                                         {
       deathHook = hook;
}
void setIPCErrorPrintf ( int(*)(char *s,...)  func)

Definition at line 41 of file ipc_c_tcp.c.

                                                  {
       error_printf = func;
}

Here is the caller graph for this function:


Variable Documentation

void(* deathHook)(void) = NULL [static]

Definition at line 34 of file ipc_c_tcp.c.

int(* error_printf)(char *s,...) = (int (*)(char *, ...))printf

Definition at line 35 of file ipc_c_tcp.c.