• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

I_Net.h

Go to the documentation of this file.
00001 /** @file
00002 
00003   Net subsystem
00004 
00005   @section license License
00006 
00007   Licensed to the Apache Software Foundation (ASF) under one
00008   or more contributor license agreements.  See the NOTICE file
00009   distributed with this work for additional information
00010   regarding copyright ownership.  The ASF licenses this file
00011   to you under the Apache License, Version 2.0 (the
00012   "License"); you may not use this file except in compliance
00013   with the License.  You may obtain a copy of the License at
00014 
00015       http://www.apache.org/licenses/LICENSE-2.0
00016 
00017   Unless required by applicable law or agreed to in writing, software
00018   distributed under the License is distributed on an "AS IS" BASIS,
00019   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00020   See the License for the specific language governing permissions and
00021   limitations under the License.
00022 
00023   @section details Details
00024 
00025   Net subsystem is a layer on top the operations sytem network apis. It
00026   provides an interface for accepting/creating new connection oriented
00027   (TCP) and connection less (UDP) connetions and for reading/writing
00028   data through these. The net system can manage 1000s of connections
00029   very efficiently. Another advantage of using the net system is that
00030   the SMs dont have be concerned about differences in the net apis of
00031   various operations systems.
00032 
00033   SMs use the netProcessor global object of the Net System to create new
00034   connections or to accept incoming connections. When a new connection
00035   is created the SM gets a NetVConnection which is a handle for the
00036   underlying connections. The SM can then use the NetVConnection to get
00037   properties of the connection, read and write data. Net system also
00038   has socks and ssl support.
00039 
00040  */
00041 #ifndef __I_NET_H_
00042 #define __I_NET_H_
00043 
00044 #include "I_Version.h"
00045 #include "I_EventSystem.h"
00046 #include <netinet/in.h>
00047 
00048 #define NET_SYSTEM_MODULE_MAJOR_VERSION 1
00049 #define NET_SYSTEM_MODULE_MINOR_VERSION 0
00050 #define NET_SYSTEM_MODULE_VERSION makeModuleVersion(                 \
00051                                     NET_SYSTEM_MODULE_MAJOR_VERSION, \
00052                                     NET_SYSTEM_MODULE_MINOR_VERSION, \
00053                                     PUBLIC_MODULE_HEADER)
00054 
00055 static int const NO_FD = -1;
00056 
00057 extern int net_config_poll_timeout;
00058 
00059 #define NET_EVENT_OPEN                    (NET_EVENT_EVENTS_START)
00060 #define NET_EVENT_OPEN_FAILED             (NET_EVENT_EVENTS_START+1)
00061 #define NET_EVENT_ACCEPT                  (NET_EVENT_EVENTS_START+2)
00062 #define NET_EVENT_ACCEPT_SUCCEED          (NET_EVENT_EVENTS_START+3)
00063 #define NET_EVENT_ACCEPT_FAILED           (NET_EVENT_EVENTS_START+4)
00064 #define NET_EVENT_CANCEL                  (NET_EVENT_EVENTS_START+5)
00065 #define NET_EVENT_DATAGRAM_READ_COMPLETE  (NET_EVENT_EVENTS_START+6)
00066 #define NET_EVENT_DATAGRAM_READ_ERROR     (NET_EVENT_EVENTS_START+7)
00067 #define NET_EVENT_DATAGRAM_WRITE_COMPLETE (NET_EVENT_EVENTS_START+8)
00068 #define NET_EVENT_DATAGRAM_WRITE_ERROR    (NET_EVENT_EVENTS_START+9)
00069 #define NET_EVENT_DATAGRAM_READ_READY     (NET_EVENT_EVENTS_START+10)
00070 #define NET_EVENT_DATAGRAM_OPEN           (NET_EVENT_EVENTS_START+11)
00071 #define NET_EVENT_DATAGRAM_ERROR          (NET_EVENT_EVENTS_START+12)
00072 #define NET_EVENT_ACCEPT_INTERNAL         (NET_EVENT_EVENTS_START+22)
00073 #define NET_EVENT_CONNECT_INTERNAL        (NET_EVENT_EVENTS_START+23)
00074 
00075 #define MAIN_ACCEPT_PORT                  -1
00076 
00077 /*
00078  * Net system uses event threads
00079  * so, the net thread group id is the event thread group id
00080  */
00081 
00082 #define ET_NET ET_CALL
00083 
00084 #include "I_NetVConnection.h"
00085 #include "I_NetProcessor.h"
00086 #include "I_SessionAccept.h"
00087 
00088 void ink_net_init(ModuleVersion version);
00089 #endif

Generated by  doxygen 1.7.1