server_http_on_windows.go 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. //go:build windows
  2. package yu_hpsocket
  3. import (
  4. yu_strings "gogs.qqck.cn/s/tools/strings"
  5. "syscall"
  6. )
  7. func init() {
  8. server_http_callback_OnMessageBegin_ptr = syscall.NewCallback(server_http_callback_OnMessageBegin)
  9. server_http_callback_OnRequestLine_ptr = syscall.NewCallback(server_http_callback_OnRequestLine)
  10. server_http_callback_OnHeader_ptr = syscall.NewCallback(server_http_callback_OnHeader)
  11. server_http_callback_OnHeadersComplete_ptr = syscall.NewCallback(server_http_callback_OnHeadersComplete)
  12. server_http_callback_OnBody_ptr = syscall.NewCallback(server_http_callback_OnBody)
  13. server_http_callback_OnChunkHeader_ptr = syscall.NewCallback(server_http_callback_OnChunkHeader)
  14. server_http_callback_OnChunkComplete_ptr = syscall.NewCallback(server_http_callback_OnChunkComplete)
  15. server_http_callback_OnMessageComplete_ptr = syscall.NewCallback(server_http_callback_OnMessageComplete)
  16. server_http_callback_OnUpgrade_ptr = syscall.NewCallback(server_http_callback_OnUpgrade)
  17. server_http_callback_OnParseError_ptr = syscall.NewCallback(server_http_callback_OnParseError)
  18. server_http_callback_OnWSMessageHeader_ptr = syscall.NewCallback(server_http_callback_OnWSMessageHeader)
  19. server_http_callback_OnWSMessageBody_ptr = syscall.NewCallback(server_http_callback_OnWSMessageBody)
  20. server_http_callback_OnWSMessageComplete_ptr = syscall.NewCallback(server_http_callback_OnWSMessageComplete)
  21. }
  22. var (
  23. server_http_callback_OnMessageBegin_ptr uintptr
  24. server_http_callback_OnRequestLine_ptr uintptr
  25. server_http_callback_OnHeader_ptr uintptr
  26. server_http_callback_OnHeadersComplete_ptr uintptr
  27. server_http_callback_OnBody_ptr uintptr
  28. server_http_callback_OnChunkHeader_ptr uintptr
  29. server_http_callback_OnChunkComplete_ptr uintptr
  30. server_http_callback_OnMessageComplete_ptr uintptr
  31. server_http_callback_OnUpgrade_ptr uintptr
  32. server_http_callback_OnParseError_ptr uintptr
  33. server_http_callback_OnWSMessageHeader_ptr uintptr
  34. server_http_callback_OnWSMessageBody_ptr uintptr
  35. server_http_callback_OnWSMessageComplete_ptr uintptr
  36. )
  37. func server_http_callback_OnMessageBegin(Sender, ConnID uintptr) HPR {
  38. switch j_item := _server_on_get(Sender); j_item._type {
  39. case _server_type_HttpServer:
  40. t := j_item.t.(*HttpServer)
  41. return t.onMessageBegin(t, Sender, ConnID)
  42. }
  43. return HPR_OK
  44. }
  45. func server_http_callback_OnRequestLine(Sender, ConnID, Method, Url uintptr) HPR {
  46. switch j_item := _server_on_get(Sender); j_item._type {
  47. case _server_type_HttpServer:
  48. t := j_item.t.(*HttpServer)
  49. return t.onRequestLine(t, Sender, ConnID, yu_strings.GbkPtrToUtf8(Method), yu_strings.GbkPtrToUtf8(Url))
  50. }
  51. return HPR_OK
  52. }
  53. func server_http_callback_OnHeader(Sender, ConnID, Name, Value uintptr) HPR {
  54. // switch j_item := _server_on_get(Sender); j_item._type {
  55. // case _server_type_HttpServer:
  56. // t := j_item.t.(*HttpServer)
  57. // return t.onHeader(t, Sender, ConnID, yu_strings.GbkPtrToUtf8(Name), yu_strings.GbkPtrToUtf8(Value))
  58. // }
  59. return HPR_OK
  60. }
  61. func server_http_callback_OnHeadersComplete(Sender, ConnID uintptr) HPR {
  62. switch j_item := _server_on_get(Sender); j_item._type {
  63. case _server_type_HttpServer:
  64. t := j_item.t.(*HttpServer)
  65. return t.onHeadersComplete(t, Sender, ConnID)
  66. }
  67. return HPR_OK
  68. }
  69. func server_http_callback_OnBody(Sender, ConnID, Data uintptr, Length uintptr) HPR {
  70. switch j_item := _server_on_get(Sender); j_item._type {
  71. case _server_type_HttpServer:
  72. t := j_item.t.(*HttpServer)
  73. return t.onBody(t, Sender, ConnID, Data, Length)
  74. }
  75. return HPR_OK
  76. }
  77. func server_http_callback_OnChunkHeader(Sender, ConnID uintptr, Length uintptr) HPR {
  78. switch j_item := _server_on_get(Sender); j_item._type {
  79. case _server_type_HttpServer:
  80. t := j_item.t.(*HttpServer)
  81. return t.onChunkHeader(t, Sender, ConnID, Length)
  82. }
  83. return HPR_OK
  84. }
  85. func server_http_callback_OnChunkComplete(Sender, ConnID uintptr) HPR {
  86. switch j_item := _server_on_get(Sender); j_item._type {
  87. case _server_type_HttpServer:
  88. t := j_item.t.(*HttpServer)
  89. return t.onChunkComplete(t, Sender, ConnID)
  90. }
  91. return HPR_OK
  92. }
  93. func server_http_callback_OnMessageComplete(Sender, ConnID uintptr) HPR {
  94. switch j_item := _server_on_get(Sender); j_item._type {
  95. case _server_type_HttpServer:
  96. t := j_item.t.(*HttpServer)
  97. return t.onMessageComplete(t, Sender, ConnID)
  98. }
  99. return HPR_OK
  100. }
  101. func server_http_callback_OnUpgrade(Sender, ConnID uintptr, UpgradeType HUT) HPR {
  102. switch j_item := _server_on_get(Sender); j_item._type {
  103. case _server_type_HttpServer:
  104. t := j_item.t.(*HttpServer)
  105. return t.onUpgrade(t, Sender, ConnID, UpgradeType)
  106. }
  107. return HPR_OK
  108. }
  109. func server_http_callback_OnParseError(Sender, ConnID uintptr, ErrorCode int, ErrorDesc uintptr) HPR {
  110. switch j_item := _server_on_get(Sender); j_item._type {
  111. case _server_type_HttpServer:
  112. t := j_item.t.(*HttpServer)
  113. return t.onParseError(t, Sender, ConnID, ErrorCode, yu_strings.GbkPtrToUtf8(ErrorDesc))
  114. }
  115. return HPR_OK
  116. }
  117. func server_http_callback_OnWSMessageBody(Sender, ConnID, Data uintptr, Length uintptr) HR {
  118. switch j_item := _server_on_get(Sender); j_item._type {
  119. case _server_type_HttpServer:
  120. t := j_item.t.(*HttpServer)
  121. return t.onWSMessageBody(t, Sender, ConnID, Data, Length)
  122. }
  123. return HR_OK
  124. }
  125. func server_http_callback_OnWSMessageComplete(Sender, ConnID uintptr) HR {
  126. switch j_item := _server_on_get(Sender); j_item._type {
  127. case _server_type_HttpServer:
  128. t := j_item.t.(*HttpServer)
  129. return t.onWSMessageComplete(t, Sender, ConnID)
  130. }
  131. return HR_OK
  132. }