Changeset 7 in libcf++ for trunk/include/cf/network.h


Ignore:
Timestamp:
03/29/15 16:30:07 (9 years ago)
Author:
cheese
Message:

#1 fix and add interfaces

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/cf/network.h

    r5 r7  
    1212#include <string>
    1313
     14#define UNUSED_SOCKET   -1
     15
    1416namespace cf
    1517{
     
    7981             * @throw cf::exception
    8082             */
    81             tcp(const cf::socket_t attachedSocket = -1)
     83            tcp(const cf::socket_t attachedSocket = UNUSED_SOCKET)
    8284                throw (cf::exception);
    8385
     
    8587             * destructor
    8688             */
    87             ~tcp();
     89            virtual ~tcp();
     90
     91            /**
     92             * get socket descriptor
     93             * @return socket descriptor
     94             */
     95            cf::socket_t descriptor() const;
    8896
    8997            /**
     
    178186
    179187            /**
     188             * set non-blocking
     189             * @param flag true; false
     190             */
     191            cf::void_t setNonBlocking(const cf::bool_t flag);
     192
     193            /**
    180194             * set timeout
    181195             * @param seconds timeout seconds
     
    215229                throw (cf::exception);
    216230        };
     231
     232        /**
     233         * byteOrder
     234         */
     235        class byteOrder
     236        {
     237        public:
     238            /**
     239             * host to network long
     240             * @return long for network
     241             * @param long for host
     242             */
     243            static cf::uint32_t htonl(cf::uint32_t in);
     244
     245            /**
     246             * host to network short
     247             * @return short for network
     248             * @param short for host
     249             */
     250            static cf::uint16_t htons(cf::uint16_t in);
     251
     252            /**
     253             * network to host long
     254             * @return long for host
     255             * @param long for network
     256             */
     257            static cf::uint32_t ntohl(cf::uint32_t in);
     258
     259            /**
     260             * network to host short
     261             * @return short for host
     262             * @param short for network
     263             */
     264            static cf::uint16_t ntohs(cf::uint16_t in);
     265        };
    217266    }
    218267}
Note: See TracChangeset for help on using the changeset viewer.