openMerchant/TrustCommerce/C/log-tclink.c File Reference

#include "tclink.h"
#include <stdio.h>
#include <memory.h>
#include <errno.h>
#include <string.h>
#include <strings.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <signal.h>
#include <openssl/crypto.h>
#include <openssl/x509.h>
#include <openssl/pem.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <openssl/rand.h>

Include dependency graph for log-tclink.c:

Go to the source code of this file.

Classes

struct  param_data
struct  _TCLinkCon

Defines

#define OPENSSL_NO_KRB5   1
#define closesocket(x)   close(x)
#define DEFAULT_HOST   "gateway2048.trustcommerce.com"
#define TIMEOUT   40
#define TC_BUFF_MAX   16000
#define TC_LINE_MAX   ((PARAM_MAX_LEN * 2) + 2)
#define SAFE_COPY(d, s)   safe_copy((d), (s), sizeof(d));
#define SAFE_APPEND(d, s)   safe_append((d), (s), sizeof(d));

Typedefs

typedef struct param_data param
typedef struct _TCLinkCon TCLinkCon

Enumerations

enum  { TC_CERT_SIZE = 952 }

Functions

static int number (int min, int max)
static void LOG_TIME (const char *msg)
static void safe_copy (char *dst, const char *src, int size)
static void safe_append (char *dst, const char *src, int size)
static void AddRecvParam (TCLinkCon *c, const char *name, const char *value)
static int AddRecvString (TCLinkCon *c, char *string)
static void ClearSendList (TCLinkCon *c)
static void ClearRecvList (TCLinkCon *c)
static int BeginConnection (TCLinkCon *c, int host_ip)
static int FinishConnection (TCLinkCon *c, int sd)
static int CheckConnection (TCLinkCon *c, int *sd, int num_sd)
void do_SSL_randomize ()
static int Connect (TCLinkCon *c, int host_hash)
static int Send (TCLinkCon *c, const char *string)
static int ReadLine (TCLinkCon *c, char *buffer, char *destbuf)
static int Close (TCLinkCon *c)
TCLinkHandle TCLinkCreate ()
void TCLinkPushParam (TCLinkHandle handle, const char *name, const char *value)
void TCLinkSend (TCLinkHandle handle)
char * TCLinkGetResponse (TCLinkHandle handle, const char *name, char *value)
static void stuff_string (char *buf, int *len, int size, const char *add)
char * TCLinkGetEntireResponse (TCLinkHandle handle, char *buf, int size)
void TCLinkDestroy (TCLinkHandle handle)
char * TCLinkGetVersion (char *buf)

Variables

char * tclink_version = TCLINK_VERSION
char * tclink_host = DEFAULT_HOST
int tclink_port = 443
unsigned char cert_data [TC_CERT_SIZE]


Define Documentation

#define closesocket (  )     close(x)

Definition at line 42 of file log-tclink.c.

#define DEFAULT_HOST   "gateway2048.trustcommerce.com"

Definition at line 45 of file log-tclink.c.

#define OPENSSL_NO_KRB5   1

Definition at line 30 of file log-tclink.c.

#define SAFE_APPEND ( d,
 )     safe_append((d), (s), sizeof(d));

Definition at line 186 of file log-tclink.c.

Referenced by TCLinkSend().

#define SAFE_COPY ( d,
 )     safe_copy((d), (s), sizeof(d));

Definition at line 185 of file log-tclink.c.

Referenced by TCLinkSend().

#define TC_BUFF_MAX   16000

Definition at line 48 of file log-tclink.c.

Referenced by ReadLine(), and TCLinkSend().

#define TC_LINE_MAX   ((PARAM_MAX_LEN * 2) + 2)

Definition at line 49 of file log-tclink.c.

Referenced by ReadLine(), and TCLinkSend().

#define TIMEOUT   40

Definition at line 46 of file log-tclink.c.

Referenced by Connect(), and ReadLine().


Typedef Documentation

typedef struct param_data param

typedef struct _TCLinkCon TCLinkCon


Enumeration Type Documentation

anonymous enum

Enumerator:
TC_CERT_SIZE 

Definition at line 94 of file log-tclink.c.


Function Documentation

static void AddRecvParam ( TCLinkCon c,
const char *  name,
const char *  value 
) [static]

static int AddRecvString ( TCLinkCon c,
char *  string 
) [static]

Definition at line 231 of file log-tclink.c.

References AddRecvParam().

Referenced by TCLinkSend().

static int BeginConnection ( TCLinkCon c,
int  host_ip 
) [static]

Definition at line 279 of file log-tclink.c.

References LOG_TIME(), and tclink_port.

Referenced by Connect().

static int CheckConnection ( TCLinkCon c,
int *  sd,
int  num_sd 
) [static]

Definition at line 415 of file log-tclink.c.

References FinishConnection(), LOG_TIME(), and _TCLinkCon::sd.

Referenced by Connect().

static void ClearRecvList ( TCLinkCon c  )  [static]

static void ClearSendList ( TCLinkCon c  )  [static]

static int Close ( TCLinkCon c  )  [static]

Definition at line 729 of file log-tclink.c.

References _TCLinkCon::ctx, _TCLinkCon::sd, and _TCLinkCon::ssl.

Referenced by TCLinkDestroy(), and TCLinkSend().

static int Connect ( TCLinkCon c,
int  host_hash 
) [static]

void do_SSL_randomize (  ) 

Definition at line 476 of file log-tclink.c.

References LOG_TIME().

Referenced by Connect().

static int FinishConnection ( TCLinkCon c,
int  sd 
) [static]

Definition at line 313 of file log-tclink.c.

References _TCLinkCon::ctx, LOG_TIME(), _TCLinkCon::ssl, and _TCLinkCon::tc_cert.

Referenced by CheckConnection().

static void LOG_TIME ( const char *  msg  )  [static]

static int number ( int  min,
int  max 
) [static]

Definition at line 163 of file log-tclink.c.

Referenced by Connect().

static int ReadLine ( TCLinkCon c,
char *  buffer,
char *  destbuf 
) [static]

static void safe_append ( char *  dst,
const char *  src,
int  size 
) [static]

Definition at line 199 of file log-tclink.c.

static void safe_copy ( char *  dst,
const char *  src,
int  size 
) [static]

Definition at line 188 of file log-tclink.c.

Referenced by ReadLine(), and TCLinkGetResponse().

static int Send ( TCLinkCon c,
const char *  string 
) [static]

Definition at line 667 of file log-tclink.c.

References _TCLinkCon::ssl.

Referenced by TCLinkSend().

static void stuff_string ( char *  buf,
int *  len,
int  size,
const char *  add 
) [static]

Definition at line 931 of file log-tclink.c.

Referenced by TCLinkGetEntireResponse().

TCLinkHandle TCLinkCreate (  ) 

Definition at line 758 of file log-tclink.c.

void TCLinkDestroy ( TCLinkHandle  handle  ) 

Definition at line 958 of file log-tclink.c.

char* TCLinkGetEntireResponse ( TCLinkHandle  handle,
char *  buf,
int  size 
)

Definition at line 942 of file log-tclink.c.

char* TCLinkGetResponse ( TCLinkHandle  handle,
const char *  name,
char *  value 
)

Definition at line 916 of file log-tclink.c.

char* TCLinkGetVersion ( char *  buf  ) 

Definition at line 976 of file log-tclink.c.

void TCLinkPushParam ( TCLinkHandle  handle,
const char *  name,
const char *  value 
)

Definition at line 783 of file log-tclink.c.

void TCLinkSend ( TCLinkHandle  handle  ) 

Definition at line 812 of file log-tclink.c.


Variable Documentation

unsigned char cert_data[TC_CERT_SIZE]

Definition at line 95 of file log-tclink.c.

Referenced by Connect().

char* tclink_host = DEFAULT_HOST

Definition at line 52 of file log-tclink.c.

Referenced by Connect().

int tclink_port = 443

Definition at line 53 of file log-tclink.c.

Referenced by BeginConnection().

char* tclink_version = TCLINK_VERSION

Definition at line 51 of file log-tclink.c.

Referenced by TCLinkGetVersion(), and TCLinkSend().


Generated on Sat Aug 15 12:47:59 2009 for w3systemsDevelopment by  doxygen 1.5.5