Main Page   Class Hierarchy   Compound List   File List   Compound Members  

S_IpAddr.cpp

00001 /*
00002  *  This program is free software; you can redistribute it and/or modify
00003  *  it under the terms of the GNU General Public License as published by
00004  *  the Free Software Foundation; either version 2 of the License, or
00005  *  (at your option) any later version.
00006  *
00007  *  This program is distributed in the hope that it will be useful,
00008  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00009  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010  *  GNU General Public License for more details.
00011  *
00012  *  You should have received a copy of the GNU General Public License
00013  *  along with this program; if not, write to the Free Software
00014  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00015  *
00016  * (c)Copyright 2006 Hewlett-Packard Development Company, LP.
00017  *
00018  */
00019 
00020 #include "S_IpAddr.hpp"
00021 
00022 #include "Utils.hpp"
00023 
00024 T_pIpAddr create_IpAddr () {
00025   T_pIpAddr L_ret = NULL ;
00026   ALLOC_VAR(L_ret, T_pIpAddr, sizeof(T_IpAddr));
00027   clear_IpAddr(L_ret);
00028   return (L_ret);
00029 }
00030 
00031 void  clear_IpAddr(T_pIpAddr P_IpAddr) {
00032   if (P_IpAddr != NULL) {
00033     P_IpAddr->m_umode = E_IP_USAGE_MODE_UNKNOWN ;
00034     P_IpAddr->m_buffer_size = DEFAULT_IP_BUFFER_SIZE ;
00035     P_IpAddr->m_open = NULL ;
00036 
00037 
00038     P_IpAddr->m_value = NULL ;
00039     P_IpAddr->m_port = -1 ;
00040     P_IpAddr->m_ip = NULL ;
00041     memset(&(P_IpAddr->m_addr), 0, sizeof(T_SockAddrStorage));
00042 
00043     P_IpAddr->m_open_src = NULL ;
00044     P_IpAddr->m_value_src = NULL ;
00045     P_IpAddr->m_port_src = -1 ;
00046     P_IpAddr->m_ip_src = NULL ;
00047     memset(&(P_IpAddr->m_addr_src), 0, sizeof(T_SockAddrStorage));
00048 
00049   }
00050 }
00051 
00052 void  delete_IpAddr(T_pIpAddr *P_IpAddr) {
00053 
00054   T_pIpAddr L_IpAddr = NULL ;
00055   if (P_IpAddr != NULL) {
00056     L_IpAddr = *P_IpAddr ;
00057 
00058     FREE_TABLE(L_IpAddr->m_open);
00059 
00060     FREE_TABLE(L_IpAddr->m_value);
00061     FREE_TABLE(L_IpAddr->m_ip);
00062 
00063     FREE_TABLE(L_IpAddr->m_open_src);
00064     FREE_TABLE(L_IpAddr->m_value_src);
00065     FREE_TABLE(L_IpAddr->m_ip_src);
00066 
00067 
00068     FREE_VAR(L_IpAddr);
00069     *P_IpAddr = NULL ;
00070 
00071   }
00072   
00073 }
00074 
00075 int  get_domain(T_pIpAddr P_IpAddr) {
00076   int L_ret = -1 ;
00077   if (P_IpAddr != NULL) {
00078     switch ((P_IpAddr->m_addr).SOCKADDR_FAMILY) {
00079     case AF_INET:
00080       L_ret = PF_INET ;
00081       break ;
00082 #ifndef USE_IPV4_ONLY
00083     case AF_INET6:
00084       L_ret = PF_INET6 ;
00085       break ;
00086 #endif
00087     default:
00088       break ;
00089     }
00090   }
00091   return (L_ret);
00092 }

Generated on Wed Mar 7 14:44:59 2007 for Seagull by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002