Main Page   Class Hierarchy   Compound List   File List   Compound Members  

S_SCTPIpAddr.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 #include "S_SCTPIpAddr.hpp"
00020 #include "Utils.hpp"
00021 
00022 T_pIpAddr create_IpAddr () {
00023   T_pIpAddr L_ret = NULL ;
00024   ALLOC_VAR(L_ret, T_pIpAddr, sizeof(T_IpAddr));
00025   clear_IpAddr(L_ret);
00026   return (L_ret);
00027 }
00028 
00029 void  clear_IpAddr(T_pIpAddr P_IpAddr) {
00030   if (P_IpAddr != NULL) {
00031     P_IpAddr->m_umode = E_IP_USAGE_MODE_UNKNOWN ;
00032     P_IpAddr->m_buffer_size = DEFAULT_IP_BUFFER_SIZE ;
00033     P_IpAddr->m_open = NULL ;
00034     P_IpAddr->m_value = NULL ;
00035     P_IpAddr->m_port = -1 ;
00036     P_IpAddr->m_ip = NULL ;
00037     memset(&(P_IpAddr->m_addr), 0, sizeof(T_SockAddrStorage));  ;
00038   }
00039 }
00040 
00041 void  delete_IpAddr(T_pIpAddr *P_IpAddr) {
00042 
00043   T_pIpAddr L_IpAddr = NULL ;
00044   if (P_IpAddr != NULL) {
00045     L_IpAddr = *P_IpAddr ;
00046 
00047     FREE_TABLE(L_IpAddr->m_open);
00048     FREE_VAR(L_IpAddr->m_value);
00049     FREE_VAR(L_IpAddr->m_ip);
00050     FREE_VAR(L_IpAddr);
00051 
00052     *P_IpAddr = NULL ;
00053   }
00054   
00055 }
00056 
00057 int  get_domain(T_pIpAddr P_IpAddr) {
00058   int L_ret = -1 ;
00059   if (P_IpAddr != NULL) {
00060     switch ((P_IpAddr->m_addr).SOCKADDR_FAMILY) {
00061     case AF_INET:
00062       L_ret = PF_INET ;
00063       break ;
00064 #ifndef USE_IPV4_ONLY
00065     case AF_INET6:
00066       L_ret = PF_INET6 ;
00067       break ;
00068 #endif
00069     default:
00070       break ;
00071     }
00072   }
00073   return (L_ret);
00074 }

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