Added build timestamps for logging

This commit is contained in:
Joseph Henry
2017-09-21 23:20:06 -07:00
parent 82aff7ebb4
commit 83b641dd77
5 changed files with 88 additions and 87 deletions

View File

@@ -133,7 +133,7 @@ endif
# Build with address sanitization library for advanced debugging (clang) # Build with address sanitization library for advanced debugging (clang)
# TODO: Add GCC version as well # TODO: Add GCC version as well
ifeq ($(LIBZT_SANITIZE),1) ifeq ($(LIBZT_SANITIZE),1)
SANFLAGS+=-x c++ -O -g -fsanitize=address -DASAN_OPTIONS=symbolize=1 \ SANFLAGS+=-x c++ -g -fsanitize=address -DASAN_OPTIONS=symbolize=1 \
-DASAN_SYMBOLIZER_PATH=$(shell which llvm-symbolizer) -DASAN_SYMBOLIZER_PATH=$(shell which llvm-symbolizer)
endif endif
@@ -254,6 +254,7 @@ static_lib: picotcp $(ZTO_OBJS)
mv ext/picotcp/build/lib/*.o obj mv ext/picotcp/build/lib/*.o obj
mv ext/picotcp/build/modules/*.o obj mv ext/picotcp/build/modules/*.o obj
$(ARTOOL) $(ARFLAGS) -o $(STATIC_LIB) obj/*.o $(ARTOOL) $(ARFLAGS) -o $(STATIC_LIB) obj/*.o
@date +"Build script finished on %F %T"
endif endif
ifeq ($(STACK_LWIP),1) ifeq ($(STACK_LWIP),1)
static_lib: lwip $(ZTO_OBJS) static_lib: lwip $(ZTO_OBJS)
@@ -263,6 +264,7 @@ static_lib: lwip $(ZTO_OBJS)
$(STACK_DRIVER_FILES) -c $(STACK_DRIVER_FILES) -c
mv *.o obj mv *.o obj
$(ARTOOL) $(ARFLAGS) -o $(STATIC_LIB) $(STACK_LIB) obj/*.o $(ARTOOL) $(ARFLAGS) -o $(STATIC_LIB) $(STACK_LIB) obj/*.o
@date +"Build script finished on %F %T"
endif endif
# for layer-2 only (this will omit all userspace network stack code) # for layer-2 only (this will omit all userspace network stack code)
ifeq ($(NO_STACK),1) ifeq ($(NO_STACK),1)
@@ -271,6 +273,7 @@ static_lib: $(ZTO_OBJS)
$(CXX) $(CXXFLAGS) $(ZT_FLAGS) $(ZT_INCLUDES) $(LIBZT_FLAGS) $(LIBZT_INCLUDES) $(LIBZT_FILES) -c $(CXX) $(CXXFLAGS) $(ZT_FLAGS) $(ZT_INCLUDES) $(LIBZT_FLAGS) $(LIBZT_INCLUDES) $(LIBZT_FILES) -c
mv *.o obj mv *.o obj
$(ARTOOL) $(ARFLAGS) -o $(STATIC_LIB) obj/*.o $(ARTOOL) $(ARFLAGS) -o $(STATIC_LIB) obj/*.o
@date +"Build script finished on %F %T"
endif endif
############################################################################## ##############################################################################
@@ -319,19 +322,23 @@ selftest:
$(SANFLAGS) $(LIBZT_INCLUDES) $(ZT_INCLUDES) $(ZT_UTILS) test/selftest.cpp -o \ $(SANFLAGS) $(LIBZT_INCLUDES) $(ZT_INCLUDES) $(ZT_UTILS) test/selftest.cpp -o \
$(BUILD)/selftest -L$(BUILD) -lzt -lpthread $(BUILD)/selftest -L$(BUILD) -lzt -lpthread
@./check.sh $(BUILD)/selftest @./check.sh $(BUILD)/selftest
@date +"Build script finished on %F %T"
nativetest: nativetest:
$(CXX) $(CXXFLAGS) -D__NATIVETEST__ $(STACK_DRIVER_FLAGS) $(SANFLAGS) \ $(CXX) $(CXXFLAGS) -D__NATIVETEST__ $(STACK_DRIVER_FLAGS) $(SANFLAGS) \
$(LIBZT_INCLUDES) $(ZT_INCLUDES) test/selftest.cpp -o $(BUILD)/nativetest $(LIBZT_INCLUDES) $(ZT_INCLUDES) test/selftest.cpp -o $(BUILD)/nativetest
@./check.sh $(BUILD)/nativetest @./check.sh $(BUILD)/nativetest
@date +"Build script finished on %F %T"
ztproxy: ztproxy:
$(CXX) $(CXXFLAGS) $(SANFLAGS) $(LIBZT_INCLUDES) $(ZT_INCLUDES) \ $(CXX) $(CXXFLAGS) $(SANFLAGS) $(LIBZT_INCLUDES) $(ZT_INCLUDES) \
examples/ztproxy/ztproxy.cpp -o $(BUILD)/ztproxy $< -L$(BUILD) -lzt examples/ztproxy/ztproxy.cpp -o $(BUILD)/ztproxy $< -L$(BUILD) -lzt
@./check.sh $(BUILD)/ztproxy @./check.sh $(BUILD)/ztproxy
@date +"Build script finished on %F %T"
intercept: intercept:
$(CXX) $(CXXFLAGS) $(SANFLAGS) $(STACK_DRIVER_FLAGS) $(LIBZT_INCLUDES) \ $(CXX) $(CXXFLAGS) $(SANFLAGS) $(STACK_DRIVER_FLAGS) $(LIBZT_INCLUDES) \
$(ZT_INCLUDES) examples/intercept/intercept.cpp -D_GNU_SOURCE \ $(ZT_INCLUDES) examples/intercept/intercept.cpp -D_GNU_SOURCE \
-shared -o $(BUILD)/intercept.so $< -ldl -shared -o $(BUILD)/intercept.so $< -ldl
@./check.sh $(BUILD)/intercept.so @./check.sh $(BUILD)/intercept.so
@date +"Build script finished on %F %T"
############################################################################## ##############################################################################
## Misc ## ## Misc ##
@@ -350,3 +357,5 @@ clean:
-find . -type f \( -name '*.a' -o -name '*.o' -o -name '*.so' -o -name \ -find . -type f \( -name '*.a' -o -name '*.o' -o -name '*.so' -o -name \
'*.o.d' -o -name '*.out' -o -name '*.log' -o -name '*.dSYM' \) -delete '*.o.d' -o -name '*.out' -o -name '*.log' -o -name '*.dSYM' \) -delete
time:
@date +"Build script finished on %F %T"

View File

@@ -542,36 +542,34 @@ ssize_t zts_recvmsg(ZT_RECVMSG_SIG);
/** /**
* Read bytes from socket onto buffer * Read bytes from socket onto buffer
* - Note, this function isn't strictly necessary, you can * - Note, this function isn't strictly necessary, you can use a regular read()
* use a regular read() call as long as the socket fd was * call as long as the socket file descriptor was created via a zts_socket() call.
* created via a zts_socket() call.
*/ */
int zts_read(ZT_READ_SIG); int zts_read(ZT_READ_SIG);
/** /**
* Write bytes from buffer to socket * Write bytes from buffer to socket
* - Note, this function isn't strictly necessary, you can * - Note, this function isn't strictly necessary, you can use a regular write()
* use a regular write() call as long as the socket fd was * call as long as the socket file descriptor was created via a zts_socket() call.
* created via a zts_socket() call.
*/ */
int zts_write(ZT_WRITE_SIG); int zts_write(ZT_WRITE_SIG);
/* /**
* Sends a FIN segment * Sends a FIN segment
*/ */
int zts_shutdown(ZT_SHUTDOWN_SIG); int zts_shutdown(ZT_SHUTDOWN_SIG);
/* /**
* Returns a vector of network routes { target, via, metric, etc... } * Returns a vector of network routes { target, via, metric, etc... }
*/ */
std::vector<ZT_VirtualNetworkRoute> *zts_get_network_routes(char *nwid); std::vector<ZT_VirtualNetworkRoute> *zts_get_network_routes(char *nwid);
/* /**
* Adds a DNS nameserver for the network stack to use * Adds a DNS nameserver for the network stack to use
*/ */
int zts_add_dns_nameserver(struct sockaddr *addr); int zts_add_dns_nameserver(struct sockaddr *addr);
/* /**
* Removes a DNS nameserver * Removes a DNS nameserver
*/ */
int zts_del_dns_nameserver(struct sockaddr *addr); int zts_del_dns_nameserver(struct sockaddr *addr);
@@ -593,7 +591,7 @@ namespace ZeroTier
struct InetAddress; struct InetAddress;
} }
/* /**
* Whether we can add a new socket or not. Depends on stack in use * Whether we can add a new socket or not. Depends on stack in use
*/ */
bool can_provision_new_socket(int socket_type); bool can_provision_new_socket(int socket_type);
@@ -607,7 +605,7 @@ bool can_provision_new_socket(int socket_type);
*/ */
int zts_num_active_virt_sockets(); int zts_num_active_virt_sockets();
/* /**
* Returns maximum number of sockets allowed by network stack * Returns maximum number of sockets allowed by network stack
*/ */
int zts_maxsockets(int socket_type); int zts_maxsockets(int socket_type);
@@ -624,46 +622,47 @@ ZeroTier::VirtualTap *getTapByName(char *ifname);
ZeroTier::VirtualTap *getTapByIndex(int index); ZeroTier::VirtualTap *getTapByIndex(int index);
ZeroTier::VirtualTap *getAnyTap(); ZeroTier::VirtualTap *getAnyTap();
/* /**
* Returns a pointer to a VirtualSocket for a given fd * Returns a pointer to a VirtualSocket for a given file descriptor
*/ */
ZeroTier::VirtualSocket *get_virt_socket(int fd); ZeroTier::VirtualSocket *get_virt_socket(int fd);
/* /**
* Removes a VirtualSocket * Removes a VirtualSocket
*/ */
int del_virt_socket(int fd); int del_virt_socket(int fd);
/* /**
* Adds a virtualSocket * Adds a virtualSocket
*/ */
int add_unassigned_virt_socket(int fd, ZeroTier::VirtualSocket *vs); int add_unassigned_virt_socket(int fd, ZeroTier::VirtualSocket *vs);
/*
/**
* Removes unassigned VirtualSocket * Removes unassigned VirtualSocket
*/ */
int del_unassigned_virt_socket(int fd); int del_unassigned_virt_socket(int fd);
/* /**
* Adds an assigned VirtualSocket * Adds an assigned VirtualSocket
*/ */
int add_assigned_virt_socket(ZeroTier::VirtualTap *tap, ZeroTier::VirtualSocket *vs, int fd); int add_assigned_virt_socket(ZeroTier::VirtualTap *tap, ZeroTier::VirtualSocket *vs, int fd);
/* /**
* Removes an assigned VirtualSocket * Removes an assigned VirtualSocket
*/ */
int del_assigned_virt_socket(ZeroTier::VirtualTap *tap, ZeroTier::VirtualSocket *vs, int fd); int del_assigned_virt_socket(ZeroTier::VirtualTap *tap, ZeroTier::VirtualSocket *vs, int fd);
/* /**
* Gets a pair of associated virtual objects (VirtualSocket bound to a VirtualTap) * Gets a pair of associated virtual objects (VirtualSocket bound to a VirtualTap)
*/ */
std::pair<ZeroTier::VirtualSocket*, ZeroTier::VirtualTap*> *get_assigned_virtual_pair(int fd); std::pair<ZeroTier::VirtualSocket*, ZeroTier::VirtualTap*> *get_assigned_virtual_pair(int fd);
/* /**
* Disable all virtual tap devices * Disable all virtual tap devices
*/ */
void disableTaps(); void disableTaps();
/* /**
* Get device ID (from file) * Get device ID (from file)
*/ */
int zts_get_device_id_from_file(const char *filepath, char *devID); int zts_get_device_id_from_file(const char *filepath, char *devID);
@@ -673,8 +672,8 @@ int zts_get_device_id_from_file(const char *filepath, char *devID);
*/ */
void *zts_start_service(void *thread_id); void *zts_start_service(void *thread_id);
/* /**
* * Should be called wherever libzt enters a condition where undefined behaviour might occur
*/ */
void handle_general_failure(); void handle_general_failure();

View File

@@ -27,23 +27,23 @@
#ifndef UTILITIES_HPP #ifndef UTILITIES_HPP
#define UTILITIES_HPP #define UTILITIES_HPP
/* /**
* Returns masked address for subnet comparisons * Returns masked address for subnet comparisons
*/ */
//ZeroTier::InetAddress *ztipv6_mask(ZeroTier::InetAddress *addr, unsigned int bits); //ZeroTier::InetAddress *ztipv6_mask(ZeroTier::InetAddress *addr, unsigned int bits);
bool ipv6_in_subnet(ZeroTier::InetAddress *subnet, ZeroTier::InetAddress *addr); bool ipv6_in_subnet(ZeroTier::InetAddress *subnet, ZeroTier::InetAddress *addr);
/* /**
* Convert protocol numbers to human-readable strings * Convert protocol numbers to human-readable strings
*/ */
char *beautify_eth_proto_nums(int proto); char *beautify_eth_proto_nums(int proto);
/* /**
* Convert a struct sockaddr to a ZeroTier::InetAddress * Convert a struct sockaddr to a ZeroTier::InetAddress
*/ */
void sockaddr2inet(int socket_family, const struct sockaddr *addr, ZeroTier::InetAddress *inet); void sockaddr2inet(int socket_family, const struct sockaddr *addr, ZeroTier::InetAddress *inet);
/* /**
* Convert a raw MAC address byte array into a human-readable string * Convert a raw MAC address byte array into a human-readable string
*/ */
void mac2str(char *macbuf, int len, unsigned char* addr); void mac2str(char *macbuf, int len, unsigned char* addr);
@@ -54,7 +54,7 @@ void mac2str(char *macbuf, int len, unsigned char* addr);
(ipaddr)->addr[2] = ZeroTier::Utils::hton(((e & 0xffff) << 16) | (f & 0xffff)); \ (ipaddr)->addr[2] = ZeroTier::Utils::hton(((e & 0xffff) << 16) | (f & 0xffff)); \
(ipaddr)->addr[3] = ZeroTier::Utils::hton(((g & 0xffff) << 16) | (h & 0xffff)); } while(0) (ipaddr)->addr[3] = ZeroTier::Utils::hton(((g & 0xffff) << 16) | (h & 0xffff)); } while(0)
/* /**
* Convert from standard IPV6 address structure to an lwIP native structure * Convert from standard IPV6 address structure to an lwIP native structure
*/ */
inline void in6_to_ip6(ip6_addr_t *ba, struct sockaddr_in6 *in6) inline void in6_to_ip6(ip6_addr_t *ba, struct sockaddr_in6 *in6)

View File

@@ -56,12 +56,10 @@ namespace ZeroTier {
class VirtualTap; class VirtualTap;
/* /**
* Something analogous to a socket. This is a common object used by the * An abstraction of a socket that operates between the application-exposed platform-sockets
* libzt API, VirtualTap, and the userspace network stack driver implementations. * and the network stack's representation of a protocol control block. This object is used by
* In some situations the word 'Connection' would capture the meaning and * the POSIX socket emulation layer and stack drivers.
* function of this object, however I'd like to discourage this since this
* object also handles non-connection-based traffic as well.
*/ */
class VirtualSocket class VirtualSocket
{ {
@@ -74,6 +72,9 @@ namespace ZeroTier {
PhySocket *sock = NULL; PhySocket *sock = NULL;
// State control // State control
/**
* Sets the VirtualSocket's state value
*/
void set_state(int state) { void set_state(int state) {
// states may be set by application or by stack callbacks, thus this must be guarded // states may be set by application or by stack callbacks, thus this must be guarded
_op_m.lock(); _op_m.lock();
@@ -81,11 +82,13 @@ namespace ZeroTier {
//DEBUG_EXTRA("SET STATE = %d (vs=%p)", _state, this); //DEBUG_EXTRA("SET STATE = %d (vs=%p)", _state, this);
_op_m.unlock(); _op_m.unlock();
} }
/**
* Gets the VirtualSocket's state value
*/
int get_state() { int get_state() {
//DEBUG_EXTRA("GET STATE = %d (vs=%p)", _state, this); //DEBUG_EXTRA("GET STATE = %d (vs=%p)", _state, this);
return _state; return _state;
} }
#if defined(STACK_PICO) #if defined(STACK_PICO)
struct pico_socket *picosock = NULL; struct pico_socket *picosock = NULL;
#endif #endif
@@ -93,13 +96,13 @@ namespace ZeroTier {
void *pcb = NULL; // Protocol Control Block void *pcb = NULL; // Protocol Control Block
/* /*
- TCP_WRITE_FLAG_COPY: indicates whether the new memory should be allocated - TCP_WRITE_FLAG_COPY: indicates whether the new memory should be allocated
for the data to be copied into. If this flag is not given, no new memory for the data to be copied into. If this flag is not given, no new memory
should be allocated and the data should only be referenced by pointer. This should be allocated and the data should only be referenced by pointer. This
also means that the memory behind dataptr must not change until the data is also means that the memory behind dataptr must not change until the data is
ACKed by the remote host ACKed by the remote host
- TCP_WRITE_FLAG_MORE: indicates that more data follows. If this is omitted, - TCP_WRITE_FLAG_MORE: indicates that more data follows. If this is omitted,
the PSH flag is set in the last segment created by this call to tcp_write. the PSH flag is set in the last segment created by this call to tcp_write.
If this flag is given, the PSH flag is not set. If this flag is given, the PSH flag is not set.
*/ */
// copy as default, processed via pointer reference if set to 0. See notes in lwip_cb_sent() and lwip_Write() // copy as default, processed via pointer reference if set to 0. See notes in lwip_cb_sent() and lwip_Write()
int8_t copymode = TCP_WRITE_FLAG_COPY; int8_t copymode = TCP_WRITE_FLAG_COPY;
@@ -154,7 +157,7 @@ namespace ZeroTier {
} }
}; };
/* /**
* A helper object for passing VirtualTap(s) and VirtualSocket(s) through the stack * A helper object for passing VirtualTap(s) and VirtualSocket(s) through the stack
*/ */
struct VirtualBindingPair struct VirtualBindingPair

View File

@@ -65,8 +65,8 @@ struct netif;
namespace ZeroTier { namespace ZeroTier {
/* /**
* Socket Tap -- emulates an Ethernet tap device * emulates an Ethernet tap device
*/ */
class VirtualTap class VirtualTap
{ {
@@ -88,96 +88,96 @@ namespace ZeroTier {
void setEnabled(bool en); void setEnabled(bool en);
bool enabled() const; bool enabled() const;
/* /**
* Registers a device with the given address * Registers a device with the given address
*/ */
bool registerIpWithStack(const InetAddress &ip); bool registerIpWithStack(const InetAddress &ip);
/* /**
* Adds an address to the userspace stack interface associated with this VirtualTap * Adds an address to the userspace stack interface associated with this VirtualTap
* - Starts VirtualTap main thread ONLY if successful * - Starts VirtualTap main thread ONLY if successful
*/ */
bool addIp(const InetAddress &ip); bool addIp(const InetAddress &ip);
/* /**
* Removes an address from the userspace stack interface associated with this VirtualTap * Removes an address from the userspace stack interface associated with this VirtualTap
*/ */
bool removeIp(const InetAddress &ip); bool removeIp(const InetAddress &ip);
/* /**
* Presents data to the userspace stack * Presents data to the userspace stack
*/ */
void put(const MAC &from,const MAC &to,unsigned int etherType,const void *data, void put(const MAC &from,const MAC &to,unsigned int etherType,const void *data,
unsigned int len); unsigned int len);
/* /**
* Get VirtualTap device name (e.g. 'libzt4-17d72843bc2c5760') * Get VirtualTap device name (e.g. 'libzt4-17d72843bc2c5760')
*/ */
std::string deviceName() const; std::string deviceName() const;
/* /**
* Get Node ID (ZT address) * Get Node ID (ZT address)
*/ */
std::string nodeId() const; std::string nodeId() const;
/* /**
* Set friendly name * Set friendly name
*/ */
void setFriendlyName(const char *friendlyName); void setFriendlyName(const char *friendlyName);
/* /**
* Scan multicast groups * Scan multicast groups
*/ */
void scanMulticastGroups(std::vector<MulticastGroup> &added,std::vector<MulticastGroup> &removed); void scanMulticastGroups(std::vector<MulticastGroup> &added,std::vector<MulticastGroup> &removed);
/* /**
* Set MTU * Set MTU
*/ */
void setMtu(unsigned int mtu); void setMtu(unsigned int mtu);
/* /**
* Calls main network stack loops * Calls main network stack loops
*/ */
void threadMain() void threadMain()
throw(); throw();
/* /**
* For moving data onto the ZeroTier virtual wire * For moving data onto the ZeroTier virtual wire
*/ */
void (*_handler)(void *, void *, uint64_t, const MAC &, const MAC &, unsigned int, unsigned int, void (*_handler)(void *, void *, uint64_t, const MAC &, const MAC &, unsigned int, unsigned int,
const void *, unsigned int); const void *, unsigned int);
/* /**
* Signals us to close the TcpVirtualSocket associated with this PhySocket * Signals us to close the TcpVirtualSocket associated with this PhySocket
*/ */
void phyOnUnixClose(PhySocket *sock, void **uptr); void phyOnUnixClose(PhySocket *sock, void **uptr);
/* /**
* Notifies us that there is data to be read from an application's socket * Notifies us that there is data to be read from an application's socket
*/ */
void phyOnUnixData(PhySocket *sock, void **uptr, void *data, ssize_t len); void phyOnUnixData(PhySocket *sock, void **uptr, void *data, ssize_t len);
/* /**
* Notifies us that we can write to an application's socket * Notifies us that we can write to an application's socket
*/ */
void phyOnUnixWritable(PhySocket *sock, void **uptr, bool stack_invoked); void phyOnUnixWritable(PhySocket *sock, void **uptr, bool stack_invoked);
/* /**
* Adds a route to the virtual tap * Adds a route to the virtual tap
*/ */
bool routeAdd(const InetAddress &addr, const InetAddress &nm, const InetAddress &gw); bool routeAdd(const InetAddress &addr, const InetAddress &nm, const InetAddress &gw);
/* /**
* Deletes a route from the virtual tap * Deletes a route from the virtual tap
*/ */
bool routeDelete(const InetAddress &addr, const InetAddress &nm); bool routeDelete(const InetAddress &addr, const InetAddress &nm);
/* /**
* Assign a VirtualSocket to the VirtualTap * Assign a VirtualSocket to the VirtualTap
*/ */
void addVirtualSocket(VirtualSocket *vs); void addVirtualSocket(VirtualSocket *vs);
/* /**
* Remove a VirtualSocket from the VirtualTap * Remove a VirtualSocket from the VirtualTap
*/ */
void removeVirtualSocket(VirtualSocket *vs); void removeVirtualSocket(VirtualSocket *vs);
@@ -186,12 +186,12 @@ namespace ZeroTier {
/* DNS */ /* DNS */
/****************************************************************************/ /****************************************************************************/
/* /**
* Registers a DNS nameserver with the network stack * Registers a DNS nameserver with the network stack
*/ */
int add_DNS_Nameserver(struct sockaddr *addr); int add_DNS_Nameserver(struct sockaddr *addr);
/* /**
* Un-registers a DNS nameserver from the network stack * Un-registers a DNS nameserver from the network stack
*/ */
int del_DNS_Nameserver(struct sockaddr *addr); int del_DNS_Nameserver(struct sockaddr *addr);
@@ -258,66 +258,56 @@ namespace ZeroTier {
/* where one would put logic to select between different stacks */ /* where one would put logic to select between different stacks */
/****************************************************************************/ /****************************************************************************/
/* /**
* Connect to a remote host via the userspace stack interface associated with this VirtualTap * Connect to a remote host via the userspace stack interface associated with this VirtualTap
*/ */
int Connect(VirtualSocket *vs, const struct sockaddr *addr, socklen_t addrlen); int Connect(VirtualSocket *vs, const struct sockaddr *addr, socklen_t addrlen);
/* /**
* Bind to the userspace stack interface associated with this VirtualTap * Bind to the userspace stack interface associated with this VirtualTap
*/ */
int Bind(VirtualSocket *vs, const struct sockaddr *addr, socklen_t addrlen); int Bind(VirtualSocket *vs, const struct sockaddr *addr, socklen_t addrlen);
/* /**
* Listen for a VirtualSocket * Listen for a VirtualSocket
*/ */
int Listen(VirtualSocket *vs, int backlog); int Listen(VirtualSocket *vs, int backlog);
/* /**
* Accepts an incoming VirtualSocket * Accepts an incoming VirtualSocket
*/ */
VirtualSocket* Accept(VirtualSocket *vs); VirtualSocket* Accept(VirtualSocket *vs);
/* /**
* Move data from RX buffer to application's "socket" * Move data from RX buffer to application's "socket"
*/ */
int Read(PhySocket *sock,void **uptr,bool stack_invoked); int Read(PhySocket *sock,void **uptr,bool stack_invoked);
/* /**
* Move data from application's "socket" into network stack * Move data from application's "socket" into network stack
*/ */
int Write(VirtualSocket *vs, void *data, ssize_t len); int Write(VirtualSocket *vs, void *data, ssize_t len);
/* /**
* Send data to specified host * Send data to specified host
*/ */
int SendTo(VirtualSocket *vs, const void *buf, size_t len, int flags, const struct sockaddr *addr, socklen_t addrlen); int SendTo(VirtualSocket *vs, const void *buf, size_t len, int flags, const struct sockaddr *addr, socklen_t addrlen);
/* /**
* Closes a VirtualSocket * Closes a VirtualSocket
*/ */
int Close(VirtualSocket *vs); int Close(VirtualSocket *vs);
/* /**
* Shuts down some aspect of a VirtualSocket * Shuts down some aspect of a VirtualSocket
*/ */
int Shutdown(VirtualSocket *vs, int how); int Shutdown(VirtualSocket *vs, int how);
/* /**
* Disposes of previously-closed VirtualSockets * Disposes of previously-closed VirtualSockets
*/ */
void Housekeeping(); void Housekeeping();
/*
* Return the address that the socket is bound to
*/
void handleGetsockname(PhySocket *sock, PhySocket *rpcsock, void **uptr, struct getsockname_st *getsockname_rpc);
/*
* Return the address of the peer connected to this socket
*/
void handleGetpeername(PhySocket *sock, PhySocket *rpcsock, void **uptr, struct getsockname_st *getsockname_rpc);
/****************************************************************************/ /****************************************************************************/
/* Not used in this implementation */ /* Not used in this implementation */
/****************************************************************************/ /****************************************************************************/