/* belle-sip - SIP (RFC3261) library. Copyright (C) 2013 Belledonne Communications SARL This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include #include "belle-sip/belle-sip.h" static belle_sip_stack_t *stack; static void resolver_callback(void *data, belle_sip_resolver_results_t *results){ int err; const struct addrinfo *ai_it; char name[NI_MAXHOST]; char port[NI_MAXSERV]; const struct addrinfo *ai_list = belle_sip_resolver_results_get_addrinfos(results); for(ai_it=ai_list;ai_it!=NULL;ai_it=ai_it->ai_next){ err=bctbx_getnameinfo(ai_it->ai_addr,ai_list->ai_addrlen,name,sizeof(name),port,sizeof(port),NI_NUMERICSERV|NI_NUMERICHOST); if (err!=0){ fprintf(stderr,"getnameinfo error: %s",gai_strerror(err)); }else{ printf("\t%s %s (ttl:%u)\n",name,port,belle_sip_resolver_results_get_ttl(results)); } } belle_sip_main_loop_quit(belle_sip_stack_get_main_loop(stack)); } int main(int argc, char *argv[]){ int i; const char *domain=NULL; const char *transport="udp"; if (argc<2){ fprintf(stderr,"Usage:\n%s [transport] [--debug]\n",argv[0]); return -1; } domain=argv[1]; for (i=2;i