00001
00002 #ifndef SENDS_RAW_SOCKET_HH
00003 #define SENDS_RAW_SOCKET_HH
00004
00005 #include "socket_api.hh"
00006
00007 namespace sends {
00008
00014 class raw_socket : public socket_api {
00015 public:
00016 raw_socket(void);
00017 ~raw_socket(void);
00018 raw_socket* accept(void);
00019 sock_err bind(const std::string& port);
00020
00021 sock_err close(void);
00022 sock_err connect(const std::string& peer);
00023
00031 sock_err listen(const std::string& port, int lq);
00032
00040 virtual long read_available(char* buf, long len);
00041
00047 virtual int socket_id(void) const;
00048
00058 int wait_data(double nsec);
00059
00066 virtual long write(const char* buf, long len);
00067
00068 protected:
00073 raw_socket(int fd);
00074
00075 protected:
00076 int mSocket;
00077 };
00078
00079
00080
00081 inline int
00082 raw_socket::socket_id(void) const {
00083 return mSocket;
00084 }
00085
00086 }
00087
00088 #endif // !defined(SENDS_RAW_SOCKET_HH)