Changeset 19 in libcf++


Ignore:
Timestamp:
08/14/15 01:20:34 (9 years ago)
Author:
cheese
Message:

#1 rename namespace from network to net

Location:
trunk
Files:
2 edited
2 moved

Legend:

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

    r18 r19  
    11/**
    2  * @file network.h
     2 * @file net.h
    33 * @author myusgun@gmail.com
    44 * @brief network
     
    1919     * network
    2020     */
    21     namespace network
     21    namespace net
    2222    {
    2323        /**
  • trunk/src/net.cpp

    r18 r19  
    11/**
    2  * @file network.cpp
     2 * @file net.cpp
    33 * @author myusgun@gmail.com
    44 * @brief network
    55 */
    6 #include "cf/network.h"
     6#include "cf/net.h"
    77
    88#include <iostream>
     
    9999}
    100100
    101 static cf::void_t setReuseAddress(const cf::network::tcp & tcp)
     101static cf::void_t setReuseAddress(const cf::net::tcp & tcp)
    102102    throw (cf::exception)
    103103{
     
    118118                                                         socklen_t *len);
    119119
    120 static cf::network::host getSocketNameFromFunction(const cf::socket_t sock,
     120static cf::net::host getSocketNameFromFunction(const cf::socket_t sock,
    121121                                                   getSocketNameAPI api)
    122122    throw (cf::exception)
     
    132132                        << ")");
    133133
    134     return cf::network::host(convertAddressToString(addr), addr.sin_port);
     134    return cf::net::host(convertAddressToString(addr), addr.sin_port);
    135135}
    136136/*--------------------------------------------------------------*/
    137137
    138 cf::network::host::host(const std::string & address,
     138cf::net::host::host(const std::string & address,
    139139                        const cf::uint16_t port)
    140140    : mAddress(address),
     
    143143}
    144144
    145 const std::string & cf::network::host::address() const
     145const std::string & cf::net::host::address() const
    146146{
    147147    return mAddress;
    148148}
    149149
    150 cf::uint16_t cf::network::host::port() const
     150cf::uint16_t cf::net::host::port() const
    151151{
    152152    return mPort;
    153153}
    154154
    155 cf::network::tcp::tcp(const cf::socket_t attachedSocket)
     155cf::net::tcp::tcp(const cf::socket_t attachedSocket)
    156156    throw (cf::exception)
    157157    : mSocket (attachedSocket),
     
    180180}
    181181
    182 cf::network::tcp::~tcp()
     182cf::net::tcp::~tcp()
    183183{
    184184    close();
    185185}
    186186
    187 cf::socket_t cf::network::tcp::descriptor() const
     187cf::socket_t cf::net::tcp::descriptor() const
    188188{
    189189    return mSocket;
    190190}
    191191
    192 cf::void_t cf::network::tcp::close()
     192cf::void_t cf::net::tcp::close()
    193193{
    194194    if (mSocket == cf::nodesc)
     
    200200}
    201201
    202 cf::void_t cf::network::tcp::connect(const cf::network::host & peer,
     202cf::void_t cf::net::tcp::connect(const cf::net::host & peer,
    203203                                     const cf::int32_t timeout)
    204204    throw (cf::exception)
     
    207207}
    208208
    209 cf::void_t cf::network::tcp::connect(const std::string & address,
     209cf::void_t cf::net::tcp::connect(const std::string & address,
    210210                                     const cf::uint16_t port,
    211211                                     const cf::int32_t timeout)
     
    270270}
    271271
    272 cf::void_t cf::network::tcp::bind(const cf::uint16_t port) const
     272cf::void_t cf::net::tcp::bind(const cf::uint16_t port) const
    273273    throw (cf::exception)
    274274{
     
    299299}
    300300
    301 cf::void_t cf::network::tcp::listen(const cf::int32_t backlog) const
     301cf::void_t cf::net::tcp::listen(const cf::int32_t backlog) const
    302302    throw (cf::exception)
    303303{
     
    307307}
    308308
    309 cf::network::tcp cf::network::tcp::accept() const
     309cf::net::tcp cf::net::tcp::accept() const
    310310    throw (cf::exception)
    311311{
     
    318318        THROW_EXCEPTION("cannot accept client");
    319319
    320     return cf::network::tcp(sock).detach();
    321 }
    322 
    323 cf::void_t cf::network::tcp::attach(const cf::socket_t sock)
     320    return cf::net::tcp(sock).detach();
     321}
     322
     323cf::void_t cf::net::tcp::attach(const cf::socket_t sock)
    324324    throw (exception)
    325325{
     
    330330}
    331331
    332 cf::socket_t cf::network::tcp::detach()
     332cf::socket_t cf::net::tcp::detach()
    333333    throw (exception)
    334334{
     
    343343}
    344344
    345 cf::void_t cf::network::tcp::send(const cf::bin & in) const
     345cf::void_t cf::net::tcp::send(const cf::bin & in) const
    346346    throw (cf::exception)
    347347{
     
    357357}
    358358
    359 cf::void_t cf::network::tcp::receive(cf::bin & out) const
     359cf::void_t cf::net::tcp::receive(cf::bin & out) const
    360360    throw (cf::exception)
    361361{
     
    384384}
    385385
    386 cf::bin cf::network::tcp::receive(const cf::int32_t size) const
     386cf::bin cf::net::tcp::receive(const cf::int32_t size) const
    387387    throw (cf::exception)
    388388{
     
    395395}
    396396
    397 cf::bin cf::network::tcp::receive() const
     397cf::bin cf::net::tcp::receive() const
    398398    throw (cf::exception)
    399399{
     
    414414}
    415415
    416 cf::void_t cf::network::tcp::getOption(const cf::int32_t optname,
     416cf::void_t cf::net::tcp::getOption(const cf::int32_t optname,
    417417                                       cf::void_t * optval,
    418418                                       cf::int32_t * optlen) const
     
    434434}
    435435
    436 cf::void_t cf::network::tcp::setOption(const cf::int32_t optname,
     436cf::void_t cf::net::tcp::setOption(const cf::int32_t optname,
    437437                                       const cf::void_t * optval,
    438438                                       const cf::int32_t optlen) const
     
    454454}
    455455
    456 cf::void_t cf::network::tcp::setNonBlocking(const cf::bool_t flag)
     456cf::void_t cf::net::tcp::setNonBlocking(const cf::bool_t flag)
    457457{
    458458#ifdef _ON_WINDOWS
     
    469469}
    470470
    471 cf::void_t cf::network::tcp::setTimeout(const cf::int32_t seconds)
     471cf::void_t cf::net::tcp::setTimeout(const cf::int32_t seconds)
    472472{
    473473    setNonBlocking(seconds > 0 /*? true : false*/);
     
    475475}
    476476
    477 cf::network::host cf::network::tcp::peer() const
     477cf::net::host cf::net::tcp::peer() const
    478478    throw (cf::exception)
    479479{
     
    488488}
    489489
    490 cf::network::host cf::network::tcp::local() const
     490cf::net::host cf::net::tcp::local() const
    491491    throw (cf::exception)
    492492{
     
    501501}
    502502
    503 std::string cf::network::nic::getMACAddress()
     503std::string cf::net::nic::getMACAddress()
    504504    throw (cf::exception)
    505505{
     
    529529
    530530
    531 cf::uint32_t cf::network::byteOrder::htonl(cf::uint32_t in)
     531cf::uint32_t cf::net::byteOrder::htonl(cf::uint32_t in)
    532532{
    533533    return ::htonl(in);
    534534}
    535535
    536 cf::uint16_t cf::network::byteOrder::htons(cf::uint16_t in)
     536cf::uint16_t cf::net::byteOrder::htons(cf::uint16_t in)
    537537{
    538538    return ::htons(in);
    539539}
    540540
    541 cf::uint32_t cf::network::byteOrder::ntohl(cf::uint32_t in)
     541cf::uint32_t cf::net::byteOrder::ntohl(cf::uint32_t in)
    542542{
    543543    return ::ntohl(in);
    544544}
    545545
    546 cf::uint16_t cf::network::byteOrder::ntohs(cf::uint16_t in)
     546cf::uint16_t cf::net::byteOrder::ntohs(cf::uint16_t in)
    547547{
    548548    return ::ntohs(in);
  • trunk/test/test.cpp

    r13 r19  
    66#include "cf/task.h"
    77#include "cf/util.h"
    8 #include "cf/network.h"
     8#include "cf/net.h"
    99
    1010#include <string>
     
    158158{
    159159    std::cout << "H/W Address : "
    160               << cf::network::nic::getMACAddress()
     160              << cf::net::nic::getMACAddress()
    161161              << std::endl;
    162162}
     
    204204    try
    205205    {
    206         cf::network::tcp server;
    207         cf::network::tcp client;
     206        cf::net::tcp server;
     207        cf::net::tcp client;
    208208        cf::bin msg;
    209209
     
    214214        {
    215215            client.attach(server.accept().detach());
    216             cf::network::host peer = client.peer();
     216            cf::net::host peer = client.peer();
    217217            std::cout << "client <"
    218218                      << peer.address() << ":" << peer.port()
     
    242242    try
    243243    {
    244         cf::network::tcp client;
    245         cf::network::host host(HOST, PORT);
     244        cf::net::tcp client;
     245        cf::net::host host(HOST, PORT);
    246246
    247247        cf::ulong_t tid = cf::task::thread::id();
  • trunk/windows/libcf++.sln

    r4 r19  
    11
    2 Microsoft Visual Studio Solution File, Format Version 10.00
    3 # Visual Studio 2008
    4 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcf++", "libcf++.vcproj", "{F6D565DE-91B5-46E1-AD17-2C7067C1DDCE}"
     2Microsoft Visual Studio Solution File, Format Version 12.00
     3# Visual Studio 14
     4VisualStudioVersion = 14.0.23107.0
     5MinimumVisualStudioVersion = 10.0.40219.1
     6Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcf++", "libcf++.vcxproj", "{F6D565DE-91B5-46E1-AD17-2C7067C1DDCE}"
    57EndProject
    6 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test.vcproj", "{A5567A0F-56C8-404E-AB02-5E95C8EE6BC0}"
    7     ProjectSection(ProjectDependencies) = postProject
    8         {F6D565DE-91B5-46E1-AD17-2C7067C1DDCE} = {F6D565DE-91B5-46E1-AD17-2C7067C1DDCE}
    9     EndProjectSection
     8Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test.vcxproj", "{A5567A0F-56C8-404E-AB02-5E95C8EE6BC0}"
    109EndProject
    1110Global
Note: See TracChangeset for help on using the changeset viewer.