Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions iocore/dns/P_DNSConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include "I_EventSystem.h"
#include "I_DNSProcessor.h"
#include "EventIO.h"

//
// Connection
Expand Down
1 change: 1 addition & 0 deletions iocore/eventsystem/I_ProxyAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <utility>

#include "tscore/ink_platform.h"
#include "tscore/Allocator.h"

class EThread;

Expand Down
7 changes: 2 additions & 5 deletions iocore/eventsystem/I_Thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,12 @@

#pragma once

#if !defined(_I_EventSystem_h) && !defined(_P_EventSystem_h)
#error "include I_EventSystem.h or P_EventSystem.h"
#endif

#include <functional>

#include "I_ProxyAllocator.h"
#include "tscore/Ptr.h"
#include "tscore/ink_platform.h"
#include "tscore/ink_thread.h"
#include "I_ProxyAllocator.h"

class ProxyMutex;

Expand Down
49 changes: 49 additions & 0 deletions iocore/net/AcceptOptions.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/** @file

Asynchronous networking API

@section license License

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*/

#include "AcceptOptions.h"
#include "I_Net.h"

AcceptOptions &
AcceptOptions::reset()
{
local_port = 0;
local_ip.invalidate();
accept_threads = -1;
ip_family = AF_INET;
etype = ET_NET;
localhost_only = false;
frequent_accept = true;
recv_bufsize = 0;
send_bufsize = 0;
sockopt_flags = 0;
packet_mark = 0;
packet_tos = 0;
packet_notsent_lowat = 0;
tfo_queue_length = 0;
f_inbound_transparent = false;
f_mptcp = false;
f_proxy_protocol = false;
return *this;
}
98 changes: 98 additions & 0 deletions iocore/net/AcceptOptions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/** @file

This file implements an I/O Processor for network I/O

@section license License

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*/

#pragma once

#include "tscore/ink_inet.h"
#include "I_Event.h"

struct AcceptOptions {
using self = AcceptOptions; ///< Self reference type.

/// Port on which to listen.
/// 0 => don't care, which is useful if the socket is already bound.
int local_port;
/// Local address to bind for accept.
/// If not set -> any address.
IpAddr local_ip;
/// IP address family.
/// @note Ignored if an explicit incoming address is set in the
/// the configuration (@c local_ip). If neither is set IPv4 is used.
int ip_family;
/// Should we use accept threads? If so, how many?
int accept_threads;
/// Event type to generate on accept.
EventType etype;
/** If @c true, the continuation is called back with
@c NET_EVENT_ACCEPT_SUCCEED
or @c NET_EVENT_ACCEPT_FAILED on success and failure resp.
*/

bool localhost_only;
/// Are frequent accepts expected?
/// Default: @c false.
bool frequent_accept;

/// Socket receive buffer size.
/// 0 => OS default.
int recv_bufsize;
/// Socket transmit buffer size.
/// 0 => OS default.
int send_bufsize;
/// defer accept for @c sockopt.
/// 0 => OS default.
int defer_accept;
/// Socket options for @c sockopt.
/// 0 => do not set options.
uint32_t sockopt_flags;
uint32_t packet_mark;
uint32_t packet_tos;
uint32_t packet_notsent_lowat;

int tfo_queue_length;

/** Transparency on client (user agent) connection.
@internal This is irrelevant at a socket level (since inbound
transparency must be set up when the listen socket is created)
but it's critical that the connection handling logic knows
whether the inbound (client / user agent) connection is
transparent.
*/
bool f_inbound_transparent;

/** MPTCP enabled on listener.
@internal For logging and metrics purposes to know whether the
listener enabled MPTCP or not.
*/
bool f_mptcp;

/// Proxy Protocol enabled
bool f_proxy_protocol;

/// Default constructor.
/// Instance is constructed with default values.
AcceptOptions() { this->reset(); }
/// Reset all values to defaults.
self &reset();
};
5 changes: 5 additions & 0 deletions iocore/net/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,19 @@


add_library(inknet STATIC
AcceptOptions.cc
ALPNSupport.cc
BIO_fastopen.cc
BoringSSLUtils.cc
Connection.cc
EventIO.cc
Inline.cc
YamlSNIConfig.cc
Net.cc
NetHandler.cc
NetVCOptions.cc
NetVConnection.cc
PollCont.cc
ProxyProtocol.cc
Socks.cc
SSLCertLookup.cc
Expand Down
Loading