Files
selfcare/proxy_c/common.h
2025-03-03 11:40:37 +08:00

101 lines
2.3 KiB
C

#ifndef _COMMON_TYPE_H_
#define _COMMON_TYPE_H_
#include <unistd.h>
#include <sys/types.h> /* basic system data types */
#include <sys/socket.h> /* basic socket definitions */
#include <netinet/in.h> /* sockaddr_in{} and other Internet defns */
#include <arpa/inet.h> /* inet(3) functions */
#include <netinet/sctp.h>
#include <sys/epoll.h> /* epoll function */
#include <fcntl.h> /* nonblocking */
#include <sys/resource.h> /*setrlimit */
#include <stdlib.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
#include <signal.h>
#include <string.h>
#include <time.h>
#include <sys/ioctl.h>
#include <termio.h>
#include <sys/stat.h>
#include <sys/io.h>
#include <sys/utsname.h>
#include <pthread.h>
#include <netinet/in.h>
#include <ctype.h>
#include <sys/prctl.h>
#ifndef u8
typedef unsigned char u8;
#endif
#ifndef u16
typedef unsigned short int u16;
#endif
#ifndef u32
typedef unsigned int u32;
#endif
#ifndef u64
typedef unsigned long long u64;
#endif
#ifndef BYTE
typedef unsigned char BYTE;
#endif
#ifndef NULL
#define NULL 0
#endif
#ifndef SUCCESS
#define SUCCESS (0)
#endif
#ifndef FAILURE
#define FAILURE (-1)
#endif
#define MAX_BUFFER 1024
/* common.c */
extern void BcdToAscii (char *ascii_buf, const BYTE *bcd_buf, int len);
extern void BcdToAsciiR(char *ascii_buf, const unsigned char *bcd_buf, int len);
extern char *GetAsciiTime();
extern int GetCurrentTime( char *pNowTime );
extern int print_buf_in_fmt_ascii(char *ascii_buf, unsigned char *bcd_buf, int len);
extern void SetTermSignal(struct termios *ptermio, void (*handler)(int));
extern void Terminate(int sig);
extern void SetFSMTimer();
extern void sysDaemonInit();
extern void sysTimer_IRQ();
extern void SigactionSystem();
/* sock_if.c */
extern int init_socket(unsigned int local_addr, short local_port, char stype, int noblock_flag);
extern int udp_recv_with_ip_info(int fd, char *buf, short MAX_LEN, int *peer_ip, short *peer_port);
extern int udp_send(int fd, int peer_ip, short peer_port, char *buf, short len);
/* mini_cli.c */
extern int cli_read_cmd(char *buf);
extern void debug_monitor(void *arg);
#endif