chore
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
# Binaries for programs and plugins
|
||||
main
|
||||
netio
|
||||
make
|
||||
examples/*[^.v]
|
||||
*.exe
|
||||
*.exe~
|
||||
*.so
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
|
||||
`netio` is a flexible networking library for V programming language.
|
||||
|
||||
Differences with the V standard library `net` module:
|
||||
Features:
|
||||
|
||||
* Provides the low-level wrappers around C API.
|
||||
* Provides the low-level wrappers around C sockets API.
|
||||
* Supports any kind of sockets, socket options, address families and protocols.
|
||||
|
||||
The `netio.protocol` submodule provides access to the operatins system protocols database.
|
||||
* Working with network interfaces (limited for now).
|
||||
* The `netio.protocol` submodule provides access to the operatins system protocols database.
|
||||
|
||||
`netio` is tested only on Linux, but should work on all POSIX-compliant operating systems.
|
||||
Microfost Windows support is not planned yet.
|
||||
Microsoft Windows support is not planned yet.
|
||||
|
||||
See examples/ dir in source code repository for usage examples.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env -S v run
|
||||
#!/usr/bin/env v
|
||||
|
||||
import os
|
||||
import rand
|
||||
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
program_linux='
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
'
|
||||
|
||||
program_freebsd='
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
'
|
||||
|
||||
system=$(uname -s)
|
||||
|
||||
case $system in
|
||||
Linux) PROGRAM=$program_linux;;
|
||||
FreeBSD) PROGRAM=$program_freebsd;;
|
||||
*) echo $0: $system is unsupported >&2; exit 1;;
|
||||
esac
|
||||
|
||||
KIND=$1
|
||||
KIND=${KIND:-"SocketType,SocketLevel,SocketOption,AddrFamily,AddrInfoFlag,NameInfoFlag,MsgFlag"}
|
||||
|
||||
echo module netio
|
||||
echo
|
||||
echo '/*'
|
||||
echo -e "\tThis file is generated by mkconst.sh, DO NOT EDIT."
|
||||
echo '*/'
|
||||
echo
|
||||
|
||||
echo "$PROGRAM" | ${CC:-"cc"} -x c - -E -dM ${CFLAGS:-""} |
|
||||
awk -v KIND=$KIND '
|
||||
$1 != "#define" || $2 ~ /\(/ || $3 == "" {next}
|
||||
$2 ~ /^_/ {next}
|
||||
$2 ~ /^[a-z]/ {next}
|
||||
$2 ~ /^SOCK_/ && KIND ~ "SocketType" {printf "pub const %s = SocketType(C.%s)\n", tolower($2), $2}
|
||||
$2 ~ /^(SOL|IPPROTO)_/ && KIND ~ "SocketLevel" {printf "pub const %s = SocketLevel(C.%s)\n", tolower($2), $2}
|
||||
$2 ~ /^(SO|IP|IPV6)_/ && KIND ~ "SocketOption" {printf "pub const %s = SocketOption(C.%s)\n", tolower($2), $2}
|
||||
$2 ~ /^AF_/ && KIND ~ "AddrFamily" {printf "pub const %s = AddrFamily(C.%s)\n", tolower($2), $2}
|
||||
$2 ~ /^AI_/ && KIND ~ "AddrInfoFlag" {printf "pub const %s = AddrInfoFlag(C.%s)\n", tolower($2), $2}
|
||||
$2 ~ /^NI_/ && KIND ~ "NameInfoFlag" {printf "pub const %s = NameInfoFlag(C.%s)\n", tolower($2), $2}
|
||||
$2 ~ /^MSG_/ && KIND ~ "MsgFlag" {printf "pub const %s = MsgFlag(C.%s)\n", tolower($2), $2}
|
||||
KIND ~ "Any" {printf "%s\n", $0}
|
||||
{next}' | sort -k 2 -V
|
||||
Reference in New Issue
Block a user