tcpflow  1.6.1
About: tcpflow is a TCP/IP packet demultiplexer that captures data transmitted as part of TCP connections (flows), and stores the data in a way that is convenient for protocol analysis and debugging.
  Fossies Dox: tcpflow-1.6.1.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

unicode_escape.cpp File Reference
#include "config.h"
#include "unicode_escape.h"
#include <stdio.h>
#include <assert.h>
#include <iostream>
#include <fstream>
#include "utf8.h"
Include dependency graph for unicode_escape.cpp:

Go to the source code of this file.


#define IS_IN_RANGE(c, f, l)   (((c) >= (f)) && ((c) <= (l)))


std::string hexesc (unsigned char ch)
bool utf8cont (unsigned char ch)
bool valid_utf8codepoint (uint32_t unichar)
std::string validateOrEscapeUTF8 (const std::string &input, bool escape_bad_utf8, bool escape_backslash)


bool validateOrEscapeUTF8_validate =false

Macro Definition Documentation



unicode_escape.cpp: Escape unicode that is not valid.


Simson Garfinkel

The software provided here is released by the Naval Postgraduate School, an agency of the U.S. Department of Navy. The software bears no warranty, either expressed or implied. NPS does not assume legal liability nor responsibility for a User's use of the software or the results of such use.

Please note that within the United States, copyright protection, under Section 105 of the United States Code, Title 17, is not available for any work of the United States Government and/or for any works created by United States Government employees. User acknowledges that this software contains work which was created by NPS government employees and is therefore in the public domain and not subject to copyright.

Definition at line 40 of file unicode_escape.cpp.


#define IS_IN_RANGE (   c,
)    (((c) >= (f)) && ((c) <= (l)))

Definition at line 47 of file unicode_escape.cpp.

Function Documentation

◆ hexesc()

std::string hexesc ( unsigned char  ch)

Definition at line 53 of file unicode_escape.cpp.

Referenced by validateOrEscapeUTF8().

◆ utf8cont()

bool utf8cont ( unsigned char  ch)

returns true if this is a UTF8 continuation character

Definition at line 61 of file unicode_escape.cpp.

Referenced by validateOrEscapeUTF8().

◆ valid_utf8codepoint()

bool valid_utf8codepoint ( uint32_t  unichar)

After a UTF-8 sequence is decided, this function is called to determine if the character is invalid. The UTF-8 spec now says that if a UTF-8 decoding produces an invalid character, or a surrogate, it is not valid. (There were some nasty security vulnerabilities that were exploited before this came out.) So we do a lot of checks here.

Definition at line 74 of file unicode_escape.cpp.

Referenced by validateOrEscapeUTF8().