Click here to Skip to main content
15,892,737 members
Articles / Desktop Programming / MFC

Build your own cryptographically safe server/client protocol

Rate me:
Please Sign up or sign in to vote.
4.95/5 (125 votes)
21 Jun 2006CPOL37 min read 396.4K   22.3K   380  
This article presents all you need to implement your own secure protocol using variable keysize RSA encryption/decryption, digital signing, multi precision library, Diffie-Hellman key exchange, Rijndael, and more. Everything is converged into a secure IOCP client/server chat server.
#if !defined(AFX_SQLLISTCTRL_H__DEBCFBF5_0237_4D9B_8C17_E70FE11ECFB6__INCLUDED_)
#define AFX_SQLLISTCTRL_H__DEBCFBF5_0237_4D9B_8C17_E70FE11ECFB6__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// SqlListCtrl.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// MyListCtrl window


#include "HistoryEdit.h"


#ifndef __LIST_ITEMINFO
#define __LIST_ITEMINFO

/*
*	Structure to contain the list data. 
*/


typedef struct tagITEMINFO { 
	unsigned int m_ID;
    CString  m_sClientAddress;
	int m_iListIndex; // to Know what index the item has in the list.  
	int m_iNumberOfReceivedMsg;
	CString m_sName;
}ITEMINFO;

#endif




class MyListCtrl : public CListCtrl
{
// Construction
public:
	MyListCtrl();

// Attributes
public:

// Operations
public:


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(MyListCtrl)
	//}}AFX_VIRTUAL

// Implementation
public:
	BOOL Select(int index);
	BOOL FreeItem(int Index);
	void ReSort();
	

	BOOL SetHeaderIcon(int iIndex,int iPictureIndex);
	ITEMINFO* Find(CString ID);
	ITEMINFO* Select(CString ID);
	void SetIconSize(int x,int y);
	//BOOL DBLoadIcon();
	//BOOL DBLoadData(CString kategori="");

//	BOOL SqlInit(CString username,CString password,CString  hostadress,int Listtype, CHistoryEdit *logg=NULL);
	BOOL DeleteSelectedItem();
   

	BOOL init();

	ITEMINFO* GetSelectedItem();
	BOOL DeleteAllItems();
	static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
	static int CALLBACK CompareFunc2(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
	BOOL FreeListItems();
	int AddItemToList(int nIndex,int iImage=0, ITEMINFO *pItem=NULL);
	int AddItemToList(ITEMINFO *pItem, int iImage=0);
	virtual ~MyListCtrl();
	//
	// Data base functions
	//
	//BYTE* DBLoadImage(Connection *con,long* size,CString stable,CString sblobfield,CString sKeyField,CString sKey);

	// Generated message map functions
protected:
	
	// Header and Column managment 
	// Current column nr which we sort by.
	int m_iCurrentSortColumn;
	int m_iNumberOfColumns;

	int m_iColumnWidthArray[10];
	// The Image List for the columns.
	CImageList m_HeaderImages;
	// The dirrection of the sort. 
	int m_sortdirection;
	
	// Other configs 
	int m_ListType;
	CImageList m_ImageListThumb;

	// The size of the icons
	int m_IconWidth;
	int m_IconHeight;
	BOOL m_ShowIcons;
	//{{AFX_MSG(MyListCtrl)
	afx_msg void OnDestroy();
	afx_msg void OnGetdispinfo(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnCustomdraw( NMHDR* pNMHDR, LRESULT* pResult );
	afx_msg void OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()
private:
	void ResizeColumns(int cx=-1);
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_SQLLISTCTRL_H__DEBCFBF5_0237_4D9B_8C17_E70FE11ECFB6__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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Program Manager
Sweden Sweden
Amin Gholiha.
Education:
- Master of Science in Information Technology.
- Degree of Master of Education.
Knowledge/interest: programming (.NET,Visual, C#/C++), neural network, mathematical modeling, signal processing, sequence analysis, pattern recognition,robot technology, system design, security and business management systems. For business proposal email Gholiha@rocketmail.com, all other emails will be ignored.
Current Work:
Project Manager
www.easysoft.nu (the best free e-signature tool)

Comments and Discussions