IRC_SERVER
By @hyunjunk (hyunjun2372@gmail.com)
Toggle main menu visibility
Main Page
Related Pages
Topics
Namespaces
Namespace List
Namespace Members
All
c
e
g
i
k
m
n
p
q
r
s
v
Functions
c
g
m
v
Enumerations
Enumerator
c
e
i
k
m
n
p
q
r
s
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
w
~
Functions
a
c
d
e
f
g
i
j
l
m
o
p
r
s
u
w
~
Variables
_
a
b
c
h
i
l
m
n
o
p
r
s
t
u
w
Typedefs
Enumerator
Related Symbols
Files
File List
File Members
All
_
a
f
i
k
l
m
n
p
r
s
u
Functions
Typedefs
Macros
_
a
f
i
l
n
p
r
s
u
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
Utils.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <string>
4
#include <cstdio>
5
#include <sstream>
6
#include "
Network/SocketTypedef.hpp
"
7
8
std::string
InetAddrToString
(
const
struct
sockaddr_in& addr)
9
{
10
char
buf[INET_ADDRSTRLEN + 6
/* :port */
+ 1
/* null-terminator */
];
11
const
uint32_t ip = ntohl(addr.sin_addr.s_addr);
12
const
uint16_t port = ntohs(addr.sin_port);
13
14
STATIC_ASSERT
(
sizeof
(addr.sin_addr.s_addr) ==
sizeof
(uint32_t));
15
STATIC_ASSERT
(
sizeof
(addr.sin_port) ==
sizeof
(uint16_t));
16
17
std::snprintf(buf,
sizeof
(buf),
"%d.%d.%d.%d:%d"
, (ip >> 24) & 0xFF, (ip >> 16) & 0xFF, (ip >> 8) & 0xFF, ip & 0xFF, port);
18
return
buf;
19
}
8
std::string
InetAddrToString
(
const
struct
sockaddr_in& addr) {
…
}
STATIC_ASSERT
#define STATIC_ASSERT(exp)
Definition
MacroDefines.hpp:42
SocketTypedef.hpp
InetAddrToString
std::string InetAddrToString(const struct sockaddr_in &addr)
Definition
Utils.hpp:8
Source
Network
Utils.hpp
Generated by
1.12.0