MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / accept_connection

Function accept_connection

src/remote/server/server.cpp:1954–2226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1952}
1953
1954static bool accept_connection(rem_port* port, P_CNCT* connect, PACKET* send)
1955{
1956/**************************************
1957 *
1958 * a c c e p t _ c o n n e c t i o n
1959 *
1960 **************************************
1961 *
1962 * Functional description
1963 * Process a connect packet.
1964 *
1965 **************************************/
1966
1967 // Accept the physical connection
1968 send->p_operation = op_reject;
1969
1970 if (!port->accept(connect))
1971 {
1972 port->send(send);
1973 return false;
1974 }
1975
1976 // Starting with CONNECT_VERSION3, strings inside the op_connect packet are UTF8 encoded
1977
1978 if (connect->p_cnct_cversion >= CONNECT_VERSION3)
1979 {
1980 ISC_utf8ToSystem(port->port_login);
1981 ISC_utf8ToSystem(port->port_user_name);
1982 ISC_utf8ToSystem(port->port_peer_name);
1983 }
1984
1985 // Select the most appropriate protocol (this will get smarter)
1986 P_ARCH architecture = arch_generic;
1987 USHORT version = 0;
1988 USHORT type = 0;
1989 bool compress = false;
1990 bool accepted = false;
1991 USHORT weight = 0;
1992 const p_cnct::p_cnct_repeat* protocol = connect->p_cnct_versions;
1993
1994 for (const p_cnct::p_cnct_repeat* const end = protocol + connect->p_cnct_count;
1995 protocol < end; protocol++)
1996 {
1997 if ((protocol->p_cnct_version == PROTOCOL_VERSION10 ||
1998 (protocol->p_cnct_version >= PROTOCOL_VERSION11 &&
1999 protocol->p_cnct_version <= PROTOCOL_VERSION19)) &&
2000 (protocol->p_cnct_architecture == arch_generic ||
2001 protocol->p_cnct_architecture == ARCHITECTURE) &&
2002 protocol->p_cnct_weight >= weight)
2003 {
2004 accepted = true;
2005 weight = protocol->p_cnct_weight;
2006 version = protocol->p_cnct_version;
2007 architecture = protocol->p_cnct_architecture;
2008 type = MIN(protocol->p_cnct_max_type & ptype_MASK, ptype_lazy_send);
2009 compress = protocol->p_cnct_max_type & pflag_compress;
2010 }
2011 }

Callers 1

process_packetFunction · 0.70

Calls 15

ISC_utf8ToSystemFunction · 0.85
REMOTE_make_stringFunction · 0.85
REMOTE_get_configFunction · 0.85
wireEncryptionFunction · 0.85
ConnectAuthClass · 0.85
SrvAuthBlockClass · 0.85
loginSuccessFunction · 0.85
setErrorStatusFunction · 0.85
loginFailFunction · 0.85
iscLogStatusFunction · 0.85
createPluginsItrMethod · 0.80
setPluginNameMethod · 0.80

Tested by

no test coverage detected