sresolv 1.12.11devel
|
00001 /* 00002 * This file is part of the Sofia-SIP package 00003 * 00004 * Copyright (C) 2009 Nokia Corporation. 00005 * 00006 * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden> 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public License 00010 * as published by the Free Software Foundation; either version 2.1 of 00011 * the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, but 00014 * WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with this library; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 00021 * 02110-1301 USA 00022 * 00023 */ 00024 00025 #ifndef SOFIA_SIP_SRES_SIP_H 00026 00027 #define SOFIA_SIP_SRES_SIP_H 00028 00035 #ifndef SU_TYPES_H 00036 #include <sofia-sip/su_types.h> 00037 #endif 00038 00039 #ifndef SU_ADDRINFO_H 00040 #include <sofia-sip/su_addrinfo.h> 00041 #endif 00042 00043 #ifndef URL_H 00044 #include <sofia-sip/url.h> 00045 #endif 00046 00047 #ifndef SOFIA_RESOLV_SRES_H 00048 #include <sofia-resolv/sres.h> 00049 #endif 00050 00051 SOFIA_BEGIN_DECLS 00052 00053 typedef struct sres_sip_s sres_sip_t; 00054 00055 #ifndef SRES_SIP_MAGIC_T 00056 00060 #define SRES_SIP_MAGIC_T struct sres_sip_magic_s 00061 #endif 00062 00064 typedef SRES_SIP_MAGIC_T sres_sip_magic_t; 00065 00066 typedef void sres_sip_notify_f(sres_sip_magic_t *context, 00067 sres_sip_t *resolver, 00068 int error); 00069 00070 SOFIAPUBFUN sres_sip_t *sres_sip_new( 00071 sres_resolver_t *sres, 00072 url_string_t const *url, 00073 su_addrinfo_t const *hints, 00074 int naptr, int srv, 00075 sres_sip_notify_f *callback, 00076 sres_sip_magic_t *magic); 00077 00078 SOFIAPUBFUN sres_sip_t *sres_sip_ref(sres_sip_t *); 00079 SOFIAPUBFUN void sres_sip_unref(sres_sip_t *); 00080 00081 SOFIAPUBFUN su_addrinfo_t const *sres_sip_results(sres_sip_t *); 00082 00083 SOFIAPUBFUN su_addrinfo_t const *sres_sip_next(sres_sip_t *); 00084 00085 SOFIAPUBFUN int sres_sip_next_step(sres_sip_t *nr); 00086 00087 SOFIAPUBFUN int sres_sip_error(sres_sip_t *nr); 00088 00089 /* Errors */ 00090 enum { 00091 SRES_SIP_ERR_FAULT = -1, /* Invalid pointers */ 00092 SRES_SIP_ERR_BAD_URI = -2, /* Invalid URI */ 00093 SRES_SIP_ERR_BAD_HINTS = -3, /* Invalid hints */ 00094 SRES_SIP_ERR_NO_NAME = -4, /* No domain found */ 00095 SRES_SIP_ERR_NO_DATA = -5, /* No matching records */ 00096 SRES_SIP_ERR_NO_TPORT = -6, /* Unknown transport */ 00097 SRES_SIP_ERR_FAIL = -7, /* Permanent resolving error */ 00098 SRES_SIP_ERR_AGAIN = -8, /* Temporary resolving error */ 00099 SRES_SIP_ERR_INTERNAL = -9, /* Internal error */ 00100 _SRES_SIP_ERR_LAST 00101 }; 00102 00103 /* Well-known transport numbers */ 00104 enum { 00105 TPPROTO_TCP = 6, 00106 TPPROTO_UDP = 17, 00107 TPPROTO_SCTP = 132, 00108 TPPROTO_SECURE = 256, 00109 TPPROTO_TLS = TPPROTO_SECURE | TPPROTO_TCP, 00110 TPPROTO_NONE = 0 00111 }; 00112 00113 #define TPPROTO_TCP TPPROTO_TCP 00114 #define TPPROTO_UDP TPPROTO_UDP 00115 #define TPPROTO_SCTP TPPROTO_SCTP 00116 #define TPPROTO_TLS TPPROTO_TLS 00117 #define TPPROTO_NONE TPPROTO_NONE 00118 00119 SOFIA_END_DECLS 00120 00121 #endif /* SOFIA_SIP_SRES_SIP_H */