Seastar
High performance C++ framework for concurrent servers
Toggle main menu visibility
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
a
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
v
w
y
Functions
a
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
v
w
y
Variables
Typedefs
Enumerations
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
~
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
~
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Typedefs
Enumerations
Related Functions
Files
File List
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Modules
Pages
seastar
net
unix_address.hh
1
/*
2
* This file is open source software, licensed to you under the terms
3
* of the Apache License, Version 2.0 (the "License"). See the NOTICE file
4
* distributed with this work for additional information regarding copyright
5
* ownership. You may not use this file except in compliance with the License.
6
*
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing,
12
* software distributed under the License is distributed on an
13
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
* KIND, either express or implied. See the License for the
15
* specific language governing permissions and limitations
16
* under the License.
17
*/
18
/*
19
* Copyright (C) 2019 Red Hat, Inc.
20
*/
21
#pragma once
22
23
#ifndef SEASTAR_MODULE
24
#include <iosfwd>
25
#include <sys/types.h>
26
#include <sys/un.h>
27
#include <string>
28
#endif
29
#include <seastar/util/modules.hh>
30
31
namespace
seastar
{
32
SEASTAR_MODULE_EXPORT_BEGIN
43
struct
unix_domain_addr
{
44
const
std::string name;
45
const
int
path_count;
// either name.length() or name.length()+1. See path_length_aux() below.
46
47
explicit
unix_domain_addr
(
const
std::string& fn) : name{fn}, path_count{path_length_aux()} {}
48
49
explicit
unix_domain_addr
(
const
char
* fn) : name{fn}, path_count{path_length_aux()} {}
50
51
int
path_length()
const
{
return
path_count; }
52
53
// the following holds:
54
// for abstract name: name.length() == number of meaningful bytes, including the null in name[0].
55
// for filesystem path: name.length() does not count the implicit terminating null.
56
// Here we tweak the outside-visible length of the address.
57
int
path_length_aux()
const
{
58
auto
pl = (int)name.length();
59
if
(!pl || (name[0] ==
'\0'
)) {
60
// unnamed, or abstract-namespace
61
return
pl;
62
}
63
return
1 + pl;
64
}
65
66
const
char
* path_bytes()
const
{
return
name.c_str(); }
67
68
bool
operator==(
const
unix_domain_addr
& a)
const
{
69
return
name == a.name;
70
}
71
bool
operator!=(
const
unix_domain_addr
& a)
const
{
72
return
!(*
this
== a);
73
}
74
};
75
76
std::ostream& operator<<(std::ostream&,
const
unix_domain_addr
&);
77
SEASTAR_MODULE_EXPORT_END
78
}
// namespace seastar
seastar
Seastar API namespace.
Definition:
abort_on_ebadf.hh:26
seastar::unix_domain_addr
Definition:
unix_address.hh:43
Generated by
1.9.4