Harald Welte | 4b233b4 | 2012-11-07 08:32:31 +0100 | [diff] [blame^] | 1 | |
| 2 | /* |
| 3 | * Copyright (C) 2006 Raul Tremsal |
| 4 | * File : esme.h |
| 5 | * Author: Raul Tremsal <ultraismo@yahoo.com> |
| 6 | * |
| 7 | * This file is part of libsmpp34 (c-open-smpp3.4 library). |
| 8 | * |
| 9 | * The libsmpp34 library is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU Lesser General Public License as |
| 11 | * published by the Free Software Foundation; either version 2.1 of the |
| 12 | * License, or (at your option) any later version. |
| 13 | * |
| 14 | * This library is distributed in the hope that it will be useful, but |
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public |
| 17 | * License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU Lesser General Public License |
| 20 | * along with this library; if not, write to the Free Software Foundation, |
| 21 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 22 | * |
| 23 | */ |
| 24 | |
| 25 | #ifndef _esme_h_ |
| 26 | #define _esme_h_ |
| 27 | |
| 28 | #define GET_PROP_INT( dst, c, src )\ |
| 29 | {\ |
| 30 | xmlChar *clave = NULL; dst = 0;\ |
| 31 | if( (clave = xmlGetProp(c, (xmlChar*)src)) != NULL ){\ |
| 32 | dst = strtol((char*)clave, NULL, 10);\ |
| 33 | xmlFree( clave );\ |
| 34 | }\ |
| 35 | }; |
| 36 | |
| 37 | #define GET_PROP_STR( dst, c, src )\ |
| 38 | {\ |
| 39 | xmlChar *clave = NULL;\ |
| 40 | memset(dst, 0, sizeof(dst));\ |
| 41 | if( (clave = xmlGetProp(c, (xmlChar*)src)) != NULL ){\ |
| 42 | snprintf((char*)dst, sizeof(dst), "%s", (char*)clave);\ |
| 43 | xmlFree( clave );\ |
| 44 | }\ |
| 45 | }; |
| 46 | |
| 47 | |
| 48 | |
| 49 | #define _xmlChar( str ) (const xmlChar*) str |
| 50 | #define XML_IN_NODE( c, str, exito, fracaso )\ |
| 51 | while( c != NULL ){\ |
| 52 | if( xmlStrcmp(c->name, _xmlChar(str)) == 0 ){\ |
| 53 | exito;\ |
| 54 | };\ |
| 55 | c = c->next;\ |
| 56 | };\ |
| 57 | if( c == NULL ){\ |
| 58 | printf("Can't find tag <%s>.", str);\ |
| 59 | fracaso;\ |
| 60 | }; |
| 61 | |
| 62 | int do_tcp_connect( xmlNodePtr p, int *sock_tcp ); |
| 63 | int do_tcp_close( int sock_tcp ); |
| 64 | int do_smpp_connect( xmlNodePtr p, int sock_tcp ); |
| 65 | int do_smpp_send_message( xmlNodePtr p, int sock_tcp ); |
| 66 | int do_smpp_close( int sock_tcp ); |
| 67 | #endif /* _esme_h_ */ |