Beta-song's project - ksocket

Latest version: 0.0.2
What is ksocket
    Ksocket is a linux 2.6 kernel module that provides bsd-style socket interfaces (namely socket, bind, listen, connect, accept, ...) for kernel developers to facilitate their network progaramming in linux kernel space.
    The interfaces ksocket presents are much the same as their equivalent in glibc, so even new developers for kernel space will have no barrier in developing kernel network-related programms.
ksocket APIs
Ksocket provides the following interfaces for now:
  • ksocket_t ksocket(int domain, int type, int protocol)
  • int kshutdown(ksocket_t socket, int how)
  • int kclose(ksocket_t socket)
  • int kbind(ksocket_t socket, struct sockaddr *address, int address_len)
  • int klisten(ksocket_t socket, int backlog)
  • int kconnect(ksocket_t socket, struct sockaddr *address, int address_len)
  • ksocket_t kaccept(ksocket_t socket, struct sockaddr *address, int *address_len)
  • ssize_t krecv(ksocket_t socket, void *buffer, size_t length, int flags)
  • ssize_t ksend(ksocket_t socket, const void *buffer, size_t length, int flags)
  • ssize_t krecvfrom(ksocket_t socket, void * buffer, size_t length, int flags, struct sockaddr * address, int * address_len)
  • ssize_t ksendto(ksocket_t socket, void *message, size_t length, int flags, const struct sockaddr *dest_addr, int dest_len)
  • int kgetsockname(ksocket_t socket, struct sockaddr *address, int *address_len)
  • int kgetpeername(ksocket_t socket, struct sockaddr *address, int *address_len)
  • int ksetsockopt(ksocket_t socket, int level, int optname, void *optval, int optlen)
  • int kgetsockopt(ksocket_t socket, int level, int optname, void *optval, int *optlen)
Latest Release
Version 0.02 (2010-03-16)
  • add KSOCKET_ADDR_SAFE macro for speed consideration
  • add tcp client sample code
  • other minor changes
  • Click here to get ksocket
Contact Me
For questions or comments regarding to this module, please write to song.xian-guang at hotmail dot com, or visit my blog to leave me a message.
SourceForge Logo