|
libassa 3.5.1
|
#include <UnConUDPSocket.h>
Public Member Functions | |
| UnConUDPSocket () | |
| Constructor. More... | |
| ~UnConUDPSocket () | |
| Destructor. More... | |
| int | recvfrom (char *buf_, int size_, Address *peer_addr_) |
| recvfrom() function receives a message from connectionless-mode socket. More... | |
| int | sendto (const char *buf_, const unsigned int size_, const Address *dest_addr_) |
| sendto() function sends a message through connectionless-mode socket. More... | |
| virtual int | in_avail () const |
| This function returns the number of characters immediately available in the get area of the underlying Socketbuf buffer without making a system call. More... | |
Public Member Functions inherited from ASSA::UDPSocket | |
| UDPSocket () | |
| Default constructor. More... | |
| UDPSocket (const handler_t fd_) | |
| Constructor. More... | |
| virtual | ~UDPSocket () |
| Destructor will close connection. More... | |
| bool | open (const int domain_) |
| Create socket. More... | |
| bool | close () |
| Close socket connection. More... | |
| bool | bind (const Address &my_address_) |
| Server in UDP client-server scenario has to bind socket to its local well-known port. More... | |
| handler_t | getHandler () const |
| Get socket file descriptor. More... | |
| const int | getDomain () const |
| Get socket domain type. More... | |
Public Member Functions inherited from ASSA::Socket | |
| Socket () | |
| Constructor. More... | |
| virtual | ~Socket () |
| Destructor. More... | |
| virtual bool | open (const int domain_)=0 |
| Open socket. More... | |
| virtual bool | close ()=0 |
| Close socket. More... | |
| virtual bool | connect (const Address &address_) |
| Make a connection. More... | |
| virtual bool | bind (const Address &my_address_)=0 |
| Server binds listening socket to its local well-known port. More... | |
| virtual int | write (const char *buf_, const u_int size_) |
| Write specified number of bytes to the socket. More... | |
| int | getBytesAvail (void) const |
| Return number of bytes available in socket receive buffer. More... | |
| virtual int | read (char *buf_, const u_int size_) |
| Read expected number of bytes from the socket. More... | |
| int | ignore (int n_=INT_MAX, int delim_=EOF) |
| Extracts bytes and discards them. More... | |
| virtual handler_t | getHandler () const =0 |
| Get file descriptor. More... | |
| virtual const int | getDomain () const =0 |
| Get socket domain. More... | |
| virtual Streambuf * | rdbuf () |
| Return a pointer to the Streambuf associated with the stream. More... | |
| virtual Streambuf * | rdbuf (Streambuf *) |
| Virtual function that sets new socket buffer and returns the old one. More... | |
| virtual int | in_avail () const =0 |
| This function returns the number of characters immediately available in the get area of the underlying Socketbuf buffer without making a system call if Socket is doing buffering I/O. More... | |
| virtual Socket & | flush () |
| This function simply calls the public "synchronizing" function rdbuf()->pubsync() (assuming the associated streambuf object is present). More... | |
| bool | turnOptionOn (opt_t opt_) |
| Enable socket option. More... | |
| bool | turnOptionOff (opt_t opt_) |
| Disable socket option. More... | |
| bool | setOption (opt_t opt_, int arg_) |
| Set socket option to value required. More... | |
| int | getOption (opt_t opt_) const |
| Get current value of a socket option. More... | |
| operator void * () const | |
| Convertion to void* (for testing where bool is required) More... | |
| bool | operator! () const |
| Alias to fail() More... | |
| iostate | rdstate () const |
| Retrieve state of the socket. More... | |
| void | clear (iostate state_=Socket::goodbit) |
| Clear the socket state. Closed socket remains in bad state. More... | |
| void | setstate (iostate flag_) |
| Set socket state to flag_ by adding flag_ to the existing state. More... | |
| bool | good () const |
| Indicates no error on the socket. More... | |
| bool | eof () const |
| An earlier extraction operation has encountered the end of file of the input stream (peer closed its socket). More... | |
| bool | fail () const |
| Indicates that earlier extraction opeartion has failed to match the required pattern of input. More... | |
| bool | bad () const |
| Socket fd == -1 or read/write error occured or some loss of integrity on assosiated stream buffer. More... | |
| void | dumpState () const |
| Write state bits of the socket to the log file. More... | |
| Socket & | operator>> (char &c) |
| Input of built-in char type. The value will be XDR-decoded. More... | |
| Socket & | operator>> (unsigned char &c_) |
| Input of built-in u_char type. The value will be XDR-decoded. More... | |
| Socket & | operator>> (signed char &c_) |
| Input of built-in signed char type. The value will be XDR-decoded. More... | |
| Socket & | operator>> (std::string &s_) |
| Input of STL string type. The string content will be XDR-decoded. More... | |
| Socket & | operator>> (short &n_) |
| Input of built-in short type. The value will be XDR-decoded. More... | |
| Socket & | operator>> (unsigned short &n_) |
| Input of built-in u_short type. The value will be XDR-decoded. More... | |
| Socket & | operator>> (int &n_) |
| Input of built-in integer type. The value will be XDR-decoded. More... | |
| Socket & | operator>> (unsigned int &n_) |
| Input of built-in u_int type. The value will be XDR-decoded. More... | |
| Socket & | operator>> (long &n_) |
| Input of built-in long type. The value will be XDR-decoded. More... | |
| Socket & | operator>> (unsigned long &n_) |
| Input of built-in u_long type. The value will be XDR-decoded. More... | |
| Socket & | operator>> (float &n_) |
| Input of built-in float type. The value will be XDR-decoded. More... | |
| Socket & | operator>> (double &n_) |
| Input of built-in double type. The value will be XDR-decoded. More... | |
| Socket & | operator<< (char c) |
| Output of built-in char type. The value will be XDR-encoded. More... | |
| Socket & | operator<< (unsigned char c_) |
| Output of built-in u_char type. The value will be XDR-encoded. More... | |
| Socket & | operator<< (signed char c_) |
| Output of built-in signed char type. The value will be XDR-encoded. More... | |
| Socket & | operator<< (const std::string &s_) |
| Output of STL string type. The value will be XDR-encoded. More... | |
| Socket & | operator<< (short n_) |
| Output of built-in short type. The value will be XDR-encoded. More... | |
| Socket & | operator<< (unsigned short n_) |
| Output of built-in u_short type. The value will be XDR-encoded. More... | |
| Socket & | operator<< (int n_) |
| Output of built-in integer type. The value will be XDR-encoded. More... | |
| Socket & | operator<< (unsigned int n_) |
| Output of built-in u_int type. The value will be XDR-encoded. More... | |
| Socket & | operator<< (long n_) |
| Output of built-in long type. The value will be XDR-encoded. More... | |
| Socket & | operator<< (unsigned long n_) |
| Output of built-in u_long type. The value will be XDR-encoded. More... | |
| Socket & | operator<< (float n_) |
| Output of built-in float type. The value will be XDR-encoded. More... | |
| Socket & | operator<< (double n_) |
| Output of built-in double type. The value will be XDR-encoded. More... | |
| Socket & | operator<< (Socket &(*f)(Socket &)) |
| Manipulators plug-in operator. More... | |
Additional Inherited Members | |
Public Types inherited from ASSA::Socket | |
| enum | io_state_t { goodbit = 0 , eofbit = 1 , failbit = 2 , badbit = 4 } |
| State bits: goodbit, eofbit, failbit, badbit. More... | |
| enum | opt_t { reuseaddr , rcvlowat , sndlowat , nonblocking } |
| Socket options. More... | |
| typedef int | iostate |
| typedef unsigned char | IOState |
Static Public Member Functions inherited from ASSA::Socket | |
| static size_t | xdr_length (const std::string &s_) |
| Give the true length of the XDR-encoded STL string. More... | |
| static bool | is_little_endian () |
| Determine the endianess of the platform we are on. More... | |
| static void | close_handler (handler_t &socket_) |
| Close socket endpoint in a portable way. More... | |
| static string | decode_fcntl_flags (long mask_) |
| Decipher flags packed into mask_ used in fcntl() call. More... | |
Static Public Attributes inherited from ASSA::Socket | |
| static const int | PGSIZE = 4096 |
| Size of bytes of a kernel page. More... | |
Protected Member Functions inherited from ASSA::UDPSocket | |
| void | setHandler (const int fd_) |
| Set file descriptor. More... | |
| void | setDomain (const int type_) |
| Set socket domain type. More... | |
Protected Member Functions inherited from ASSA::Socket | |
| int | set_option (int level_, int optname_, int val_) |
| Gateway method of setting socket options. More... | |
| int | set_fd_options (long flags_) |
| Gateway method for setting file descriptor options. More... | |
| int | clear_fd_options (long flags_) |
| Gateway method for clearing file descriptor options. More... | |
Protected Attributes inherited from ASSA::Socket | |
| handler_t | m_fd |
| File descriptor. More... | |
| int | m_type |
| Socket domain type. More... | |
| IOState | m_state |
| Control state of the socket. More... | |
Definition at line 26 of file UnConUDPSocket.h.
| ASSA::UnConUDPSocket::UnConUDPSocket | ( | ) |
Constructor.
Definition at line 69 of file UnConUDPSocket.h.
References ASSA::SOCKTRACE, and trace_with_mask.
| ASSA::UnConUDPSocket::~UnConUDPSocket | ( | ) |
Destructor.
Definition at line 75 of file UnConUDPSocket.h.
References ASSA::SOCKTRACE, and trace_with_mask.
|
inlinevirtual |
This function returns the number of characters
immediately available in the get area of the underlying Socketbuf buffer without making a system call.
Always return 0.
Implements ASSA::Socket.
Definition at line 66 of file UnConUDPSocket.h.
| int UnConUDPSocket::recvfrom | ( | char * | buf_, |
| int | size_, | ||
| Address * | peer_addr_ | ||
| ) |
recvfrom() function receives a message from connectionless-mode socket.
It also permits the application to retrieve the source address of received data.
| buf_ | points to buffer where the message should be stored |
| size_ | buffer length is bytes |
| peer_addr_ | pointer to the address structure where sending address is to be stored |
Definition at line 24 of file UnConUDPSocket.cpp.
References ASSA::Address::getAddress(), ASSA::UDPSocket::getHandler(), ASSA::Address::getLength(), and recvfrom().
Referenced by recvfrom().
| int UnConUDPSocket::sendto | ( | const char * | buf_, |
| const unsigned int | size_, | ||
| const Address * | dest_addr_ | ||
| ) |
sendto() function sends a message through connectionless-mode socket.
The message will be sent to the address specified by dest_addr_.
| buf_ | pointer to the buffer containing the message to be sent |
| size_ | the size of the message in bytes |
| dest_addr_ | contains destination address |
Definition at line 59 of file UnConUDPSocket.cpp.
References ASSA::Address::getAddress(), ASSA::UDPSocket::getHandler(), and ASSA::Address::getLength().