- ultimatetcp-ip42_samples.zip
- Ultimate TCP-IP
- ActiveX
- BuildAll
- MinDependency_Dlls
- MinDependency_EvalDlls
- UTDns
- UTFinger
- UTFingerServ
- utftp
- utftpserv
- UTHistory
- uthttp
- UTImap4
- UTMail
- UTMailServ
- UTMsg
- UTNntp
- utping
- UTSocket
- Demos
- Examples
- Client
- ASP
- MFC
- Imap4
- Nntp
- SDK
- DNS
- Finger
- Ftp
- History
- Http
- Mail
- MX Lookup
- Ping
- UDP
- VisualBasic
- Dns
- Finger
- Ftp
- History
- Http
- Imap4
- Mail
- MartsMail
- Nntp
- Ping
- Socket
- UDPSocket
- Master.dsw
- Master.sln
- Server
- ASP
- MFC
- SampleServer
- SDK
- AccessControlServerDemo
- Finger
- Ftp
- Http
- Mail
- VisualBasic
- service
- svrtest
- Security
- Examples
- Client
- Echo
- FTPs
- Https
- Imap4s
- Mail
- MasterS.dsw
- MasterS.sln
- Server
- Echo
- FTPs
- Https
- Mail
- Test_Del
- Util
- CertManager
- ultimatetcp-ip42_docs.zip
- ultimatetcp-ip42_src.zip
- Include
|
// =================================================================
// class: CUT_HeaderEncoding
// File: UT_HeaderEncoding.h
//
// Purpose:
//
// RFC 2047: MIME Part III. Message Header Extensions for Non-ASCII Text
//
// ===================================================================
// Ultimate TCP/IP v4.2
// This software along with its related components, documentation and files ("The Libraries")
// is � 1994-2007 The Code Project (1612916 Ontario Limited) and use of The Libraries is
// governed by a software license agreement ("Agreement"). Copies of the Agreement are
// available at The Code Project (www.codeproject.com), as part of the package you downloaded
// to obtain this file, or directly from our office. For a copy of the license governing
// this software, you may contact us at legalaffairs@codeproject.com, or by calling 416-849-8900.
// ===================================================================
#if !defined(AFX_UT_HEADERENCODING_H__5E5288CB_0EEC_11D4_A59B_0080C858F182__INCLUDED_)
#define AFX_UT_HEADERENCODING_H__5E5288CB_0EEC_11D4_A59B_0080C858F182__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define MAX_CHARSET_SIZE 40 // v4.2 added - was hard coded in Decode fn
// from RFC 1700 40 ASCII chars, case insensitive
typedef enum enumEncodingType
{
ENCODING_BASE64,
ENCODING_QUOTED_PRINTABLE,
ENCODING_NONE
};
class CUT_HeaderEncoding
{
private:
char m_szBase64Table[128]; // Buffer to hold the base64 character table
LPSTR m_lpszEncodedBuffer; // Encoded header text buffer
LPSTR m_lpszDecodedBuffer; // Decoded header text buffer
LPSTR m_lpszCharSetBuffer; // Decoded char set buffer
int m_nLastError; // Last error code
// Encoding helper functions
void EncodeBase64Bytes(unsigned char *in,unsigned char *out, int count);
void EncodeBase64(LPCSTR lpszHeader, LPCSTR lpszCharSet);
void EncodeQuotedPrintable(LPCSTR lpszHeader, LPCSTR lpszCharSet);
UCHAR FindBase64Val(char character);
int DecodeBase64Bytes(unsigned char *in, unsigned char *out);
int DecodeBase64(LPCSTR lpszHeader, LPSTR lpszBuffer, int nBufferSize);
long HexToDec(char *hexVal, int numDigits);
int DecodeQuotedPrintable(LPCSTR lpszText, LPSTR lpszBuffer, int nBufferSize);
public:
CUT_HeaderEncoding();
virtual ~CUT_HeaderEncoding();
// Encode the message header text
virtual LPCSTR Encode(LPCSTR lpszText, LPCSTR lpszCharSet, enumEncodingType EncodingType = ENCODING_QUOTED_PRINTABLE);
// Decode the message header text
virtual LPCSTR Decode(LPCSTR lpszText, LPSTR lpszCharSet);
// Return the last error code
virtual int GetLastError() { return m_nLastError; }
virtual BOOL IsEncoded(LPCSTR lpszText);
};
#endif // !defined(AFX_UT_HEADERENCODING_H__5E5288CB_0EEC_11D4_A59B_0080C858F182__INCLUDED_)
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
In January 2005, David Cunningham and Chris Maunder created TheUltimateToolbox.com, a new group dedicated to the continued development, support and growth of Dundas Software’s award winning line of MFC, C++ and ActiveX control products.
Ultimate Grid for MFC, Ultimate Toolbox for MFC, and Ultimate TCP/IP have been stalwarts of C++/MFC development for a decade. Thousands of developers have used these products to speed their time to market, improve the quality of their finished products, and enhance the reliability and flexibility of their software.