Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _UDP_IO_EVENT_H_
00025 #define _UDP_IO_EVENT_H_
00026
00027
00028
00029 class UDPIOEvent:public Event
00030 {
00031 public:
00032 UDPIOEvent():fd(-1), err(0), m(0), handle(0), b(0), bytesTransferred(0)
00033 {
00034 };
00035 ~UDPIOEvent() {
00036 };
00037 void setInfo(int fd_, IOBufferBlock * b_, int bytesTransferred_, int errno_)
00038 {
00039 fd = fd_;
00040 b = b_;
00041 bytesTransferred = bytesTransferred_;
00042 err = errno_;
00043 };
00044 void setInfo(int fd_, struct msghdr *m_, int bytesTransferred_, int errno_)
00045 {
00046 fd = fd_;
00047 m = m_;
00048 bytesTransferred = bytesTransferred_;
00049 err = errno_;
00050 };
00051 void setHandle(void *v)
00052 {
00053 handle = v;
00054 }
00055 void *getHandle()
00056 {
00057 return handle;
00058 }
00059 void free();
00060 int getBytesTransferred()
00061 {
00062 return bytesTransferred;
00063 }
00064 IOBufferBlock *getIOBufferBlock()
00065 {
00066 return b;
00067 }
00068 int getError()
00069 {
00070 return err;
00071 }
00072 Continuation *getContinuation()
00073 {
00074 return continuation;
00075 }
00076 static void free(UDPIOEvent * e);
00077 private:
00078 void *operator new(size_t size);
00079 int fd;
00080 int err;
00081 struct msghdr *m;
00082 void *handle;
00083 Ptr<IOBufferBlock> b;
00084 int bytesTransferred;
00085 };
00086
00087 extern ClassAllocator<UDPIOEvent> UDPIOEventAllocator;
00088 TS_INLINE void
00089 UDPIOEvent::free(UDPIOEvent * e)
00090 {
00091 e->b = NULL;
00092 e->mutex = NULL;
00093 UDPIOEventAllocator.free(e);
00094 }
00095 #endif