catalinux / Conn (public) (License: LGPLv2) (since 2016-03-01) (hash sha1)
Net library for easy building ipv4/ipv6 network daemons/clients
List of commits:
Subject Hash Author Date (UTC)
Some cosmetic changes for examples. 2fc9e92d9fb24568a13355db191e5bf64d601ee8 Catalin(ux) M. BOIE 2009-02-23 15:21:02
More TODO entries added/removed. eb5a15672c8adf3c3da2425582b1e842c6127b13 Catalin(ux) M. BOIE 2009-02-23 15:20:04
Minor cosmetic changes. 5955b574710254e771bbf9d81a8712033c9f1464 Catalin(ux) M. BOIE 2009-02-23 11:32:20
Added support for multiple polling engines and added epoll engine. ecf8b9c40ddae857b9d7dd72dee6596c1689db3e Catalin(ux) M. BOIE 2009-02-23 10:02:39
Duilder updates. db4999d6737f84d17c3b9aa5863483c91d6ed1a7 Catalin(ux) M. BOIE 2008-12-08 14:17:02
Bump up the version to 1.0.11. c623ba1f66e79d758d88407b6224c3574d9fd730 Catalin(ux) M. BOIE 2008-07-16 06:38:33
Added Conn_for_every_line. e7b9ae7009aa9a5cafa1f0f4e3916729f69dbb6b Catalin(ux) M. BOIE 2008-07-15 14:38:29
Bump version to 1.0.10. 4919629756fe6236e2ff75e646e612ed534353e8 Catalin(ux) M. BOIE 2008-07-04 09:23:00
Updated duilder. a20257fddc85103b43978c64d9cd4a5d4c1451ea Catalin(ux) M. BOIE 2008-07-04 09:14:18
Added SRPM_POST_RUN duilder config variable. f7c007d745d147f285ad8bc0a9bdfea3a7d832c0 Catalin(ux) M. BOIE 2008-07-04 09:13:47
Changed my e-mail address and URL. 9353a5fd0cad934232e41b23ee10872f33df2da1 Catalin(ux) M. BOIE 2008-07-04 09:13:10
Updated .gitignore. c40b1c4bf37a2b43804e39444571110eb79be466 Catalin(ux) M. BOIE 2008-07-04 09:07:56
Added .gitignore for examples directory. fc20d411e784066c30e3abe3d77989168fca1ee9 Catalin(ux) M. BOIE 2008-07-04 09:07:33
Added Conn_get_line. 5916ac4c9544d242a21ac50178efae893dff4806 Catalin(ux) M. BOIE 2008-07-04 08:59:27
Prepared to use duilder (my custom builder). 058d181795e64c0d1a82d587e7b1d858b7af87b2 Catalin(ux) M. BOIE 2008-03-21 13:37:19
Populated .gitignore file. e549ac0271ac654f039d5a04a0708d25030b0ed6 Catalin(ux) M. BOIE 2008-03-21 13:12:49
Replaced umbrella with embedromix. 6b6671cce7f0a2c98ac27705ad638c4e1bc52213 Catalin(ux) M. BOIE 2007-10-03 21:56:40
Incremented revision. e79bace79bb15f59133841a144ef1ff04e516cd5 Catalin(ux) M. BOIE 2007-10-03 21:55:25
Changed changelog. 00c9dba4e97d924299fd992ff8f4e20fce5c770e Catalin(ux) M. BOIE 2007-10-03 20:43:21
First import. 5ad0e7b8aa527aaebab52c53b45c36257fce5d0a Catalin(ux) M. BOIE 2007-10-03 20:20:26
Commit 2fc9e92d9fb24568a13355db191e5bf64d601ee8 - Some cosmetic changes for examples.
Signed-off-by: Catalin(ux) M. BOIE <catab@embedromix.ro>
Author: Catalin(ux) M. BOIE
Author date (UTC): 2009-02-23 15:21
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2009-03-05 15:31
Parent(s): eb5a15672c8adf3c3da2425582b1e842c6127b13
Signing key:
Tree: 880d1519c8e7e5b133a6ee505c2ae5d1d6462171
File Lines added Lines deleted
examples/.gitignore 1 0
examples/c.c 19 25
examples/s.c 8 9
File examples/.gitignore changed (mode: 100644) (index 01cac35..a54e886)
... ... s
4 4 timeout timeout
5 5 trigger trigger
6 6 udp_s udp_s
7 line1
File examples/c.c changed (mode: 100644) (index f7a867a..79d49f4)
20 20 #include <Conn.h> #include <Conn.h>
21 21
22 22 /* Global variables */ /* Global variables */
23 static unsigned short debug = 12;
23 static unsigned short debug = 9;
24 24
25 25 static FILE *Logf = NULL; static FILE *Logf = NULL;
26 26 static char *log_file = "c.log"; static char *log_file = "c.log";
 
... ... static void c_close(struct Conn *C)
57 57 free(C->private); free(C->private);
58 58 } }
59 59
60 static void c_data(struct Conn *C)
60 static int c_data_cb(struct Conn *C, char *line)
61 61 { {
62 62 struct priv *p; struct priv *p;
63 63 char *dump; char *dump;
64 char *line;
65 64
66 65 p = (struct priv *) C->private; p = (struct priv *) C->private;
67 66
68 while ((line = Conn_get_line(C))) {
69 if (debug >= 8) {
70 dump = Conn_dump(line, strlen(line));
71 Log(8, "data: recv: %s\n", dump);
72 free(dump);
73 }
67 if (debug >= 8) {
68 dump = Conn_dump(line, strlen(line));
69 Log(8, "data: recv: %s\n", dump);
70 free(dump);
71 }
74 72
75 p->dummy++;
73 p->dummy++;
76 74
77 answers++;
75 answers++;
78 76
79 Conn_eat(C, strlen(line));
80 }
77 return 0;
78 }
79
80 static void c_data(struct Conn *C)
81 {
82 Conn_for_every_line(C, c_data_cb);
81 83
82 84 Conn_close(C); Conn_close(C);
83 85 } }
 
... ... static void c_error(struct Conn *C)
90 92
91 93 int main(void) int main(void)
92 94 { {
93 char *stat;
94 int ret;
95 struct timeval start, end;
96 unsigned int elap;
97 unsigned int i, ipv4conns = 1, ipv6conns = 0;
95 int ret;
96 struct timeval start, end;
97 unsigned int elap;
98 unsigned int i, ipv4conns = 5000, ipv6conns = 5000;
98 99 struct Conn *C4, *C6; struct Conn *C4, *C6;
99 100
100
101 101 Logf = fopen(log_file, "a+"); Logf = fopen(log_file, "a+");
102 102 if (!Logf) { if (!Logf) {
103 103 fprintf(stderr, "Cannot open log file [%s] [%s]\n", fprintf(stderr, "Cannot open log file [%s] [%s]\n",
 
... ... int main(void)
161 161 break; break;
162 162 } }
163 163
164 if (debug >= 9) {
165 stat = Conn_status(0);
166 Log(9, "%s\n", stat);
167 free(stat);
168 }
169
170 164 if (answers % 10 == 0) if (answers % 10 == 0)
171 165 printf("."); printf(".");
172 166
File examples/s.c changed (mode: 100644) (index d269331..8b9cb42)
20 20 #include <Conn.h> #include <Conn.h>
21 21
22 22 /* Global variables */ /* Global variables */
23 static unsigned short debug = 12;
23 static unsigned short debug = 9;
24 24
25 25 static FILE *Logf = NULL; static FILE *Logf = NULL;
26 26 static char *log_file = "s.log"; static char *log_file = "s.log";
 
... ... static void s_close(struct Conn *C)
45 45 __FUNCTION__, C->addr, C->port, Conn_getid(C)); __FUNCTION__, C->addr, C->port, Conn_getid(C));
46 46 } }
47 47
48 static void s_data(struct Conn *C)
48 static int s_data_cb(struct Conn *C, char *line)
49 49 { {
50 char *line;
51 50 char *dump; char *dump;
52 51
53 line = Conn_get_line(C);
54 if (!line)
55 return;
56
57 52 if (debug >= 8) { if (debug >= 8) {
58 53 dump = Conn_dump(line, strlen(line)); dump = Conn_dump(line, strlen(line));
59 54 Log(8, "%s: recv head=%d tail=%d bytes on slot %d: [%s]\n", Log(8, "%s: recv head=%d tail=%d bytes on slot %d: [%s]\n",
 
... ... static void s_data(struct Conn *C)
68 63 Log(8, " Send back: %s", line); Log(8, " Send back: %s", line);
69 64 Conn_enqueue(C, line, strlen(line)); Conn_enqueue(C, line, strlen(line));
70 65
71 Conn_eat(C, strlen(line) + 1);
66 return 0;
67 }
68
69 static void s_data(struct Conn *C)
70 {
71 Conn_for_every_line(C, s_data_cb);
72 72 } }
73 73
74 74 static void s_error(struct Conn *C) static void s_error(struct Conn *C)
 
... ... int main(void)
82 82 struct Conn *I4 = NULL, *I6 = NULL; struct Conn *I4 = NULL, *I6 = NULL;
83 83 int ret; int ret;
84 84 struct timeval start; struct timeval start;
85 int loops = 0;
86 85
87 86 Logf = fopen(log_file, "w"); Logf = fopen(log_file, "w");
88 87 if (!Logf) { if (!Logf) {
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/catalinux/Conn

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/catalinux/Conn

Clone this repository using git:
git clone git://git.rocketgit.com/user/catalinux/Conn

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main