Initial commit: server + serverfiles
This commit is contained in:
Executable
+57
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Filename: buffer.h
|
||||
* Description: Buffer 처리 모듈
|
||||
*
|
||||
* Author: 김한주 (aka. 비엽, Cronan), 송영진 (aka. myevan, 빗자루)
|
||||
*/
|
||||
#ifndef __INC_LIBTHECORE_BUFFER_H__
|
||||
#define __INC_LIBTHECORE_BUFFER_H__
|
||||
|
||||
#define SAFE_BUFFER_DELETE(buf) { if(buf != NULL) { buffer_delete(buf); buf = NULL; } }
|
||||
|
||||
typedef struct buffer BUFFER;
|
||||
typedef struct buffer * LPBUFFER;
|
||||
|
||||
struct buffer
|
||||
{
|
||||
struct buffer * next;
|
||||
|
||||
char * write_point;
|
||||
int write_point_pos;
|
||||
|
||||
const char * read_point;
|
||||
int length;
|
||||
|
||||
char * mem_data;
|
||||
int mem_size;
|
||||
|
||||
long flag;
|
||||
};
|
||||
|
||||
extern LPBUFFER buffer_new(int size); // 새 버퍼 생성
|
||||
extern void buffer_delete(LPBUFFER buffer); // 버퍼 삭제
|
||||
extern void buffer_reset(LPBUFFER buffer); // 버퍼 길이들을 초기화
|
||||
|
||||
extern DWORD buffer_size(LPBUFFER buffer); // 버퍼에 남은 길이
|
||||
extern int buffer_has_space(LPBUFFER buffer); // 쓸 수 있는 길이를 리턴
|
||||
|
||||
extern void buffer_write (LPBUFFER& buffer, const void* src, int length); // 버퍼에 쓴다.
|
||||
extern void buffer_read(LPBUFFER buffer, void * buf, int bytes); // 버퍼에서 읽는다.
|
||||
extern BYTE buffer_get_byte(LPBUFFER buffer);
|
||||
extern WORD buffer_get_word(LPBUFFER buffer);
|
||||
extern DWORD buffer_get_dword(LPBUFFER buffer);
|
||||
|
||||
// buffer_proceed 함수는 buffer_peek으로 읽기용 포인터를 리턴 받아서 쓸 필요가
|
||||
// 있을 때 처리가 끝나면 얼마나 처리가 끝났다고 통보해야 할 때 쓴다.
|
||||
// (buffer_read, buffer_get_* 시리즈의 경우에는 알아서 처리되지만 peek으로 처리했을
|
||||
// 때는 그렇게 될 수가 없으므로)
|
||||
extern const void * buffer_read_peek(LPBUFFER buffer); // 읽는 위치를 리턴
|
||||
extern void buffer_read_proceed(LPBUFFER buffer, int length); // length만큼의 처리가 끝남
|
||||
|
||||
// 마찬가지로 write_peek으로 쓰기 위치를 얻어온 다음 얼마나 썼나 통보할 때
|
||||
// buffer_write_proceed를 사용한다.
|
||||
extern void * buffer_write_peek(LPBUFFER buffer); // 쓰는 위치를 리턴
|
||||
extern void buffer_write_proceed(LPBUFFER buffer, int length); // length만 증가 시킨다.
|
||||
|
||||
extern void buffer_adjust_size(LPBUFFER & buffer, int add_size); // add_size만큼 추가할 크기를 확보
|
||||
#endif
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* TEA is a 64-bit symmetric block cipher with a 128-bit key, developed
|
||||
by David J. Wheeler and Roger M. Needham, and described in their
|
||||
paper at <URL:http://www.cl.cam.ac.uk/ftp/users/djw3/tea.ps>.
|
||||
|
||||
This implementation is based on their code in
|
||||
<URL:http://www.cl.cam.ac.uk/ftp/users/djw3/xtea.ps> */
|
||||
|
||||
extern int TEA_Encrypt(DWORD *dest, const DWORD *src, const DWORD *key, int size);
|
||||
extern int TEA_Decrypt(DWORD *dest, const DWORD *src, const DWORD *key, int size);
|
||||
|
||||
extern int GOST_Encrypt(DWORD * DstBuffer, const DWORD * SrcBuffer, const DWORD * KeyAddress, DWORD Length, DWORD *IVector);
|
||||
extern int GOST_Decrypt(DWORD * DstBuffer, const DWORD * SrcBuffer, const DWORD * KeyAddress, DWORD Length, DWORD *IVector);
|
||||
|
||||
extern int DES_Encrypt(DWORD *DstBuffer, const DWORD * SrcBuffer, const DWORD *KeyAddress, DWORD Length, DWORD *IVector);
|
||||
extern int DES_Decrypt(DWORD *DstBuffer, const DWORD * SrcBuffer, const DWORD *KeyAddress, DWORD Length, DWORD *IVector);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
Executable
+161
@@ -0,0 +1,161 @@
|
||||
#ifndef __INC_LIBTHECORE_FDWATCH_H__
|
||||
#define __INC_LIBTHECORE_FDWATCH_H__
|
||||
|
||||
#ifndef __WIN32__
|
||||
|
||||
/* ### LINUX-BLOCK-BEGIN (fdwatch.h) ###################################### */
|
||||
#if defined(__linux__)
|
||||
|
||||
/* --------------------------------------------------------------------
|
||||
* Linux backend: epoll(7).
|
||||
*
|
||||
* kqueue reports one event per (descriptor, filter) pair, so a socket
|
||||
* that is both readable and writable produces *two* struct kevents.
|
||||
* epoll reports one struct epoll_event per descriptor carrying a
|
||||
* bitmask of every ready condition. Every caller of this API was
|
||||
* written against the kqueue event stream (it walks the returned events
|
||||
* by index and asks fdwatch_check_event() for a single FDW_* answer per
|
||||
* index), so the Linux backend expands each epoll_event back into up to
|
||||
* two FDWEVENTs. FDWEVENT is therefore the exact analogue of struct
|
||||
* kevent, and "fdwrevents" below is the analogue of "kqrevents".
|
||||
* ------------------------------------------------------------------ */
|
||||
|
||||
typedef struct fdwatch FDWATCH;
|
||||
typedef struct fdwatch * LPFDWATCH;
|
||||
|
||||
enum EFdwatch
|
||||
{
|
||||
FDW_NONE = 0,
|
||||
FDW_READ = 1,
|
||||
FDW_WRITE = 2,
|
||||
FDW_WRITE_ONESHOT = 4,
|
||||
FDW_EOF = 8,
|
||||
};
|
||||
|
||||
typedef struct fdwevent
|
||||
{
|
||||
int ident; /* kevent.ident : the file descriptor */
|
||||
int filter; /* kevent.filter : FDW_READ / FDW_WRITE */
|
||||
int flags; /* kevent.flags : carries FDW_EOF only */
|
||||
int data; /* kevent.data : free send-buffer space */
|
||||
} FDWEVENT;
|
||||
|
||||
typedef FDWEVENT * LPFDWEVENT;
|
||||
typedef int EPOLLFD;
|
||||
|
||||
struct fdwatch
|
||||
{
|
||||
EPOLLFD ep; /* epoll instance; mirrors kqueue's kq */
|
||||
|
||||
int nfiles;
|
||||
|
||||
struct epoll_event * epevents; /* epoll_wait() output buffer */
|
||||
|
||||
LPFDWEVENT fdwrevents; /* expanded events; mirrors kqrevents */
|
||||
int nfdwrevents; /* number of valid entries above */
|
||||
|
||||
int * fd_event_idx;
|
||||
|
||||
void ** fd_data;
|
||||
int * fd_rw;
|
||||
|
||||
unsigned int * fd_mask; /* epoll mask currently armed per fd */
|
||||
};
|
||||
|
||||
#else /* !__linux__ : FreeBSD and other BSDs - kqueue backend (unchanged) */
|
||||
/* ### LINUX-BLOCK-END (fdwatch.h) ######################################## */
|
||||
|
||||
typedef struct fdwatch FDWATCH;
|
||||
typedef struct fdwatch * LPFDWATCH;
|
||||
|
||||
enum EFdwatch
|
||||
{
|
||||
FDW_NONE = 0,
|
||||
FDW_READ = 1,
|
||||
FDW_WRITE = 2,
|
||||
FDW_WRITE_ONESHOT = 4,
|
||||
FDW_EOF = 8,
|
||||
};
|
||||
|
||||
typedef struct kevent KEVENT;
|
||||
typedef struct kevent * LPKEVENT;
|
||||
typedef int KQUEUE;
|
||||
|
||||
struct fdwatch
|
||||
{
|
||||
KQUEUE kq;
|
||||
|
||||
int nfiles;
|
||||
|
||||
LPKEVENT kqevents;
|
||||
int nkqevents;
|
||||
|
||||
LPKEVENT kqrevents;
|
||||
int * fd_event_idx;
|
||||
|
||||
void ** fd_data;
|
||||
int * fd_rw;
|
||||
};
|
||||
|
||||
/* ### LINUX-BLOCK-BEGIN (fdwatch.h tail) ################################# */
|
||||
#endif /* __linux__ */
|
||||
/* ### LINUX-BLOCK-END (fdwatch.h tail) ################################### */
|
||||
|
||||
#else
|
||||
|
||||
typedef struct fdwatch FDWATCH;
|
||||
typedef struct fdwatch * LPFDWATCH;
|
||||
|
||||
enum EFdwatch
|
||||
{
|
||||
FDW_NONE = 0,
|
||||
FDW_READ = 1,
|
||||
FDW_WRITE = 2,
|
||||
FDW_WRITE_ONESHOT = 4,
|
||||
FDW_EOF = 8,
|
||||
};
|
||||
|
||||
struct fdwatch
|
||||
{
|
||||
fd_set rfd_set;
|
||||
fd_set wfd_set;
|
||||
|
||||
socket_t* select_fds;
|
||||
int* select_rfdidx;
|
||||
|
||||
int nselect_fds;
|
||||
|
||||
fd_set working_rfd_set;
|
||||
fd_set working_wfd_set;
|
||||
|
||||
int nfiles;
|
||||
|
||||
void** fd_data;
|
||||
int* fd_rw;
|
||||
};
|
||||
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
extern LPFDWATCH fdwatch_new(int nfiles);
|
||||
extern void fdwatch_clear_fd(LPFDWATCH fdw, socket_t fd);
|
||||
extern void fdwatch_delete(LPFDWATCH fdw);
|
||||
extern int fdwatch_check_fd(LPFDWATCH fdw, socket_t fd);
|
||||
extern int fdwatch_check_event(LPFDWATCH fdw, socket_t fd, unsigned int event_idx);
|
||||
extern void fdwatch_clear_event(LPFDWATCH fdw, socket_t fd, unsigned int event_idx);
|
||||
extern void fdwatch_add_fd(LPFDWATCH fdw, socket_t fd, void* client_data, int rw, int oneshot);
|
||||
extern int fdwatch(LPFDWATCH fdw, struct timeval *timeout);
|
||||
extern void * fdwatch_get_client_data(LPFDWATCH fdw, unsigned int event_idx);
|
||||
extern void fdwatch_del_fd(LPFDWATCH fdw, socket_t fd);
|
||||
extern int fdwatch_get_buffer_size(LPFDWATCH fdw, socket_t fd);
|
||||
extern int fdwatch_get_ident(LPFDWATCH fdw, unsigned int event_idx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#ifndef __INC_LIBTHECORE_HANGUL_H__
|
||||
#define __INC_LIBTHECORE_HANGUL_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifdef __WIN32__
|
||||
#define isdigit iswdigit
|
||||
#define isspace iswspace
|
||||
#endif
|
||||
|
||||
#define ishan(ch) (((ch) & 0xE0) > 0x90)
|
||||
#define ishanasc(ch) (isascii(ch) || ishan(ch))
|
||||
#define ishanalp(ch) (isalpha(ch) || ishan(ch))
|
||||
#define isnhdigit(ch) (!ishan(ch) && isdigit(ch))
|
||||
#define isnhspace(ch) (!ishan(ch) && isspace(ch))
|
||||
|
||||
extern const char * first_han(const BYTE * str); // 첫번째 두 글자의 모음(ㄱㄴㄷ)을 뽑아 가/나/다/..를 리턴한다.
|
||||
extern int check_han(const char * str); // 한글이면 true 스트링 전부 체크
|
||||
extern int is_hangul(const BYTE * str); // 한글이면 true (2바이트만 체크)
|
||||
extern int under_han(const void * orig); // 받침이 있으면 true
|
||||
|
||||
#define UNDER(str) under_han(str)
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#ifndef __INC_LIBTHECORE_HEART_H__
|
||||
#define __INC_LIBTHECORE_HEART_H__
|
||||
|
||||
typedef struct heart HEART;
|
||||
typedef struct heart * LPHEART;
|
||||
|
||||
typedef void (*HEARTFUNC) (LPHEART heart, int pulse);
|
||||
|
||||
struct heart
|
||||
{
|
||||
HEARTFUNC func;
|
||||
|
||||
struct timeval before_sleep;
|
||||
struct timeval opt_time;
|
||||
struct timeval last_time;
|
||||
|
||||
int passes_per_sec;
|
||||
int pulse;
|
||||
};
|
||||
|
||||
extern LPHEART heart_new(int opt_usec, HEARTFUNC func);
|
||||
extern void heart_delete(LPHEART ht);
|
||||
extern int heart_idle(LPHEART ht); // ¸î pulse°¡ Áö³µ³ª ¸®ÅÏÇÑ´Ù.
|
||||
extern void heart_beat(LPHEART ht, int pulses);
|
||||
|
||||
#endif
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* Filename: kstbl.h
|
||||
* Description: KS 완성형 2350자의 조합형 코드
|
||||
*
|
||||
* Author: 비엽 (server), myevan (Client)
|
||||
*/
|
||||
#ifndef __KSTBL_H__
|
||||
#define __KSTBL_H__
|
||||
extern unsigned KStbl[2350];
|
||||
#endif
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#ifndef __INC_LIBTHECORE_LOG_H__
|
||||
#define __INC_LIBTHECORE_LOG_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
extern int log_init(void);
|
||||
extern void log_destroy(void);
|
||||
extern void log_rotate(void);
|
||||
|
||||
// 로그 레벨 처리 (레벨은 bitvector로 처리된다)
|
||||
extern void log_set_level(unsigned int level);
|
||||
extern void log_unset_level(unsigned int level);
|
||||
|
||||
// 로그 파일을 얼만큼 보관하는가에 대한 함수
|
||||
extern void log_set_expiration_days(unsigned int days);
|
||||
extern int log_get_expiration_days(void);
|
||||
|
||||
#ifndef __WIN32__
|
||||
extern void _sys_err(const char *func, int line, const char *format, ...);
|
||||
#else
|
||||
extern void _sys_err(const char *func, int line, const char *format, ...);
|
||||
#endif
|
||||
extern void sys_log_header(const char *header);
|
||||
extern void sys_log(unsigned int lv, const char *format, ...);
|
||||
extern void pt_log(const char *format, ...);
|
||||
|
||||
#ifndef __WIN32__
|
||||
#define sys_err(fmt, args...) _sys_err(__FUNCTION__, __LINE__, fmt, ##args)
|
||||
#else
|
||||
#define sys_err(fmt, ...) _sys_err(__FUNCTION__, __LINE__, fmt, __VA_ARGS__)
|
||||
#endif // __WIN32__
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // __INC_LOG_H__
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#ifndef __INC_LIBTHECORE_MAIN_H__
|
||||
#define __INC_LIBTHECORE_MAIN_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifdef __LIBTHECORE__
|
||||
extern volatile int tics;
|
||||
extern volatile int shutdowned;
|
||||
#endif
|
||||
#include "heart.h"
|
||||
|
||||
extern LPHEART thecore_heart;
|
||||
|
||||
enum ENUM_PROFILER
|
||||
{
|
||||
PF_IDLE,
|
||||
PF_HEARTBEAT,
|
||||
NUM_PF
|
||||
};
|
||||
|
||||
extern unsigned int thecore_profiler[NUM_PF];
|
||||
|
||||
extern int thecore_init(int fps, HEARTFUNC heartbeat_func);
|
||||
extern int thecore_idle(void);
|
||||
extern void thecore_shutdown(void);
|
||||
extern void thecore_destroy(void);
|
||||
extern int thecore_pulse(void);
|
||||
extern float thecore_time(void);
|
||||
extern float thecore_pulse_per_second(void);
|
||||
extern int thecore_is_shutdowned(void);
|
||||
|
||||
extern void thecore_tick(void); // tics Áõ°¡
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#ifndef __INC_LIBTHECORE_MEMCPY_H__
|
||||
#define __INC_LIBTHECORE_MEMCPY_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
#ifdef __LIBTHECORE__
|
||||
void thecore_find_best_memcpy();
|
||||
#endif
|
||||
|
||||
#ifndef __WIN32__
|
||||
extern void *(*thecore_memcpy) (void * to, const void * from, size_t len);
|
||||
#else
|
||||
#include <cstring>
|
||||
#define thecore_memcpy memcpy
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#ifndef __INC_LIBTHECORE_SIGNAL_H__
|
||||
#define __INC_LIBTHECORE_SIGNAL_H__
|
||||
|
||||
/* ### LINUX-BLOCK-BEGIN (signal.h shadow guard) ######################### */
|
||||
#if defined(__linux__) && !defined(_SIGNAL_H)
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Header-shadowing guard (Linux only).
|
||||
*
|
||||
* glibc's <sys/signal.h> is literally one line: "#include <signal.h>". Every
|
||||
* module compiles with -I<...>/libthecore/include, so that bracket include
|
||||
* resolves to *this* file instead of /usr/include/signal.h, and SIGPIPE,
|
||||
* signal(), sigaction() and friends silently disappear. libthecore's own
|
||||
* stdafx.h includes <sys/signal.h>, so this bites signal.c immediately, and
|
||||
* db/src/Main.cpp and libsql/Tellwait.cpp include <signal.h> directly. (It
|
||||
* does not happen on FreeBSD, where <signal.h> includes <sys/signal.h> and not
|
||||
* the other way round, which is why the production build never hit this.)
|
||||
*
|
||||
* Pull the real header in via #include_next, which resumes the search after
|
||||
* the directory this file was found in. _SIGNAL_H is glibc's own guard, so
|
||||
* when the system header already got in first this is a no-op.
|
||||
* ------------------------------------------------------------------------- */
|
||||
#include_next <signal.h>
|
||||
#endif
|
||||
/* ### LINUX-BLOCK-END (signal.h shadow guard) ########################### */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
extern void signal_setup();
|
||||
extern void signal_timer_disable();
|
||||
extern void signal_timer_enable(int timeout_seconds);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Executable
+45
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Filename: socket.c
|
||||
* Description: ¼ÒÄÏ °ü·Ã ÇÔ¼ö Çì´õ.
|
||||
*
|
||||
* Author: ºñ¿± (server), myevan (Client)
|
||||
*/
|
||||
#ifndef __INC_LIBTHECORE_SOCKET_H__
|
||||
#define __INC_LIBTHECORE_SOCKET_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifdef __WIN32__
|
||||
typedef int socklen_t;
|
||||
#else
|
||||
#define INVALID_SOCKET -1
|
||||
#endif
|
||||
|
||||
extern int socket_read(socket_t desc, char* read_point, size_t space_left);
|
||||
extern int socket_write(socket_t desc, const char *data, size_t length);
|
||||
|
||||
extern int socket_udp_read(socket_t desc, char * read_point, size_t space_left, struct sockaddr * from, socklen_t * fromlen);
|
||||
extern int socket_tcp_bind(const char * ip, int port);
|
||||
extern int socket_udp_bind(const char * ip, int port);
|
||||
|
||||
extern socket_t socket_accept(socket_t s, struct sockaddr_in *peer);
|
||||
extern void socket_close(socket_t s);
|
||||
extern socket_t socket_connect(const char* host, WORD port);
|
||||
|
||||
extern void socket_nonblock(socket_t s);
|
||||
extern void socket_block(socket_t s);
|
||||
extern void socket_dontroute(socket_t s);
|
||||
extern void socket_lingeroff(socket_t s);
|
||||
extern void socket_lingeron(socket_t s);
|
||||
|
||||
extern void socket_sndbuf(socket_t s, unsigned int opt);
|
||||
extern void socket_rcvbuf(socket_t s, unsigned int opt);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Executable
+238
@@ -0,0 +1,238 @@
|
||||
#ifndef __INC_LIBTHECORE_STDAFX_H__
|
||||
#define __INC_LIBTHECORE_STDAFX_H__
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define INLINE __inline__
|
||||
#elif defined(_MSC_VER)
|
||||
#define INLINE inline
|
||||
#endif
|
||||
|
||||
#ifdef __WIN32__
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#include <tchar.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <conio.h>
|
||||
#include <process.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <locale.h>
|
||||
#include <io.h>
|
||||
#include <direct.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "xdirent.h"
|
||||
#include "xgetopt.h"
|
||||
|
||||
#define S_ISDIR(m) (m & _S_IFDIR)
|
||||
#define snprintf _snprintf
|
||||
|
||||
struct timespec
|
||||
{
|
||||
time_t tv_sec; /* seconds */
|
||||
long tv_nsec; /* and nanoseconds */
|
||||
};
|
||||
|
||||
#define __USE_SELECT__
|
||||
|
||||
#define PATH_MAX _MAX_PATH
|
||||
|
||||
// C runtime library adjustments
|
||||
#define strlcat(dst, src, size) strcat_s(dst, size, src)
|
||||
#define strlcpy(dst, src, size) strncpy_s(dst, size, src, _TRUNCATE)
|
||||
#define strtoull(str, endptr, base) _strtoui64(str, endptr, base)
|
||||
#define strtof(str, endptr) (float)strtod(str, endptr)
|
||||
#define strcasecmp(s1, s2) stricmp(s1, s2)
|
||||
#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
|
||||
#define atoll(str) _atoi64(str)
|
||||
#define localtime_r(timet, result) localtime_s(result, timet)
|
||||
#define strtok_r(s, delim, ptrptr) strtok_s(s, delim, ptrptr)
|
||||
|
||||
#include <boost/__typeof/__typeof.hpp>
|
||||
#define __typeof(t) BOOST_TYPEOF(t)
|
||||
|
||||
// dummy declaration of non-supported signals
|
||||
#define SIGUSR1 30 /* user defined signal 1 */
|
||||
#define SIGUSR2 31 /* user defined signal 2 */
|
||||
|
||||
inline void usleep(unsigned long usec) {
|
||||
::Sleep(usec / 1000);
|
||||
}
|
||||
inline unsigned sleep(unsigned sec) {
|
||||
::Sleep(sec * 1000);
|
||||
return 0;
|
||||
}
|
||||
inline double rint(double x)
|
||||
{
|
||||
return ::floor(x+.5);
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
/* ### LINUX-BLOCK-BEGIN (stdafx.h __USE_SELECT__) ####################### */
|
||||
/* Linux gets the epoll backend in fdwatch.c, so it must NOT fall back to the
|
||||
* select() one. That branch is not merely slow here, it is wrong:
|
||||
* - it calls select(0, ...); nfds == 0 is fine on Windows where the
|
||||
* argument is ignored, but on Linux it means "watch nothing";
|
||||
* - game calls fdwatch_new(4096) while FD_SETSIZE is 1024, and
|
||||
* socket_accept() (socket.c:232) accepts descriptors up to 65500;
|
||||
* - it uses a compacted index model and swap-removes on delete, whereas
|
||||
* db's RemovePeer() deletes mid-iteration, which would silently re-point
|
||||
* later event indices at the wrong peer.
|
||||
* The original directive is the "#ifndef __FreeBSD__" preserved below. */
|
||||
#if !defined(__FreeBSD__) && !defined(__linux__)
|
||||
/* ### LINUX-BLOCK-END (stdafx.h __USE_SELECT__) ######################### */
|
||||
#define __USE_SELECT__
|
||||
#ifdef __CYGWIN__
|
||||
#define _POSIX_SOURCE 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <sys/signal.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include <pthread.h>
|
||||
#include <semaphore.h>
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <sys/event.h>
|
||||
#endif
|
||||
|
||||
/* ### LINUX-BLOCK-BEGIN (stdafx.h linux headers) ######################## */
|
||||
#if defined(__linux__)
|
||||
/* ------------------------------------------------------------------------
|
||||
* Linux port. kqueue(2) does not exist here; fdwatch.c implements the same
|
||||
* public API on top of epoll(7). See the "#if defined(__linux__)" branch of
|
||||
* fdwatch.c.
|
||||
* ---------------------------------------------------------------------- */
|
||||
#include <features.h>
|
||||
#include <sys/epoll.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/sockios.h> /* SIOCOUTQ - used to emulate EVFILT_WRITE's
|
||||
"free space in the socket send buffer" */
|
||||
#include <sys/random.h> /* getrandom() - stands in for srandomdev() */
|
||||
#endif
|
||||
/* ### LINUX-BLOCK-END (stdafx.h linux headers) ########################## */
|
||||
|
||||
#endif
|
||||
|
||||
/* ### LINUX-BLOCK-BEGIN (stdafx.h strlcpy) ############################## */
|
||||
#if defined(__linux__)
|
||||
/* ------------------------------------------------------------------------
|
||||
* strlcpy()/strlcat() are BSD extensions. glibc only gained them in 2.38
|
||||
* (Ubuntu 24.04 / Debian 13 and newer); on anything older libthecore ships
|
||||
* the canonical OpenBSD implementation in strlcpy.c. The prototypes below
|
||||
* are byte-compatible with both glibc's and OpenBSD's, so declaring them is
|
||||
* harmless when the C library already provides them - but we only do so when
|
||||
* it does not, to avoid clashing with glibc's __restrict qualified
|
||||
* declarations.
|
||||
*
|
||||
* Every other module (game, db, libgame, libsql, ...) includes this header
|
||||
* through its own stdafx.h, so this one place covers all 65 call sites.
|
||||
*
|
||||
* NOTE: the __WIN32__ branch above #defines strlcpy/strlcat as macros; this
|
||||
* branch is in the #else half of that same #ifdef chain, so the two can never
|
||||
* collide.
|
||||
* ---------------------------------------------------------------------- */
|
||||
#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
|
||||
#if __GLIBC_PREREQ(2, 38)
|
||||
#define THECORE_HAVE_STRLCPY 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef THECORE_HAVE_STRLCPY
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern size_t strlcpy(char * dst, const char * src, size_t siz);
|
||||
extern size_t strlcat(char * dst, const char * src, size_t siz);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
/* ### LINUX-BLOCK-END (stdafx.h strlcpy) ################################ */
|
||||
|
||||
/* ### LINUX-BLOCK-BEGIN (stdafx.h false/true) ########################### */
|
||||
/* ---------------------------------------------------------------------------
|
||||
* "false" and "true" are keywords in C++, not macros, so "#ifndef false" is
|
||||
* always true and the two #defines below turn them into the *int* 0 and 1 for
|
||||
* every translation unit that includes this header.
|
||||
*
|
||||
* That is fatal on Linux under -std=c++23 (the standard game/src/Makefile and
|
||||
* db/src/Makefile both use). libstdc++ 13 writes constraints such as
|
||||
*
|
||||
* requires __is_signed_int128<_Tp> || false
|
||||
*
|
||||
* in <bits/iterator_concepts.h>, and with "false" rewritten to 0 the compiler
|
||||
* rejects them: "error: constraint '0' has type 'int', not 'bool'". It fires
|
||||
* hundreds of times for any TU that includes <string>, <vector>, <algorithm>,
|
||||
* <map> ... after this header - which is exactly what game/src/stdafx.h does
|
||||
* (it includes this file at line 9 and the STL headers at lines 15-27), so it
|
||||
* would break essentially all of game/ and db/.
|
||||
*
|
||||
* The C++ keywords already are what these macros try to provide: FALSE/TRUE
|
||||
* below still evaluate to 0 and 1, just with type bool instead of int, and
|
||||
* both promote to the same int in every context this tree uses them
|
||||
* (comparisons, varargs, assignment to int/BYTE fields).
|
||||
*
|
||||
* The FreeBSD/Windows path keeps the original #ifndef block verbatim.
|
||||
* ------------------------------------------------------------------------- */
|
||||
#if !(defined(__linux__) && defined(__cplusplus))
|
||||
#ifndef false
|
||||
#define false 0
|
||||
#define true (!false)
|
||||
#endif
|
||||
#endif
|
||||
/* ### LINUX-BLOCK-END (stdafx.h false/true) ############################# */
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE false
|
||||
#define TRUE (!FALSE)
|
||||
#endif
|
||||
|
||||
#include "typedef.h"
|
||||
#include "heart.h"
|
||||
#include "fdwatch.h"
|
||||
#include "socket.h"
|
||||
#include "kstbl.h"
|
||||
#include "hangul.h"
|
||||
#include "buffer.h"
|
||||
#include "signal.h"
|
||||
#include "log.h"
|
||||
#include "main.h"
|
||||
#include "utils.h"
|
||||
#include "crypt.h"
|
||||
#include "memcpy.h"
|
||||
|
||||
#endif // __INC_LIBTHECORE_STDAFX_H__
|
||||
Executable
+62
@@ -0,0 +1,62 @@
|
||||
#ifndef __INC_LIBTHECORE_TYPEDEF_H__
|
||||
#define __INC_LIBTHECORE_TYPEDEF_H__
|
||||
|
||||
typedef unsigned long int QWORD;
|
||||
typedef unsigned char UBYTE;
|
||||
typedef signed char sbyte;
|
||||
typedef unsigned short sh_int;
|
||||
|
||||
#ifndef __WIN32__
|
||||
|
||||
#ifndef __cplusplus
|
||||
typedef unsigned char bool;
|
||||
#endif
|
||||
|
||||
typedef unsigned int DWORD;
|
||||
typedef int BOOL;
|
||||
typedef unsigned char BYTE;
|
||||
typedef unsigned short WORD;
|
||||
typedef long LONG;
|
||||
typedef unsigned long ULONG;
|
||||
typedef int INT;
|
||||
typedef unsigned int UINT;
|
||||
|
||||
typedef int socket_t;
|
||||
|
||||
#else
|
||||
|
||||
struct timezone
|
||||
{
|
||||
int tz_minuteswest; /* minutes west of Greenwich */
|
||||
int tz_dsttime; /* type of dst correction */
|
||||
};
|
||||
|
||||
typedef SOCKET socket_t;
|
||||
|
||||
#if !defined(_W64)
|
||||
#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
|
||||
#define _W64 __w64
|
||||
#else
|
||||
#define _W64
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _WIN64
|
||||
typedef __int64 ssize_t;
|
||||
#else
|
||||
typedef _W64 int ssize_t;
|
||||
#endif
|
||||
|
||||
// Fixed-size integer types
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1300)
|
||||
typedef __int32 int32_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#endif
|
||||
|
||||
typedef unsigned int uint;
|
||||
|
||||
#endif
|
||||
|
||||
#endif // __INC_LIBTHECORE_TYPEDEF_H__
|
||||
Executable
+152
@@ -0,0 +1,152 @@
|
||||
#ifndef __INC_LIBTHECORE_UTILS_H__
|
||||
#define __INC_LIBTHECORE_UTILS_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define SAFE_FREE(p) { if (p) { free( (void *) p); (p) = NULL; } }
|
||||
#define SAFE_DELETE(p) { if (p) { delete (p); (p) = NULL; } }
|
||||
#define SAFE_DELETE_ARRAY(p) { if (p) { delete[] (p); (p) = NULL; } }
|
||||
#define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p) = NULL; } }
|
||||
|
||||
#define LOWER(c) (((c)>='A' && (c) <= 'Z') ? ((c)+('a'-'A')) : (c))
|
||||
#define UPPER(c) (((c)>='a' && (c) <= 'z') ? ((c)+('A'-'a')) : (c))
|
||||
|
||||
#define str_cmp strcasecmp
|
||||
#define STRNCPY(dst, src, len) do {strncpy(dst, src, len); dst[len] = '\0'; } while(0)
|
||||
|
||||
extern char * str_dup(const char * source); // 메모리 할당 해서 source 복사 한거 리턴
|
||||
extern void printdata(const unsigned char * data, int bytes); // data를 hex랑 ascii로 출력 (패킷 분석 등에 쓰임)
|
||||
extern int filesize(FILE * fp); // 파일 크기 리턴
|
||||
|
||||
#define core_dump() core_dump_unix(__FILE__, __LINE__)
|
||||
extern void core_dump_unix(const char *who, WORD line); // 코어를 강제로 덤프
|
||||
|
||||
#define TOKEN(string) if (!str_cmp(token_string, string))
|
||||
// src = 토큰 : 값
|
||||
extern void parse_token(char * src, char * token, char * value);
|
||||
|
||||
extern void trim_and_lower(const char * src, char * dest, size_t dest_size);
|
||||
|
||||
// 문자열을 소문자로
|
||||
extern void lower_string(const char * src, char * dest, size_t dest_len);
|
||||
|
||||
// arg1이 arg2로 시작하는가? (대소문자 구별하지 않음)
|
||||
extern int is_abbrev(char *arg1, char *arg2);
|
||||
|
||||
// a와 b의 시간이 얼마나 차이나는지 리턴
|
||||
extern struct timeval * timediff(const struct timeval *a, const struct timeval *b);
|
||||
|
||||
// a의 시간에 b의 시간을 더해 리턴
|
||||
extern struct timeval * timeadd(struct timeval *a, struct timeval *b);
|
||||
|
||||
// 현재 시간 curr_tm으로 부터 days가 지난 날을 리턴
|
||||
extern struct tm * tm_calc(const struct tm *curr_tm, int days);
|
||||
|
||||
extern int MAX(int a, int b); // 둘중에 큰 값을 리턴
|
||||
extern int MIN(int a, int b); // 둘중에 작은 값을 리턴
|
||||
extern int MINMAX(int min, int value, int max); // 최소 최대 값을 함께 비교해서 리턴
|
||||
|
||||
extern int number_ex(int from, int to, const char *file, int line); // from으로 부터 to까지의 랜덤 값 리턴
|
||||
#define number(from, to) number_ex(from, to, __FILE__, __LINE__)
|
||||
|
||||
float fnumber(float from, float to);
|
||||
|
||||
extern void thecore_sleep(struct timeval * timeout); // timeout만큼 프로세스 쉬기
|
||||
extern DWORD thecore_random(); // 랜덤 함수
|
||||
|
||||
extern float get_float_time();
|
||||
extern DWORD get_dword_time();
|
||||
|
||||
extern char * time_str(time_t ct);
|
||||
|
||||
#define CREATE(result, type, number) do { \
|
||||
if (!((result) = (type *) calloc ((number), sizeof(type)))) { \
|
||||
sys_err("calloc failed [%d] %s", errno, strerror(errno)); \
|
||||
abort(); } } while(0)
|
||||
|
||||
#define RECREATE(result,type,number) do { \
|
||||
if (!((result) = (type *) realloc ((result), sizeof(type) * (number)))) { \
|
||||
sys_err("realloc failed [%d] %s", errno, strerror(errno)); \
|
||||
abort(); } } while(0)
|
||||
|
||||
// Next 와 Prev 가 있는 리스트에 추가
|
||||
#define INSERT_TO_TW_LIST(item, head, prev, next) \
|
||||
if (!(head)) \
|
||||
{ \
|
||||
head = item; \
|
||||
(head)->prev = (head)->next = NULL; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(head)->prev = item; \
|
||||
(item)->next = head; \
|
||||
(item)->prev = NULL; \
|
||||
head = item; \
|
||||
}
|
||||
|
||||
#define REMOVE_FROM_TW_LIST(item, head, prev, next) \
|
||||
if ((item) == (head)) \
|
||||
{ \
|
||||
if (((head) = (item)->next)) \
|
||||
(head)->prev = NULL; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
if ((item)->next) \
|
||||
(item)->next->prev = (item)->prev; \
|
||||
\
|
||||
if ((item)->prev) \
|
||||
(item)->prev->next = (item)->next; \
|
||||
}
|
||||
|
||||
|
||||
#define INSERT_TO_LIST(item, head, next) \
|
||||
(item)->next = (head); \
|
||||
(head) = (item); \
|
||||
|
||||
#define REMOVE_FROM_LIST(item, head, next) \
|
||||
if ((item) == (head)) \
|
||||
head = (item)->next; \
|
||||
else \
|
||||
{ \
|
||||
temp = head; \
|
||||
\
|
||||
while (temp && (temp->next != (item))) \
|
||||
temp = temp->next; \
|
||||
\
|
||||
if (temp) \
|
||||
temp->next = (item)->next; \
|
||||
} \
|
||||
|
||||
#ifndef MAKEFOURCC
|
||||
#define MAKEFOURCC(ch0, ch1, ch2, ch3) \
|
||||
((DWORD)(BYTE) (ch0 ) | ((DWORD)(BYTE) (ch1) << 8) | \
|
||||
((DWORD)(BYTE) (ch2) << 16) | ((DWORD)(BYTE) (ch3) << 24))
|
||||
#endif // defined(MAKEFOURCC)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
// _countof for gcc/g++
|
||||
#if !defined(_countof)
|
||||
#if !defined(__cplusplus)
|
||||
#define _countof(_Array) (sizeof(_Array) / sizeof(_Array[0]))
|
||||
#else
|
||||
extern "C++"
|
||||
{
|
||||
template <typename _CountofType, size_t _SizeOfArray>
|
||||
char (*__countof_helper(_CountofType (&_Array)[_SizeOfArray]))[_SizeOfArray];
|
||||
#define _countof(_Array) sizeof(*__countof_helper(_Array))
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __WIN32__
|
||||
extern void gettimeofday(struct timeval* t, struct timezone* dummy);
|
||||
#endif
|
||||
|
||||
#endif // __INC_UTILS_H__
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
#ifndef DIRENT_INCLUDED
|
||||
#define DIRENT_INCLUDED
|
||||
|
||||
/*
|
||||
|
||||
Declaration of POSIX directory browsing functions and types for Win32.
|
||||
|
||||
Author: Kevlin Henney (kevlin@acm.org, kevlin@curbralan.com)
|
||||
History: Created March 1997. Updated June 2003.
|
||||
Rights: See end of file.
|
||||
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
typedef struct DIR DIR;
|
||||
|
||||
struct dirent
|
||||
{
|
||||
char *d_name;
|
||||
};
|
||||
|
||||
DIR *opendir(const char *);
|
||||
int closedir(DIR *);
|
||||
struct dirent *readdir(DIR *);
|
||||
void rewinddir(DIR *);
|
||||
|
||||
/*
|
||||
|
||||
Copyright Kevlin Henney, 1997, 2003. All rights reserved.
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided
|
||||
that this copyright and permissions notice appear in all copies and
|
||||
derivatives.
|
||||
|
||||
This software is supplied "as is" without express or implied warranty.
|
||||
|
||||
But that said, if there are any problems please get in touch.
|
||||
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
// XGetopt.h Version 1.2
|
||||
//
|
||||
// Author: Hans Dietrich
|
||||
// hdietrich2@hotmail.com
|
||||
//
|
||||
// This software is released into the public domain.
|
||||
// You are free to use it in any way you like.
|
||||
//
|
||||
// This software is provided "as is" with no expressed
|
||||
// or implied warranty. I accept no liability for any
|
||||
// damage or loss of business that this software may cause.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef XGETOPT_H
|
||||
#define XGETOPT_H
|
||||
|
||||
extern int optind, opterr, optreset;
|
||||
extern TCHAR *optarg;
|
||||
|
||||
int getopt(int argc, TCHAR *argv[], TCHAR *optstring);
|
||||
|
||||
#endif //XGETOPT_H
|
||||
Executable
+82
@@ -0,0 +1,82 @@
|
||||
#ifndef __FreeBSD__
|
||||
|
||||
/*
|
||||
* luau (Lib Update/Auto-Update): Simple Update Library
|
||||
* Copyright (C) 2003 David Eklund
|
||||
*
|
||||
* - This library is free software; you can redistribute it and/or -
|
||||
* - modify it under the terms of the GNU Lesser General Public -
|
||||
* - License as published by the Free Software Foundation; either -
|
||||
* - version 2.1 of the License, or (at your option) any later version. -
|
||||
* - -
|
||||
* - This library is distributed in the hope that it will be useful, -
|
||||
* - but WITHOUT ANY WARRANTY; without even the implied warranty of -
|
||||
* - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -
|
||||
* - Lesser General Public License for more details. -
|
||||
* - -
|
||||
* - You should have received a copy of the GNU Lesser General Public -
|
||||
* - License along with this library; if not, write to the Free Software -
|
||||
* - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
|
||||
*/
|
||||
|
||||
/*
|
||||
* md5.h and md5.c are based off of md5hl.c, md5c.c, and md5.h from libmd, which in turn are
|
||||
* based off the FreeBSD libmd library. Their respective copyright notices follow:
|
||||
*/
|
||||
|
||||
/*
|
||||
* This code implements the MD5 message-digest algorithm.
|
||||
* The algorithm is due to Ron Rivest. This code was
|
||||
* written by Colin Plumb in 1993, no copyright is claimed.
|
||||
* This code is in the public domain; do with it what you wish.
|
||||
*
|
||||
* Equivalent code is available from RSA Data Security, Inc.
|
||||
* This code has been tested against that, and is equivalent,
|
||||
* except that you don't need to include two pages of legalese
|
||||
* with every copy.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* "THE BEER-WARE LICENSE" (Revision 42):
|
||||
* <phk@login.dkuug.dk> wrote this file. As long as you retain this notice you
|
||||
* can do whatever you want with this stuff. If we meet some day, and you think
|
||||
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* $Id: md5.h,v 1.1.1.1 2004/04/02 05:11:38 deklund2 Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MD5_H
|
||||
#define MD5_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define MD5_HASHBYTES 16
|
||||
|
||||
typedef struct MD5Context {
|
||||
uint32_t buf[4];
|
||||
uint32_t bits[2];
|
||||
unsigned char in[64];
|
||||
} MD5_CTX;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void MD5Init(MD5_CTX *context);
|
||||
void MD5Update(MD5_CTX *context, unsigned char const *buf, unsigned len);
|
||||
void MD5Final(unsigned char digest[MD5_HASHBYTES], MD5_CTX *context);
|
||||
void MD5Transform(uint32_t buf[4], uint32_t const in[16]);
|
||||
char* MD5End(MD5_CTX *, char *);
|
||||
|
||||
char* lutil_md5_file(const char *filename, char *buf);
|
||||
char* lutil_md5_data(const unsigned char *data, unsigned int len, char *buf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* MD5_H */
|
||||
|
||||
#endif // #ifndef __FreeBSD__
|
||||
Reference in New Issue
Block a user