FreeRDP
tpkt.h File Reference
#include "tpdu.h"
#include "transport.h"
#include <winpr/stream.h>
#include <freerdp/api.h>
This graph shows which files directly or indirectly include this file:

Macros

#define TPKT_HEADER_LENGTH   4
 
#define tpkt_ensure_stream_consumed(s, length)   tpkt_ensure_stream_consumed_((s), (length), __func__)
 

Functions

FREERDP_LOCAL int tpkt_verify_header (wStream *s)
 
FREERDP_LOCAL BOOL tpkt_read_header (wStream *s, UINT16 *length)
 
FREERDP_LOCAL BOOL tpkt_write_header (wStream *s, size_t length)
 
FREERDP_LOCAL BOOL tpkt_ensure_stream_consumed_ (wStream *s, size_t length, const char *fkt)
 

Macro Definition Documentation

◆ tpkt_ensure_stream_consumed

#define tpkt_ensure_stream_consumed (   s,
  length 
)    tpkt_ensure_stream_consumed_((s), (length), __func__)

◆ TPKT_HEADER_LENGTH

#define TPKT_HEADER_LENGTH   4

FreeRDP: A Remote Desktop Protocol Implementation Transport Packets (TPKTs)

Copyright 2011 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com

Licensed 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.

Function Documentation

◆ tpkt_ensure_stream_consumed_()

FREERDP_LOCAL BOOL tpkt_ensure_stream_consumed_ ( wStream s,
size_t  length,
const char *  fkt 
)
Here is the call graph for this function:

◆ tpkt_read_header()

FREERDP_LOCAL BOOL tpkt_read_header ( wStream s,
UINT16 length 
)

Read a TPKT header.

Parameters
sA stream to read from
lengthA pointer to the result, must not be NULL
Returns
TRUE for success, FALSE otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tpkt_verify_header()

FREERDP_LOCAL int tpkt_verify_header ( wStream s)

TPKTs are defined in:

http://tools.ietf.org/html/rfc1006/ RFC 1006 - ISO Transport Service on top of the TCP

http://www.itu.int/rec/T-REC-T.123/ ITU-T T.123 (01/2007) - Network-specific data protocol stacks for multimedia conferencing

  TPKT Header

____________________ byte | | | 3 (version) | 1 |____________________| | | | Reserved | 2 |____________________| | | | Length (MSB) | 3 |____________________| | | | Length (LSB) | 4 |____________________| | | | X.224 TPDU | 5 - ? ....

A TPKT header is of fixed length 4, and the following X.224 TPDU is at least three bytes long. Therefore, the minimum TPKT length is 7, and the maximum TPKT length is 65535. Because the TPKT length includes the TPKT header (4 bytes), the maximum X.224 TPDU length is 65531. Verify if a packet has valid TPKT header.

Parameters
sA stream to read from
Returns
TRUE for success, FALSE otherwise
Here is the caller graph for this function:

◆ tpkt_write_header()

FREERDP_LOCAL BOOL tpkt_write_header ( wStream s,
size_t  length 
)

Write a TPKT header.

Parameters
sA stream to write to
lengthThe value to write
Returns
TRUE for success, FALSE otherwise
Here is the call graph for this function:
Here is the caller graph for this function: