ServerDlg.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // ServerDlg.h : header file
  2. //
  3. #pragma once
  4. #include "afxwin.h"
  5. #include "../../../Src/SSLServer.h"
  6. #include "../../Global/helper.h"
  7. // CServerDlg dialog
  8. class CServerDlg : public CDialogEx, public CTcpServerListener
  9. {
  10. // Construction
  11. public:
  12. CServerDlg(CWnd* pParent = NULL); // standard constructor
  13. // Dialog Data
  14. enum { IDD = IDD_SERVER_DIALOG };
  15. protected:
  16. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  17. virtual BOOL PreTranslateMessage(MSG* pMsg);
  18. // Implementation
  19. protected:
  20. HICON m_hIcon;
  21. // Generated message map functions
  22. virtual BOOL OnInitDialog();
  23. afx_msg void OnPaint();
  24. afx_msg HCURSOR OnQueryDragIcon();
  25. afx_msg void OnBnClickedStart();
  26. afx_msg void OnBnClickedStop();
  27. afx_msg void OnBnClickedDisconnect();
  28. afx_msg void OnEnChangeConnId();
  29. afx_msg LRESULT CServerDlg::OnUserInfoMsg(WPARAM wp, LPARAM lp);
  30. afx_msg int OnVKeyToItem(UINT nKey, CListBox* pListBox, UINT nIndex);
  31. DECLARE_MESSAGE_MAP()
  32. public:
  33. void SetAppState(EnAppState state);
  34. private:
  35. virtual EnHandleResult OnPrepareListen(SOCKET soListen);
  36. virtual EnHandleResult OnAccept(CONNID dwConnID, SOCKET soClient);
  37. virtual EnHandleResult OnHandShake(CONNID dwConnID);
  38. virtual EnHandleResult OnSend(CONNID dwConnID, const BYTE* pData, int iLength);
  39. virtual EnHandleResult OnReceive(CONNID dwConnID, const BYTE* pData, int iLength);
  40. virtual EnHandleResult OnClose(CONNID dwConnID, EnSocketOperation enOperation, int iErrorCode);
  41. virtual EnHandleResult OnShutdown();
  42. private:
  43. CListBox m_Info;
  44. CButton m_Start;
  45. CButton m_Stop;
  46. CEdit m_Address;
  47. CEdit m_ConnID;
  48. CButton m_DisConn;
  49. EnAppState m_enState;
  50. private:
  51. static const USHORT PORT;
  52. static const LPCTSTR ADDRESS;
  53. CString m_strAddress;
  54. CSSLServer m_Server;
  55. };