E-MailRelay

gmsg_win32.cpp
Go to the documentation of this file.
1//
2// Copyright (C) 2001-2024 Graeme Walker <graeme_walker@users.sourceforge.net>
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
16// ===
17///
18/// \file gmsg_win32.cpp
19///
20
21#include "gdef.h"
22#include "gmsg.h"
23
24ssize_t G::Msg::send( SOCKET fd , const void * buffer , std::size_t size , int flags ) noexcept
25{
26 return ::send( fd , reinterpret_cast<const char*>(buffer) , static_cast<int>(size) , flags ) ;
27}
28
29ssize_t G::Msg::sendto( SOCKET fd , const void * buffer , std::size_t size , int flags ,
30 const sockaddr * address_p , socklen_t address_n ) noexcept
31{
32 return ::sendto( fd , reinterpret_cast<const char*>(buffer) , static_cast<int>(size) ,
33 flags , address_p , address_n ) ;
34}
35
36ssize_t G::Msg::recv( SOCKET fd , void * buffer , std::size_t size , int flags ) noexcept
37{
38 return ::recv( fd , reinterpret_cast<char*>(buffer) , static_cast<int>(size) , flags ) ;
39}
40
41ssize_t G::Msg::recvfrom( SOCKET fd , void * buffer , std::size_t size , int flags ,
42 sockaddr * address_p , socklen_t * address_np ) noexcept
43{
44 return ::recvfrom( fd , reinterpret_cast<char*>(buffer) , static_cast<int>(size) ,
45 flags , address_p , address_np ) ;
46}
47
48 bool G::Msg::fatal( int error ) noexcept
49{
50 return !(
51 error == 0 ||
52 error == WSAEINTR ||
53 error == WSAEWOULDBLOCK ||
54 error == WSAEINPROGRESS ||
55 error == WSAENOBUFS ||
56 false ) ;
57}
58
G::Msg::recv
static ssize_t recv(SOCKET, void *, std::size_t, int flags) noexcept
A recv() wrapper.
Definition: gmsg_mac.cpp:39
G::Msg::fatal
static bool fatal(int error) noexcept
Returns true if the error value indicates a permanent problem with the socket.
Definition: gmsg_mac.cpp:50
G::Msg::send
static ssize_t send(SOCKET, const void *, std::size_t, int flags) noexcept
A send() wrapper.
Definition: gmsg_mac.cpp:27
G::Msg::sendto
static ssize_t sendto(SOCKET, const void *, std::size_t, int flags, const sockaddr *, socklen_t) noexcept
A sendto() wrapper.
Definition: gmsg_mac.cpp:32
G::Msg::recvfrom
static ssize_t recvfrom(SOCKET, void *, std::size_t, int, sockaddr *, socklen_t *) noexcept
A recvfrom() wrapper.
Definition: gmsg_mac.cpp:44
gmsg.h