|
version 1.30.2.12, 2024/03/20 17:06:11
|
version 1.34, 2025/03/31 17:06:03
|
|
Line 12 terms:
|
Line 12 terms:
|
| All of the documentation and software included in the ELWIX and AITNET |
All of the documentation and software included in the ELWIX and AITNET |
| Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
| |
|
| Copyright 2004 - 2024 | Copyright 2004 - 2025 |
| by Michael Pounov <misho@elwix.org>. All rights reserved. |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
| |
|
| Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
|
Line 69 static void *txBPFPacket(sched_task_t *);
|
Line 69 static void *txBPFPacket(sched_task_t *);
|
| static void *rxEXTPacket(sched_task_t *); |
static void *rxEXTPacket(sched_task_t *); |
| static void *txEXTPacket(sched_task_t *); |
static void *txEXTPacket(sched_task_t *); |
| |
|
| |
#ifdef __linux__ |
| |
#ifdef __mips__ |
| |
static sched_task_func_t cbProto[SOCK_MAX_SUPPORT][4] = { |
| |
{ acceptClients, closeClient, rxPacket, txPacket }, /* SOCK_STREAM */ |
| |
{ rxUDPPacket, freeClient, NULL /*rxUDPPacket*/, txUDPPacket }, /* SOCK_DGRAM */ |
| |
{ acceptClients, closeClient, rxPacket, txPacket }, /* SOCK_STREAM */ |
| |
{ rxRAWPacket, freeClient, NULL /*rxRAWPacket*/, txRAWPacket }, /* SOCK_RAW */ |
| |
{ rxBPFPacket, freeClient, NULL /*rxBPFPacket*/, txBPFPacket }, /* SOCK_BPF */ |
| |
{ rxEXTPacket, freeClient, NULL /*rxEXTPacket*/, txEXTPacket } /* SOCK_EXT */ |
| |
}; |
| |
#else |
| |
static sched_task_func_t cbProto[SOCK_MAX_SUPPORT][4] = { |
| |
{ acceptClients, closeClient, rxPacket, txPacket }, /* SOCK_STREAM */ |
| |
{ acceptClients, closeClient, rxPacket, txPacket }, /* SOCK_STREAM */ |
| |
{ rxUDPPacket, freeClient, NULL /*rxUDPPacket*/, txUDPPacket }, /* SOCK_DGRAM */ |
| |
{ rxRAWPacket, freeClient, NULL /*rxRAWPacket*/, txRAWPacket }, /* SOCK_RAW */ |
| |
{ rxBPFPacket, freeClient, NULL /*rxBPFPacket*/, txBPFPacket }, /* SOCK_BPF */ |
| |
{ rxEXTPacket, freeClient, NULL /*rxEXTPacket*/, txEXTPacket } /* SOCK_EXT */ |
| |
}; |
| |
#endif |
| |
#else |
| static sched_task_func_t cbProto[SOCK_MAX_SUPPORT][4] = { |
static sched_task_func_t cbProto[SOCK_MAX_SUPPORT][4] = { |
| { acceptClients, closeClient, rxPacket, txPacket }, /* SOCK_STREAM */ |
{ acceptClients, closeClient, rxPacket, txPacket }, /* SOCK_STREAM */ |
| { acceptClients, closeClient, rxPacket, txPacket }, /* SOCK_STREAM */ |
{ acceptClients, closeClient, rxPacket, txPacket }, /* SOCK_STREAM */ |
|
Line 77 static sched_task_func_t cbProto[SOCK_MAX_SUPPORT][4]
|
Line 98 static sched_task_func_t cbProto[SOCK_MAX_SUPPORT][4]
|
| { rxBPFPacket, freeClient, NULL /*rxBPFPacket*/, txBPFPacket }, /* SOCK_BPF */ |
{ rxBPFPacket, freeClient, NULL /*rxBPFPacket*/, txBPFPacket }, /* SOCK_BPF */ |
| { rxEXTPacket, freeClient, NULL /*rxEXTPacket*/, txEXTPacket } /* SOCK_EXT */ |
{ rxEXTPacket, freeClient, NULL /*rxEXTPacket*/, txEXTPacket } /* SOCK_EXT */ |
| }; |
}; |
| |
#endif |
| |
|
| /* Global Signal Argument when kqueue support disabled */ |
/* Global Signal Argument when kqueue support disabled */ |
| |
|
|
Line 543 rxUDPPacket(sched_task_t *task)
|
Line 565 rxUDPPacket(sched_task_t *task)
|
| #endif |
#endif |
| rlen = recvfrom(TASK_FD(task), AIT_GET_BUF(&b), AIT_LEN(&b), 0, &sa.sa, &salen); |
rlen = recvfrom(TASK_FD(task), AIT_GET_BUF(&b), AIT_LEN(&b), 0, &sa.sa, &salen); |
| rpc = (struct tagRPCCall*) AIT_GET_BUF(&b); |
rpc = (struct tagRPCCall*) AIT_GET_BUF(&b); |
| if (rlen < sizeof(struct tagRPCCall)) | if (!rpc || rlen < sizeof(struct tagRPCCall)) |
| goto end; |
goto end; |
| else |
else |
| len = ntohl(rpc->call_len); |
len = ntohl(rpc->call_len); |
|
Line 687 rxRAWPacket(sched_task_t *task)
|
Line 709 rxRAWPacket(sched_task_t *task)
|
| if (sa.sa.sa_family == AF_INET) { |
if (sa.sa.sa_family == AF_INET) { |
| struct ip *h; |
struct ip *h; |
| h = (struct ip*) AIT_GET_BUF(&b); |
h = (struct ip*) AIT_GET_BUF(&b); |
| if (rlen < ntohs(h->ip_len) || h->ip_p != IPPROTO_ERPC) | if (!h || rlen < ntohs(h->ip_len) || h->ip_p != IPPROTO_ERPC) |
| goto end; |
goto end; |
| else { |
else { |
| rlen -= sizeof(struct ip); |
rlen -= sizeof(struct ip); |
|
Line 697 rxRAWPacket(sched_task_t *task)
|
Line 719 rxRAWPacket(sched_task_t *task)
|
| #ifdef IPV6_REMOVE_HEADER |
#ifdef IPV6_REMOVE_HEADER |
| struct ip6_hdr *h; |
struct ip6_hdr *h; |
| h = (struct ip6_hdr*) AIT_GET_BUF(&b); |
h = (struct ip6_hdr*) AIT_GET_BUF(&b); |
| if (rlen < ntohs(h->ip6_plen) || h->ip6_nxt != IPPROTO_ERPC) | if (!h || rlen < ntohs(h->ip6_plen) || h->ip6_nxt != IPPROTO_ERPC) |
| goto end; |
goto end; |
| else { |
else { |
| rlen -= sizeof(struct ip6_hdr); |
rlen -= sizeof(struct ip6_hdr); |
|
Line 707 rxRAWPacket(sched_task_t *task)
|
Line 729 rxRAWPacket(sched_task_t *task)
|
| rpc = (struct tagRPCCall*) AIT_GET_BUF(&b); |
rpc = (struct tagRPCCall*) AIT_GET_BUF(&b); |
| #endif |
#endif |
| } |
} |
| if (rlen < sizeof(struct tagRPCCall)) | if (!rpc || rlen < sizeof(struct tagRPCCall)) |
| goto end; |
goto end; |
| else |
else |
| len = ntohl(rpc->call_len); |
len = ntohl(rpc->call_len); |
|
Line 1014 rxEXTPacket(sched_task_t *task)
|
Line 1036 rxEXTPacket(sched_task_t *task)
|
| AIT_SET_BUF(&b, NULL, srv->srv_netbuf); |
AIT_SET_BUF(&b, NULL, srv->srv_netbuf); |
| rlen = read(TASK_FD(task), AIT_GET_BUF(&b), AIT_LEN(&b)); |
rlen = read(TASK_FD(task), AIT_GET_BUF(&b), AIT_LEN(&b)); |
| rpc = (struct tagRPCCall*) AIT_GET_BUF(&b); |
rpc = (struct tagRPCCall*) AIT_GET_BUF(&b); |
| if (rlen < sizeof(struct tagRPCCall)) | if (!rpc || rlen < sizeof(struct tagRPCCall)) |
| goto end; |
goto end; |
| else |
else |
| len = ntohl(rpc->call_len); |
len = ntohl(rpc->call_len); |
|
Line 1562 rpc_srv_initServer(u_char InstID, int concurentClients
|
Line 1584 rpc_srv_initServer(u_char InstID, int concurentClients
|
| /* init functions */ |
/* init functions */ |
| pthread_mutex_init(&srv->srv_funcs.mtx, NULL); |
pthread_mutex_init(&srv->srv_funcs.mtx, NULL); |
| SLIST_INIT(&srv->srv_funcs); |
SLIST_INIT(&srv->srv_funcs); |
| AVL_INIT(&srv->srv_funcs); | RB_INIT(&srv->srv_funcs); |
| |
|
| /* init scheduler */ |
/* init scheduler */ |
| srv->srv_root = schedBegin(); |
srv->srv_root = schedBegin(); |
|
Line 1722 rpc_srv_loopServer(rpc_srv_t * __restrict srv)
|
Line 1744 rpc_srv_loopServer(rpc_srv_t * __restrict srv)
|
| AIT_FREE_VAL(&f->func_name); |
AIT_FREE_VAL(&f->func_name); |
| e_free(f); |
e_free(f); |
| } |
} |
| srv->srv_funcs.avlh_root = NULL; | srv->srv_funcs.rbh_root = NULL; |
| RPC_FUNCS_UNLOCK(&srv->srv_funcs); |
RPC_FUNCS_UNLOCK(&srv->srv_funcs); |
| |
|
| return 0; |
return 0; |
|
Line 1822 rpc_srv_initServer2(u_char InstID, int concurentClient
|
Line 1844 rpc_srv_initServer2(u_char InstID, int concurentClient
|
| /* init functions */ |
/* init functions */ |
| pthread_mutex_init(&srv->srv_funcs.mtx, NULL); |
pthread_mutex_init(&srv->srv_funcs.mtx, NULL); |
| SLIST_INIT(&srv->srv_funcs); |
SLIST_INIT(&srv->srv_funcs); |
| AVL_INIT(&srv->srv_funcs); | RB_INIT(&srv->srv_funcs); |
| |
|
| /* init scheduler */ |
/* init scheduler */ |
| srv->srv_root = schedBegin(); |
srv->srv_root = schedBegin(); |
|
Line 1940 rpc_srv_initServerExt(u_char InstID, int netBuf, int f
|
Line 1962 rpc_srv_initServerExt(u_char InstID, int netBuf, int f
|
| /* init functions */ |
/* init functions */ |
| pthread_mutex_init(&srv->srv_funcs.mtx, NULL); |
pthread_mutex_init(&srv->srv_funcs.mtx, NULL); |
| SLIST_INIT(&srv->srv_funcs); |
SLIST_INIT(&srv->srv_funcs); |
| AVL_INIT(&srv->srv_funcs); | RB_INIT(&srv->srv_funcs); |
| |
|
| /* init scheduler */ |
/* init scheduler */ |
| srv->srv_root = schedBegin(); |
srv->srv_root = schedBegin(); |