Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump/net/lib/libsockin rename rumpcomp_user.* -> sockin_...
details: https://anonhg.NetBSD.org/src/rev/df412ab1a93e
branches: trunk
changeset: 327618:df412ab1a93e
user: pooka <pooka%NetBSD.org@localhost>
date: Thu Mar 13 01:40:30 2014 +0000
description:
rename rumpcomp_user.* -> sockin_user.*
diffstat:
sys/rump/net/lib/libsockin/Makefile | 4 +-
sys/rump/net/lib/libsockin/rumpcomp_user.c | 587 -----------------------------
sys/rump/net/lib/libsockin/rumpcomp_user.h | 43 --
sys/rump/net/lib/libsockin/sockin.c | 6 +-
sys/rump/net/lib/libsockin/sockin_user.c | 587 +++++++++++++++++++++++++++++
sys/rump/net/lib/libsockin/sockin_user.h | 43 ++
6 files changed, 635 insertions(+), 635 deletions(-)
diffs (truncated from 1321 to 300 lines):
diff -r d5c097a72789 -r df412ab1a93e sys/rump/net/lib/libsockin/Makefile
--- a/sys/rump/net/lib/libsockin/Makefile Thu Mar 13 01:38:11 2014 +0000
+++ b/sys/rump/net/lib/libsockin/Makefile Thu Mar 13 01:40:30 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.6 2013/03/18 13:14:11 pooka Exp $
+# $NetBSD: Makefile,v 1.7 2014/03/13 01:40:30 pooka Exp $
#
LIB= rumpnet_sockin
@@ -8,7 +8,7 @@
CPPFLAGS+= -I${RUMPTOP}/librump/rumpkern
-RUMPCOMP_USER= #defined
+RUMPCOMP_USER_SRCS= sockin_user.c
.include <bsd.lib.mk>
.include <bsd.klinks.mk>
diff -r d5c097a72789 -r df412ab1a93e sys/rump/net/lib/libsockin/rumpcomp_user.c
--- a/sys/rump/net/lib/libsockin/rumpcomp_user.c Thu Mar 13 01:38:11 2014 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,587 +0,0 @@
-/* $NetBSD: rumpcomp_user.c,v 1.8 2013/07/04 09:58:28 pooka Exp $ */
-
-/*
- * Copyright (c) 2008 Antti Kantee. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* for struct msghdr content visibility */
-#define _XOPEN_SOURCE 4
-#define _XOPEN_SOURCE_EXTENDED 1
-
-#ifndef _KERNEL
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#include <errno.h>
-#include <poll.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-
-#include <rump/rumpuser_component.h>
-#include <rump/rumpdefs.h>
-
-#include "rumpcomp_user.h"
-
-#define seterror(_v_) if ((_v_) == -1) rv = errno; else rv = 0;
-
-#ifndef __arraycount
-#define __arraycount(a) (sizeof(a) / sizeof(*a))
-#endif
-
-#ifndef __UNCONST
-#define __UNCONST(a) ((void*)(const void*)a)
-#endif
-
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <netinet/udp.h>
-
-
-static int translate_so_sockopt(int);
-static int translate_ip_sockopt(int);
-static int translate_tcp_sockopt(int);
-static int translate_domain(int);
-
-#define translate(_a_) case RUMP_##_a_: return _a_
-static int
-translate_so_sockopt(int lopt)
-{
-
- switch (lopt) {
- translate(SO_DEBUG);
-#ifndef SO_REUSEPORT
- case RUMP_SO_REUSEPORT: return SO_REUSEADDR;
-#else
- translate(SO_REUSEPORT);
-#endif
- translate(SO_TYPE);
- translate(SO_ERROR);
- translate(SO_DONTROUTE);
- translate(SO_BROADCAST);
- translate(SO_SNDBUF);
- translate(SO_RCVBUF);
- translate(SO_KEEPALIVE);
- translate(SO_OOBINLINE);
- translate(SO_LINGER);
- default: return -1;
- }
-}
-
-static int
-translate_ip_sockopt(int lopt)
-{
-
- switch (lopt) {
- translate(IP_TOS);
- translate(IP_TTL);
- translate(IP_HDRINCL);
- translate(IP_MULTICAST_TTL);
- translate(IP_MULTICAST_LOOP);
- translate(IP_MULTICAST_IF);
- translate(IP_ADD_MEMBERSHIP);
- translate(IP_DROP_MEMBERSHIP);
- default: return -1;
- }
-}
-
-static int
-translate_tcp_sockopt(int lopt)
-{
-
- switch (lopt) {
- translate(TCP_NODELAY);
- translate(TCP_MAXSEG);
- default: return -1;
- }
-}
-
-static int
-translate_domain(int domain)
-{
-
- switch (domain) {
- translate(AF_INET);
- translate(AF_INET6);
- default: return AF_UNSPEC;
- }
-}
-
-#undef translate
-
-static void
-translate_sockopt(int *levelp, int *namep)
-{
- int level, name;
-
- level = *levelp;
- name = *namep;
-
- switch (level) {
- case RUMP_SOL_SOCKET:
- level = SOL_SOCKET;
- name = translate_so_sockopt(name);
- break;
- case RUMP_IPPROTO_IP:
-#ifdef SOL_IP
- level = SOL_IP;
-#else
- level = IPPROTO_IP;
-#endif
- name = translate_ip_sockopt(name);
- break;
- case RUMP_IPPROTO_TCP:
-#ifdef SOL_TCP
- level = SOL_TCP;
-#else
- level = IPPROTO_TCP;
-#endif
- name = translate_tcp_sockopt(name);
- break;
- case RUMP_IPPROTO_UDP:
-#ifdef SOL_UDP
- level = SOL_UDP;
-#else
- level = IPPROTO_UDP;
-#endif
- name = -1;
- break;
- default:
- level = -1;
- }
- *levelp = level;
- *namep = name;
-}
-
-#ifndef __NetBSD__
-static const struct {
- int bfl;
- int lfl;
-} bsd_to_native_msg_flags_[] = {
- {RUMP_MSG_OOB, MSG_OOB},
- {RUMP_MSG_PEEK, MSG_PEEK},
- {RUMP_MSG_DONTROUTE, MSG_DONTROUTE},
- {RUMP_MSG_EOR, MSG_EOR},
- {RUMP_MSG_TRUNC, MSG_TRUNC},
- {RUMP_MSG_CTRUNC, MSG_CTRUNC},
- {RUMP_MSG_WAITALL, MSG_WAITALL},
- {RUMP_MSG_DONTWAIT, MSG_DONTWAIT},
-
- /* might be better to always set NOSIGNAL ... */
-#ifdef MSG_NOSIGNAL
- {RUMP_MSG_NOSIGNAL, MSG_NOSIGNAL},
-#endif
-};
-
-static int native_to_bsd_msg_flags(int);
-
-static int
-native_to_bsd_msg_flags(int lflag)
-{
- unsigned int i;
- int bfl, lfl;
- int bflag = 0;
-
- if (lflag == 0)
- return (0);
-
- for(i = 0; i < __arraycount(bsd_to_native_msg_flags_); i++) {
- bfl = bsd_to_native_msg_flags_[i].bfl;
- lfl = bsd_to_native_msg_flags_[i].lfl;
-
- if (lflag & lfl) {
- lflag ^= lfl;
- bflag |= bfl;
- }
- }
- if (lflag != 0)
- return (-1);
-
- return (bflag);
-}
-
-static int
-bsd_to_native_msg_flags(int bflag)
-{
- unsigned int i;
- int lflag = 0;
-
- if (bflag == 0)
- return (0);
-
- for(i = 0; i < __arraycount(bsd_to_native_msg_flags_); i++) {
- if (bflag & bsd_to_native_msg_flags_[i].bfl)
- lflag |= bsd_to_native_msg_flags_[i].lfl;
- }
-
- return (lflag);
-}
-#endif
-
-struct rump_sockaddr {
- uint8_t sa_len; /* total length */
- uint8_t sa_family; /* address family */
- char sa_data[14]; /* actually longer; address value */
-};
-
-struct rump_msghdr {
- void *msg_name; /* optional address */
- uint32_t msg_namelen; /* size of address */
- struct iovec *msg_iov; /* scatter/gather array */
- int msg_iovlen; /* # elements in msg_iov */
- void *msg_control; /* ancillary data, see below */
- uint32_t msg_controllen; /* ancillary data buffer len */
- int msg_flags; /* flags on received message */
-};
-
-static struct sockaddr *translate_sockaddr(const struct sockaddr *,
- uint32_t);
-static void translate_sockaddr_back(const struct sockaddr *,
- struct rump_sockaddr *, uint32_t len);
-static struct msghdr *translate_msghdr(const struct rump_msghdr *, int *);
-static void translate_msghdr_back(const struct msghdr *, struct rump_msghdr *);
-
-#if defined(__NetBSD__)
-static struct sockaddr *
-translate_sockaddr(const struct sockaddr *addr, uint32_t len)
-{
-
- return (struct sockaddr *)__UNCONST(addr);
-}
-
-static void
-translate_sockaddr_back(const struct sockaddr *laddr,
- struct rump_sockaddr *baddr, uint32_t len)
-{
-
- return;
Home |
Main Index |
Thread Index |
Old Index