UDPForwarder.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* ----------------------------------------------------------------------------
  2. * This file was automatically generated by SWIG (http://www.swig.org).
  3. * Version 2.0.1
  4. *
  5. * Do not make changes to this file unless you know what you are doing--modify
  6. * the SWIG interface file instead.
  7. * ----------------------------------------------------------------------------- */
  8. namespace RakNet {
  9. using System;
  10. using System.Runtime.InteropServices;
  11. public class UDPForwarder : IDisposable {
  12. private HandleRef swigCPtr;
  13. protected bool swigCMemOwn;
  14. internal UDPForwarder(IntPtr cPtr, bool cMemoryOwn) {
  15. swigCMemOwn = cMemoryOwn;
  16. swigCPtr = new HandleRef(this, cPtr);
  17. }
  18. internal static HandleRef getCPtr(UDPForwarder obj) {
  19. return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  20. }
  21. ~UDPForwarder() {
  22. Dispose();
  23. }
  24. public virtual void Dispose() {
  25. lock(this) {
  26. if (swigCPtr.Handle != IntPtr.Zero) {
  27. if (swigCMemOwn) {
  28. swigCMemOwn = false;
  29. RakNetPINVOKE.delete_UDPForwarder(swigCPtr);
  30. }
  31. swigCPtr = new HandleRef(null, IntPtr.Zero);
  32. }
  33. GC.SuppressFinalize(this);
  34. }
  35. }
  36. public UDPForwarder() : this(RakNetPINVOKE.new_UDPForwarder(), true) {
  37. }
  38. public void Startup() {
  39. RakNetPINVOKE.UDPForwarder_Startup(swigCPtr);
  40. }
  41. public void Shutdown() {
  42. RakNetPINVOKE.UDPForwarder_Shutdown(swigCPtr);
  43. }
  44. public void Update() {
  45. RakNetPINVOKE.UDPForwarder_Update(swigCPtr);
  46. }
  47. public void SetMaxForwardEntries(ushort maxEntries) {
  48. RakNetPINVOKE.UDPForwarder_SetMaxForwardEntries(swigCPtr, maxEntries);
  49. }
  50. public int GetMaxForwardEntries() {
  51. int ret = RakNetPINVOKE.UDPForwarder_GetMaxForwardEntries(swigCPtr);
  52. return ret;
  53. }
  54. public int GetUsedForwardEntries() {
  55. int ret = RakNetPINVOKE.UDPForwarder_GetUsedForwardEntries(swigCPtr);
  56. return ret;
  57. }
  58. public short socketFamily {
  59. set {
  60. RakNetPINVOKE.UDPForwarder_socketFamily_set(swigCPtr, value);
  61. }
  62. get {
  63. short ret = RakNetPINVOKE.UDPForwarder_socketFamily_get(swigCPtr);
  64. return ret;
  65. }
  66. }
  67. public UDPForwarderResult StartForwarding(SystemAddress source, SystemAddress destination, uint timeoutOnNoDataMS, string forceHostAddress, ushort socketFamily, out ushort forwardingPort, out uint forwardingSocket) {
  68. UDPForwarderResult ret = (UDPForwarderResult)RakNetPINVOKE.UDPForwarder_StartForwarding(swigCPtr, SystemAddress.getCPtr(source), SystemAddress.getCPtr(destination), timeoutOnNoDataMS, forceHostAddress, socketFamily, out forwardingPort, out forwardingSocket);
  69. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  70. return ret;
  71. }
  72. public void StopForwarding(SystemAddress source, SystemAddress destination) {
  73. RakNetPINVOKE.UDPForwarder_StopForwarding(swigCPtr, SystemAddress.getCPtr(source), SystemAddress.getCPtr(destination));
  74. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  75. }
  76. }
  77. }
粤ICP备19079148号