#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>

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 closesocket | ( | x | ) | 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, | |||
| s | ) | safe_append((d), (s), sizeof(d)); |
| #define SAFE_COPY | ( | d, | |||
| s | ) | safe_copy((d), (s), sizeof(d)); |
| #define TC_BUFF_MAX 16000 |
| #define TC_LINE_MAX ((PARAM_MAX_LEN * 2) + 2) |
| #define TIMEOUT 40 |
| typedef struct param_data param |
| typedef struct _TCLinkCon TCLinkCon |
| anonymous enum |
| static void AddRecvParam | ( | TCLinkCon * | c, | |
| const char * | name, | |||
| const char * | value | |||
| ) | [static] |
Definition at line 216 of file log-tclink.c.
References param_data::name, param_data::next, _TCLinkCon::recv_param_list, and param_data::value.
Referenced by AddRecvString(), and TCLinkSend().
| static int AddRecvString | ( | TCLinkCon * | c, | |
| char * | string | |||
| ) | [static] |
| 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] |
Definition at line 259 of file log-tclink.c.
References param_data::name, param_data::next, _TCLinkCon::recv_param_list, and param_data::value.
Referenced by TCLinkDestroy(), and TCLinkSend().
| static void ClearSendList | ( | TCLinkCon * | c | ) | [static] |
Definition at line 244 of file log-tclink.c.
References param_data::name, param_data::next, _TCLinkCon::send_param_list, _TCLinkCon::send_param_tail, and param_data::value.
Referenced by TCLinkDestroy().
| 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] |
Definition at line 511 of file log-tclink.c.
References BeginConnection(), cert_data, CheckConnection(), _TCLinkCon::ctx, _TCLinkCon::dns, do_SSL_randomize(), _TCLinkCon::ip, _TCLinkCon::is_error, LOG_TIME(), _TCLinkCon::meth, _TCLinkCon::num_ips, number(), _TCLinkCon::pass, _TCLinkCon::sd, _TCLinkCon::start_time, _TCLinkCon::tc_cert, TC_CERT_SIZE, tclink_host, and TIMEOUT.
Referenced by TCLinkSend().
| void do_SSL_randomize | ( | ) |
| 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] |
Definition at line 168 of file log-tclink.c.
Referenced by BeginConnection(), CheckConnection(), Connect(), do_SSL_randomize(), FinishConnection(), and TCLinkSend().
| static int number | ( | int | min, | |
| int | max | |||
| ) | [static] |
| static int ReadLine | ( | TCLinkCon * | c, | |
| char * | buffer, | |||
| char * | destbuf | |||
| ) | [static] |
Definition at line 680 of file log-tclink.c.
References _TCLinkCon::is_error, safe_copy(), _TCLinkCon::sd, _TCLinkCon::ssl, TC_BUFF_MAX, TC_LINE_MAX, and TIMEOUT.
Referenced by TCLinkSend().
| 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] |
| 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] |
| 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.
| unsigned char cert_data[TC_CERT_SIZE] |
| char* tclink_host = DEFAULT_HOST |
| int tclink_port = 443 |
| char* tclink_version = TCLINK_VERSION |
1.5.5