RflySimSDK v4.01
RflySimSDK说明文档
载入中...
搜索中...
未找到
vrpn_Endpoint_IP类 参考

Encapsulation of the data and methods for a single IP-based connection to take care of one part of many clients talking to a single server. 更多...

#include <vrpn_Connection.h>

类 vrpn_Endpoint_IP 继承关系图:
vrpn_Endpoint_IP 的协作图:

Public 成员函数

 vrpn_Endpoint_IP (vrpn_TypeDispatcher *dispatcher, vrpn_int32 *connectedEndpointCounter)
Accessors
virtual vrpn_bool doing_okay (void) const
vrpn_bool outbound_udp_open (void) const
 True if the UDP outbound is open, False if not.
vrpn_int32 tcp_outbuf_size (void) const
vrpn_int32 udp_outbuf_size (void) const
Public 成员函数 继承自 vrpn_Endpoint
 vrpn_Endpoint (vrpn_TypeDispatcher *dispatcher, vrpn_int32 *connectedEndpointCounter)
int pack_log_description (void)
 Packs the log description set by setup_new_connection().
int pack_sender_description (vrpn_int32 which)
 Packs a sender description over our socket.
int pack_type_description (vrpn_int32 which)
 Packs a type description.
int local_type_id (vrpn_int32 remote_type) const
 Returns the local mapping for the remote type (-1 if none).
int local_sender_id (vrpn_int32 remote_sender) const
 Returns the local mapping for the remote sender (-1 if none).
void init (void)
void clear_other_senders_and_types (void)
int newLocalSender (const char *name, vrpn_int32 which)
int newLocalType (const char *name, vrpn_int32 which)
int newRemoteType (vrpn_CNAME type_name, vrpn_int32 remote_id, vrpn_int32 local_id)
int newRemoteSender (vrpn_CNAME sender_name, vrpn_int32 remote_id, vrpn_int32 local_id)
void setConnection (vrpn_Connection *conn)
vrpn_ConnectiongetConnection ()
void setLogNames (const char *inName, const char *outName)
int openLogs (void)

Manipulators

vrpn_SOCKET d_tcpSocket
vrpn_SOCKET d_tcpListenSocket
int d_tcpListenPort
vrpn_SOCKET d_udpLobSocket
char * d_remote_machine_name
 Machine to call
int d_remote_port_number
 Port to connect to on remote machine
timeval d_last_connect_attempt
 When the last UDP lob occurred
vrpn_bool d_tcp_only
vrpn_SOCKET d_udpOutboundSocket
vrpn_SOCKET d_udpInboundSocket
char * d_tcpOutbuf
char * d_udpOutbuf
vrpn_int32 d_tcpBuflen
vrpn_int32 d_udpBuflen
vrpn_int32 d_tcpNumOut
vrpn_int32 d_udpNumOut
vrpn_int32 d_tcpSequenceNumber
vrpn_int32 d_udpSequenceNumber
vrpn_float64 d_tcpAlignedInbuf [vrpn_CONNECTION_TCP_BUFLEN/sizeof(vrpn_float64)+1]
vrpn_float64 d_udpAlignedInbuf [vrpn_CONNECTION_UDP_BUFLEN/sizeof(vrpn_float64)+1]
char * d_tcpInbuf
char * d_udpInbuf
char * d_NICaddress
void init (void)
int mainloop (timeval *timeout)
int pack_message (vrpn_uint32 len, struct timeval time, vrpn_int32 type, vrpn_int32 sender, const char *buffer, vrpn_uint32 class_of_service)
 Pack a message that will be sent the next time mainloop() is called.
virtual int send_pending_reports (void)
 send pending report, clear the buffer.
int pack_udp_description (int portno)
int handle_tcp_messages (const timeval *timeout)
int handle_udp_messages (const timeval *timeout)
int connect_tcp_to (const char *msg)
int connect_tcp_to (const char *addr, int port)
int connect_udp_to (const char *addr, int port)
int setup_new_connection (void)
void poll_for_cookie (const timeval *timeout=NULL)
int finish_new_connection_setup (void)
void drop_connection (void)
void clearBuffers (void)
void setNICaddress (const char *)
int getOneTCPMessage (int fd, char *buf, size_t buflen)
int getOneUDPMessage (char *buf, size_t buflen)

额外继承的成员函数

静态 Public 成员函数 继承自 vrpn_Endpoint
static int VRPN_CALLBACK handle_sender_message (void *userdata, vrpn_HANDLERPARAM p)
static int VRPN_CALLBACK handle_type_message (void *userdata, vrpn_HANDLERPARAM p)
Public 属性 继承自 vrpn_Endpoint
int status
long d_remoteLogMode
 Mode to put the remote logging in
char * d_remoteInLogName
 Name of the remote log file
char * d_remoteOutLogName
 Name of the remote log file
char rhostname [150]
vrpn_Logd_inLog
vrpn_Logd_outLog
Protected 成员函数 继承自 vrpn_Endpoint
virtual int dispatch (vrpn_int32 type, vrpn_int32 sender, timeval time, vrpn_uint32 payload_len, char *bufptr)
int tryToMarshall (char *outbuf, vrpn_int32 &buflen, vrpn_int32 &numOut, vrpn_uint32 len, timeval time, vrpn_int32 type, vrpn_int32 sender, const char *buffer, vrpn_uint32 classOfService)
int marshall_message (char *outbuf, vrpn_uint32 outbuf_size, vrpn_uint32 initial_out, vrpn_uint32 len, struct timeval time, vrpn_int32 type, vrpn_int32 sender, const char *buffer, vrpn_uint32 sequenceNumber)
Protected 属性 继承自 vrpn_Endpoint
vrpn_TranslationTable * d_senders
vrpn_TranslationTable * d_types
vrpn_TypeDispatcher * d_dispatcher
vrpn_int32 * d_connectionCounter
vrpn_Connectiond_parent

详细描述

Encapsulation of the data and methods for a single IP-based connection to take care of one part of many clients talking to a single server.

This will only be used from within the vrpn_Connection_IP class; it should not be instantiated by users or devices. Should not be visible!

成员函数说明

◆ clearBuffers()

void clearBuffers ( void )
virtual

Empties out the TCP and UDP send buffers. Needed by vrpn_FileConnection to get at {udp,tcp}NumOut.

实现了 vrpn_Endpoint.

◆ connect_tcp_to()

int connect_tcp_to ( const char * addr,
int port )

Connects d_tcpSocket to the specified address (msg = "IP port"); sets status to COOKIE_PENDING; returns 0 on success, -1 on failure

◆ connect_udp_to()

int connect_udp_to ( const char * addr,
int port )

Connects d_udpSocket to the specified address and port; returns 0 on success, sets status to BROKEN and returns -1 on failure.

◆ doing_okay()

virtual vrpn_bool doing_okay ( void ) const
virtual

实现了 vrpn_Endpoint.

◆ drop_connection()

void drop_connection ( void )
virtual

Should only be called by vrpn_Connection::drop_connection(), since there's more housecleaning to do at that level. I suppose that argues against separating this function out.

实现了 vrpn_Endpoint.

◆ finish_new_connection_setup()

int finish_new_connection_setup ( void )
virtual

实现了 vrpn_Endpoint.

◆ mainloop()

int mainloop ( timeval * timeout)
virtual

实现了 vrpn_Endpoint.

◆ outbound_udp_open()

vrpn_bool outbound_udp_open ( void ) const

True if the UDP outbound is open, False if not.

◆ pack_message()

int pack_message ( vrpn_uint32 len,
struct timeval time,
vrpn_int32 type,
vrpn_int32 sender,
const char * buffer,
vrpn_uint32 class_of_service )
virtual

Pack a message that will be sent the next time mainloop() is called.

Turn off the RELIABLE flag if you want low-latency (UDP) send.

实现了 vrpn_Endpoint.

◆ poll_for_cookie()

void poll_for_cookie ( const timeval * timeout = NULL)
virtual

实现了 vrpn_Endpoint.

◆ send_pending_reports()

virtual int send_pending_reports ( void )
virtual

send pending report, clear the buffer.

This function was protected, now is public, so we can use it to send out intermediate results without calling mainloop

实现了 vrpn_Endpoint.

◆ setup_new_connection()

int setup_new_connection ( void )
virtual

Sends the magic cookie and other information to its peer. It is called by both the client and server setup routines.

实现了 vrpn_Endpoint.

类成员变量说明

◆ d_last_connect_attempt

timeval d_last_connect_attempt

When the last UDP lob occurred

◆ d_remote_machine_name

char* d_remote_machine_name

Machine to call

◆ d_remote_port_number

int d_remote_port_number

Port to connect to on remote machine

◆ d_tcp_only

vrpn_bool d_tcp_only

For connections made through firewalls or NAT with the tcp: URL, we do not want to allow the endpoints on either end to open a UDP link to their counterparts. If this is the case, then this flag should be set to true.

◆ d_tcpListenPort

int d_tcpListenPort

Socket and port that the client listens on when lobbing datagrams at the server and waiting for it to call back.

◆ d_tcpListenSocket

vrpn_SOCKET d_tcpListenSocket

This section deals with when a client connection is trying to establish (or re-establish) a connection with its server. It keeps track of what we need to know to make this happen.

◆ d_tcpSocket

vrpn_SOCKET d_tcpSocket
待办事项
XXX These should be protected; making them so will lead to making the code split the functions between Endpoint and Connection protected:

◆ d_udpInboundSocket

vrpn_SOCKET d_udpInboundSocket
protected

Inbound unreliable messages come here. Need one for each due to different clock synchronization for each; we need to know which server each message is from.

待办事项
XXX Now that we don't need multiple clocks, can we collapse this?

◆ d_udpLobSocket

vrpn_SOCKET d_udpLobSocket

Socket to use to lob UDP requests asking for the server to call us back.


该类的文档由以下文件生成: