vrpn 07.35
Virtual Reality Peripheral Network
|
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. More...
#include <vrpn_Connection.h>
Public Member Functions | |
vrpn_Endpoint_IP (vrpn_TypeDispatcher *dispatcher, vrpn_int32 *connectedEndpointCounter) | |
virtual | ~vrpn_Endpoint_IP (void) |
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 |
![]() | |
vrpn_Endpoint (vrpn_TypeDispatcher *dispatcher, vrpn_int32 *connectedEndpointCounter) | |
virtual | ~vrpn_Endpoint (void) |
virtual int | pack_message (vrpn_uint32 len, struct timeval time, vrpn_int32 type, vrpn_int32 sender, const char *buffer, vrpn_uint32 class_of_service)=0 |
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. | |
virtual int | send_pending_reports (void)=0 |
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 | |
int | pack_log_description (void) |
Packs the log description set by setup_new_connection(). | |
virtual int | setup_new_connection (void)=0 |
Sends the magic cookie and other information to its peer. It is called by both the client and server setup routines. | |
virtual void | poll_for_cookie (const timeval *timeout=NULL)=0 |
virtual int | finish_new_connection_setup (void)=0 |
virtual void | drop_connection (void)=0 |
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. | |
virtual void | clearBuffers (void)=0 |
Empties out the TCP and UDP send buffers. Needed by vrpn_FileConnection to get at {udp,tcp}NumOut. | |
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) |
Clear out the remote mapping list. This is done when a connection is dropped and we want to try and re-establish it. | |
int | newLocalSender (const char *name, vrpn_int32 which) |
A new local sender or type has been established; set the local type for it if the other side has declared it. Return 1 if the other side has one, 0 if not. | |
int | newLocalType (const char *name, vrpn_int32 which) |
int | newRemoteType (cName type_name, vrpn_int32 remote_id, vrpn_int32 local_id) |
Adds a new remote type/sender and returns its index. Returns -1 on error. | |
int | newRemoteSender (cName sender_name, vrpn_int32 remote_id, vrpn_int32 local_id) |
void | setConnection (vrpn_Connection *conn) |
vrpn_Connection * | getConnection () |
void | setLogNames (const char *inName, const char *outName) |
int | openLogs (void) |
Manipulators | |
SOCKET | d_tcpSocket |
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. | |
int | d_tcpListenPort |
Socket and port that the client listens on when lobbing datagrams at the server and waiting for it to call back. | |
SOCKET | d_udpLobSocket |
Socket to use to lob UDP requests asking for the server to call us back. | |
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 |
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. | |
SOCKET | d_udpOutboundSocket |
SOCKET | d_udpInboundSocket |
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. | |
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) |
Connects d_tcpSocket to the specified address (msg = "IP port"); sets status to COOKIE_PENDING; returns 0 on success, -1 on failure. | |
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. | |
int | setup_new_connection (void) |
Sends the magic cookie and other information to its peer. It is called by both the client and server setup routines. | |
void | poll_for_cookie (const timeval *timeout=NULL) |
int | finish_new_connection_setup (void) |
void | drop_connection (void) |
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. | |
void | clearBuffers (void) |
Empties out the TCP and UDP send buffers. Needed by vrpn_FileConnection to get at {udp,tcp}NumOut. | |
void | setNICaddress (const char *) |
int | getOneTCPMessage (int fd, char *buf, size_t buflen) |
int | getOneUDPMessage (char *buf, size_t buflen) |
Additional Inherited Members | |
![]() | |
static int VRPN_CALLBACK | handle_sender_message (void *userdata, vrpn_HANDLERPARAM p) |
static int VRPN_CALLBACK | handle_type_message (void *userdata, vrpn_HANDLERPARAM p) |
![]() | |
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_Log * | d_inLog |
vrpn_Log * | d_outLog |
![]() | |
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) |
Calls marshall_message(); if that fails, calls send_pending_reports() and then marshalls again. Returns the number of characters successfully marshalled. | |
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) |
Marshal the message into the buffer if it will fit. | |
![]() | |
vrpn_TranslationTable * | d_senders |
vrpn_TranslationTable * | d_types |
vrpn_TypeDispatcher * | d_dispatcher |
vrpn_int32 * | d_connectionCounter |
vrpn_Connection * | d_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!
Definition at line 422 of file vrpn_Connection.h.
vrpn_Endpoint_IP::vrpn_Endpoint_IP | ( | vrpn_TypeDispatcher * | dispatcher, |
vrpn_int32 * | connectedEndpointCounter | ||
) |
Definition at line 2778 of file vrpn_Connection.C.
References d_tcpBuflen, d_tcpOutbuf, d_udpBuflen, d_udpOutbuf, and init().
|
virtual |
Definition at line 2869 of file vrpn_Connection.C.
References d_remote_machine_name, d_tcpListenSocket, d_tcpNumOut, d_tcpOutbuf, d_tcpSocket, d_udpInboundSocket, d_udpLobSocket, d_udpNumOut, d_udpOutboundSocket, d_udpOutbuf, INVALID_SOCKET, and vrpn_closeSocket.
|
virtual |
Empties out the TCP and UDP send buffers. Needed by vrpn_FileConnection to get at {udp,tcp}NumOut.
Implements vrpn_Endpoint.
Definition at line 3902 of file vrpn_Connection.C.
References d_tcpNumOut, and d_udpNumOut.
Referenced by drop_connection(), send_pending_reports(), and vrpn_File_Connection::send_pending_reports().
int vrpn_Endpoint_IP::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.
Definition at line 3703 of file vrpn_Connection.C.
References BROKEN, COOKIE_PENDING, d_NICaddress, d_tcp_only, d_tcpSocket, SOCK_CAST, vrpn_Endpoint::status, and vrpn_closeSocket.
int vrpn_Endpoint_IP::connect_tcp_to | ( | const char * | msg | ) |
Definition at line 3690 of file vrpn_Connection.C.
References connect_tcp_to().
Referenced by connect_tcp_to(), vrpn_Connection_IP::connect_to_client(), mainloop(), and vrpn_Connection_IP::server_check_for_incoming_connections().
int vrpn_Endpoint_IP::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.
Definition at line 3817 of file vrpn_Connection.C.
References BROKEN, d_NICaddress, d_tcp_only, d_udpOutboundSocket, and vrpn_Endpoint::status.
Referenced by vrpn_Connection_IP::handle_UDP_message().
|
virtual |
Implements vrpn_Endpoint.
Definition at line 2946 of file vrpn_Connection.C.
References LOGGING, vrpn_Endpoint::status, and TRYING_TO_CONNECT.
Referenced by poll_for_cookie().
|
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.
Implements vrpn_Endpoint.
Definition at line 3831 of file vrpn_Connection.C.
References vrpn_Endpoint::clear_other_senders_and_types(), clearBuffers(), vrpn_Log::close(), vrpn_Endpoint::d_connectionCounter, vrpn_Endpoint::d_dispatcher, vrpn_Endpoint::d_outLog, d_tcpNumOut, d_tcpSocket, d_udpInboundSocket, d_udpNumOut, d_udpOutboundSocket, INVALID_SOCKET, vrpn_Log::logMessage(), vrpn_Log::logMode(), vrpn_closeSocket, vrpn_CONNECTION_DISCONNECT_MESSAGE, vrpn_CONTROL, vrpn_dropped_connection, vrpn_dropped_last_connection, and vrpn_gettimeofday.
Referenced by vrpn_File_Connection::reset().
|
virtual |
Implements vrpn_Endpoint.
Definition at line 4028 of file vrpn_Connection.C.
References BROKEN, check_vrpn_cookie(), CONNECTED, vrpn_Endpoint::d_connectionCounter, vrpn_Endpoint::d_dispatcher, vrpn_Endpoint::d_inLog, d_NICaddress, vrpn_Endpoint::d_outLog, d_tcp_only, d_tcpSocket, d_udpInboundSocket, INVALID_SOCKET, vrpn_Log::logMode(), vrpn_Endpoint::pack_log_description(), vrpn_Endpoint::pack_sender_description(), vrpn_Endpoint::pack_type_description(), pack_udp_description(), send_pending_reports(), vrpn_Log::setCookie(), vrpn_Endpoint::status, vrpn_CONTROL, vrpn_COOKIE_SIZE, vrpn_gettimeofday, vrpn_got_connection, vrpn_got_first_connection, vrpn_LOG_INCOMING, vrpn_LOG_OUTGOING, vrpn_MAGICLEN, and vrpn_noint_block_read().
Referenced by poll_for_cookie().
|
protected |
Definition at line 4164 of file vrpn_Connection.C.
References vrpn_Endpoint::d_inLog, vrpn_Endpoint::dispatch(), vrpn_Log::logIncomingMessage(), vrpn_ALIGN, and vrpn_noint_block_read().
Referenced by handle_tcp_messages().
|
protected |
Definition at line 4249 of file vrpn_Connection.C.
References vrpn_Endpoint::d_inLog, vrpn_Endpoint::dispatch(), vrpn_Endpoint::local_type_id(), vrpn_Log::logIncomingMessage(), and vrpn_ALIGN.
Referenced by handle_udp_messages().
int vrpn_Endpoint_IP::handle_tcp_messages | ( | const timeval * | timeout | ) |
Definition at line 3511 of file vrpn_Connection.C.
References vrpn_Endpoint::d_parent, d_tcpAlignedInbuf, d_tcpInbuf, d_tcpSocket, vrpn_Connection::get_Jane_value(), getOneTCPMessage(), and vrpn_noint_select().
Referenced by mainloop().
int vrpn_Endpoint_IP::handle_udp_messages | ( | const timeval * | timeout | ) |
Definition at line 3596 of file vrpn_Connection.C.
References vrpn_Endpoint::d_parent, d_udpAlignedInbuf, d_udpInboundSocket, d_udpInbuf, vrpn_Connection::get_Jane_value(), getOneUDPMessage(), and vrpn_noint_select().
Referenced by mainloop().
void vrpn_Endpoint_IP::init | ( | void | ) |
Definition at line 2969 of file vrpn_Connection.C.
References d_last_connect_attempt, d_tcpListenPort, d_tcpListenSocket, d_tcpSocket, d_udpInboundSocket, d_udpLobSocket, d_udpOutboundSocket, and INVALID_SOCKET.
Referenced by vrpn_Endpoint_IP().
|
virtual |
Implements vrpn_Endpoint.
Definition at line 2983 of file vrpn_Connection.C.
References BROKEN, connect_tcp_to(), CONNECTED, COOKIE_PENDING, d_last_connect_attempt, d_NICaddress, d_remote_machine_name, d_remote_port_number, d_tcp_only, d_tcpListenPort, d_tcpListenSocket, d_tcpSocket, d_udpInboundSocket, d_udpLobSocket, handle_tcp_messages(), handle_udp_messages(), LOGGING, poll_for_cookie(), send_pending_reports(), setup_new_connection(), vrpn_Endpoint::status, TRYING_TO_CONNECT, vrpn_closeSocket, vrpn_gettimeofday, vrpn_noint_select(), vrpn_socket_error, vrpn_socket_error_to_chars, and vrpn_udp_request_lob_packet().
vrpn_bool vrpn_Endpoint_IP::outbound_udp_open | ( | void | ) | const |
True if the UDP outbound is open, False if not.
Definition at line 2927 of file vrpn_Connection.C.
References d_udpOutboundSocket.
|
virtual |
Pack a message that will be sent the next time mainloop() is called.
Pack a message into the appropriate output buffer (TCP or UDP) depending on the class of service for the message, and handle logging for the message (but not filtering).
Turn off the RELIABLE flag if you want low-latency (UDP) send.
This function does not handle semantic checking, local callbacks and filtering. (these must be done in the vrpn_Connection class routine that calls this one).
Parameters: The length of the message, the local-clock time value for the message, the type and sender IDs for the message, the buffer that holds the message contents, and the class of service (currently, only reliable/unreliable is used).
Returns 0 on success and -1 on failure.
Implements vrpn_Endpoint.
Definition at line 3248 of file vrpn_Connection.C.
References CONNECTED, vrpn_Endpoint::d_outLog, d_tcpBuflen, d_tcpNumOut, d_tcpOutbuf, d_tcpSequenceNumber, d_tcpSocket, d_udpBuflen, d_udpNumOut, d_udpOutboundSocket, d_udpOutbuf, d_udpSequenceNumber, LOGGING, vrpn_Log::logOutgoingMessage(), vrpn_Endpoint::status, vrpn_Endpoint::tryToMarshall(), and vrpn_CONNECTION_RELIABLE.
Referenced by pack_udp_description().
int vrpn_Endpoint_IP::pack_udp_description | ( | int | portno | ) |
Definition at line 3414 of file vrpn_Connection.C.
References d_NICaddress, d_tcpSocket, pack_message(), vrpn_CONNECTION_RELIABLE, vrpn_CONNECTION_UDP_DESCRIPTION, and vrpn_gettimeofday.
Referenced by finish_new_connection_setup().
|
virtual |
Implements vrpn_Endpoint.
Definition at line 3966 of file vrpn_Connection.C.
References BROKEN, CONNECTED, d_remote_machine_name, d_tcpSocket, doing_okay(), finish_new_connection_setup(), vrpn_Endpoint::status, and vrpn_noint_select().
Referenced by mainloop(), and setup_new_connection().
|
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
Implements vrpn_Endpoint.
Definition at line 3316 of file vrpn_Connection.C.
References BROKEN, clearBuffers(), d_tcpNumOut, d_tcpOutbuf, d_tcpSocket, d_udpNumOut, d_udpOutboundSocket, d_udpOutbuf, vrpn_Endpoint::status, TRYING_TO_CONNECT, vrpn_noint_select(), vrpn_socket_error, and vrpn_socket_error_to_chars.
Referenced by finish_new_connection_setup(), and mainloop().
void vrpn_Endpoint_IP::setNICaddress | ( | const char * | address | ) |
Definition at line 3908 of file vrpn_Connection.C.
References BROKEN, d_NICaddress, and vrpn_Endpoint::status.
Referenced by vrpn_Connection_IP::server_check_for_incoming_connections().
|
virtual |
Sends the magic cookie and other information to its peer. It is called by both the client and server setup routines.
Implements vrpn_Endpoint.
Definition at line 3936 of file vrpn_Connection.C.
References BROKEN, COOKIE_PENDING, vrpn_Endpoint::d_remoteLogMode, d_tcpSocket, poll_for_cookie(), vrpn_Endpoint::status, vrpn_cookie_size(), vrpn_noint_block_write(), and write_vrpn_cookie().
Referenced by mainloop().
vrpn_int32 vrpn_Endpoint_IP::tcp_outbuf_size | ( | void | ) | const |
Definition at line 2942 of file vrpn_Connection.C.
References d_tcpBuflen.
vrpn_int32 vrpn_Endpoint_IP::udp_outbuf_size | ( | void | ) | const |
Definition at line 2944 of file vrpn_Connection.C.
References d_udpBuflen.
timeval vrpn_Endpoint_IP::d_last_connect_attempt |
When the last UDP lob occurred.
Definition at line 515 of file vrpn_Connection.h.
Referenced by init(), and mainloop().
|
protected |
Definition at line 554 of file vrpn_Connection.h.
Referenced by connect_tcp_to(), connect_udp_to(), finish_new_connection_setup(), mainloop(), pack_udp_description(), and setNICaddress().
char* vrpn_Endpoint_IP::d_remote_machine_name |
Machine to call.
Definition at line 513 of file vrpn_Connection.h.
Referenced by mainloop(), poll_for_cookie(), vrpn_Connection_IP::server_check_for_incoming_connections(), and ~vrpn_Endpoint_IP().
int vrpn_Endpoint_IP::d_remote_port_number |
Port to connect to on remote machine.
Definition at line 514 of file vrpn_Connection.h.
Referenced by mainloop(), and vrpn_Connection_IP::server_check_for_incoming_connections().
vrpn_bool vrpn_Endpoint_IP::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.
Definition at line 517 of file vrpn_Connection.h.
Referenced by connect_tcp_to(), connect_udp_to(), finish_new_connection_setup(), mainloop(), and vrpn_Connection_IP::server_check_for_incoming_connections().
|
protected |
Definition at line 546 of file vrpn_Connection.h.
Referenced by handle_tcp_messages().
|
protected |
Definition at line 537 of file vrpn_Connection.h.
Referenced by pack_message(), tcp_outbuf_size(), and vrpn_Endpoint_IP().
|
protected |
Definition at line 551 of file vrpn_Connection.h.
Referenced by handle_tcp_messages().
int vrpn_Endpoint_IP::d_tcpListenPort |
Socket and port that the client listens on when lobbing datagrams at the server and waiting for it to call back.
Definition at line 504 of file vrpn_Connection.h.
Referenced by init(), and mainloop().
SOCKET vrpn_Endpoint_IP::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.
Definition at line 503 of file vrpn_Connection.h.
Referenced by init(), mainloop(), and ~vrpn_Endpoint_IP().
|
protected |
Definition at line 539 of file vrpn_Connection.h.
Referenced by clearBuffers(), drop_connection(), pack_message(), send_pending_reports(), and ~vrpn_Endpoint_IP().
|
protected |
Definition at line 535 of file vrpn_Connection.h.
Referenced by pack_message(), send_pending_reports(), vrpn_Endpoint_IP(), and ~vrpn_Endpoint_IP().
|
protected |
Definition at line 542 of file vrpn_Connection.h.
Referenced by pack_message().
SOCKET vrpn_Endpoint_IP::d_tcpSocket |
Definition at line 497 of file vrpn_Connection.h.
Referenced by connect_tcp_to(), drop_connection(), finish_new_connection_setup(), handle_tcp_messages(), init(), mainloop(), pack_message(), pack_udp_description(), poll_for_cookie(), send_pending_reports(), vrpn_Connection_IP::server_check_for_incoming_connections(), setup_new_connection(), and ~vrpn_Endpoint_IP().
|
protected |
Definition at line 549 of file vrpn_Connection.h.
Referenced by handle_udp_messages().
|
protected |
Definition at line 538 of file vrpn_Connection.h.
Referenced by pack_message(), udp_outbuf_size(), and vrpn_Endpoint_IP().
|
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.
Definition at line 528 of file vrpn_Connection.h.
Referenced by drop_connection(), finish_new_connection_setup(), handle_udp_messages(), init(), mainloop(), and ~vrpn_Endpoint_IP().
|
protected |
Definition at line 552 of file vrpn_Connection.h.
Referenced by handle_udp_messages().
SOCKET vrpn_Endpoint_IP::d_udpLobSocket |
Socket to use to lob UDP requests asking for the server to call us back.
Definition at line 511 of file vrpn_Connection.h.
Referenced by init(), mainloop(), and ~vrpn_Endpoint_IP().
|
protected |
Definition at line 540 of file vrpn_Connection.h.
Referenced by clearBuffers(), drop_connection(), pack_message(), send_pending_reports(), and ~vrpn_Endpoint_IP().
|
protected |
Definition at line 527 of file vrpn_Connection.h.
Referenced by connect_udp_to(), drop_connection(), init(), outbound_udp_open(), pack_message(), send_pending_reports(), and ~vrpn_Endpoint_IP().
|
protected |
Definition at line 536 of file vrpn_Connection.h.
Referenced by pack_message(), send_pending_reports(), vrpn_Endpoint_IP(), and ~vrpn_Endpoint_IP().
|
protected |
Definition at line 543 of file vrpn_Connection.h.
Referenced by pack_message().