repo_name stringlengths 5 122 | path stringlengths 3 232 | text stringlengths 6 1.05M |
|---|---|---|
isshe/code-library | B.Operating-System/Linux/Application/C.Test/test_isshe_crypto.c | #include <stdio.h>
#include <string.h>
#include "isshe_aes_cfg128.h"
void test_aes_cfb128()
{
unsigned char ckey[] = "helloworldkey";
unsigned char ivec[] = "goodbyworldkey";
unsigned char ivec_cp[ISSHE_AES_BLOCK_SIZE];
int bytes_read;
unsigned char indata[ISSHE_AES_BLOCK_SIZE * 2];
//unsigne... |
isshe/code-library | K.Tools/wantype/common.h |
#ifndef _COMMON_H_
#define _COMMON_H_
#include <stdint.h>
#include <sys/time.h>
#define ETH_10MB 1
#define SEC2USEC 1000000
#define DEFAULT_TIMEOUT 3
enum wantype {
WANTYPE_UNKNOWN = 0,
WANTYPE_DHCP = 1,
WANTYPE_PPPOE = 1 << 1,
};
struct wantype_config {
char ifname[64];
struct ti... |
isshe/code-library | K.Tools/issheSocks/src/base/iuser/iuser.h | #ifndef _ISSHE_IUSER_H_
#define _ISSHE_IUSER_H_
#include <stdint.h>
#define IUSER_NAME_PWD_MAX_LEN 32
typedef struct {
// 测试使用明文,后面加密后保存
uint8_t username[IUSER_NAME_PWD_MAX_LEN]; // aes(md5(username))
uint8_t userpwd[IUSER_NAME_PWD_MAX_LEN]; // aes(md5(userpwd))
}iuser_s;
#endif |
isshe/code-library | K.Tools/issheSocks/src/roles/isocks/isocks.c |
#include "isocks.h" |
isshe/code-library | B.Operating-System/Linux/Application/B.lib/isshe_time.c | #include <sys/time.h>
#include <string.h>
#include <stdio.h>
#ifdef __linux__
#include <time.h>
#endif
#include "isshe_time.h"
#include "isshe_error.h"
#include "isshe_common.h"
int isshe_gettimeofday(struct timeval *tv, struct timezone *tz)
{
int rc;
if ((rc = gettimeofday(tv, tz)) < ISSHE_SUCCESS) {
... |
isshe/code-library | B.Operating-System/Linux/Application/C.Test/test_isshe_error.c | #include <stdio.h>
#include <errno.h>
#include "isshe_error.h"
int main(void)
{
isshe_error("isshe_error...");
return 0;
} |
isshe/code-library | J.Dynamic-Tracing/Linux-Observability-with-BPF/3.BPF-Map/map-iterate/main.c | #include <linux/bpf.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include "bpf/bpf.h"
int main(int argc, char **argv)
{
int fd, result, key, value, it;
fd = bpf_create_map(BPF_MAP_TYPE_HASH, sizeof(key),
sizeof(value), 256, 0);
if (fd < 0) {
... |
isshe/code-library | K.Tools/issheSocks/src/protocol/isout/isout_encode.h | <filename>K.Tools/issheSocks/src/protocol/isout/isout_encode.h
#ifndef _ISSHE_ISOUT_ENCODE_H_
#define _ISSHE_ISOUT_ENCODE_H_
#include <stdint.h>
//#include <event2/bufferevent.h>
//#include <event2/buffer.h>
#include "iuser.h"
#include "isession.h"
#define ISOUT_HEADER_MIN_LEN 32
int isout_encode_hmac(uint8_t *dat... |
isshe/code-library | K.Tools/wantype/dhcp.c | <filename>K.Tools/wantype/dhcp.c
#include <sys/types.h>
#include <sys/socket.h>
#include <linux/if_packet.h>
#include <net/ethernet.h> /* the L2 protocols */
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <arpa/inet.h>
#include <net/if.h> /... |
isshe/code-library | B.Operating-System/Linux/Application/B.lib/isshe_socket.c | #include "isshe_common.h"
#include "isshe_error.h"
#include "isshe_socket.h"
int isshe_socket(int domain, int type, int protocol)
{
int rc;
if ((rc = socket(domain, type, protocol)) < 0) {
isshe_sys_error_exit("socket error");
}
return rc;
}
int isshe_setsockopt(int s, int level, int optname... |
isshe/code-library | K.Tools/wantype/common.c | <filename>K.Tools/wantype/common.c
#include "common.h"
#include <stdint.h>
#include <time.h> // time()
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h> // open
#include <sys/ioctl.h>
#include <string.h>
#include <stdio.h>
#include <net/if.h> // if_nametoindex()、ifreq
#include <errno.h>
#include <std... |
isshe/code-library | K.Tools/issheSocks/src/isshe_socks_protocol.h | #ifndef _ISSHE_SOCKS_PROTOCOL_H_
#define _ISSHE_SOCKS_PROTOCOL_H_
// 标准
#include <stdint.h>
// 第三方
#include <event2/event.h>
#include <event2/listener.h>
#define ISSHE_SOCKS_FLAG_TO_USER 1
#define ISSHE_SOCKS_FLAG_FROM_USER 2
#define ISSHE_SOCKS_FLAG_CONFIG 4
#define ISSHE_SOCKS_OPT_... |
isshe/code-library | B.Operating-System/Linux/Application/A.include/crypto/isshe_md5.h | #ifndef _ISSHE_MD5_H_
#define _ISSHE_MD5_H_
#include <stdint.h>
typedef struct {
uint64_t bytes;
uint32_t a, b, c, d;
uint8_t buffer[64];
} isshe_md5_s;
void isshe_md5_init(isshe_md5_s *ctx);
void isshe_md5_update(isshe_md5_s *ctx, const void *data, uint64_t size);
void isshe_md5_final(isshe_md5_s *... |
isshe/code-library | B.Operating-System/Linux/Application/C.Test/test_isshe_hmac.c | #include <stdio.h>
#include <string.h>
#include <stdint.h>
#include "isshe_hmac.h"
void print_hex_buf(uint8_t *buf, int num)
{
int i;
for (i = 0; i < num; i++) {
printf("%02X ", buf[i]);
}
printf("\n");
}
int main(void)
{
uint8_t result[1024];
uint8_t data[1024] = "123";
uint32_t d... |
isshe/code-library | B.Operating-System/Linux/Application/B.lib/isshe_process.c | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/errno.h>
#include <string.h>
#include <sys/wait.h>
#include <syslog.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <signal.h>
#ifdef __linux__
#include <sys/time.h>
#include <sys/resource.h>
#endif
#include "isshe_process.h"
#include "issh... |
isshe/code-library | K.Tools/issheSocks/src/isshe_proxy_server.h | <gh_stars>1-10
#ifndef _ISSHE_PROXY_SERVER_H_
#define _ISSHE_PROXY_SERVER_H_
// 标准
#include <stdint.h>
// 第三方
#include <event2/event.h>
#include <event2/listener.h>
// 自定义
#include "isshe_config_parser.h"
#include "isshe_socks_protocol.h"
struct isshe_proxy_server
{
struct event_base *evbase;
struct evconn... |
isshe/code-library | K.Tools/issheSocks/src/protocol/isout/isout_connection.h | <filename>K.Tools/issheSocks/src/protocol/isout/isout_connection.h
#ifndef _ISSHE_ISOUT_CONNECTION_H_
#define _ISSHE_ISOUT_CONNECTION_H_
#include <stdint.h>
#include <event2/event.h>
#include <event2/bufferevent.h>
#include <event2/buffer.h>
#include "isout_protocol.h"
#define ISOUT_OPTS_FLAG_DNAME (1 << 0)
#... |
isshe/code-library | B.Operating-System/Linux/Kernel/Examples/1.Hello/hello.c | <gh_stars>1-10
#include "linux/init.h"
#include "linux/module.h"
static int hello_init(void)
{
printk(KERN_ALERT "Hello World linux_driver_module\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbey linux_driver_module\n");
}
module_init(hello_init);
module_exit(hello_exit);
MOD... |
isshe/code-library | K.Tools/issheSocks/src/base/isession/isession.h | <filename>K.Tools/issheSocks/src/base/isession/isession.h
#include <stdint.h>
#include <event2/event.h>
#include <event2/bufferevent.h>
#include <event2/buffer.h>
//#include "iconfig.h"
//#include "iuser.h"
typedef struct
{
void *in;
void *out;
void *config;
uint64_t flag;
struct event_base *evb... |
isshe/code-library | B.Operating-System/Linux/Application/A.include/isshe_rio.h |
#ifndef _ISSHE_RIO_H_
#define _ISSHE_RIO_H_
#define RIO_BUFSIZE 8192
typedef struct {
int rio_fd; /* Descriptor for this internal buf */
int rio_cnt; /* Unread bytes in internal buf */
char *rio_bufptr; /* Next unread byte in internal buf */
char rio_buf[RIO_BUFSI... |
isshe/code-library | B.Operating-System/Linux/Application/A.include/crypto/isshe_sha2.h | #ifndef _ISSHE_SHA2_H_
#define _ISSHE_SHA2_H_
#pragma once
#include <stdint.h>
#include <stdio.h>
#define ISSHE_SHA256_LBLOCK 16
// SHA-256 treats input data as a contiguous
// array of 32 bit wide big-endian values.
#define ISSHE_SHA256_CBLOCK 64
#define ISSHE_SHA256_DIGEST_LENGTH 32
ty... |
isshe/code-library | B.Operating-System/Linux/Application/A.include/isshe_stdio.h | #ifndef _ISSHE_STDIO_H_
#define _ISSHE_STDIO_H_
char *isshe_fgets(char *ptr, int n, FILE *stream);
void isshe_fputs(const char *ptr, FILE *stream);
#endif |
isshe/code-library | B.Operating-System/Linux/Application/C.Test/test_isshe_rand.c | <reponame>isshe/code-library<filename>B.Operating-System/Linux/Application/C.Test/test_isshe_rand.c<gh_stars>1-10
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include "isshe_rand.h"
void print_hex_buf(uint8_t *buf, int num)
{
int i;
for (i = 0; i < num; i++) {
printf("%02X ", buf[i]);
... |
isshe/code-library | B.Operating-System/Linux/Application/A.include/isshe_time.h | #ifndef _ISSHE_TIME_H_
#define _ISSHE_TIME_H_
int isshe_gettimeofday(struct timeval *tv, struct timezone *tz);
char * isshe_gf_time(void);
#endif |
isshe/code-library | B.Operating-System/Linux/Application/B.lib/crypto/isshe_rand.c | #include <stdio.h>
#include "isshe_rand.h"
int isshe_rand_bytes_dev_urandom(unsigned char *buf, int num)
{
int res;
FILE *fp = fopen(ISSHE_DEV_URANDOM, "rb");
if (!fp) {
return -1;
}
res = fread(buf, 1, num, fp);
fclose(fp);
if (res != num) {
return -1;
}
return ... |
isshe/code-library | K.Tools/issheSocks/src/isshe_socks_protocol.c | #include <stdint.h>
#include <string.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <event2/event.h>
#include <event2/bufferevent.h>
#include <event2/buffer.h>
#include "isshe_socks_protocol.h"
#include "isshe_socks_common.h"
void isshe_socks_opt_add_end(uint8_t *bu... |
isshe/code-library | K.Tools/issheSocks/src/protocol/isout/isout_protocol.h | <reponame>isshe/code-library
/*
* 定义/处理协议本身
*/
#ifndef _ISSHE_ISOUT_PROTOCOL_H_
#define _ISSHE_ISOUT_PROTOCOL_H_
// 标准
#include <stdint.h>
#define ISOUT_ALL_OPT_MAX_LEN 1024
#define ISOUT_HMAC_LEN 32
/*
+------------+----------+----------+
| 消息验证码 | 协议选项 | 加密数据 |
+------------+----------+----------+
*/
ty... |
isshe/code-library | B.Operating-System/Linux/Application/A.include/isshe_process.h | #ifndef _ISSHE_PROCESS_H_
#define _ISSHE_PROCESS_H_
#include "isshe_common.h"
#define isshe_log_pid getpid()
pid_t isshe_fork(void);
void isshe_print_exit_status(int status);
/**
* daemonize: 守护进程化——使一个进程"变为"守护进程
*/
void isshe_daemonize(const char *pname, int facility);
pid_t isshe_waitpid(pid_t pid, ... |
isshe/code-library | K.Tools/issheSocks/src/isshe_socks_common.h | #ifndef _ISSHE_SOCKS_COMMON_H_
#define _ISSHE_SOCKS_COMMON_H_
#include <event2/event.h>
#include <event2/listener.h>
#define MAX_OUTPUT (512*1024) // ???!!!
#define SUCCESS 0
#define FAILURE (-1)
#define FALSE 0
#define TRUE 1
struct event_base *isshe_socks_event_new();
struct evconnlist... |
isshe/code-library | K.Tools/issheSocks/src/protocol/isout/isout_decode.h | #ifndef _ISSHE_ISOUT_DECODE_H_
#define _ISSHE_ISOUT_DECODE_H_
#include "isession.h"
int isout_decode(isession_s *session);
#endif |
isshe/code-library | K.Tools/issheSocks/src/isshe_config_parser.c | <reponame>isshe/code-library
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "isshe_config_parser.h"
static struct socks_parser_config *
socks_parser_config_new()
{
struct socks_parser_config *sp_config;
sp_config = (struct socks_parser_config *)malloc(sizeof(struct socks_parser_config));... |
isshe/code-library | K.Tools/issheSocks/src/isshe_socks_parser.c |
#include <arpa/inet.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <errno.h>
#include <event2/event.h>
#include <event2/bufferevent.h>
#include <event2/buffer.h>
#include "isshe_socks_parser.h"
#include "is... |
isshe/code-library | B.Operating-System/Linux/Application/A.include/crypto/isshe_aes.h | <gh_stars>1-10
#ifndef _ISSHE_AES_H_
#define _ISSHE_AES_H_
#include <stdint.h>
//#define FULL_UNROLL 1
//#define OPENSSL_SMALL_FOOTPRINT 1
//#define STRICT_ALIGNMENT 1
#define ISSHE_AES_ENCRYPT 1
#define ISSHE_AES_DECRYPT 0
#define ISSHE_AES_MAX_ROUND 14
#define ISSHE_AES_BLOCK_SIZE ... |
isshe/code-library | K.Tools/issheSocks/src/protocol/isout/isout_decode.c |
#include "isout_decode.h"
#include "isout_encode.h"
#include "isshe_aes_cfg128.h"
#include "isout_protocol.h"
#include "isout_connection.h"
#include "isshe_common.h"
int is_valid_hmac(uint8_t *data, uint32_t len, uint8_t *hmac)
{
uint8_t expect_hmac[ISOUT_HMAC_LEN];
isout_encode_hmac(data, len, expect_hmac);... |
isshe/code-library | K.Tools/wantype/main.c | <reponame>isshe/code-library
#include <sys/types.h>
#include <sys/socket.h>
#include <linux/if_packet.h>
#include <net/ethernet.h> /* the L2 protocols */
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <arpa/inet.h>
#include <net/if.h> // f... |
isshe/code-library | K.Tools/issheSocks/src/isshe_proxy_server.c |
#include <arpa/inet.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <errno.h>
#include <event2/event.h>
#include <event2/bufferevent.h>
#include <event2/buffer.h>
#include "isshe_config_parser.h"
#include "isshe_proxy_server.h"
#include "isshe_socks_common.h"
#include "i... |
isshe/code-library | K.Tools/issheSocks/src/isshe_socks_common.c | <gh_stars>1-10
#include <arpa/inet.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <event2/event.h>
#include <event2/bufferevent.h>
#include <event2/buffer.h>
#include "isshe_socks_common.h"
struct event_base *
isshe_socks_event_new()
{
struct event_base *base = event_base_new();
if (... |
isshe/code-library | B.Operating-System/Linux/Application/A.include/isshe_file.h | <gh_stars>1-10
#ifndef _ISSHE_FILE_H_
#define _ISSHE_FILE_H_
#include <unistd.h>
#include <sys/stat.h>
#define LOCKMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)
int isshe_lock_file(int fd);
int isshe_unlock_file(int fd);
// 简化fcntl锁相关的调用
int lock_reg(int, int, int, off_t, int, off_t); /* {Prog lockreg} */
pid_t lock_test(... |
isshe/code-library | B.Operating-System/Linux/Application/A.include/isshe_error.h | #ifndef _ISSHE_ERROR_H_
#define _ISSHE_ERROR_H_
#define ISSHE_ERROR_MAX_LINE 4096
enum error_type {
UNIX_ERROR = 0,
POSIX_ERROR,
GAI_ERROR,
APP_ERROR,
DNS_ERROR,
};
/*
* 系统调用错误;不退出;
*/
void isshe_sys_error(const char *fmt, ...);
/*
* 系统调用错误;退出;core dump;
*/
void isshe_sys_error_dump(const... |
isshe/code-library | B.Operating-System/Linux/Application/A.include/isshe_rpc.h | <gh_stars>1-10
#ifndef _ISSHE_RPC_H_
#define _ISSHE_RPC_H_
#include <rpc/rpc.h>
CLIENT *isshe_clnt_create(char *host,
unsigned long prog, unsigned long vers, char *proto);
bool_t isshe_clnt_control(CLIENT *cl, int req, char *info);
#endif |
isshe/code-library | K.Tools/issheSocks/src/roles/isocks/isocks.h | #ifndef _ISSHE_ISOCKS_H_
#define _ISSHE_ISOCKS_H_
#endif |
isshe/code-library | B.Operating-System/Linux/Application/A.include/isshe_pthread.h | #ifndef _ISSHE_THREAD_H_
#define _ISSHE_THREAD_H_
#include <pthread.h>
int isshe_pthread_create(pthread_t *tid, const pthread_attr_t *attr, void * (*func)(void *), void *arg);
int isshe_pthread_join(pthread_t tid, void **status);
int isshe_pthread_cancel(pthread_t tid);
int isshe_pthread_detach(pthread_t tid);
void i... |
isshe/code-library | B.Operating-System/Linux/Application/A.include/crypto/isshe_aes_cfg128.h |
#ifndef _ISSHE_AES_CFB128_H_
#define _ISSHE_AES_CFB128_H_
#include "isshe_aes.h"
typedef void (*block128_f) (const unsigned char in[16],
unsigned char out[16], const void *key);
void isshe_aes_cfb128_encrypt(const unsigned char *in, unsigned char *out,
size_t le... |
isshe/code-library | K.Tools/wantype/dhcp.h | #ifndef _DHCP_H_
#define _DHCP_H_
#include <linux/if_ether.h>
#include <stdint.h>
#include <linux/ip.h>
#include <linux/udp.h>
#include "common.h"
#define HOST_NAME "isshe"
#define DHCP_MAGIC 0x63825363
#define BOOTREQUEST 1
#define BOOTREPLY 2
#define OPTION_CODE 0
#define OPTION_LEN 1... |
isshe/code-library | B.Operating-System/Linux/Kernel/Examples/2.isshe_hic/isshe_hic.c |
#include <linux/kmod.h>
#include <linux/module.h>
#include <linux/version.h>
#include <linux/skbuff.h>
#include <linux/netfilter.h>
#include <linux/netfilter_ipv4.h>
#include <net/netfilter/nf_conntrack.h>
#define DRV_VERSION "1.0.0"
#define DRV_DESC "Collect host info"
struct dhcphdr {
__u8 opcode; ... |
isshe/code-library | K.Tools/issheSocks/src/roles/iproxy/iproxy.h | #ifndef _ISSHE_IPROXY_H_
#define _ISSHE_IPROXY_H_
#include <event2/event.h>
#include <event2/bufferevent.h>
#include <event2/buffer.h>
#endif |
isshe/code-library | K.Tools/issheSocks/src/protocol/isout/isout_encode.c |
#include "isout_encode.h"
#include "isshe_common.h"
#include "isout_connection.h"
#include "isshe_aes_cfg128.h"
int isout_opts_to_string(uint8_t *buf, isout_conn_opts_s *opts, uint64_t flag)
{
int i = 0;
// 这两个放前面!HMAC生成依赖这两个的随机性
i += isout_opt_append(buf + i, ISOUT_OPT_COUNT, sizeof(opts->count), o... |
isshe/code-library | B.Operating-System/Linux/Application/C.Test/test_isshe_sha2.c | #include <stdio.h>
#include <string.h>
#include "isshe_sha2.h"
void print_hex_buf(uint8_t *buf, int num)
{
int i;
for (i = 0; i < num; i++) {
printf("%02X ", buf[i]);
}
printf("\n");
}
int main(void)
{
char buf[32];
char data[3] = "123";
printf("data = %ld:%s\n", sizeof(data), dat... |
isshe/code-library | B.Operating-System/Linux/Application/A.include/crypto/isshe_rand.h | <reponame>isshe/code-library
#ifndef _ISSHE_RAND_H_
#define _ISSHE_RAND_H_
//#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
#define ISSHE_DEV_URANDOM "/dev/urandom"
//#endif
int isshe_rand_bytes(unsigned char *buf, int num);
#endif |
isshe/code-library | B.Operating-System/Linux/Application/A.include/isshe_common.h | <reponame>isshe/code-library
#ifndef _ISSHE_COMMON_H_
#define _ISSHE_COMMON_H_
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>
#include <fcntl.h> /* For O_* constants */
#include <sys/stat.h> /* For mode constants */
#include <sys/e... |
isshe/code-library | B.Operating-System/Linux/Application/B.lib/isshe_rio.c | #include "isshe_common.h"
#include "isshe_rio.h"
#include "isshe_error.h"
/****************************************
* 健壮I/O函数:标准I/O的包装函数
****************************************/
/*
* rio_readn - 健壮地读取n个字节 (unbuffered/无缓冲)
*/
ssize_t rio_readn(int fd, void *usrbuf, size_t n)
{
size_t nleft = n;
ssize_t nre... |
isshe/code-library | J.Dynamic-Tracing/Linux-Observability-with-BPF/3.BPF-Map/map-remove/main.c | #include <linux/bpf.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include "bpf/bpf.h"
int main(int argc, char **argv)
{
int fd, result, key, value;
fd = bpf_create_map(BPF_MAP_TYPE_ARRAY, sizeof(key),
sizeof(value), 256, 0);
if (fd < 0) {
pr... |
isshe/code-library | K.Tools/wantype/pppoe.c |
#include <sys/types.h>
#include <sys/socket.h>
#include <linux/if_packet.h>
#include <net/ethernet.h> /* the L2 protocols */
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <arpa/inet.h>
#include <net/if.h> // for if_nametoindex
#include <s... |
isshe/code-library | B.Operating-System/Linux/Application/B.lib/crypto/isshe_aes_cfb128.c | <reponame>isshe/code-library
#include <stdio.h>
#include "isshe_aes_cfg128.h"
void isshe_crypto_cfb128_encrypt(const unsigned char *in, unsigned char *out,
size_t len, const void *key,
unsigned char ivec[16], int *num,
int enc, block128... |
isshe/code-library | J.Dynamic-Tracing/Linux-Observability-with-BPF/4.Probes/6.DSDT/main.c | <gh_stars>1-10
#include <sys/sdt.h>
#include <sys/time.h>
int main() {
DTRACE_PROBE(hello-usdt, probe-main);
} |
isshe/code-library | B.Operating-System/Linux/Application/A.include/isshe_unistd.h | <filename>B.Operating-System/Linux/Application/A.include/isshe_unistd.h<gh_stars>1-10
#ifndef _ISSHE_UNISTD_H_
#define _ISSHE_UNISTD_H_
#include <sys/mman.h>
#include <sys/time.h>
#include <sys/types.h>
#include <poll.h>
#ifdef __linux__
#include <sys/epoll.h>
#endif
#if defined(__bsdi__) || defined(__APPLE__)
#inc... |
isshe/code-library | K.Tools/issheSocks/src/protocol/isout/isout_protocol.c | <gh_stars>1-10
#include <string.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "isout_protocol.h"
#include "isshe_common.h"
/*
* 一次加一个,返回加的这个选项的长度。
* 预期用法是:
* buf = [], i = 0;
* i += append(buf + i);
*/
int isout_opt_append(uint8_t *buf, uint8_t type, uint8_t len, c... |
isshe/code-library | B.Operating-System/Linux/Application/B.lib/isshe_unistd.c | <gh_stars>1-10
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/mman.h>
#include "isshe_unistd.h"
#include "isshe_error.h"
#include "isshe_common.h"
long isshe_pathconf(const char *pathname, int name)
{
long val;
errno = 0; /* in case pathconf() does not change ... |
isshe/code-library | B.Operating-System/Linux/Application/A.include/crypto/isshe_hmac.h | <filename>B.Operating-System/Linux/Application/A.include/crypto/isshe_hmac.h
#ifndef _ISSHE_HMAC_H_
#define _ISSHE_HMAC_H_
#include <stdint.h>
#define HMAC_IPAD 0x36
#define HMAC_OPAD 0x5c
#define HMAC_PADKEY_LEN 64
#define HMAC_MD5_DIGEST_LEN 16
#define HMAC_SHA256_DIGEST_LEN 32
void isshe_hmac_md5(uint8_t* text,... |
isshe/code-library | B.Operating-System/Linux/Application/B.lib/isshe_file.c | <filename>B.Operating-System/Linux/Application/B.lib/isshe_file.c
#include <syslog.h>
#include <fcntl.h>
#include "isshe_file.h"
#include "isshe_error.h"
#include "isshe_common.h"
static int isshe_lock_unlock(int fd, short type) {
struct flock fl;
fl.l_type = type;
fl.l_start = 0;
fl.l_whence = SEEK... |
isshe/code-library | B.Operating-System/Linux/Application/A.include/isshe_ipc.h | <reponame>isshe/code-library
#ifndef _ISSHE_IPC_H_
#define _ISSHE_IPC_H_
#include <sys/msg.h>
#include <semaphore.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h> // system v
#include <sys/shm.h> // system v
#ifndef SEM_FAILED
#define SEM_FAILED ((sem_t *)(-1))
#endif
#ifdef __linux__
#def... |
isshe/code-library | K.Tools/issheSocks/src/isshe_socks_crypt.h | #ifndef _ISSHE_SOCKS_CRYPT_H_
#define _ISSHE_SOCKS_CRYPT_H_
#endif |
isshe/code-library | J.Dynamic-Tracing/Linux-Observability-with-BPF/3.BPF-Map/map-update/main.c | #include <linux/bpf.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
// for function declare
#include "bpf/bpf.h" // /kernel-src/tools/lib/bpf/bpf.h
int main(int argc, char **argv)
{
int my_map, result, key, value;
key = 1, value = 1234;
my_map = bpf_create_map(BPF_MAP_TYPE_ARRAY, sizeof(key... |
isshe/code-library | J.Dynamic-Tracing/Linux-Observability-with-BPF/3.BPF-Map/rate-limit/rate_limit_kern.c | #include <linux/version.h>
#include <linux/ptrace.h>
#include <uapi/linux/bpf.h>
#include "bpf_helpers.h"
#define SEC(NAME) __attribute__((section(NAME), used))
// static int (*bpf_trace_printk)(const char *fmt, int fmt_size,
// ...) = (void *)BPF_FUNC_trace_printk;
#define IPV4_FAMILY... |
isshe/code-library | K.Tools/wantype/pppoe.h | <gh_stars>1-10
#ifndef _PPPOE_H_
#define _PPPOE_H_
#include <linux/if_ether.h>
#include <linux/if_pppox.h>
#include "common.h"
#define PPPOE_TYPE 0x01
#define PPPOE_VERSION 0x01
#define PPPOE_TAG_TYPE 0x0101
struct pppoe_packet {
struct ethhdr eth;
struct pppoe_hdr phdr;
struct pppoe_tag ptag;
... |
isshe/code-library | K.Tools/issheSocks/src/protocol/isout/isout_connection.c |
#include "isshe_common.h"
#include "isout_connection.h"
#include "isout_protocol.h"
void *isout_opts_malloc_copy(isout_opt_s *opt)
{
void *temp = malloc(opt->len);
if (!temp) {
printf("ERROR: isout_opts_copy malloc!!!\n");
exit(0);
}
memcpy(temp, opt->data, opt->len);
return tem... |
isshe/code-library | K.Tools/issheSocks/src/isshe_socks_parser.h | #ifndef _ISSHE_SOCKS_PARSER_H_
#define _ISSHE_SOCKS_PARSER_H_
// 标准
#include <stdint.h>
// 第三方
#include <event2/event.h>
#include <event2/listener.h>
// 自定义
#include "isshe_config_parser.h"
#define BUFFER_LEN 1500
#define IPV4_ADDR_LEN 4
#define IPV6_ADDR_LEN 16
#define DEFAULT_SOC... |
isshe/code-library | B.Operating-System/Linux/Application/A.include/isshe_socket.h | <filename>B.Operating-System/Linux/Application/A.include/isshe_socket.h
#ifndef _ISSHE_SOCKET_H_
#define _ISSHE_SOCKET_H_
#define LISTENQ 1024 /* Second argument to listen() */
#define SA struct sockaddr
int isshe_socket(int domain, int type, int protocol);
int isshe_setsockopt(int s, int level, int optname, cons... |
isshe/code-library | B.Operating-System/Linux/Application/B.lib/isshe_ipc.c |
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h> /* For mode constants */
#include <fcntl.h> /* For O_* constants */
#include "isshe_ipc.h"
#include "isshe_error.h"
#include "isshe_common.h"
static char *posix_ipc_name(const c... |
isshe/code-library | B.Operating-System/Linux/Application/B.lib/isshe_rpc.c | #include "isshe_rpc.h"
#include "isshe_error.h"
CLIENT *isshe_clnt_create(char *host,
unsigned long prog, unsigned long vers, char *proto)
{
CLIENT *cl;
if ( (cl = clnt_create(host, prog, vers, proto)) == NULL) {
clnt_pcreateerror(host);
isshe_error_exit("clnt_create error");
}
re... |
isshe/code-library | K.Tools/issheSocks/src/isshe_config_parser.h | <gh_stars>1-10
#ifndef _ISSHE_CONFIG_PARSER_H_
#define _ISSHE_CONFIG_PARSER_H_
#include <stdint.h>
struct socks_parser_config
{
uint8_t enable;
uint8_t dns_enable;
uint8_t outproto;
uint16_t port;
};
struct proxy_server_config
{
uint8_t enable;
uint8_t dns_enable;
uint8_t inproto;
uin... |
isshe/code-library | B.Operating-System/Linux/Application/B.lib/isshe_error.c | #include <stdio.h>
#include <errno.h> // for "errno"
#include <stdarg.h> // for "可变参"
#include <string.h>
#include <stdlib.h>
#include <syslog.h> // for syslog()
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h> // for inet_ntop()/inet_pton()
#include "isshe_error.h... |
isshe/code-library | K.Tools/issheSocks/src/roles/irelay/irelay.h | #ifndef _ISSHE_IRELAY_H_
#define _ISSHE_IRELAY_H_
#endif |
isshe/code-library | K.Tools/issheSocks/src/roles/iproxy/iproxy.c | <filename>K.Tools/issheSocks/src/roles/iproxy/iproxy.c<gh_stars>1-10
#include "iproxy.h"
#include "isession.h"
void iproxy_left_read_cb(struct bufferevent *bev, void *ctx)
{
}
void iproxy_right_read_cb(struct bufferevent *bev, void *ctx)
{
}
void iproxy_left_event_cb(
struct bufferevent *bev, short wha... |
illej/opengl-app | src/vertex_buffer.h | #ifndef VERTEX_BUFFER_H
#define VERTEX_BUFFER_H
#include "renderer.h"
struct vertex_buffer
{
unsigned int renderer_id;
};
struct vb_element
{
struct vertex_buffer *vbo; // TODO: this is bad lol
unsigned int count;
unsigned int type;
unsigned char normalised;
};
struct vb_layout
{
unsigned in... |
illej/opengl-app | src/texture.h | #ifndef TEXTURE_H
#define TEXTURE_H
struct texture
{
unsigned int id;
unsigned char *data;
int width;
int height;
int bytes_per_pixel;
};
static void
texture_create (struct texture *tex, char *file)
{
stbi_set_flip_vertically_on_load (1);
tex->data = stbi_load (file, &tex->width, &tex->h... |
illej/opengl-app | tests/test.c | #include "test_clear_colour.h"
#include "test_texture.h"
#include "test_3d_cube.h"
// TODO: may be able to put this back into test.h??? do we want to??
void
test_setup (enum test_type type, struct test_data *d)
{
d->type = type;
switch (d->type)
{
case TEST_CLEAR_COLOUR: { test_clear_colour_setup... |
illej/opengl-app | src/renderer.h | #ifndef RENDERER_H
#define RENDERER_H
#include "common.h"
#include "vertex_buffer.h"
#include "vertex_array.h"
#include "index_buffer.h"
#include "shader.h"
#include "texture.h"
struct renderer
{
unsigned int id;
};
static void
renderer_clear (void)
{
GLCALL (glClearColor (0.0f, 0.15f, 0.3f, 1.0f));
GLCA... |
illej/opengl-app | src/shader.h | #ifndef SHADER_H
#define SHADER_H
#include "renderer.h"
struct uniform_location_cache_entry
{
char name[32];
int location;
};
struct shader
{
unsigned int id;
unsigned int cache_len;
struct uniform_location_cache_entry uniform_location_cache[256];
};
static char *
read_file_to_str (char *file)
{... |
illej/opengl-app | src/common.h | <reponame>illej/opengl-app
#ifndef COMMON_H
#define COMMON_H
#include <stdio.h>
#include <GL/glew.h>
#define ARRAY_LEN(arr) (sizeof ((arr)) / sizeof ((arr)[0]))
#if DEBUG
#define ASSERT(expr) if (!(expr)) { printf ("Assertion failed at %s %s(%d): %s\n", __FILE__, __func__, __LINE__, #expr); *(int *) 0 = 0; }
#de... |
illej/opengl-app | src/index_buffer.h | <filename>src/index_buffer.h
#ifndef INDEX_BUFFER_H
#define INDEX_BUFFER_H
#include "renderer.h"
struct index_buffer
{
unsigned int renderer_id;
unsigned int count;
};
void
ib_create (struct index_buffer *ib, unsigned int *data, unsigned int count)
{
ASSERT (sizeof (unsigned int) == sizeof (GLuint));
... |
illej/opengl-app | tests/test_texture.h | <filename>tests/test_texture.h<gh_stars>0
#ifndef TEST_TEXTURE_H
#define TEST_TEXTURE_H
void test_texture_setup (struct test_data *t)
{
unsigned int i = 0;
t->vert_data[i++] = -0.5f; // bottom-left of view (x, y)
t->vert_data[i++] = -0.5f;
t->vert_data[i++] = 0.0f; // bottom-left of texture (u, v)
... |
illej/opengl-app | src/main.c | <reponame>illej/opengl-app
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <GL/glew.h> // Always include before gl.h and glfw3.h
#include <SDL2/SDL.h>
#define MATH_3D_IMPLEMENTATION
#include <math_3d.h>
#define STB_IMAGE_IMPLEMENTATION
#include <stb_image.h>
#define NK_INCLUDE_FIXED_TYPES
#defi... |
illej/opengl-app | src/vertex_array.h | <filename>src/vertex_array.h
#ifndef VERTEX_ARRAY_H
#define VERTEX_ARRAY_H
#include "renderer.h"
struct vertex_array
{
unsigned int renderer_id;
};
static void
va_create (struct vertex_array *vao)
{
GLCALL (glGenVertexArrays (1, &vao->renderer_id));
}
static void
va_delete (struct vertex_array *vao)
{
G... |
illej/opengl-app | tests/test_clear_colour.h | <gh_stars>0
#ifndef TEST_CLEAR_COLOUR_H
#define TEST_CLEAR_COLOUR_H
#include "test.h"
void
test_clear_colour_setup (struct test_data *t)
{
unsigned int i = 0;
t->colour[i++] = 0.2f;
t->colour[i++] = 0.3f;
t->colour[i++] = 0.8f;
t->colour[i++] = 1.0f;
}
void
test_clear_colour_update (struct t... |
illej/opengl-app | tests/test_3d_cube.h | #ifndef TEST_3D_CUBE_H
#define TEST_3D_CUBE_H
static float g_cube_vert_data[] = {
-1.0f,-1.0f,-1.0f, // triangle 1 : begin
-1.0f,-1.0f, 1.0f,
-1.0f, 1.0f, 1.0f, // triangle 1 : end
1.0f, 1.0f,-1.0f, // triangle 2 : begin
-1.0f,-1.0f,-1.0f,
-1.0f, 1.0f,-1.0f, // triangle 2 : end
1.0f,-1.0f, ... |
illej/opengl-app | tests/test.h | #ifndef TEST_H
#define TEST_H
//#include "renderer.h"
//
enum test_type
{
TEST_INALID = 0,
TEST_CLEAR_COLOUR,
TEST_TEXTURE,
TEST_3D_CUBE,
};
struct test_data
{
enum test_type type;
/* CLEAR COLOUR */
float colour[4];
/* TEXTURE */
float vert_data[16];
unsigned int vert_size;... |
KeilChris/VHT | interface/include/arm_vsocket.h | /*
* Copyright (c) 2021-2022 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICEN... |
danielsundfeld/cuda_sankoff | src/read_fasta.h | /*!
* \author <NAME>
* \copyright MIT License
*/
#ifndef _READ_FASTA_FILE
#define _READ_FASTA_FILE
#include <string>
int read_fasta_file(const std::string &name, const int &check = 0);
#endif
|
danielsundfeld/cuda_sankoff | src/Cost.h | <reponame>danielsundfeld/cuda_sankoff
#ifndef _COST_H
#define _COST_H
#ifdef __CUDACC__
#define CUDAFLAGS __device__ __host__
#else
#define CUDAFLAGS
#endif
#define _RIBOSUM_8560 1
class Cost {
public:
static constexpr float gap = -13;
static constexpr float unpaired = 5;
static constexpr ... |
danielsundfeld/cuda_sankoff | src/DPMatrix_GPU.h | <reponame>danielsundfeld/cuda_sankoff<filename>src/DPMatrix_GPU.h
#ifndef _DPMATRIX_GPU_H
#define _DPMATRIX_GPU_H
#include "dp_matrix_cell.h"
#define MAX_SEQ_SIZE 1024
struct sequences {
char s1[MAX_SEQ_SIZE];
int s1_l;
char s2[MAX_SEQ_SIZE];
int s2_l;
};
long long int dp_matrix_calc_total_size(long ... |
danielsundfeld/cuda_sankoff | src/sankoff_args.h | <filename>src/sankoff_args.h
#ifndef _SANKOFF_ARGS
#define _SANKOFF_ARGS
int load_args(int argc, char *argv[], int *threads_num = 0);
#endif
|
danielsundfeld/cuda_sankoff | src/dp_matrix_cell.h | <gh_stars>0
#ifndef _DP_MATRIX_CELL_H
#define _DP_MATRIX_CELL_H
struct dp_matrix_cell {
float score;
char parent;
};
enum Parent {
NullParent = 0,
FirstCell,
GapI,
GapK,
GapJ,
GapL,
UnpairedIK,
UnpairedJL,
PairedGapS1,
PairedGapS2,
Paired,
Multibranch,
LastPa... |
danielsundfeld/cuda_sankoff | src/Sankoff_GPU.h | #ifndef _SANKOFF_GPU_H
#define _SANKOFF_GPU_H
#include <string>
#include "bp_probs.h"
#include "dp_matrix_cell.h"
#include "DPMatrix_GPU.h"
class Sankoff_GPU {
public:
Sankoff_GPU(const std::string &seq1, const std::string &seq2);
virtual ~Sankoff_GPU();
int diag_sankoff(); //Run a pure sa... |
danielsundfeld/cuda_sankoff | src/TimeCounter.h | /*!
* \class TimeCounter
* \author <NAME>
* \copyright MIT License
*
* \brief Class that count elapsed time between the creation and destruction
*/
#ifndef _TIMECOUNTER_H
#define _TIMECOUNTER_H
#include <sys/time.h>
#include <iostream>
#include <string>
class TimeCounter
{
public:
TimeCounter(const s... |
danielsundfeld/cuda_sankoff | src/Sequences.h | <reponame>danielsundfeld/cuda_sankoff<gh_stars>0
/*!
* \class Sequences
* \author <NAME>
* \copyright MIT License
*
* \brief Singleton that holds all sequences being aligned
*/
#ifndef _SEQUENCES_H
#define _SEQUENCES_H
#include <string>
#include <vector>
class Sequences
{
public:
static Sequences* ge... |
danielsundfeld/cuda_sankoff | src/DPMatrix.h | <filename>src/DPMatrix.h<gh_stars>0
#ifndef _DPMATRIX_H
#define _DPMATRIX_H
#include <string>
#include "Backtrace.h"
#include "dp_matrix_cell.h"
class DPMatrix {
public:
DPMatrix(const int &s1_l, const int &s2_l);
~DPMatrix();
dp_matrix_cell get_pos(const int &i, const int &j, const int &k... |
danielsundfeld/cuda_sankoff | src/bp_probs.h | <filename>src/bp_probs.h
#ifndef _BP_PROBS
#define _BP_PROBS
#include <string>
#include "DPMatrix_GPU.h"
struct bp_prob {
int size;
float m[MAX_SEQ_SIZE][MAX_SEQ_SIZE];
};
int get_bp_prob(const std::string &seq, struct bp_prob *bp);
#endif
|
danielsundfeld/cuda_sankoff | src/Sankoff.h | <gh_stars>0
#ifndef _SANKOFF_H
#define _SANKOFF_H
#include <string>
#include "bp_probs.h"
#include "DPMatrix.h"
#include "dp_matrix_cell.h"
class Sankoff {
public:
Sankoff(const std::string &seq1, const std::string &seq2);
virtual ~Sankoff();
int sankoff(); //Run a pure sankoff algorithm
... |
danielsundfeld/cuda_sankoff | src/Backtrace.h | #ifndef _BACKTRACE_H
#define _BACKTRACE_H
#include <string>
#include "DPMatrix.h"
#include "dp_matrix_cell.h"
class DPMatrix;
class Backtrace {
public:
Backtrace(DPMatrix *dp_matrix, int i, int j, int k, int l, const std::string &s1, const std::string &s2);
void run();
void print(std::str... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.