The Pedigree Project  0.1
Classes | Public Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
LwipSocketSyscalls Class Reference
+ Inheritance diagram for LwipSocketSyscalls:
+ Collaboration diagram for LwipSocketSyscalls:

Classes

struct  LwipMetadata
 

Public Member Functions

 LwipSocketSyscalls (int domain, int type, int protocol)
 
virtual bool create ()
 Implementation-specific final socket creation logic. More...
 
virtual int connect (const struct sockaddr *address, socklen_t addrlen)
 
virtual ssize_t sendto_msg (const struct msghdr *msghdr)
 
virtual ssize_t recvfrom_msg (struct msghdr *msghdr)
 
virtual int listen (int backlog)
 
virtual int bind (const struct sockaddr *address, socklen_t addrlen)
 
virtual int accept (struct sockaddr *address, socklen_t *addrlen)
 
virtual int shutdown (int how)
 
virtual int getpeername (struct sockaddr *address, socklen_t *address_len)
 
virtual int getsockname (struct sockaddr *address, socklen_t *address_len)
 
virtual int setsockopt (int level, int optname, const void *optvalue, socklen_t optlen)
 
virtual int getsockopt (int level, int optname, void *optvalue, socklen_t *optlen)
 
virtual bool canPoll () const
 
virtual bool poll (bool &read, bool &write, bool &error, Semaphore *waiter)
 
virtual void unPoll (Semaphore *waiter)
 
- Public Member Functions inherited from NetworkSyscalls
 NetworkSyscalls (int domain, int type, int protocol)
 
virtual ssize_t sendto (const void *buffer, size_t bufferlen, int flags, const struct sockaddr *address, socklen_t addrlen)
 
virtual ssize_t recvfrom (void *buffer, size_t bufferlen, int flags, struct sockaddr *address, socklen_t *addrlen)
 
virtual bool monitor (Thread *pThread, Event *pEvent)
 
virtual bool unmonitor (Event *pEvent)
 
void associate (FileDescriptor *fd)
 
int getDomain () const
 
int getType () const
 
int getProtocol () const
 
FileDescriptorgetFileDescriptor () const
 
bool isBlocking () const
 
void setBlocking (bool blocking)
 

Static Private Member Functions

static void netconnCallback (struct netconn *conn, enum netconn_evt evt, uint16_t len)
 
static void lwipToSyscallError (err_t err)
 

Private Attributes

struct netconn * m_Socket
 
struct LwipSocketSyscalls::LwipMetadata m_Metadata
 

Static Private Attributes

static Tree< struct netconn *, LwipSocketSyscalls * > m_SyscallObjects
 

Additional Inherited Members

- Protected Attributes inherited from NetworkSyscalls
int m_Domain
 
int m_Type
 
int m_Protocol
 
bool m_Blocking
 
FileDescriptorm_Fd
 

Detailed Description

Definition at line 131 of file net-syscalls.h.

Member Function Documentation

int LwipSocketSyscalls::accept ( struct sockaddr *  address,
socklen_t *  addrlen 
)
virtual
Todo:
handle other families

Implements NetworkSyscalls.

Definition at line 1164 of file net-syscalls.cc.

References create(), ERR_OK, FileDescriptor::fd, and FileDescriptor::networkImpl.

int LwipSocketSyscalls::connect ( const struct sockaddr *  address,
socklen_t  addrlen 
)
virtual
Todo:
need to track if we've already done a bind() and not bind if so
Todo:
for accept() we need to do this too

Implements NetworkSyscalls.

Definition at line 899 of file net-syscalls.cc.

References Dec, and ERR_OK.

bool LwipSocketSyscalls::create ( )
virtual

Implementation-specific final socket creation logic.

Todo:
need an error here...

Reimplemented from NetworkSyscalls.

Definition at line 821 of file net-syscalls.cc.

References WARNING.

Referenced by accept().

+ Here is the caller graph for this function:

int LwipSocketSyscalls::getpeername ( struct sockaddr *  address,
socklen_t *  address_len 
)
virtual
Todo:
handle other families

Implements NetworkSyscalls.

Definition at line 1237 of file net-syscalls.cc.

References ERR_OK.

int LwipSocketSyscalls::getsockname ( struct sockaddr *  address,
socklen_t *  address_len 
)
virtual
Todo:
handle other families

Implements NetworkSyscalls.

Definition at line 1260 of file net-syscalls.cc.

References ERR_OK.

int LwipSocketSyscalls::getsockopt ( int  level,
int  optname,
void *  optvalue,
socklen_t *  optlen 
)
virtual
Todo:
implement with lwIP functionality

Implements NetworkSyscalls.

Definition at line 1316 of file net-syscalls.cc.

void LwipSocketSyscalls::netconnCallback ( struct netconn *  conn,
enum netconn_evt  evt,
uint16_t  len 
)
staticprivate
Todo:
figure out how to bubble errors
Todo:
need a way to do this with lwip when threads are off

Definition at line 1396 of file net-syscalls.cc.

References Semaphore::acquire(), ERR_ABRT, ERR_ALREADY, ERR_ARG, ERR_BUF, ERR_CLSD, ERR_CONN, ERR_IF, ERR_INPROGRESS, ERR_ISCONN, ERR_MEM, ERR_OK, ERR_RST, ERR_RTE, ERR_TIMEOUT, ERR_USE, ERR_VAL, ERR_WOULDBLOCK, Semaphore::release(), and Ne2k::send().

bool LwipSocketSyscalls::poll ( bool &  read,
bool &  write,
bool &  error,
Semaphore waiter 
)
virtual
Todo:
this is buggy as it'll return for the wrong events!

Reimplemented from NetworkSyscalls.

Definition at line 1329 of file net-syscalls.cc.

ssize_t LwipSocketSyscalls::recvfrom_msg ( struct msghdr *  msghdr)
virtual
Todo:
need to build this - extract from the pbuf

Implements NetworkSyscalls.

Definition at line 1027 of file net-syscalls.cc.

References ERR_OK, Scheduler::instance(), pbuf_copy_partial(), pbuf_free(), pbuf::tot_len, and Scheduler::yield().

ssize_t LwipSocketSyscalls::sendto_msg ( const struct msghdr *  msghdr)
virtual
Todo:
need to build this - but netconn_sendto() requires a netbuf
Todo:
implement sendto

Implements NetworkSyscalls.

Definition at line 950 of file net-syscalls.cc.

References ERR_OK.

int LwipSocketSyscalls::setsockopt ( int  level,
int  optname,
const void *  optvalue,
socklen_t  optlen 
)
virtual
Todo:
implement with lwIP functionality

Implements NetworkSyscalls.

Definition at line 1282 of file net-syscalls.cc.


The documentation for this class was generated from the following files: