Click here to Skip to main content
15,893,790 members
Articles / Desktop Programming / ATL

En/Decode MIME-Content with MimeSniffer

Rate me:
Please Sign up or sign in to vote.
4.88/5 (26 votes)
2 Dec 20022 min read 376.3K   7K   74  
RFC-compliant Mime-En/Decoder
// ClientSocket.h : Declaration of the CClientSocket

#ifndef __CLIENTSOCKET_H_
#define __CLIENTSOCKET_H_

#include "resource.h"       // main symbols

/////////////////////////////////////////////////////////////////////////////
// CClientSocket
class ATL_NO_VTABLE CClientSocket : 
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CClientSocket, &CLSID_ClientSocket>,
	public ISupportErrorInfo,
	public IDispatchImpl<IClientSocket, &IID_IClientSocket, &LIBID_MIMESNIFFERLib>,
	public IStream
{
public:
	CClientSocket()
	{
		ATLTRACE(_T("CClientSocket()\n"));
	}
	virtual ~CClientSocket()
	{
		ATLTRACE(_T("~CClientSocket()\n"));
	}

DECLARE_REGISTRY_RESOURCEID(IDR_CLIENTSOCKET)
DECLARE_NOT_AGGREGATABLE(CClientSocket)

DECLARE_PROTECT_FINAL_CONSTRUCT()

BEGIN_COM_MAP(CClientSocket)
	COM_INTERFACE_ENTRY(IClientSocket)
	COM_INTERFACE_ENTRY(IDispatch)
	COM_INTERFACE_ENTRY(ISupportErrorInfo)
	COM_INTERFACE_ENTRY(IStream)
END_COM_MAP()

// ISupportsErrorInfo
	STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);

//	IStream
    STDMETHODIMP Read( 
            /* [out] */ void __RPC_FAR *pv,
            /* [in] */ ULONG cb,
            /* [out] */ ULONG __RPC_FAR *pcbRead);
    STDMETHODIMP Write( 
            /* [in] */ const void __RPC_FAR *pv,
            /* [in] */ ULONG cb,
            /* [out] */ ULONG __RPC_FAR *pcbWritten);

	STDMETHODIMP Seek( 
            /* [in] */ LARGE_INTEGER dlibMove,
            /* [in] */ DWORD dwOrigin,
            /* [out] */ ULARGE_INTEGER __RPC_FAR *plibNewPosition)
	{
		return E_NOTIMPL;
	}
        
    STDMETHODIMP SetSize( 
        /* [in] */ ULARGE_INTEGER libNewSize)
	{
		return E_NOTIMPL;
	}
    
    STDMETHODIMP CopyTo( 
        /* [unique][in] */ IStream __RPC_FAR *pstm,
        /* [in] */ ULARGE_INTEGER cb,
        /* [out] */ ULARGE_INTEGER __RPC_FAR *pcbRead,
        /* [out] */ ULARGE_INTEGER __RPC_FAR *pcbWritten)
	{
		return E_NOTIMPL;
	}

    
    STDMETHODIMP Commit( 
        /* [in] */ DWORD grfCommitFlags)  
	{
		return E_NOTIMPL;
	}
    
    STDMETHODIMP Revert( void)  
	{
		return E_NOTIMPL;
	}
    
    STDMETHODIMP LockRegion( 
        /* [in] */ ULARGE_INTEGER libOffset,
        /* [in] */ ULARGE_INTEGER cb,
        /* [in] */ DWORD dwLockType)  
	{
		return E_NOTIMPL;
	}
    
    STDMETHODIMP UnlockRegion( 
        /* [in] */ ULARGE_INTEGER libOffset,
        /* [in] */ ULARGE_INTEGER cb,
        /* [in] */ DWORD dwLockType)  
	{
		return E_NOTIMPL;
	}
    
    STDMETHODIMP Stat( 
        /* [out] */ STATSTG __RPC_FAR *pstatstg,
        /* [in] */ DWORD grfStatFlag)  
	{
		return E_NOTIMPL;
	}
    
    STDMETHODIMP Clone( 
        /* [out] */ IStream __RPC_FAR *__RPC_FAR *ppstm)
	{
		return E_NOTIMPL;
	}

// IClientSocket
public:
	STDMETHOD(GetResultSMTP)(/*[out,retval]*/ VARIANT_BOOL* pbvarResult);
	STDMETHOD(PrepareSMTP)(/*[in]*/ LPDISPATCH pDecoder, /*[out,retval]*/ VARIANT_BOOL* pbvarResult);
	STDMETHOD(DisconnectSMTP)(/*[out, retval]*/ VARIANT_BOOL* pRet);
	STDMETHOD(ConnectSMTP)(/*[in]*/ BSTR strServer, /*[in,default=25]*/ long nPort, /*[out, retval]*/ VARIANT_BOOL* pRet);
};

#endif //__CLIENTSOCKET_H_

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.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions