wolfExamples.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef _WOLFEXAMPLES_H_
  2. #define _WOLFEXAMPLES_H_
  3. #include <rt.h>
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. // support functions for all threads
  8. BOOLEAN Catalog(RTHANDLE hProcess, RTHANDLE hObject, LPSTR lpszName);
  9. void Cleanup(void);
  10. void Fail(LPSTR lpszMessage, ...);
  11. DWORD UsecsToKticks(DWORD dwUsecs);
  12. /* Example API's */
  13. int wolfExample_TLSServer(int port);
  14. int wolfExample_TLSClient(const char* ip, int port);
  15. int wolfExample_TLSLocal(int port);
  16. // global type definitions
  17. typedef enum {
  18. BEFORE_INIT,
  19. INIT_BUSY,
  20. INIT_DONE,
  21. CLEANUP_BUSY
  22. } INIT_STATE;
  23. typedef struct {
  24. RTHANDLE hMain; // RTHANDLE of main thread
  25. INIT_STATE state; // main thread state
  26. BOOLEAN bCataloged; // TRUE if we cataloged process name in root
  27. BOOLEAN bShutdown; // TRUE if all threads have to terminate
  28. } INIT_STRUCT;
  29. // global variables
  30. extern RTHANDLE hRootProcess; // RTHANDLE of root process
  31. extern DWORD dwKtickInUsecs; // length of one low level tick in usecs
  32. extern INIT_STRUCT gInit; // structure describing all global objects
  33. #ifdef __cplusplus
  34. } /* extern "C" */
  35. #endif
  36. #endif /* _WOLFEXAMPLES_H_ */