Permalink
Browse files

update

  • Loading branch information...
1 parent 7690df4 commit 2d58e9a2dfae355fbbd578da054913b57ebbceb5 yayanyang committed Sep 6, 2012
Showing with 97 additions and 0 deletions.
  1. +51 −0 io/epoll/iodata.hpp
  2. +46 −0 io/epoll/socket.cpp
View
@@ -0,0 +1,51 @@
+/**
+*
+* @file iodata
+* @brief Copyright (C) 2012 yayanyang All Rights Reserved
+* @author yayanyang
+* @version 1.0.0.0
+* @date 2012/08/31
+*/
+#ifndef LEMON_IO_EPOLL_IODATA_HPP
+#define LEMON_IO_EPOLL_IODATA_HPP
+#include <lemon/io/io_service.hpp>
+
+namespace lemon{namespace io{
+
+ template<typename IOService>
+ struct IODataT
+ {
+ typedef IODataT<IOService> Self;
+
+ typedef void (IOService::*IODataRelease)( Self * self );
+
+ IODataRelease Release;
+
+ void *UserData;
+
+ LemonIOCallback Callback;
+
+ void *Buffer;
+
+ size_t BufferSize;
+
+ IODataT(void * userData, LemonIOCallback callback, void * buffer, size_t bufferSize,IODataRelease release)
+ :UserData(userData),
+ Callback(callback),
+ Buffer(buffer),
+ BufferSize(bufferSize),
+ Release(release)
+ {
+
+ }
+ };
+
+ template<class IOService>
+ inline void Release(IOService * service,IODataT<IOService> * iodata)
+ {
+ (service->*(iodata->Release))(iodata);
+ }
+
+}}
+
+#endif //LEMON_IO_EPOLL_IODATA_HPP
View
@@ -0,0 +1,46 @@
+#include <lemon/io/posix/socket.hpp>
+
+#ifdef LEMON_IO_EPOLL
+
+namespace lemon{namespace io{
+
+ Socket::Socket(int af, int type, int protocol,IOService * service)
+ :BaseType(service),_af(af),_type(type),_protocol(protocol)
+ {
+ _handle = socket( af, type , protocol );
+
+ if(-1 == _handle)
+ {
+ scope_error_info errorCode;
+
+ LEMON_POSIX_ERROR(errorCode,errno);
+ }
+ }
+
+ void Socket::Send(const byte_t * buffer, size_t length, int flag , LemonIOCallback callback, void * userdata)
+ {
+
+ }
+
+ void Socket::SendTo(const byte_t * buffer, size_t length, int flag ,const sockaddr * addr, socklen_t addrlen, LemonIOCallback callback, void * userdata)
+ {
+
+ }
+
+ void Socket::Recieve(byte_t * buffer, size_t length, int flag , LemonIOCallback callback, void * userdata)
+ {
+
+ }
+
+ void Socket::RecieveFrom(byte_t * buffer, size_t length, int flag , sockaddr * addr,socklen_t * addrlen, LemonIOCallback callback, void * userdata)
+ {
+
+ }
+
+ void Socket::Connect(const sockaddr * addr, socklen_t addrlen, LemonIOCallback callback, void * userdata)
+ {
+
+ }
+}}
+
+#endif // LEMON_IO_EPOLL

0 comments on commit 2d58e9a

Please sign in to comment.