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)
Added Conn_sys that logs some system variables related to network perf. af960f317b8ca9a8f78fe44e80ddbdb6a9483e6f Catalin(ux) M. BOIE 2009-08-31 16:36:00
Better output flags. d57a98c2b158aeb30530c2e5188977a40336a360 Catalin(ux) M. BOIE 2009-08-25 20:37:55
Improved examples. 75439293c1d067327e606d72ec6290b43110bf24 Catalin(ux) M. BOIE 2009-08-25 20:37:29
Removed line1.c because duplicates code. 1119059afacde8d0b7b7dab77850dd6b71684190 Catalin(ux) M. BOIE 2009-08-25 20:11:52
Removed *.run becasue we have a generic run script. 007083cd9d1abefe4dd73e65c9026a2607fbcd4e Catalin(ux) M. BOIE 2009-08-25 20:09:00
Removed bind_s example because blackhole_s will take place. b9b06d98f00413b5a5df9d7bc9b3bd05b5536f28 Catalin(ux) M. BOIE 2009-08-25 20:07:38
Added Conn_set_address helper. 1b6e7e8a294ac88aa966e4e43bb77a4fdff0ca5a Catalin(ux) M. BOIE 2009-08-25 19:21:00
Fixed storing of local address (do not overwrite remote address). d431edba6699d1363e4d616aa6f96588272188b0 Catalin(ux) M. BOIE 2009-08-25 18:37:55
Added Conn_stop to eleganly stop Conn system. 4ca191771c5c119e9755a5af3158fabe43ddf5f2 Catalin(ux) M. BOIE 2009-08-25 18:30:32
Replaced Conn_protocol with Conn_get_socket_protocol. a1cbc5c612d82e6d1341524c67fe249648c81806 Catalin(ux) M. BOIE 2009-08-25 18:16:45
Compressed a little the POLL flags. 47b5dce395694c18c973e3ce6ba9a71c690a41bc Catalin(ux) M. BOIE 2009-08-25 18:16:16
Store also local address for incoming connections. 0548ce6434185cdd36e110c61315b4cb21849666 Catalin(ux) M. BOIE 2009-08-25 18:15:46
Added possibility to shutdown blackhole_s server by typing 'quit'. 5fd60900809e1a2d7554aa7fa93ce83b29214de0 Catalin(ux) M. BOIE 2009-08-25 17:54:27
Cosmetic changes. 7099dd49a270b9f4ecc0cb2e55254bef671202e5 Catalin(ux) M. BOIE 2009-08-25 17:54:15
Improved status output. 1ff597059bbb208b56ad18bf8324fae5b63950a2 Catalin(ux) M. BOIE 2009-08-25 17:53:44
Conn_type_* becomes CONN_TYPE_*. b284a20cc5430042cc662edc4d121c7f18cb3569 Catalin(ux) M. BOIE 2009-08-25 17:52:51
Improved status logging. 54fea00d8f16127244fd15b209c24f606adb20b3 Catalin(ux) M. BOIE 2009-08-25 17:33:14
Added Conn_strcasestr for case insensitive search in buffer. ca14b37b2a1f23887ad12fed729a3dd0ff253443 Catalin(ux) M. BOIE 2009-08-24 17:18:24
Improved ntime example. b63de9b82ffab1c0d759571a40f1d72f9b8df927 Catalin(ux) M. BOIE 2009-08-24 17:09:21
Removed unused includes. 8af81a4c311caa7d738000a5208d01d7620d1040 Catalin(ux) M. BOIE 2009-08-21 18:57:33
Commit af960f317b8ca9a8f78fe44e80ddbdb6a9483e6f - Added Conn_sys that logs some system variables related to network perf.
Signed-off-by: Catalin(ux) M. BOIE <catab@embedromix.ro>
Author: Catalin(ux) M. BOIE
Author date (UTC): 2009-08-31 16:36
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2009-09-02 15:42
Parent(s): d57a98c2b158aeb30530c2e5188977a40336a360
Signing key:
Tree: 1bc65ec82c08c9f283764a85a430ea6b7b9e63a1
File Lines added Lines deleted
Conn.c 57 0
Conn.h 1 0
File Conn.c changed (mode: 100644) (index 38cc411..5906f34)
... ... int Conn_engine_set(const unsigned int engine)
102 102 return 0; return 0;
103 103 } }
104 104
105 /*
106 * Reads a value from proc
107 */
108 static void Conn_read_proc(char *buf, const size_t buf_size, const char *file)
109 {
110 int fd;
111 ssize_t n;
112
113 fd = open(file, O_RDONLY);
114 if (fd == -1) {
115 snprintf(buf, buf_size, "ERROR_OPEN!");
116 return;
117 }
118
119 n = read(fd, buf, buf_size - 1);
120 if (n == -1) {
121 snprintf(buf, buf_size, "ERROR_READ!");
122 } else if (n == 0) {
123 strcpy(buf, "");
124 } else {
125 buf[n - 1] = '\0';
126 n--;
127
128 while ((n >= 0) && (buf[n - 1] == '\n')) {
129 buf[n - 1] = '\0';
130 n--;
131 }
132 }
133
134 close(fd);
135 }
136
137 /*
138 * Returns some important system values
139 */
140 char *Conn_sys(void)
141 {
142 static char ret[512];
143 char somaxconn[16];
144 char tcp_max_tw_buckets[16];
145 char tcp_fin_timeout[16];
146
147 Conn_read_proc(somaxconn, sizeof(somaxconn),
148 "/proc/sys/net/core/somaxconn");
149 Conn_read_proc(tcp_max_tw_buckets, sizeof(tcp_max_tw_buckets),
150 "/proc/sys/net/ipv4/tcp_max_tw_buckets");
151 Conn_read_proc(tcp_fin_timeout, sizeof(tcp_fin_timeout),
152 "/proc/sys/net/ipv4/tcp_fin_timeout");
153
154 snprintf(ret, sizeof(ret), "net.core.somaxconn=%s"
155 " net.ipv4.tcp_max_tw_buckets=%s"
156 " net.ipv4.tcp_fin_timeout=%s",
157 somaxconn, tcp_max_tw_buckets, tcp_fin_timeout);
158
159 return ret;
160 }
161
105 162 int Conn_init(const unsigned int max) int Conn_init(const unsigned int max)
106 163 { {
107 164 unsigned int ret; unsigned int ret;
File Conn.h changed (mode: 100644) (index 8fa0f67..3e0391d)
... ... extern int Conn_band(struct Conn *C, const unsigned int width,
27 27 const unsigned int factor); const unsigned int factor);
28 28 extern struct Conn *Conn_alloc(void); extern struct Conn *Conn_alloc(void);
29 29 extern int Conn_commit(struct Conn *C); extern int Conn_commit(struct Conn *C);
30 extern char *Conn_sys(void);
30 31
31 32 #endif #endif
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