資源簡介
實現GB28181協議的小demo。基于osip庫和exosip庫實現的功能
代碼片段和文件信息
/*
?*
?*?IP-address/hostname?to?country?converter.
?*
?*?Problem;?you?want?to?know?where?IP?a.b.c.d?is?located.
?*
?*?Use?ares_gethostbyname?(“d.c.b.a.zz.countries.nerd.dk“)
?*?and?get?the?CNAME?(host->h_name).?Result?will?be:
?*???CNAME?=?zz.countries.nerd.dk?with?address?127.0.x.y?(ver?1)?or
?*???CNAME?=?.zz.countries.nerd.dk?with?address?127.0.x.y?(ver?2)
?*
?*?The?2?letter?country?code?is?in??and?the?ISO-3166?country
?*?number?is?in?x.y?(number?=?x*256?+?y).?Version?2?of?the?protocol?is?missing
?*?the??number.
?*
?*?Ref:?http://countries.nerd.dk/more.html
?*
?*?Written?by?G.?Vanem??2006?2007
?*
?*?NB!?This?program?may?not?be?big-endian?aware.
?*
?*?Permission?to?use?copy?modify?and?distribute?this
?*?software?and?its?documentation?for?any?purpose?and?without
?*?fee?is?hereby?granted?provided?that?the?above?copyright
?*?notice?appear?in?all?copies?and?that?both?that?copyright
?*?notice?and?this?permission?notice?appear?in?supporting
?*?documentation?and?that?the?name?of?M.I.T.?not?be?used?in
?*?advertising?or?publicity?pertaining?to?distribution?of?the
?*?software?without?specific?written?prior?permission.
?*?M.I.T.?makes?no?representations?about?the?suitability?of
?*?this?software?for?any?purpose.??It?is?provided?“as?is“
?*?without?express?or?implied?warranty.
?*/
#include?“ares_setup.h“
#ifdef?HAVE_STRINGS_H
#include?
#endif
#if?defined(WIN32)?&&?!defined(WATT32)
??#include?
#else
??#include?
??#include?
??#include?
#endif
#include?“ares.h“
#include?“ares_getopt.h“
#include?“ares_nowarn.h“
#ifndef?HAVE_STRDUP
#??include?“ares_strdup.h“
#??define?strdup(ptr)?ares_strdup(ptr)
#endif
#ifndef?HAVE_STRCASECMP
#??include?“ares_strcasecmp.h“
#??define?strcasecmp(p1p2)?ares_strcasecmp(p1p2)
#endif
#ifndef?HAVE_STRNCASECMP
#??include?“ares_strcasecmp.h“
#??define?strncasecmp(p1p2n)?ares_strncasecmp(p1p2n)
#endif
#ifndef?INADDR_NONE
#define?INADDR_NONE?0xffffffff
#endif
static?const?char?*usage??????=?“acountry?[-vh?]?{host|addr}?...\n“;
static?const?char??nerd_fmt[]?=?“%u.%u.%u.%u.zz.countries.nerd.dk“;
static?const?char?*nerd_ver1??=?nerd_fmt?+?14;??/*?.countries.nerd.dk?*/
static?const?char?*nerd_ver2??=?nerd_fmt?+?11;??/*?.zz.countries.nerd.dk?*/
static?int?????????verbose????=?0;
#define?TRACE(fmt)?do?{???????????????\
?????????????????????if?(verbose?>?0)?\
???????????????????????printf?fmt?;???\
???????????????????}?WHILE_FALSE
static?void?wait_ares(ares_channel?channel);
static?void?callback(void?*arg?int?status?int?timeouts?struct?hostent?*host);
static?void?callback2(void?*arg?int?status?int?timeouts?struct?hostent?*host);
static?void?find_country_from_cname(const?char?*cname?struct?in_addr?addr);
static?void?Abort(const?char?*fmt?...)
{
??va_list?args;
??va_start(args?fmt);
??vfprintf(stderr?fmt?args);
??va_end(args);
??exit(1);
}
int?main(int?argc?char?**argv)
{
??ares_channel?channel;
??int????ch?status;
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????52507??2016-01-24?06:41??subway\c-ares\acinclude.m4
?????文件??????44489??2017-05-26?00:25??subway\c-ares\aclocal.m4
?????文件???????1758??2016-01-24?06:41??subway\c-ares\acountry.1
?????文件??????24960??2017-05-26?00:24??subway\c-ares\acountry.c
?????文件???????2360??2016-01-24?06:41??subway\c-ares\adig.1
?????文件??????22743??2016-01-24?06:41??subway\c-ares\adig.c
?????文件???????2023??2016-01-24?06:41??subway\c-ares\ahost.1
?????文件???????5130??2016-03-13?23:29??subway\c-ares\ahost.c
?????文件??????23253??2017-06-19?20:15??subway\c-ares\ares.h
?????文件???????6907??2017-06-20?14:03??subway\c-ares\ares_build.h
?????文件???????3731??2017-04-04?17:04??subway\c-ares\ares_build.h.in
?????文件???????1638??2016-09-30?17:19??subway\c-ares\ares_cancel.3
?????文件???????2229??2016-01-24?06:41??subway\c-ares\ares_cancel.c
?????文件???????3990??2017-06-20?14:03??subway\c-ares\ares_cancel.pdf
?????文件??????13608??2017-05-26?00:26??subway\c-ares\ares_config.h.in
?????文件???????2837??2016-09-27?16:33??subway\c-ares\ares_create_query.3
?????文件???????6196??2017-04-04?17:04??subway\c-ares\ares_create_query.c
?????文件???????4984??2017-06-20?14:03??subway\c-ares\ares_create_query.pdf
?????文件???????6324??2016-02-11?19:23??subway\c-ares\ares_data.c
?????文件???????3123??2016-02-11?19:23??subway\c-ares\ares_data.h
?????文件???????1546??2016-09-30?17:20??subway\c-ares\ares_destroy.3
?????文件???????2938??2016-02-02?18:58??subway\c-ares\ares_destroy.c
?????文件???????3990??2017-06-20?14:03??subway\c-ares\ares_destroy.pdf
?????文件???????1285??2016-09-29?15:07??subway\c-ares\ares_destroy_options.3
?????文件???????3660??2017-06-20?14:03??subway\c-ares\ares_destroy_options.pdf
?????文件???????5306??2016-01-24?06:41??subway\c-ares\ares_dns.h
?????文件???????1431??2016-09-29?15:07??subway\c-ares\ares_dup.3
?????文件???????3810??2017-06-20?14:03??subway\c-ares\ares_dup.pdf
?????文件???????2181??2016-01-24?06:41??subway\c-ares\ares_expand_name.3
?????文件???????6269??2017-05-26?00:24??subway\c-ares\ares_expand_name.c
............此處省略1722個文件信息
評論
共有 條評論