# CConnectionRepository

from pandac.PandaModules import CConnectionRepository

Class : CConnectionRepository
Description : This class implements the C++ side of the ConnectionRepository object. In particular, it manages the connection to the server once it has been opened (but does not open it directly). It manages reading and writing datagrams on the connection and monitoring for unexpected disconnects as well as handling intentional disconnects.
Certain server messages, like field updates, are handled entirely within the C++ layer, while server messages that are not understood by the C++ layer are returned up to the Python layer for processing.

## Inheritance:

CConnectionRepository:

## Methods of CConnectionRepository:

checkDatagram
considerFlush
disconnect
flush
getClientDatagram
getCw
getDatagram
getDatagramIterator
getDcFile
getMsgChannel
getMsgChannelCount
getMsgSender
getMsgType
getOverflowEventName
getQcm
getQcr
getSimulatedDisconnect
getStream
getVerbose
hasOwnerView
isConnected
sendDatagram
setClientDatagram
setConnectionHttp
setPythonRepository
setSimulatedDisconnect
setVerbose
toggleVerbose
tryConnectNspr

checkDatagram bool CConnectionRepository::check_datagram(void); SIMULATE_NETWORK_DELAY Description: Returns true if a new datagram is available, false otherwise. If the return value is true, the new datagram may be retrieved via get_datagram(), or preferably, with get_datagram_iterator() and get_msg_type().

considerFlush bool CConnectionRepository::consider_flush(void); Description: Sends the most recently queued data if enough time has elapsed. This only has meaning if set_collect_tcp() has been set to true.

disconnect void CConnectionRepository::disconnect(void); Description: Closes the connection to the server.

flush bool CConnectionRepository::flush(void); Description: Sends the most recently queued data now. This only has meaning if set_collect_tcp() has been set to true.

getClientDatagram bool CConnectionRepository::get_client_datagram(void) const; Description: Returns the client_datagram flag.

getCw ConnectionWriter &CConnectionRepository::get_cw(void); Description: Returns the ConnectionWriter object associated with the repository.

getDatagram void CConnectionRepository::get_datagram(Datagram &dg); HAVE_NSPR Description: Fills the datagram object with the datagram most recently retrieved by check_datagram().

getDatagramIterator void CConnectionRepository::get_datagram_iterator(DatagramIterator &di); Description: Fills the DatagramIterator object with the iterator for the datagram most recently retrieved by check_datagram(). This iterator has already read past the datagram header and the message type, and is positioned at the beginning of data.

getDcFile DCFile &CConnectionRepository::get_dc_file(void); Filename: cConnectionRepository.I Created by: drose (17May04) PANDA 3D SOFTWARE Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved All use of this software is subject to the terms of the Panda 3d Software license. You should have received a copy of this license along with this source code; you will also find a current copy of the license at http://etc.cmu.edu/panda3d/docs/license/ . To contact the maintainers of this program write to panda3d-general@lists.sourceforge.net . Description: Returns the DCFile object associated with this repository.

getMsgChannel unsigned __int64 CConnectionRepository::get_msg_channel(int offset = (0)) const; Description: Returns the channel from which the current message was sent, according to the datagram headers. This information is not available to the client.

getMsgChannelCount int CConnectionRepository::get_msg_channel_count(void) const; Undocumented function.

getMsgSender unsigned __int64 CConnectionRepository::get_msg_sender(void) const; Description: Returns the sender ID of the current message, according to the datagram headers. This information is not available to the client.

getMsgType unsigned int CConnectionRepository::get_msg_type(void) const; INLINE unsigned char get_sec_code() const; Description: Returns the security code associated with the current message, according to the datagram headers. This information is not available to the client. INLINE unsigned char CConnectionRepository:: get_sec_code() const { return _sec_code; } Description: Returns the type ID of the current message, according to the datagram headers.

getOverflowEventName static string const &CConnectionRepository::get_overflow_event_name(void); Description: Returns event string that will be thrown if the datagram reader queue overflows.

getQcm QueuedConnectionManager &CConnectionRepository::get_qcm(void); Description: Returns the QueuedConnectionManager object associated with the repository.

getQcr QueuedConnectionReader &CConnectionRepository::get_qcr(void); Description: Returns the QueuedConnectionReader object associated with the repository.

getSimulatedDisconnect bool CConnectionRepository::get_simulated_disconnect(void) const; Description: Returns the simulated disconnect flag. While this is true, no datagrams will be retrieved from or sent to the server. The idea is to simulate a temporary network outage.

getStream SocketStream *CConnectionRepository::get_stream(void); Description: Returns the SocketStream that internally represents the already-established HTTP connection. Returns NULL if there is no current HTTP connection.

getVerbose bool CConnectionRepository::get_verbose(void) const; Description: Returns the current setting of the verbose flag. When true, this describes every message going back and forth on the wire.

hasOwnerView bool CConnectionRepository::has_owner_view(void) const; Description: Returns true if this repository can have 'owner' views of distributed objects.

isConnected bool CConnectionRepository::is_connected(void); Description: Returns true if the connection to the gameserver is established and still good, false if we are not connected. A false value means either (a) we never successfully connected, (b) we explicitly called disconnect(), or (c) we were connected, but the connection was spontaneously lost.

sendDatagram bool CConnectionRepository::send_datagram(Datagram const &dg); Description: Queues the indicated datagram for sending to the server. It may not get send immediately if collect_tcp is in effect; call flush() to guarantee it is sent now.

setClientDatagram void CConnectionRepository::set_client_datagram(bool client_datagram); Description: Sets the client_datagram flag. If this is true, incoming datagrams are not expected to be prefixed with the server routing information like message sender, channel number, etc.; otherwise, these server fields are parsed and removed from each incoming datagram.

setConnectionHttp void CConnectionRepository::set_connection_http(HTTPChannel *channel); Description: Once a connection has been established via the HTTP interface, gets the connection and uses it. The supplied HTTPChannel object must have a connection available via get_connection().

setPythonRepository void CConnectionRepository::set_python_repository(PyObject *python_repository); Description: Records the pointer to the Python class that derives from CConnectionRepository. This allows the C++ implementation to directly manipulation some python structures on the repository.

setSimulatedDisconnect void CConnectionRepository::set_simulated_disconnect(bool simulated_disconnect); Description: Sets the simulated disconnect flag. While this is true, no datagrams will be retrieved from or sent to the server. The idea is to simulate a temporary network outage.

setVerbose void CConnectionRepository::set_verbose(bool verbose); Description: Directly sets the verbose flag. When true, this describes every message going back and forth on the wire.

toggleVerbose void CConnectionRepository::toggle_verbose(void); Description: Toggles the current setting of the verbose flag. When true, this describes every message going back and forth on the wire.

tryConnectNspr bool CConnectionRepository::try_connect_nspr(URLSpec const &url); Description: Uses NSPR to try to connect to the server and port named in the indicated URL. Returns true if successful, false otherwise.