├── .gitmodules ├── README.md ├── build-proot-from-armhf-chroot.sh ├── build.sh ├── c-ares ├── .gitignore ├── AUTHORS ├── CHANGES ├── Makefile.Watcom ├── Makefile.am ├── Makefile.dj ├── Makefile.in ├── Makefile.inc ├── Makefile.m32 ├── Makefile.msvc ├── Makefile.netware ├── NEWS ├── README ├── README.cares ├── README.msvc ├── RELEASE-NOTES ├── TODO ├── acinclude.m4 ├── aclocal.m4 ├── acountry.1 ├── acountry.c ├── adig.1 ├── adig.c ├── ahost.1 ├── ahost.c ├── ares.h ├── ares__close_sockets.c ├── ares__get_hostent.c ├── ares__read_line.c ├── ares__timeval.c ├── ares_build.h ├── ares_build.h.in ├── ares_cancel.3 ├── ares_cancel.c ├── ares_config.h.in ├── ares_data.c ├── ares_data.h ├── ares_destroy.3 ├── ares_destroy.c ├── ares_destroy_options.3 ├── ares_dns.h ├── ares_dup.3 ├── ares_expand_name.3 ├── ares_expand_name.c ├── ares_expand_string.3 ├── ares_expand_string.c ├── ares_fds.3 ├── ares_fds.c ├── ares_free_data.3 ├── ares_free_hostent.3 ├── ares_free_hostent.c ├── ares_free_string.3 ├── ares_free_string.c ├── ares_get_servers.3 ├── ares_getenv.c ├── ares_getenv.h ├── ares_gethostbyaddr.3 ├── ares_gethostbyaddr.c ├── ares_gethostbyname.3 ├── ares_gethostbyname.c ├── ares_gethostbyname_file.3 ├── ares_getnameinfo.3 ├── ares_getnameinfo.c ├── ares_getopt.c ├── ares_getopt.h ├── ares_getsock.3 ├── ares_getsock.c ├── ares_init.3 ├── ares_init.c ├── ares_init_options.3 ├── ares_iphlpapi.h ├── ares_ipv6.h ├── ares_library_cleanup.3 ├── ares_library_init.3 ├── ares_library_init.c ├── ares_library_init.h ├── ares_llist.c ├── ares_llist.h ├── ares_mkquery.3 ├── ares_mkquery.c ├── ares_nowarn.c ├── ares_nowarn.h ├── ares_options.c ├── ares_parse_a_reply.3 ├── ares_parse_a_reply.c ├── ares_parse_aaaa_reply.3 ├── ares_parse_aaaa_reply.c ├── ares_parse_mx_reply.3 ├── ares_parse_mx_reply.c ├── ares_parse_ns_reply.3 ├── ares_parse_ns_reply.c ├── ares_parse_ptr_reply.3 ├── ares_parse_ptr_reply.c ├── ares_parse_srv_reply.3 ├── ares_parse_srv_reply.c ├── ares_parse_txt_reply.3 ├── ares_parse_txt_reply.c ├── ares_platform.c ├── ares_platform.h ├── ares_private.h ├── ares_process.3 ├── ares_process.c ├── ares_query.3 ├── ares_query.c ├── ares_rules.h ├── ares_save_options.3 ├── ares_search.3 ├── ares_search.c ├── ares_send.3 ├── ares_send.c ├── ares_set_servers.3 ├── ares_set_socket_callback.3 ├── ares_setup.h ├── ares_strcasecmp.c ├── ares_strcasecmp.h ├── ares_strdup.c ├── ares_strdup.h ├── ares_strerror.3 ├── ares_strerror.c ├── ares_timeout.3 ├── ares_timeout.c ├── ares_version.3 ├── ares_version.c ├── ares_version.h ├── ares_writev.c ├── ares_writev.h ├── bitncmp.c ├── bitncmp.h ├── buildconf ├── cares.rc ├── compile ├── config-dos.h ├── config-win32.h ├── config.guess ├── config.sub ├── configure ├── configure.ac ├── depcomp ├── exports.txt ├── fakedns.c ├── get_ver.awk ├── inet_net_pton.c ├── inet_net_pton.h ├── inet_ntop.c ├── inet_ntop.h ├── install-sh ├── libcares.pc.in ├── ltmain.sh ├── m4 │ ├── cares-compilers.m4 │ ├── cares-confopts.m4 │ ├── cares-functions.m4 │ ├── cares-override.m4 │ ├── cares-reentrant.m4 │ ├── cares-system.m4 │ ├── libtool.m4 │ ├── ltoptions.m4 │ ├── ltsugar.m4 │ ├── ltversion.m4 │ ├── lt~obsolete.m4 │ └── xc-translit.m4 ├── maketgz ├── missing ├── mkinstalldirs ├── nameser.h ├── setup_once.h ├── vc │ ├── acountry │ │ └── vc6acountry.dsp │ ├── adig │ │ └── vc6adig.dsp │ ├── ahost │ │ └── vc6ahost.dsp │ ├── cares │ │ ├── vc6cares.dsp │ │ └── vc6cares.dsw │ └── vc6aws.dsw └── windows_port.c ├── disableselinux └── disableselinux.c ├── dist-gimp └── root │ └── .config │ └── autostart │ ├── gimp.desktop │ └── inkscape.desktop ├── dist-x86 ├── busybox ├── libandroid-shmem.so ├── libdisableselinux.so └── proot ├── dist ├── busybox ├── etc │ ├── hostname │ ├── hosts │ └── resolv.conf ├── libandroid-shmem.so ├── libdisableselinux.so ├── postinstall-locales.sh ├── postinstall.sh ├── proot ├── proot.sh ├── root │ ├── .config │ │ ├── pulse │ │ │ └── default.pa │ │ ├── user-dirs.dirs │ │ ├── user-dirs.locale │ │ └── xfce4 │ │ │ └── xfconf │ │ │ └── xfce-perchannel-xml │ │ │ ├── xfce4-desktop.xml │ │ │ ├── xfce4-panel.xml │ │ │ ├── xfce4-session.xml │ │ │ ├── xfwm4.xml │ │ │ └── xsettings.xml │ ├── .dist │ │ └── Synaptic.desktop │ ├── .gimp-2.8 │ │ ├── brushes │ │ │ └── .gitignore │ │ ├── curves │ │ │ └── .gitignore │ │ ├── devicerc │ │ ├── dynamics │ │ │ └── .gitignore │ │ ├── environ │ │ │ └── .gitignore │ │ ├── fonts │ │ │ └── .gitignore │ │ ├── fractalexplorer │ │ │ └── .gitignore │ │ ├── gfig │ │ │ └── .gitignore │ │ ├── gflare │ │ │ └── .gitignore │ │ ├── gimprc │ │ ├── gimpressionist │ │ │ └── .gitignore │ │ ├── gradients │ │ │ └── .gitignore │ │ ├── interpreters │ │ │ └── .gitignore │ │ ├── levels │ │ │ └── .gitignore │ │ ├── modules │ │ │ └── .gitignore │ │ ├── palettes │ │ │ └── .gitignore │ │ ├── patterns │ │ │ └── .gitignore │ │ ├── plug-ins │ │ │ └── .gitignore │ │ ├── scripts │ │ │ └── .gitignore │ │ ├── templates │ │ │ └── .gitignore │ │ ├── themes │ │ │ └── .gitignore │ │ ├── tmp │ │ │ └── .gitignore │ │ ├── tool-options │ │ │ └── .gitignore │ │ └── tool-presets │ │ │ └── .gitignore │ ├── .local │ │ └── share │ │ │ └── recently-used.xbel │ └── Desktop │ │ ├── Root-XTerm.desktop │ │ ├── Synaptic.desktop │ │ └── XTerm.desktop ├── startx.sh ├── update-dns.sh └── usr │ └── local │ └── bin │ └── sudo ├── img ├── img-cups-jessie.sh ├── img-debian-jessie--prepare-obb.sh ├── img-debian-jessie-armhf.sh ├── img-debian-jessie-x86.sh ├── img-debian-jessie.pkg ├── img-debug-wheezy-proot-armhf.sh ├── img-debug-wheezy-proot-x86.sh ├── img-debug-wheezy.pkg ├── img-gimp-jessie--prepare-obb.sh ├── img-gimp-jessie-armhf.sh ├── img-gimp-jessie-x86.sh ├── img-gimp-wheezy-armhf.sh ├── img-gimp-wheezy-x86.sh ├── img-gimp-wheezy.pkg ├── merge-dirs.sh ├── prepare-img-proot.sh ├── sources-jessie.list ├── strip.list └── upload.sh ├── linux-includes └── linux │ ├── prctl.h │ └── seccomp.h ├── pkgs ├── build-deb.sh ├── gimp-limit-redraw-rate.patch ├── gimp_2.8.14-1+b1_armhf.deb ├── gimp_2.8.14-1+b1_i386.deb ├── libgc-disable-dev-zero.patch ├── libgc1c2_7.2d-6.4_armhf.deb └── libgc1c2_7.2d-6.4_i386.deb └── proot-android.patch /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "fakechroot"] 2 | path = fakechroot 3 | url = git@github.com:pelya/fakechroot.git 4 | [submodule "android-shmem"] 5 | path = android-shmem 6 | url = git@github.com:pelya/android-shmem.git 7 | [submodule "proot-src"] 8 | path = proot-src 9 | url = git@github.com:cedric-vincent/PRoot.git 10 | [submodule "proot-src-by-termux"] 11 | path = proot-src-by-termux 12 | url = https://github.com/termux/proot.git 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Run Debian on top of Android with a single click. 2 | ================================================= 3 | 4 | No root required! Should work on any high-end device! 5 | Unleash full unrestricted desktop environment onto your mobile device! 6 | Instant frustration guaranteed! (unless you're using mouse or stylus). 7 | 8 | This app is NOT full Debian OS - it is a compatibility layer, which allows you to run Debian applications. 9 | Your phone is NOT rooted during installation. 10 | Also, this is NOT official Debian.org release. 11 | 12 | There are several limitations: 13 | 14 | - It cannot mess up your Android device, because it's a regular well-behaved Android app, which does not need root access. 15 | - No audio support. Some time ago PulseAudio was somewhat supported, but now it's broken. 16 | - No OpenGL support. It's possible to add it but it's a huge chunk of work, and I will not be doing that. 17 | - No access to the device hardware. That means you cannot re-partition SD card, you cannot burn CD-Roms, you cannot run ping or sniff your network etc. 18 | - No ability to move app to SD card, so you will need a lot of internal storage. 19 | - Most servers such as SSH or Apache won't start, because they all need root features. 20 | You can use tightvncserver instead of SSH, and wbox instead of Apache as a simple file sharing web server, 21 | 22 | How does that work. 23 | =================== 24 | 25 | The Debian graphical shell is launched using PRoot, the ultimate Linux virtualization solution: http://proot.me/ 26 | Then it launches XSDL X server to render it to screen. 27 | 28 | Development. 29 | ============ 30 | 31 | You'll need Android SDK and following packages: 32 | ``` 33 | sudo apt-get install autoconf automake debhelper build-essential libtool qemu-user-static debootstrap emdebian-archive-keyring realpath pxz 34 | echo deb http://www.emdebian.org/debian/ unstable main | sudo tee /etc/apt/sources.list.d/emdebian.list 35 | sudo apt-get update 36 | sudo apt-get install g++-4.7-arm-linux-gnueabihf 37 | mkdir ~/bin 38 | cd ~/bin 39 | ln -s /usr/bin/arm-linux-gnueabihf-gcc-4.7 arm-linux-gnueabihf-gcc 40 | ln -s /usr/bin/arm-linux-gnueabihf-g++-4.7 arm-linux-gnueabihf-g++ 41 | ``` 42 | 43 | Run 44 | ``` 45 | git submodule update --init --recursive 46 | ./build.sh 47 | ``` 48 | That should compile PRoot, libandroid-shmem.so used to speed up drawing speed, 49 | and libdisableselinux.so used to prevent Debian from messing up with Android security features. 50 | 51 | Busybox is precompiled, taken from this repository: 52 | https://github.com/pelya/busybox-android 53 | 54 | The scripts for creating Debian images are located in directory "img". 55 | To prepare image, run these scripts: 56 | ``` 57 | cd img 58 | sudo ./img-debian-jessie-x86.sh 59 | sudo ./img-debian-jessie-armhf.sh 60 | sudo ./img-debian-jessie--prepare-obb.sh 61 | ``` 62 | 63 | The XSDL X server is in an external repository - to compile it, follow instructions here: 64 | https://github.com/pelya/commandergenius/tree/sdl_android/project/jni/application/xserver-debian 65 | then install resulting .apk file on your Android device, and run it. 66 | 67 | There are two patched Debian packages in directory pkgs with their patches, 68 | used to improve GIMP drawing speed and fix a crash at start in Inkscape, 69 | you will need to create Debian chroots for armhf and i386 arhitecture, 70 | and build these packages from inside these chroots. 71 | -------------------------------------------------------------------------------- /build-proot-from-armhf-chroot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | fail() { echo "Compilation failed!" ; exit 1; } 4 | 5 | [ -e libtalloc.a ] || { 6 | [ -e talloc-2.1.0 ] || curl -L http://www.samba.org/ftp/talloc/talloc-2.1.0.tar.gz | tar xvz || fail 7 | cd talloc-2.1.0 8 | make clean 9 | env CFLAGS="-flto -fpic" LDFLAGS="-flto" ./configure build || fail 10 | #cp -f libtalloc.so ../libtalloc.so || fail 11 | ar rcs ../libtalloc.a bin/default/talloc*.o # bin/default/lib/replace/replace*.o 12 | cd .. 13 | } || fail 14 | 15 | [ -e dist/proot ] || { 16 | cd proot-src 17 | git clean -f -d -x 18 | git checkout -f 19 | patch -p1 < ../proot-android.patch || fail 20 | cd src 21 | env \ 22 | CFLAGS="-I../../talloc-2.1.0 -Wall -Wextra -O2 -flto -fpic -I../../linux-includes" \ 23 | LDFLAGS="-L../.. -ltalloc -static -flto" \ 24 | V=1 make -e -j4 || fail 25 | cp proot ../../dist/ 26 | cd ../.. 27 | strip dist/proot 28 | } || fail 29 | -------------------------------------------------------------------------------- /c-ares/.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.1 3 | *.8 4 | *.gz 5 | *.la 6 | *.lo 7 | *.o 8 | .autotools 9 | .cproject 10 | .deps 11 | .libs 12 | .pc 13 | .project 14 | .proverc 15 | Makefile 16 | Makefile.in 17 | aclocal.m4 18 | autom4te.cache 19 | build-tree-* 20 | config.*.cache 21 | config.cache 22 | config.guess 23 | config.h 24 | config.h.in 25 | config.log 26 | config.status 27 | config.sub 28 | configure 29 | depcomp 30 | install-sh 31 | libtool 32 | ltmain.sh 33 | m4/libtool.m4 34 | m4/ltoptions.m4 35 | m4/ltsugar.m4 36 | m4/ltversion.m4 37 | m4/lt~obsolete.m4 38 | missing 39 | scripts/*.env 40 | scripts/*.fakechroot 41 | scripts/fakechroot 42 | stamp-h* 43 | test/*.debs.tgz 44 | test/*.rpms.tgz 45 | test/rinse-cache 46 | test/src/test-* 47 | !test/src/test-*.c 48 | test/testtree 49 | compile 50 | test-driver 51 | ares_config.h 52 | libcares.pc 53 | -------------------------------------------------------------------------------- /c-ares/AUTHORS: -------------------------------------------------------------------------------- 1 | c-ares is based on ares, and these are the people that have worked on it since 2 | the fork was made: 3 | 4 | Alexander Lazic 5 | Alexey Simak 6 | Andreas Rieke 7 | Ashish Sharma 8 | Brad House 9 | Brad Spencer 10 | Bram Matthys 11 | Dan Fandrich 12 | Daniel Stenberg 13 | Dirk Manske 14 | Dominick Meglio 15 | Doug Goldstein 16 | Duncan Wilcox 17 | Eino Tuominen 18 | Erik Kline 19 | George Neill 20 | Gisle Vanem 21 | Guilherme Balena Versiani 22 | Gunter Knauf 23 | Henrik Stoerner 24 | James Bursa 25 | Michael Wallner 26 | Nick Mathewson 27 | Phil Blundell 28 | Ravi Pratap 29 | Robin Cornelius 30 | Sebastian at basti79.de 31 | Shmulik Regev 32 | Steinar H. Gunderson 33 | Tofu Linden 34 | Vlad Dinulescu 35 | William Ahern 36 | Yang Tse 37 | liren at vivisimo.com 38 | -------------------------------------------------------------------------------- /c-ares/CHANGES: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EXALAB/debian-noroot/afd0f723bf6f2bd53a13bbbe9c77dfa6ea11644f/c-ares/CHANGES -------------------------------------------------------------------------------- /c-ares/Makefile.dj: -------------------------------------------------------------------------------- 1 | # 2 | # c-ares Makefile for djgpp/gcc/Watt-32. 3 | # By Gisle Vanem 2004. 4 | # 5 | 6 | 7 | TOPDIR = .. 8 | 9 | DEPEND_PREREQ = ares_config.h 10 | 11 | include ../packages/DOS/common.dj 12 | include Makefile.inc 13 | 14 | CFLAGS += -DWATT32 -Dselect=select_s 15 | 16 | LDFLAGS = -s 17 | 18 | ifeq ($(USE_CURLDEBUG),1) 19 | EX_LIBS = ../lib/libcurl.a 20 | OBJ_HACK = $(OBJECTS) 21 | else 22 | OBJ_HACK = libcares.a 23 | endif 24 | 25 | ifeq ($(USE_SSL),1) 26 | EX_LIBS += $(OPENSSL_ROOT)/lib/libssl.a $(OPENSSL_ROOT)/lib/libcrypt.a 27 | endif 28 | 29 | ifeq ($(USE_ZLIB),1) 30 | EX_LIBS += $(ZLIB_ROOT)/libz.a 31 | endif 32 | 33 | ifeq ($(USE_IDNA),1) 34 | EX_LIBS += $(LIBIDN_ROOT)/lib/dj_obj/libidn.a -liconv 35 | endif 36 | 37 | EX_LIBS += $(WATT32_ROOT)/lib/libwatt.a 38 | 39 | OBJECTS = $(addprefix $(OBJ_DIR)/, $(CSOURCES:.c=.o)) 40 | 41 | all: $(OBJ_DIR) ares_config.h libcares.a ahost.exe adig.exe acountry.exe 42 | @echo Welcome to c-ares. 43 | 44 | libcares.a: $(OBJECTS) 45 | ar rs $@ $? 46 | 47 | ares_config.h: config-dos.h 48 | $(COPY) $^ $@ 49 | 50 | ahost.exe: ahost.c $(OBJ_DIR)/ares_getopt.o $(OBJ_HACK) 51 | $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(EX_LIBS) 52 | 53 | adig.exe: adig.c $(OBJ_DIR)/ares_getopt.o $(OBJ_HACK) 54 | $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(EX_LIBS) 55 | 56 | acountry.exe: acountry.c $(OBJ_DIR)/ares_getopt.o $(OBJ_HACK) 57 | $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(EX_LIBS) 58 | 59 | # clean generated files 60 | # 61 | genclean: 62 | - $(DELETE) ares_config.h 63 | 64 | # clean object files and subdir 65 | # 66 | objclean: genclean 67 | - $(DELETE) $(OBJ_DIR)$(DS)*.o 68 | - $(RMDIR) $(OBJ_DIR) 69 | 70 | # clean without removing built library and programs 71 | # 72 | clean: objclean 73 | - $(DELETE) depend.dj 74 | 75 | # clean everything 76 | # 77 | realclean vclean: clean 78 | - $(DELETE) libcares.a 79 | - $(DELETE) acountry.exe 80 | - $(DELETE) adig.exe 81 | - $(DELETE) ahost.exe 82 | - $(DELETE) libcares.a 83 | 84 | -include depend.dj 85 | 86 | -------------------------------------------------------------------------------- /c-ares/Makefile.m32: -------------------------------------------------------------------------------- 1 | ############################################################# 2 | # 3 | ## Makefile for building libcares.a with MingW32 (GCC-3.2) 4 | ## Use: make -f Makefile.m32 [demos] 5 | ## 6 | ## Quick hack by Guenter; comments to: /dev/nul 7 | # 8 | ######################################################## 9 | ## Nothing more to do below this line! 10 | 11 | LIB = libcares.a 12 | 13 | CC = gcc 14 | LD = gcc 15 | RANLIB = ranlib 16 | #RM = rm -f 17 | 18 | CFLAGS = -O2 -Wall 19 | LDFLAGS = -s 20 | LIBS = -lwsock32 21 | 22 | # Makefile.inc provides the CSOURCES and HHEADERS defines 23 | include Makefile.inc 24 | 25 | OBJLIB := $(patsubst %.c,%.o,$(strip $(CSOURCES))) 26 | 27 | 28 | $(LIB): $(OBJLIB) 29 | ar cru $@ $^ 30 | $(RANLIB) $@ 31 | 32 | all: $(LIB) demos 33 | 34 | demos: adig.exe ahost.exe acountry.exe 35 | 36 | tags: 37 | etags *.[ch] 38 | 39 | %.exe: %.o ares_getopt.o $(LIB) 40 | $(LD) $(LDFLAGS) -o $@ $^ $(LIBS) 41 | 42 | $(OBJLIB): ares.h ares_dns.h ares_private.h ares_build.h ares_rules.h 43 | 44 | .c.o: 45 | $(CC) $(CFLAGS) -c $< 46 | 47 | check: 48 | 49 | install: 50 | ${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir} 51 | ${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir} 52 | ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man3 53 | ${INSTALL} -m 644 $(LIB) ${DESTDIR}${libdir} 54 | ${RANLIB} ${DESTDIR}${libdir}/$(LIB) 55 | chmod u-w ${DESTDIR}${libdir}/$(LIB) 56 | ${INSTALL} -m 444 ${srcdir}/ares.h ${DESTDIR}${includedir} 57 | ${INSTALL} -m 444 ${srcdir}/ares_build.h ${DESTDIR}${includedir} 58 | ${INSTALL} -m 444 ${srcdir}/ares_rules.h ${DESTDIR}${includedir} 59 | (for man in $(MANPAGES); do \ 60 | ${INSTALL} -m 444 ${srcdir}/$${man} ${DESTDIR}${mandir}/man3; \ 61 | done) 62 | 63 | clean: 64 | $(RM) ares_getopt.o $(OBJLIB) $(LIB) adig.exe ahost.exe acountry.exe 65 | 66 | distclean: clean 67 | $(RM) config.cache config.log config.status Makefile 68 | 69 | -------------------------------------------------------------------------------- /c-ares/NEWS: -------------------------------------------------------------------------------- 1 | Major changes since: 2 | * see the CHANGES file 3 | 4 | Major changes in release 1.1.1: 5 | * ares should now compile as C++ code (no longer uses reserved word 6 | "class"). 7 | * Added SRV support to adig test program. 8 | * Fixed a few error handling bugs in query processing. 9 | 10 | Major changes in release 1.1.0: 11 | * Added ares_free_string() function so that memory can be freed in the 12 | same layer as it is allocated, a desirable feature in some 13 | environments. 14 | * A few of the ares_dns.h macros are fixed to use the proper bitwise 15 | operator. 16 | * Fixed a couple of fenceposts fixed in ares_expand_name()'s 17 | bounds-checking. 18 | * In process_timeouts(), extract query->next before calling 19 | next_server() and possibly freeing the query structure. 20 | * Casted arguments to ctype macros casted to unsigned char, since not 21 | all char values are valid inputs to those macros according to ANSI. 22 | -------------------------------------------------------------------------------- /c-ares/README: -------------------------------------------------------------------------------- 1 | c-ares 2 | ====== 3 | 4 | This is c-ares, an asynchronous resolver library. It is intended for 5 | applications which need to perform DNS queries without blocking, or need to 6 | perform multiple DNS queries in parallel. The primary examples of such 7 | applications are servers which communicate with multiple clients and programs 8 | with graphical user interfaces. 9 | 10 | The full source code is available in the 'c-ares' release archives, and in a 11 | git repository: http://github.com/bagder/c-ares 12 | 13 | If you find bugs, correct flaws, have questions or have comments in general in 14 | regard to c-ares (or by all means the original ares too), get in touch with us 15 | on the c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares 16 | 17 | c-ares is of course distributed under the same MIT-style license as the 18 | original ares. 19 | 20 | You'll find all c-ares details and news here: 21 | 22 | http://c-ares.haxx.se/ 23 | 24 | 25 | NOTES FOR C-ARES HACKERS 26 | 27 | The following notes apply to c-ares version 1.7.0 and later. 28 | 29 | * The distributed ares_build.h file is only intended to be used on systems 30 | which can not run the also distributed configure script. 31 | 32 | * The distributed ares_build.h file is generated as a copy of ares_build.h.dist 33 | when the c-ares source code distribution archive file is originally created. 34 | 35 | * If you check out from git on a non-configure platform, you must run the 36 | appropriate buildconf* script to set up ares_build.h and other local files 37 | before being able of compiling the library. 38 | 39 | * On systems capable of running the configure script, the configure process 40 | will overwrite the distributed ares_build.h file with one that is suitable 41 | and specific to the library being configured and built, this new file is 42 | generated from the ares_build.h.in template file. 43 | 44 | * If you intend to distribute an already compiled c-ares library you _MUST_ 45 | also distribute along with it the generated ares_build.h which has been 46 | used to compile it. Otherwise the library will be of no use for the users of 47 | the library that you have built. It is _your_ responsibility to provide this 48 | file. No one at the c-ares project can know how you have built the library. 49 | 50 | * File ares_build.h includes platform and configuration dependent info, 51 | and must not be modified by anyone. Configure script generates it for you. 52 | 53 | * We cannot assume anything else but very basic compiler features being 54 | present. While c-ares requires an ANSI C compiler to build, some of the 55 | earlier ANSI compilers clearly can't deal with some preprocessor operators. 56 | 57 | * Newlines must remain unix-style for older compilers' sake. 58 | 59 | * Comments must be written in the old-style /* unnested C-fashion */ 60 | 61 | -------------------------------------------------------------------------------- /c-ares/README.cares: -------------------------------------------------------------------------------- 1 | c-ares 2 | ====== 3 | 4 | This package is based on ares 1.1.1 (written by Greg Hudson). I decided to 5 | fork and release a separate project since the ares author didn't want the 6 | improvements that were vital for our use of it. 7 | 8 | This package is dubbed 'c-ares' since I (Daniel Stenberg) wanted this for use 9 | within the curl project (hence the letter C) and it makes a nice pun. Also, 10 | c-ares is not API compatible with ares: a new name makes that more obvious to 11 | the public. 12 | 13 | The original libares was distributed at athena-dist.mit.edu:pub/ATHENA/ares. 14 | -------------------------------------------------------------------------------- /c-ares/RELEASE-NOTES: -------------------------------------------------------------------------------- 1 | c-ares version 1.7.5 2 | 3 | Fixed: 4 | 5 | o detection of semicolon comments in resolv.conf 6 | o avoid using system's inet_net_pton affected by the WLB-2008080064 advisory 7 | o replacement ares_inet_net_pton affected by the WLB-2008080064 advisory 8 | o replacement ares_inet_ntop affected by potential out of bounds write 9 | o added install target to Makefile.msvc 10 | o only fall back to AF_INET searches when looking for AF_UNSPEC addresses 11 | o fixed ares_parse_*_reply memory leaks 12 | o Use correct sizeof in ares_getnameinfo() 13 | o IPv6-on-windows: find DNS servers correctly 14 | o man pages: docs for the c-ares utility programs 15 | o getservbyport replacement for Win CE 16 | o config_sortlist: (win32) missing else 17 | o advance_tcp_send_queue: avoid NULL ptr dereference 18 | o configure: fix a bashism 19 | o ares_expand_name: Fix encoded length for indirect root 20 | 21 | Thanks go to these friendly people for their efforts and contributions: 22 | 23 | Yang Tse, Jakub Hrozek, Gisle Vanem, Tom Hughes, David Stuart, Dima Tisnek, 24 | Peter Pentchev, Stefan Buhler 25 | 26 | Have fun! 27 | -------------------------------------------------------------------------------- /c-ares/TODO: -------------------------------------------------------------------------------- 1 | TODO 2 | ==== 3 | 4 | ares_reinit() 5 | 6 | - To allow an app to force a re-read of /etc/resolv.conf etc, pretty much 7 | like the res_init() resolver function offers 8 | 9 | ares_gethostbyname 10 | 11 | - When built to support IPv6, it needs to also support PF_UNSPEC or similar, 12 | so that an application can ask for any protocol and then c-ares would return 13 | all known resolves and not just explicitly IPv4 _or_ IPv6 resolves. 14 | 15 | ares_process 16 | 17 | - Upon next ABI breakage ares_process() should be changed to return 'int' 18 | and return ARES_ENOTINITIALIZED if ares_library_init() has not been called. 19 | 20 | ares_process_fd 21 | 22 | - Upon next ABI breakage ares_process_fd() should be changed to return 23 | 'int' and return ARES_ENOTINITIALIZED if library has not been initialized. 24 | -------------------------------------------------------------------------------- /c-ares/acountry.1: -------------------------------------------------------------------------------- 1 | .TH ACOUNTRY "1" "April 2011" "c-ares utilities" 2 | .SH NAME 3 | acountry \- print the country where an IPv4 address or host is located 4 | .SH SYNOPSIS 5 | .B acountry 6 | [\fIOPTION\fR]... \fIHOST\fR... 7 | .SH DESCRIPTION 8 | .PP 9 | .\" Add any additional description here 10 | .PP 11 | Print the country where HOST (an IPv4 address or hostname) is located, 12 | using the countries.nerd.dk DNS domain to identify the country. 13 | .PP 14 | This utility comes with the \fBc\-ares\fR asynchronous resolver library. 15 | .SH OPTIONS 16 | .TP 17 | \fB\-d\fR 18 | Print some extra debugging output. 19 | .TP 20 | \fB\-h\fR, \fB\-\-help\fR 21 | Display this help and exit. 22 | .TP 23 | \fB\-v\fR 24 | Be more verbose. Print extra information. 25 | .SH "REPORTING BUGS" 26 | Report bugs to the c-ares mailing list: 27 | \fBhttp://cool.haxx.se/mailman/listinfo/c-ares\fR 28 | .SH "SEE ALSO" 29 | .PP 30 | adig(1), ahost(1). 31 | .PP 32 | The DNSBL countries.nerd.dk 33 | .br 34 | \fBhttp://countries.nerd.dk/\fR 35 | .SH COPYRIGHT 36 | This utility is based on code/ideas contained in sofware written by Greg Hudson (ares) 37 | carrying the following notice: 38 | .br 39 | Copyright 1998 by the Massachusetts Institute of Technology. 40 | .br 41 | Permission to use, copy, modify, and distribute this software and its 42 | documentation for any purpose and without fee is hereby granted, 43 | provided that the above copyright notice appear in all copies and that 44 | both that copyright notice and this permission notice appear in 45 | supporting documentation, and that the name of M.I.T. not be used in 46 | advertising or publicity pertaining to distribution of the software 47 | without specific, written prior permission. M.I.T. makes no 48 | representations about the suitability of this software for any 49 | purpose. It is provided "as is" without express or implied warranty. 50 | .br 51 | No further copyright claims are being made by the author(s) of this utility. 52 | .SH AUTHOR 53 | Gisle Vanem 54 | -------------------------------------------------------------------------------- /c-ares/acountry.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EXALAB/debian-noroot/afd0f723bf6f2bd53a13bbbe9c77dfa6ea11644f/c-ares/acountry.c -------------------------------------------------------------------------------- /c-ares/adig.1: -------------------------------------------------------------------------------- 1 | .TH ADIG "1" "April 2011" "c-ares utilities" 2 | .SH NAME 3 | adig \- print information collected from Domain Name System (DNS) servers 4 | .SH SYNOPSIS 5 | .B adig 6 | [\fIOPTION\fR]... \fINAME\fR... 7 | .SH DESCRIPTION 8 | .PP 9 | .\" Add any additional description here 10 | .PP 11 | Send queries to DNS servers about \fINAME\fR and print received 12 | information, where \fINAME\fR is a valid DNS name (e.g. www.example.com, 13 | 1.2.3.10.in-addr.arpa). 14 | .PP 15 | This utility comes with the \fBc\-ares\fR asynchronous resolver library. 16 | .SH OPTIONS 17 | .TP 18 | \fB\-c\fR class 19 | Set the query class. 20 | Possible values for class are 21 | NY, CHAOS, HS, IN (default). 22 | .TP 23 | \fB\-d\fR 24 | Print some extra debugging output. 25 | .TP 26 | \fB\-f\fR flag 27 | Add a flag. 28 | Possible values for flag are 29 | igntc, noaliases, norecurse, primary, stayopen, usevc. 30 | .TP 31 | \fB\-h\fR, \fB\-\-help\fR 32 | Display this help and exit. 33 | .TP 34 | \fB\-T\fR port 35 | Use specified TCP port to connect to DNS server. 36 | .TP 37 | \fB\-s\fR server 38 | Connect to specified DNS server, instead of the system's default one(s). 39 | .TP 40 | \fB\-t\fR type 41 | Query records of specified type. 42 | Possible values for type are 43 | A (default), AAAA, AFSDB, ANY, AXFR, CNAME, GPOS, HINFO, ISDN, KEY, LOC, MAILA, 44 | MAILB, MB, MD, MF, MG, MINFO, MR, MX, NAPTR, NS, NSAP, NSAP_PTR, NULL, 45 | PTR, PX, RP, RT, SIG, SOA, SRV, TXT, WKS, X25, 46 | .TP 47 | \fB\-U\fR port 48 | Use specified UDP port to connect to DNS server. 49 | .SH "REPORTING BUGS" 50 | Report bugs to the c-ares mailing list: 51 | \fBhttp://cool.haxx.se/mailman/listinfo/c-ares\fR 52 | .SH "SEE ALSO" 53 | .PP 54 | acountry(1), ahost(1). 55 | .SH COPYRIGHT 56 | This utility is based on code/ideas contained in sofware written by Greg Hudson (ares) 57 | carrying the following notice: 58 | .br 59 | Copyright 1998 by the Massachusetts Institute of Technology. 60 | .br 61 | Permission to use, copy, modify, and distribute this software and its 62 | documentation for any purpose and without fee is hereby granted, 63 | provided that the above copyright notice appear in all copies and that 64 | both that copyright notice and this permission notice appear in 65 | supporting documentation, and that the name of M.I.T. not be used in 66 | advertising or publicity pertaining to distribution of the software 67 | without specific, written prior permission. M.I.T. makes no 68 | representations about the suitability of this software for any 69 | purpose. It is provided "as is" without express or implied warranty. 70 | .br 71 | No further copyright claims are being made by the author(s) of this utility. 72 | -------------------------------------------------------------------------------- /c-ares/ahost.1: -------------------------------------------------------------------------------- 1 | .TH AHOST "1" "April 2011" "c-ares utilities" 2 | .SH NAME 3 | ahost \- print the A or AAAA record associated with a hostname or IP address 4 | .SH SYNOPSIS 5 | .B ahost 6 | [\fIOPTION\fR]... \fIHOST\fR... 7 | .SH DESCRIPTION 8 | .PP 9 | .\" Add any additional description here 10 | .PP 11 | Look up the DNS A or AAAA record associated with HOST (a hostname or an 12 | IP address). 13 | .PP 14 | This utility comes with the \fBc\-ares\fR asynchronous resolver library. 15 | .SH OPTIONS 16 | .TP 17 | \fB\-d\fR 18 | Print some extra debugging output. 19 | .TP 20 | \fB\-h\fR, \fB\-\-help\fR 21 | Display this help and exit. 22 | .TP 23 | \fB\-t\fR type 24 | If type is "aa", print the A record (default). 25 | If type is "aaaa", print the AAAA record. 26 | .SH "REPORTING BUGS" 27 | Report bugs to the c-ares mailing list: 28 | \fBhttp://cool.haxx.se/mailman/listinfo/c-ares\fR 29 | .SH "SEE ALSO" 30 | .PP 31 | acountry(1), adig(1). 32 | .SH COPYRIGHT 33 | This utility is based on code/ideas contained in sofware written by Greg Hudson (ares) 34 | carrying the following notice: 35 | .br 36 | Copyright 1998 by the Massachusetts Institute of Technology. 37 | .br 38 | Permission to use, copy, modify, and distribute this software and its 39 | documentation for any purpose and without fee is hereby granted, 40 | provided that the above copyright notice appear in all copies and that 41 | both that copyright notice and this permission notice appear in 42 | supporting documentation, and that the name of M.I.T. not be used in 43 | advertising or publicity pertaining to distribution of the software 44 | without specific, written prior permission. M.I.T. makes no 45 | representations about the suitability of this software for any 46 | purpose. It is provided "as is" without express or implied warranty. 47 | .br 48 | No further copyright claims are being made by the author(s) of this utility. 49 | -------------------------------------------------------------------------------- /c-ares/ares__close_sockets.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright 1998 by the Massachusetts Institute of Technology. 3 | * 4 | * Permission to use, copy, modify, and distribute this 5 | * software and its documentation for any purpose and without 6 | * fee is hereby granted, provided that the above copyright 7 | * notice appear in all copies and that both that copyright 8 | * notice and this permission notice appear in supporting 9 | * documentation, and that the name of M.I.T. not be used in 10 | * advertising or publicity pertaining to distribution of the 11 | * software without specific, written prior permission. 12 | * M.I.T. makes no representations about the suitability of 13 | * this software for any purpose. It is provided "as is" 14 | * without express or implied warranty. 15 | */ 16 | 17 | #include "ares_setup.h" 18 | 19 | #include 20 | #ifdef HAVE_UNISTD_H 21 | #include 22 | #endif 23 | 24 | #include "ares.h" 25 | #include "ares_private.h" 26 | 27 | void ares__close_sockets(ares_channel channel, struct server_state *server) 28 | { 29 | struct send_request *sendreq; 30 | 31 | /* Free all pending output buffers. */ 32 | while (server->qhead) 33 | { 34 | /* Advance server->qhead; pull out query as we go. */ 35 | sendreq = server->qhead; 36 | server->qhead = sendreq->next; 37 | if (sendreq->data_storage != NULL) 38 | free(sendreq->data_storage); 39 | free(sendreq); 40 | } 41 | server->qtail = NULL; 42 | 43 | /* Reset any existing input buffer. */ 44 | if (server->tcp_buffer) 45 | free(server->tcp_buffer); 46 | server->tcp_buffer = NULL; 47 | server->tcp_lenbuf_pos = 0; 48 | 49 | /* Reset brokenness */ 50 | server->is_broken = 0; 51 | 52 | /* Close the TCP and UDP sockets. */ 53 | if (server->tcp_socket != ARES_SOCKET_BAD) 54 | { 55 | SOCK_STATE_CALLBACK(channel, server->tcp_socket, 0, 0); 56 | sclose(server->tcp_socket); 57 | server->tcp_socket = ARES_SOCKET_BAD; 58 | server->tcp_connection_generation = ++channel->tcp_connection_generation; 59 | } 60 | if (server->udp_socket != ARES_SOCKET_BAD) 61 | { 62 | SOCK_STATE_CALLBACK(channel, server->udp_socket, 0, 0); 63 | sclose(server->udp_socket); 64 | server->udp_socket = ARES_SOCKET_BAD; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /c-ares/ares__read_line.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright 1998 by the Massachusetts Institute of Technology. 3 | * 4 | * Permission to use, copy, modify, and distribute this 5 | * software and its documentation for any purpose and without 6 | * fee is hereby granted, provided that the above copyright 7 | * notice appear in all copies and that both that copyright 8 | * notice and this permission notice appear in supporting 9 | * documentation, and that the name of M.I.T. not be used in 10 | * advertising or publicity pertaining to distribution of the 11 | * software without specific, written prior permission. 12 | * M.I.T. makes no representations about the suitability of 13 | * this software for any purpose. It is provided "as is" 14 | * without express or implied warranty. 15 | */ 16 | 17 | #include "ares_setup.h" 18 | #include 19 | #include 20 | #include 21 | #include "ares.h" 22 | #include "ares_nowarn.h" 23 | #include "ares_private.h" 24 | 25 | /* This is an internal function. Its contract is to read a line from 26 | * a file into a dynamically allocated buffer, zeroing the trailing 27 | * newline if there is one. The calling routine may call 28 | * ares__read_line multiple times with the same buf and bufsize 29 | * pointers; *buf will be reallocated and *bufsize adjusted as 30 | * appropriate. The initial value of *buf should be NULL. After the 31 | * calling routine is done reading lines, it should free *buf. 32 | */ 33 | int ares__read_line(FILE *fp, char **buf, size_t *bufsize) 34 | { 35 | char *newbuf; 36 | size_t offset = 0; 37 | size_t len; 38 | 39 | if (*buf == NULL) 40 | { 41 | *buf = malloc(128); 42 | if (!*buf) 43 | return ARES_ENOMEM; 44 | *bufsize = 128; 45 | } 46 | 47 | for (;;) 48 | { 49 | int bytestoread = aresx_uztosi(*bufsize - offset); 50 | 51 | if (!fgets(*buf + offset, bytestoread, fp)) 52 | return (offset != 0) ? 0 : (ferror(fp)) ? ARES_EFILE : ARES_EOF; 53 | len = offset + strlen(*buf + offset); 54 | if ((*buf)[len - 1] == '\n') 55 | { 56 | (*buf)[len - 1] = 0; 57 | break; 58 | } 59 | offset = len; 60 | if(len < *bufsize - 1) 61 | continue; 62 | 63 | /* Allocate more space. */ 64 | newbuf = realloc(*buf, *bufsize * 2); 65 | if (!newbuf) 66 | return ARES_ENOMEM; 67 | *buf = newbuf; 68 | *bufsize *= 2; 69 | } 70 | return ARES_SUCCESS; 71 | } 72 | -------------------------------------------------------------------------------- /c-ares/ares_cancel.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 1998 by the Massachusetts Institute of Technology. 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this 5 | .\" software and its documentation for any purpose and without 6 | .\" fee is hereby granted, provided that the above copyright 7 | .\" notice appear in all copies and that both that copyright 8 | .\" notice and this permission notice appear in supporting 9 | .\" documentation, and that the name of M.I.T. not be used in 10 | .\" advertising or publicity pertaining to distribution of the 11 | .\" software without specific, written prior permission. 12 | .\" M.I.T. makes no representations about the suitability of 13 | .\" this software for any purpose. It is provided "as is" 14 | .\" without express or implied warranty. 15 | .\" 16 | .TH ARES_CANCEL 3 "31 March 2004" 17 | .SH NAME 18 | ares_cancel \- Cancel a resolve 19 | .SH SYNOPSIS 20 | .nf 21 | .B #include 22 | .PP 23 | .B void ares_cancel(ares_channel \fIchannel\fP) 24 | .fi 25 | .SH DESCRIPTION 26 | The \fBares_cancel\fP function cancels all lookups/requests made on the the 27 | name service channel identified by \fIchannel\fP. \fBares_cancel\fP invokes 28 | the callbacks for each pending query on the channel, passing a status of 29 | .BR ARES_ECANCELLED . 30 | These calls give the callbacks a chance to clean up any state which 31 | might have been stored in their arguments. 32 | .SH SEE ALSO 33 | .BR ares_init (3) 34 | .BR ares_destroy (3) 35 | .SH NOTES 36 | This function was added in c-ares 1.2.0 37 | 38 | c-ares 1.6.0 and earlier pass a status of 39 | .BR ARES_ETIMEOUT 40 | instead of 41 | .BR ARES_ECANCELLED . 42 | .SH AUTHOR 43 | Dirk Manske 44 | -------------------------------------------------------------------------------- /c-ares/ares_cancel.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (C) 2004 by Daniel Stenberg et al 3 | * 4 | * Permission to use, copy, modify, and distribute this software and its 5 | * documentation for any purpose and without fee is hereby granted, provided 6 | * that the above copyright notice appear in all copies and that both that 7 | * copyright notice and this permission notice appear in supporting 8 | * documentation, and that the name of M.I.T. not be used in advertising or 9 | * publicity pertaining to distribution of the software without specific, 10 | * written prior permission. M.I.T. makes no representations about the 11 | * suitability of this software for any purpose. It is provided "as is" 12 | * without express or implied warranty. 13 | */ 14 | 15 | #include "ares_setup.h" 16 | #include 17 | #include 18 | #include "ares.h" 19 | #include "ares_private.h" 20 | 21 | /* 22 | * ares_cancel() cancels all ongoing requests/resolves that might be going on 23 | * on the given channel. It does NOT kill the channel, use ares_destroy() for 24 | * that. 25 | */ 26 | void ares_cancel(ares_channel channel) 27 | { 28 | struct query *query; 29 | struct list_node* list_head; 30 | struct list_node* list_node; 31 | int i; 32 | 33 | list_head = &(channel->all_queries); 34 | for (list_node = list_head->next; list_node != list_head; ) 35 | { 36 | query = list_node->data; 37 | list_node = list_node->next; /* since we're deleting the query */ 38 | query->callback(query->arg, ARES_ECANCELLED, 0, NULL, 0); 39 | ares__free_query(query); 40 | } 41 | #ifndef NDEBUG 42 | /* Freeing the query should remove it from all the lists in which it sits, 43 | * so all query lists should be empty now. 44 | */ 45 | assert(ares__is_list_empty(&(channel->all_queries))); 46 | for (i = 0; i < ARES_QID_TABLE_SIZE; i++) 47 | { 48 | assert(ares__is_list_empty(&(channel->queries_by_qid[i]))); 49 | } 50 | for (i = 0; i < ARES_TIMEOUT_TABLE_SIZE; i++) 51 | { 52 | assert(ares__is_list_empty(&(channel->queries_by_timeout[i]))); 53 | } 54 | #endif 55 | if (!(channel->flags & ARES_FLAG_STAYOPEN)) 56 | { 57 | if (channel->servers) 58 | { 59 | for (i = 0; i < channel->nservers; i++) 60 | ares__close_sockets(channel, &channel->servers[i]); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /c-ares/ares_data.h: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (C) 2009-2010 by Daniel Stenberg 3 | * 4 | * Permission to use, copy, modify, and distribute this 5 | * software and its documentation for any purpose and without 6 | * fee is hereby granted, provided that the above copyright 7 | * notice appear in all copies and that both that copyright 8 | * notice and this permission notice appear in supporting 9 | * documentation, and that the name of M.I.T. not be used in 10 | * advertising or publicity pertaining to distribution of the 11 | * software without specific, written prior permission. 12 | * M.I.T. makes no representations about the suitability of 13 | * this software for any purpose. It is provided "as is" 14 | * without express or implied warranty. 15 | */ 16 | 17 | typedef enum { 18 | ARES_DATATYPE_UNKNOWN = 1, /* unknown data type - introduced in 1.7.0 */ 19 | ARES_DATATYPE_SRV_REPLY, /* struct ares_srv_reply - introduced in 1.7.0 */ 20 | ARES_DATATYPE_TXT_REPLY, /* struct ares_txt_reply - introduced in 1.7.0 */ 21 | ARES_DATATYPE_ADDR_NODE, /* struct ares_addr_node - introduced in 1.7.1 */ 22 | ARES_DATATYPE_MX_REPLY, /* struct ares_mx_reply - introduced in 1.7.2 */ 23 | #if 0 24 | ARES_DATATYPE_ADDR6TTL, /* struct ares_addrttl */ 25 | ARES_DATATYPE_ADDRTTL, /* struct ares_addr6ttl */ 26 | ARES_DATATYPE_HOSTENT, /* struct hostent */ 27 | ARES_DATATYPE_OPTIONS, /* struct ares_options */ 28 | #endif 29 | ARES_DATATYPE_LAST /* not used - introduced in 1.7.0 */ 30 | } ares_datatype; 31 | 32 | #define ARES_DATATYPE_MARK 0xbead 33 | 34 | /* 35 | * ares_data struct definition is internal to c-ares and shall not 36 | * be exposed by the public API in order to allow future changes 37 | * and extensions to it without breaking ABI. This will be used 38 | * internally by c-ares as the container of multiple types of data 39 | * dynamically allocated for which a reference will be returned 40 | * to the calling application. 41 | * 42 | * c-ares API functions returning a pointer to c-ares internally 43 | * allocated data will actually be returning an interior pointer 44 | * into this ares_data struct. 45 | * 46 | * All this is 'invisible' to the calling application, the only 47 | * requirement is that this kind of data must be free'ed by the 48 | * calling application using ares_free_data() with the pointer 49 | * it has received from a previous c-ares function call. 50 | */ 51 | 52 | struct ares_data { 53 | ares_datatype type; /* Actual data type identifier. */ 54 | unsigned int mark; /* Private ares_data signature. */ 55 | union { 56 | struct ares_txt_reply txt_reply; 57 | struct ares_srv_reply srv_reply; 58 | struct ares_addr_node addr_node; 59 | struct ares_mx_reply mx_reply; 60 | } data; 61 | }; 62 | 63 | void *ares_malloc_data(ares_datatype type); 64 | 65 | ares_datatype ares_get_datatype(void * dataptr); 66 | -------------------------------------------------------------------------------- /c-ares/ares_destroy.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 1998 by the Massachusetts Institute of Technology. 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this 5 | .\" software and its documentation for any purpose and without 6 | .\" fee is hereby granted, provided that the above copyright 7 | .\" notice appear in all copies and that both that copyright 8 | .\" notice and this permission notice appear in supporting 9 | .\" documentation, and that the name of M.I.T. not be used in 10 | .\" advertising or publicity pertaining to distribution of the 11 | .\" software without specific, written prior permission. 12 | .\" M.I.T. makes no representations about the suitability of 13 | .\" this software for any purpose. It is provided "as is" 14 | .\" without express or implied warranty. 15 | .\" 16 | .TH ARES_DESTROY 3 "7 December 2004" 17 | .SH NAME 18 | ares_destroy \- Destroy a resolver channel 19 | .SH SYNOPSIS 20 | .nf 21 | .B #include 22 | .PP 23 | .B void ares_destroy(ares_channel \fIchannel\fP) 24 | .fi 25 | .SH DESCRIPTION 26 | The 27 | .B ares_destroy 28 | function destroys the name service channel identified by 29 | .IR channel , 30 | freeing all memory and closing all sockets used by the channel. 31 | .B ares_destroy 32 | invokes the callbacks for each pending query on the channel, passing a 33 | status of 34 | .BR ARES_EDESTRUCTION . 35 | These calls give the callbacks a chance to clean up any state which 36 | might have been stored in their arguments. 37 | .SH SEE ALSO 38 | .BR ares_init (3), 39 | .BR ares_cancel (3) 40 | .SH AUTHOR 41 | Greg Hudson, MIT Information Systems 42 | .br 43 | Copyright 1998 by the Massachusetts Institute of Technology. 44 | -------------------------------------------------------------------------------- /c-ares/ares_destroy.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright 1998 by the Massachusetts Institute of Technology. 3 | * Copyright (C) 2004-2010 by Daniel Stenberg 4 | * 5 | * Permission to use, copy, modify, and distribute this 6 | * software and its documentation for any purpose and without 7 | * fee is hereby granted, provided that the above copyright 8 | * notice appear in all copies and that both that copyright 9 | * notice and this permission notice appear in supporting 10 | * documentation, and that the name of M.I.T. not be used in 11 | * advertising or publicity pertaining to distribution of the 12 | * software without specific, written prior permission. 13 | * M.I.T. makes no representations about the suitability of 14 | * this software for any purpose. It is provided "as is" 15 | * without express or implied warranty. 16 | */ 17 | 18 | #include "ares_setup.h" 19 | #include 20 | #include 21 | #include "ares.h" 22 | #include "ares_private.h" 23 | 24 | void ares_destroy_options(struct ares_options *options) 25 | { 26 | int i; 27 | 28 | if(options->servers) 29 | free(options->servers); 30 | for (i = 0; i < options->ndomains; i++) 31 | free(options->domains[i]); 32 | free(options->domains); 33 | if(options->sortlist) 34 | free(options->sortlist); 35 | free(options->lookups); 36 | } 37 | 38 | void ares_destroy(ares_channel channel) 39 | { 40 | int i; 41 | struct query *query; 42 | struct list_node* list_head; 43 | struct list_node* list_node; 44 | 45 | if (!channel) 46 | return; 47 | 48 | list_head = &(channel->all_queries); 49 | for (list_node = list_head->next; list_node != list_head; ) 50 | { 51 | query = list_node->data; 52 | list_node = list_node->next; /* since we're deleting the query */ 53 | query->callback(query->arg, ARES_EDESTRUCTION, 0, NULL, 0); 54 | ares__free_query(query); 55 | } 56 | #ifndef NDEBUG 57 | /* Freeing the query should remove it from all the lists in which it sits, 58 | * so all query lists should be empty now. 59 | */ 60 | assert(ares__is_list_empty(&(channel->all_queries))); 61 | for (i = 0; i < ARES_QID_TABLE_SIZE; i++) 62 | { 63 | assert(ares__is_list_empty(&(channel->queries_by_qid[i]))); 64 | } 65 | for (i = 0; i < ARES_TIMEOUT_TABLE_SIZE; i++) 66 | { 67 | assert(ares__is_list_empty(&(channel->queries_by_timeout[i]))); 68 | } 69 | #endif 70 | 71 | ares__destroy_servers_state(channel); 72 | 73 | if (channel->domains) { 74 | for (i = 0; i < channel->ndomains; i++) 75 | free(channel->domains[i]); 76 | free(channel->domains); 77 | } 78 | 79 | if(channel->sortlist) 80 | free(channel->sortlist); 81 | 82 | if (channel->lookups) 83 | free(channel->lookups); 84 | 85 | free(channel); 86 | } 87 | 88 | void ares__destroy_servers_state(ares_channel channel) 89 | { 90 | struct server_state *server; 91 | int i; 92 | 93 | if (channel->servers) 94 | { 95 | for (i = 0; i < channel->nservers; i++) 96 | { 97 | server = &channel->servers[i]; 98 | ares__close_sockets(channel, server); 99 | assert(ares__is_list_empty(&server->queries_to_server)); 100 | } 101 | free(channel->servers); 102 | channel->servers = NULL; 103 | } 104 | channel->nservers = -1; 105 | } 106 | -------------------------------------------------------------------------------- /c-ares/ares_destroy_options.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 1998 by the Massachusetts Institute of Technology. 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this 5 | .\" software and its documentation for any purpose and without 6 | .\" fee is hereby granted, provided that the above copyright 7 | .\" notice appear in all copies and that both that copyright 8 | .\" notice and this permission notice appear in supporting 9 | .\" documentation, and that the name of M.I.T. not be used in 10 | .\" advertising or publicity pertaining to distribution of the 11 | .\" software without specific, written prior permission. 12 | .\" M.I.T. makes no representations about the suitability of 13 | .\" this software for any purpose. It is provided "as is" 14 | .\" without express or implied warranty. 15 | .\" 16 | .TH ARES_DESTROY_OPTIONS 3 "1 June 2007" 17 | .SH NAME 18 | ares_destroy_options \- Destroy options initialized with ares_save_options 19 | .SH SYNOPSIS 20 | .nf 21 | .B #include 22 | .PP 23 | .B void ares_destroy_options(struct ares_options *\fIoptions\fP) 24 | .fi 25 | .SH DESCRIPTION 26 | The 27 | .B ares_destroy_options 28 | function destroys the options struct identified by 29 | .IR options , 30 | freeing all memory allocated by ares_save_options. 31 | 32 | .SH SEE ALSO 33 | .BR ares_save_options (3), 34 | .BR ares_init_options (3) 35 | .SH AUTHOR 36 | Brad House 37 | .br 38 | Copyright 1998 by the Massachusetts Institute of Technology. 39 | -------------------------------------------------------------------------------- /c-ares/ares_dup.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright (C) 2004-2009 by Daniel Stenberg 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this 5 | .\" software and its documentation for any purpose and without 6 | .\" fee is hereby granted, provided that the above copyright 7 | .\" notice appear in all copies and that both that copyright 8 | .\" notice and this permission notice appear in supporting 9 | .\" documentation, and that the name of M.I.T. not be used in 10 | .\" advertising or publicity pertaining to distribution of the 11 | .\" software without specific, written prior permission. 12 | .\" M.I.T. makes no representations about the suitability of 13 | .\" this software for any purpose. It is provided "as is" 14 | .\" without express or implied warranty. 15 | .\" 16 | .TH ARES_DUP 3 "26 May 2009" 17 | .SH NAME 18 | ares_dup \- Duplicate a resolver channel 19 | .SH SYNOPSIS 20 | .nf 21 | .B #include 22 | .PP 23 | .B int ares_dup(ares_channel *\fIdest\fP, ares_channel \fIsource\fP) 24 | .fi 25 | .SH DESCRIPTION 26 | The \fBares_dup(3)\fP function duplicates an existing communications channel 27 | for name service lookups. If it returns successfully, \fBares_dup(3)\fP will 28 | set the variable pointed to by \fIdest\fP to a handle used to identify the 29 | name service channel. The caller should invoke \fIares_destroy(3)\fP on the 30 | handle when the channel is no longer needed. 31 | 32 | The \fBares_dup_options\fP function also initializes a name service channel, 33 | with additional options set exactly as the \fIsource\fP channel has them 34 | configured. 35 | .SH SEE ALSO 36 | .BR ares_destroy(3), 37 | .BR ares_init(3), 38 | .BR ares_library_init(3) 39 | .SH AVAILABILITY 40 | ares_dup(3) was added in c-ares 1.6.0 41 | .SH AUTHOR 42 | Daniel Stenberg 43 | 44 | -------------------------------------------------------------------------------- /c-ares/ares_expand_name.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 1998 by the Massachusetts Institute of Technology. 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this 5 | .\" software and its documentation for any purpose and without 6 | .\" fee is hereby granted, provided that the above copyright 7 | .\" notice appear in all copies and that both that copyright 8 | .\" notice and this permission notice appear in supporting 9 | .\" documentation, and that the name of M.I.T. not be used in 10 | .\" advertising or publicity pertaining to distribution of the 11 | .\" software without specific, written prior permission. 12 | .\" M.I.T. makes no representations about the suitability of 13 | .\" this software for any purpose. It is provided "as is" 14 | .\" without express or implied warranty. 15 | .\" 16 | .TH ARES_EXPAND_NAME 3 "20 Nov 2009" 17 | .SH NAME 18 | ares_expand_name \- Expand a DNS-encoded domain name 19 | .SH SYNOPSIS 20 | .nf 21 | .B #include 22 | .PP 23 | .B int ares_expand_name(const unsigned char *\fIencoded\fP, 24 | .B const unsigned char *\fIabuf\fP, int \fIalen\fP, char **\fIs\fP, 25 | .B long *\fIenclen\fP) 26 | .fi 27 | .SH DESCRIPTION 28 | The 29 | .B ares_expand_name 30 | function converts a DNS-encoded domain name to a dot-separated C 31 | string. The argument 32 | .I encoded 33 | gives the beginning of the encoded domain name, and the arguments 34 | .I abuf 35 | and 36 | .I alen 37 | give the containing message buffer (necessary for the processing of 38 | indirection pointers within the encoded domain name). The result is 39 | placed in a NUL-terminated allocated buffer, a pointer to which is 40 | stored in the variable pointed to by 41 | .IR s . 42 | The length of the encoded name is stored in the variable pointed to by 43 | .I enclen 44 | so that the caller can advance past the encoded domain name to read 45 | further data in the message. 46 | .SH RETURN VALUES 47 | .B ares_expand_name 48 | can return any of the following values: 49 | .TP 15 50 | .B ARES_SUCCESS 51 | Expansion of the encoded name succeeded. 52 | .TP 15 53 | .B ARES_EBADNAME 54 | The encoded domain name was malformed and could not be expanded. 55 | .TP 15 56 | .B ARES_ENOMEM 57 | Memory was exhausted. 58 | .SH SEE ALSO 59 | .BR ares_mkquery (3) 60 | .SH AUTHOR 61 | Greg Hudson, MIT Information Systems 62 | .br 63 | Copyright 1998 by the Massachusetts Institute of Technology. 64 | -------------------------------------------------------------------------------- /c-ares/ares_expand_string.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 1998 by the Massachusetts Institute of Technology. 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this 5 | .\" software and its documentation for any purpose and without 6 | .\" fee is hereby granted, provided that the above copyright 7 | .\" notice appear in all copies and that both that copyright 8 | .\" notice and this permission notice appear in supporting 9 | .\" documentation, and that the name of M.I.T. not be used in 10 | .\" advertising or publicity pertaining to distribution of the 11 | .\" software without specific, written prior permission. 12 | .\" M.I.T. makes no representations about the suitability of 13 | .\" this software for any purpose. It is provided "as is" 14 | .\" without express or implied warranty. 15 | .\" 16 | .TH ARES_EXPAND_NAME 3 "20 Nov 2009" 17 | .SH NAME 18 | ares_expand_string \- Expand a length encoded string 19 | .SH SYNOPSIS 20 | .nf 21 | .B #include 22 | .PP 23 | .B int ares_expand_string(const unsigned char *\fIencoded\fP, 24 | .B const unsigned char *\fIabuf\fP, int \fIalen\fP, unsigned char **\fIs\fP, 25 | .B long *\fIenclen\fP) 26 | .fi 27 | .SH DESCRIPTION 28 | The 29 | .B ares_expand_string 30 | function converts a length encoded string to a NUL-terminated C 31 | string. The argument 32 | .I encoded 33 | gives the beginning of the encoded string, and the arguments 34 | .I abuf 35 | and 36 | .I alen 37 | give the containing message buffer (necessary for the processing of 38 | indirection pointers within the encoded domain name). The result is 39 | placed in a NUL-terminated allocated buffer, a pointer to which is 40 | stored in the variable pointed to by 41 | .IR s . 42 | The length of the encoded string is stored in the variable pointed to by 43 | .I enclen 44 | so that the caller can advance past the encoded string to read 45 | further data in the message. 46 | .SH RETURN VALUES 47 | .B ares_expand_string 48 | can return any of the following values: 49 | .TP 15 50 | .B ARES_SUCCESS 51 | Expansion of the encoded string succeeded. 52 | .TP 15 53 | .B ARES_EBADSTR 54 | The encoded string was malformed and could not be expanded. 55 | .TP 15 56 | .B ARES_ENOMEM 57 | Memory was exhausted. 58 | .SH SEE ALSO 59 | .BR ares_free_string (3) 60 | .SH AUTHOR 61 | Dominick Meglio 62 | -------------------------------------------------------------------------------- /c-ares/ares_expand_string.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright 1998 by the Massachusetts Institute of Technology. 3 | * 4 | * Permission to use, copy, modify, and distribute this 5 | * software and its documentation for any purpose and without 6 | * fee is hereby granted, provided that the above copyright 7 | * notice appear in all copies and that both that copyright 8 | * notice and this permission notice appear in supporting 9 | * documentation, and that the name of M.I.T. not be used in 10 | * advertising or publicity pertaining to distribution of the 11 | * software without specific, written prior permission. 12 | * M.I.T. makes no representations about the suitability of 13 | * this software for any purpose. It is provided "as is" 14 | * without express or implied warranty. 15 | */ 16 | 17 | #include "ares_setup.h" 18 | 19 | #ifdef HAVE_SYS_SOCKET_H 20 | # include 21 | #endif 22 | #ifdef HAVE_NETINET_IN_H 23 | # include 24 | #endif 25 | #ifdef HAVE_ARPA_NAMESER_H 26 | # include 27 | #else 28 | # include "nameser.h" 29 | #endif 30 | 31 | #include 32 | #include 33 | #include "ares.h" 34 | #include "ares_private.h" /* for the memdebug */ 35 | 36 | /* Simply decodes a length-encoded character string. The first byte of the 37 | * input is the length of the string to be returned and the bytes thereafter 38 | * are the characters of the string. The returned result will be NULL 39 | * terminated. 40 | */ 41 | int ares_expand_string(const unsigned char *encoded, 42 | const unsigned char *abuf, 43 | int alen, 44 | unsigned char **s, 45 | long *enclen) 46 | { 47 | unsigned char *q; 48 | union { 49 | ssize_t sig; 50 | size_t uns; 51 | } elen; 52 | 53 | if (encoded == abuf+alen) 54 | return ARES_EBADSTR; 55 | 56 | elen.uns = *encoded; 57 | if (encoded+elen.sig+1 > abuf+alen) 58 | return ARES_EBADSTR; 59 | 60 | encoded++; 61 | 62 | *s = malloc(elen.uns+1); 63 | if (*s == NULL) 64 | return ARES_ENOMEM; 65 | q = *s; 66 | strncpy((char *)q, (char *)encoded, elen.uns); 67 | q[elen.uns] = '\0'; 68 | 69 | *s = q; 70 | 71 | *enclen = (long)(elen.sig+1); 72 | 73 | return ARES_SUCCESS; 74 | } 75 | 76 | -------------------------------------------------------------------------------- /c-ares/ares_fds.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 1998 by the Massachusetts Institute of Technology. 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this 5 | .\" software and its documentation for any purpose and without 6 | .\" fee is hereby granted, provided that the above copyright 7 | .\" notice appear in all copies and that both that copyright 8 | .\" notice and this permission notice appear in supporting 9 | .\" documentation, and that the name of M.I.T. not be used in 10 | .\" advertising or publicity pertaining to distribution of the 11 | .\" software without specific, written prior permission. 12 | .\" M.I.T. makes no representations about the suitability of 13 | .\" this software for any purpose. It is provided "as is" 14 | .\" without express or implied warranty. 15 | .\" 16 | .TH ARES_FDS 3 "23 July 1998" 17 | .SH NAME 18 | ares_fds \- Get file descriptors to select on for name service 19 | .SH SYNOPSIS 20 | .nf 21 | .B #include 22 | .PP 23 | .B int ares_fds(ares_channel \fIchannel\fP, fd_set *\fIread_fds\fP, 24 | .B fd_set *\fIwrite_fds\fP) 25 | .fi 26 | .SH DESCRIPTION 27 | The 28 | .B ares_fds 29 | function retrieves the set of file descriptors which the calling 30 | application should select on for reading and writing for the 31 | processing of name service queries pending on the name service channel 32 | identified by 33 | .IR channel . 34 | File descriptors will be set in the file descriptor sets pointed to by 35 | .I read_fds 36 | and 37 | .I write_fds 38 | as appropriate. File descriptors already set in 39 | .I read_fds 40 | and 41 | .I write_fds 42 | will remain set; initialization of the file descriptor sets 43 | (using 44 | .BR FD_ZERO ) 45 | is the responsibility of the caller. 46 | .SH RETURN VALUES 47 | .B ares_fds 48 | returns one greater than the number of the highest socket set in either 49 | .I read_fds 50 | or 51 | .IR write_fds . 52 | If no queries are active, 53 | .B ares_fds 54 | will return 0. 55 | .SH SEE ALSO 56 | .BR ares_timeout (3), 57 | .BR ares_process (3) 58 | .SH AUTHOR 59 | Greg Hudson, MIT Information Systems 60 | .br 61 | Copyright 1998 by the Massachusetts Institute of Technology. 62 | -------------------------------------------------------------------------------- /c-ares/ares_fds.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright 1998 by the Massachusetts Institute of Technology. 3 | * 4 | * Permission to use, copy, modify, and distribute this 5 | * software and its documentation for any purpose and without 6 | * fee is hereby granted, provided that the above copyright 7 | * notice appear in all copies and that both that copyright 8 | * notice and this permission notice appear in supporting 9 | * documentation, and that the name of M.I.T. not be used in 10 | * advertising or publicity pertaining to distribution of the 11 | * software without specific, written prior permission. 12 | * M.I.T. makes no representations about the suitability of 13 | * this software for any purpose. It is provided "as is" 14 | * without express or implied warranty. 15 | */ 16 | 17 | #include "ares_setup.h" 18 | 19 | #ifdef HAVE_SYS_TIME_H 20 | #include 21 | #endif 22 | 23 | #include "ares.h" 24 | #include "ares_nowarn.h" 25 | #include "ares_private.h" 26 | 27 | int ares_fds(ares_channel channel, fd_set *read_fds, fd_set *write_fds) 28 | { 29 | struct server_state *server; 30 | ares_socket_t nfds; 31 | int i; 32 | 33 | /* Are there any active queries? */ 34 | int active_queries = !ares__is_list_empty(&(channel->all_queries)); 35 | 36 | nfds = 0; 37 | for (i = 0; i < channel->nservers; i++) 38 | { 39 | server = &channel->servers[i]; 40 | /* We only need to register interest in UDP sockets if we have 41 | * outstanding queries. 42 | */ 43 | if (active_queries && server->udp_socket != ARES_SOCKET_BAD) 44 | { 45 | FD_SET(server->udp_socket, read_fds); 46 | if (server->udp_socket >= nfds) 47 | nfds = server->udp_socket + 1; 48 | } 49 | /* We always register for TCP events, because we want to know 50 | * when the other side closes the connection, so we don't waste 51 | * time trying to use a broken connection. 52 | */ 53 | if (server->tcp_socket != ARES_SOCKET_BAD) 54 | { 55 | FD_SET(server->tcp_socket, read_fds); 56 | if (server->qhead) 57 | FD_SET(server->tcp_socket, write_fds); 58 | if (server->tcp_socket >= nfds) 59 | nfds = server->tcp_socket + 1; 60 | } 61 | } 62 | return (int)nfds; 63 | } 64 | -------------------------------------------------------------------------------- /c-ares/ares_free_data.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 1998 by the Massachusetts Institute of Technology. 3 | .\" Copyright (C) 2004-2010 by Daniel Stenberg 4 | .\" 5 | .\" Permission to use, copy, modify, and distribute this 6 | .\" software and its documentation for any purpose and without 7 | .\" fee is hereby granted, provided that the above copyright 8 | .\" notice appear in all copies and that both that copyright 9 | .\" notice and this permission notice appear in supporting 10 | .\" documentation, and that the name of M.I.T. not be used in 11 | .\" advertising or publicity pertaining to distribution of the 12 | .\" software without specific, written prior permission. 13 | .\" M.I.T. makes no representations about the suitability of 14 | .\" this software for any purpose. It is provided "as is" 15 | .\" without express or implied warranty. 16 | .\" 17 | .TH ARES_FREE_DATA 3 "5 March 2010" 18 | .SH NAME 19 | ares_free_data \- Free data allocated by several c-ares functions 20 | .SH SYNOPSIS 21 | .nf 22 | .B #include 23 | .PP 24 | .B void ares_free_data(void *\fIdataptr\fP) 25 | .PP 26 | .B cc file.c -lcares 27 | .fi 28 | .SH DESCRIPTION 29 | .PP 30 | The 31 | .B ares_free_data(3) 32 | function frees one or more data structures allocated and returned 33 | by several c-ares functions. Specifically the data returned by the 34 | following list of functions must be deallocated using this function. 35 | .TP 5 36 | .B ares_get_servers(3) 37 | When used to free the data returned by ares_get_servers(3) this 38 | will free the whole linked list of ares_addr_node structures returned 39 | by ares_get_servers(3). 40 | .TP 41 | .B ares_parse_srv_reply(3) 42 | When used to free the data returned by ares_parse_srv_reply(3) this 43 | will free the whole linked list of ares_srv_reply structures returned 44 | by ares_parse_srv_reply(3), along with any additional storage 45 | associated with those structures. 46 | .TP 47 | .B ares_parse_mx_reply(3) 48 | When used to free the data returned by ares_parse_mx_reply(3) this 49 | will free the whole linked list of ares_mx_reply structures returned 50 | by ares_parse_mx_reply(3), along with any additional storage 51 | associated with those structures. 52 | .TP 53 | .B ares_parse_txt_reply(3) 54 | When used to free the data returned by ares_parse_txt_reply(3) this 55 | will free the whole linked list of ares_txt_reply structures returned 56 | by ares_parse_txt_reply(3), along with any additional storage 57 | associated with those structures. 58 | .SH RETURN VALUE 59 | The ares_free_data() function does not return a value. 60 | .SH AVAILABILITY 61 | This function was first introduced in c-ares version 1.7.0. 62 | .SH SEE ALSO 63 | .BR ares_get_servers(3), 64 | .BR ares_parse_srv_reply(3), 65 | .BR ares_parse_mx_reply(3), 66 | .BR ares_parse_txt_reply(3) 67 | .SH AUTHOR 68 | Yang Tse 69 | .PP 70 | Copyright 1998 by the Massachusetts Institute of Technology. 71 | .br 72 | Copyright (C) 2004-2010 by Daniel Stenberg. 73 | -------------------------------------------------------------------------------- /c-ares/ares_free_hostent.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 1998 by the Massachusetts Institute of Technology. 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this 5 | .\" software and its documentation for any purpose and without 6 | .\" fee is hereby granted, provided that the above copyright 7 | .\" notice appear in all copies and that both that copyright 8 | .\" notice and this permission notice appear in supporting 9 | .\" documentation, and that the name of M.I.T. not be used in 10 | .\" advertising or publicity pertaining to distribution of the 11 | .\" software without specific, written prior permission. 12 | .\" M.I.T. makes no representations about the suitability of 13 | .\" this software for any purpose. It is provided "as is" 14 | .\" without express or implied warranty. 15 | .\" 16 | .TH ARES_FREE_HOSTENT 3 "23 July 1998" 17 | .SH NAME 18 | ares_free_hostent \- Free host structure allocated by ares functions 19 | .SH SYNOPSIS 20 | .nf 21 | .B #include 22 | .PP 23 | .B void ares_free_hostent(struct hostent *\fIhost\fP) 24 | .fi 25 | .SH DESCRIPTION 26 | The 27 | .I ares_free_hostent 28 | function frees a 29 | .B struct hostent 30 | allocated by one of the functions \fIares_parse_a_reply(3)\fP, 31 | \fIares_parse_aaaa_reply(3)\fP, or \fIares_parse_ptr_reply(3)\fP. 32 | .SH NOTES 33 | It is not necessary (and is not correct) to free the host structure passed to 34 | the callback functions for \fIares_gethostbyname(3)\fP or 35 | \fIares_gethostbyaddr(3)\fP. c-ares will automatically free such host 36 | structures when the callback returns. 37 | .SH SEE ALSO 38 | .BR ares_parse_a_reply (3), 39 | .BR ares_parse_aaaa_reply (3), 40 | .BR ares_parse_ptr_reply (3), 41 | .BR ares_parse_ns_reply (3) 42 | .SH AUTHOR 43 | Greg Hudson, MIT Information Systems 44 | .br 45 | Copyright 1998 by the Massachusetts Institute of Technology. 46 | -------------------------------------------------------------------------------- /c-ares/ares_free_hostent.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright 1998 by the Massachusetts Institute of Technology. 3 | * 4 | * Permission to use, copy, modify, and distribute this 5 | * software and its documentation for any purpose and without 6 | * fee is hereby granted, provided that the above copyright 7 | * notice appear in all copies and that both that copyright 8 | * notice and this permission notice appear in supporting 9 | * documentation, and that the name of M.I.T. not be used in 10 | * advertising or publicity pertaining to distribution of the 11 | * software without specific, written prior permission. 12 | * M.I.T. makes no representations about the suitability of 13 | * this software for any purpose. It is provided "as is" 14 | * without express or implied warranty. 15 | */ 16 | 17 | #include "ares_setup.h" 18 | #include 19 | 20 | #ifdef HAVE_NETDB_H 21 | #include 22 | #endif 23 | 24 | #include "ares.h" 25 | #include "ares_private.h" /* for memdebug */ 26 | 27 | void ares_free_hostent(struct hostent *host) 28 | { 29 | char **p; 30 | 31 | if (!host) 32 | return; 33 | 34 | free((char *)(host->h_name)); 35 | for (p = host->h_aliases; *p; p++) 36 | free(*p); 37 | free(host->h_aliases); 38 | free(host->h_addr_list[0]); /* no matter if there is one or many entries, 39 | there is only one malloc for all of them */ 40 | free(host->h_addr_list); 41 | free(host); 42 | } 43 | -------------------------------------------------------------------------------- /c-ares/ares_free_string.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 2000 by the Massachusetts Institute of Technology. 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this 5 | .\" software and its documentation for any purpose and without 6 | .\" fee is hereby granted, provided that the above copyright 7 | .\" notice appear in all copies and that both that copyright 8 | .\" notice and this permission notice appear in supporting 9 | .\" documentation, and that the name of M.I.T. not be used in 10 | .\" advertising or publicity pertaining to distribution of the 11 | .\" software without specific, written prior permission. 12 | .\" M.I.T. makes no representations about the suitability of 13 | .\" this software for any purpose. It is provided "as is" 14 | .\" without express or implied warranty. 15 | .\" 16 | .TH ARES_FREE_STRING 3 "4 February 2004" 17 | .SH NAME 18 | ares_free_string \- Free strings allocated by ares functions 19 | .SH SYNOPSIS 20 | .nf 21 | .B #include 22 | .PP 23 | .B void ares_free_string(void *\fIstr\fP) 24 | .fi 25 | .SH DESCRIPTION 26 | The 27 | .I ares_free_string 28 | function frees a string allocated by an ares function. 29 | .SH SEE ALSO 30 | .BR ares_mkquery (3) 31 | .BR ares_expand_string (3) 32 | .SH AUTHOR 33 | Greg Hudson, MIT Information Systems 34 | .br 35 | Copyright 2000 by the Massachusetts Institute of Technology. 36 | -------------------------------------------------------------------------------- /c-ares/ares_free_string.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright 2000 by the Massachusetts Institute of Technology. 3 | * 4 | * Permission to use, copy, modify, and distribute this 5 | * software and its documentation for any purpose and without 6 | * fee is hereby granted, provided that the above copyright 7 | * notice appear in all copies and that both that copyright 8 | * notice and this permission notice appear in supporting 9 | * documentation, and that the name of M.I.T. not be used in 10 | * advertising or publicity pertaining to distribution of the 11 | * software without specific, written prior permission. 12 | * M.I.T. makes no representations about the suitability of 13 | * this software for any purpose. It is provided "as is" 14 | * without express or implied warranty. 15 | */ 16 | 17 | #include "ares_setup.h" 18 | #include 19 | #include "ares.h" 20 | #include "ares_private.h" 21 | 22 | void ares_free_string(void *str) 23 | { 24 | free(str); 25 | } 26 | -------------------------------------------------------------------------------- /c-ares/ares_get_servers.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 1998 by the Massachusetts Institute of Technology. 3 | .\" Copyright (C) 2008-2010 by Daniel Stenberg 4 | .\" 5 | .\" Permission to use, copy, modify, and distribute this 6 | .\" software and its documentation for any purpose and without 7 | .\" fee is hereby granted, provided that the above copyright 8 | .\" notice appear in all copies and that both that copyright 9 | .\" notice and this permission notice appear in supporting 10 | .\" documentation, and that the name of M.I.T. not be used in 11 | .\" advertising or publicity pertaining to distribution of the 12 | .\" software without specific, written prior permission. 13 | .\" M.I.T. makes no representations about the suitability of 14 | .\" this software for any purpose. It is provided "as is" 15 | .\" without express or implied warranty. 16 | .\" 17 | .TH ARES_GET_SERVERS 3 "5 March 2010" 18 | .SH NAME 19 | ares_get_servers \- Retrieve name servers from an initialized ares_channel 20 | .SH SYNOPSIS 21 | .nf 22 | .B #include 23 | .PP 24 | .B int ares_get_servers(ares_channel \fIchannel\fP, struct ares_addr_node **\fIservers\fP) 25 | .fi 26 | .SH DESCRIPTION 27 | The \fBares_get_servers(3)\fP function retrieves name servers configuration 28 | from the 29 | channel data identified by 30 | .IR channel , 31 | as a linked list of ares_addr_node structs storing a pointer to the first 32 | node at the address specified by 33 | .IR servers . 34 | 35 | Function caller may traverse the returned name server linked list, or may use 36 | it directly as suitable input for the \fBares_set_servers(3)\fP function, but 37 | shall not shrink or extend the list on its own. 38 | 39 | Each node of the name server linked list is stored in memory dynamically 40 | allocated and managed by c-ares. It is the caller's responsibility to free 41 | the resulting linked list, using \fBares_free_data(3)\fP , once the caller 42 | does not need it any longer. 43 | 44 | This function is capable of handling IPv4 and IPv6 name server 45 | addresses simultaneously, rendering \fBares_save_options(3)\fP with 46 | optmask \fBARES_OPT_SERVERS\fP functionally obsolete except for 47 | IPv4-only name server usage. 48 | 49 | .SH RETURN VALUES 50 | .B ares_get_servers(3) 51 | may return any of the following values: 52 | .TP 15 53 | .B ARES_SUCCESS 54 | The name servers configuration was successfuly retrieved 55 | .TP 15 56 | .B ARES_ENOMEM 57 | The memory was exhausted 58 | .TP 15 59 | .B ARES_ENODATA 60 | The channel data identified by 61 | .IR channel 62 | was invalid. 63 | .SH SEE ALSO 64 | .BR ares_set_servers (3), 65 | .BR ares_init_options (3), 66 | .BR ares_save_options(3) 67 | .SH AVAILABILITY 68 | ares_get_servers(3) was added in c-ares 1.7.1 69 | .SH AUTHOR 70 | Implementation of this function and associated library internals are based 71 | on code, comments and feedback provided in November and December of 2008 by 72 | Daniel Stenberg, Gregor Jasny, Phil Blundell and Yang Tse, December 2009 73 | by Cedric Bail, February 2010 by Jakub Hrozek. On March 2010 Yang Tse 74 | shuffled all the bits and this function popped out. 75 | .br 76 | Copyright 1998 by the Massachusetts Institute of Technology. 77 | .br 78 | Copyright (C) 2008-2010 by Daniel Stenberg 79 | -------------------------------------------------------------------------------- /c-ares/ares_getenv.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | /* Copyright 1998 by the Massachusetts Institute of Technology. 4 | * 5 | * Permission to use, copy, modify, and distribute this 6 | * software and its documentation for any purpose and without 7 | * fee is hereby granted, provided that the above copyright 8 | * notice appear in all copies and that both that copyright 9 | * notice and this permission notice appear in supporting 10 | * documentation, and that the name of M.I.T. not be used in 11 | * advertising or publicity pertaining to distribution of the 12 | * software without specific, written prior permission. 13 | * M.I.T. makes no representations about the suitability of 14 | * this software for any purpose. It is provided "as is" 15 | * without express or implied warranty. 16 | */ 17 | 18 | #include "ares_setup.h" 19 | #include "ares_getenv.h" 20 | 21 | #ifndef HAVE_GETENV 22 | 23 | char *ares_getenv(const char *name) 24 | { 25 | #ifdef _WIN32_WCE 26 | return NULL; 27 | #endif 28 | } 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /c-ares/ares_getenv.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CARES_GETENV_H 2 | #define HEADER_CARES_GETENV_H 3 | 4 | 5 | /* Copyright 1998 by the Massachusetts Institute of Technology. 6 | * 7 | * Permission to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose and without 9 | * fee is hereby granted, provided that the above copyright 10 | * notice appear in all copies and that both that copyright 11 | * notice and this permission notice appear in supporting 12 | * documentation, and that the name of M.I.T. not be used in 13 | * advertising or publicity pertaining to distribution of the 14 | * software without specific, written prior permission. 15 | * M.I.T. makes no representations about the suitability of 16 | * this software for any purpose. It is provided "as is" 17 | * without express or implied warranty. 18 | */ 19 | 20 | #include "ares_setup.h" 21 | 22 | #ifndef HAVE_GETENV 23 | extern char *ares_getenv(const char *name); 24 | #endif 25 | 26 | #endif /* HEADER_CARES_GETENV_H */ 27 | -------------------------------------------------------------------------------- /c-ares/ares_gethostbyaddr.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 1998 by the Massachusetts Institute of Technology. 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this 5 | .\" software and its documentation for any purpose and without 6 | .\" fee is hereby granted, provided that the above copyright 7 | .\" notice appear in all copies and that both that copyright 8 | .\" notice and this permission notice appear in supporting 9 | .\" documentation, and that the name of M.I.T. not be used in 10 | .\" advertising or publicity pertaining to distribution of the 11 | .\" software without specific, written prior permission. 12 | .\" M.I.T. makes no representations about the suitability of 13 | .\" this software for any purpose. It is provided "as is" 14 | .\" without express or implied warranty. 15 | .\" 16 | .TH ARES_GETHOSTBYADDR 3 "24 July 1998" 17 | .SH NAME 18 | ares_gethostbyaddr \- Initiate a host query by address 19 | .SH SYNOPSIS 20 | .nf 21 | .B #include 22 | .PP 23 | .B typedef void (*ares_host_callback)(void *\fIarg\fP, int \fIstatus\fP, 24 | .B int \fItimeouts\fP, struct hostent *\fIhostent\fP) 25 | .PP 26 | .B void ares_gethostbyaddr(ares_channel \fIchannel\fP, const void *\fIaddr\fP, 27 | .B int \fIaddrlen\fP, int \fIfamily\fP, ares_host_callback \fIcallback\fP, 28 | .B void *\fIarg\fP) 29 | .fi 30 | .SH DESCRIPTION 31 | The 32 | .B ares_gethostbyaddr 33 | function initiates a host query by address on the name service channel 34 | identified by 35 | .IR channel . 36 | The parameters 37 | .I addr 38 | and 39 | .I addrlen 40 | give the address as a series of bytes, and 41 | .I family 42 | gives the type of address. When the query is complete or has failed, the ares 43 | library will invoke \fIcallback\fP. Completion or failure of the query may 44 | happen immediately, or may happen during a later call to 45 | \fIares_process(3)\fP, \fIares_destroy(3)\fP or \fIares_cancel(3)\fP. 46 | .PP 47 | The callback argument 48 | .I arg 49 | is copied from the 50 | .B ares_gethostbyaddr 51 | argument 52 | .IR arg . 53 | The callback argument 54 | .I status 55 | indicates whether the query succeeded and, if not, how it failed. It 56 | may have any of the following values: 57 | .TP 19 58 | .B ARES_SUCCESS 59 | The host lookup completed successfully. 60 | .TP 19 61 | .B ARES_ENOTIMP 62 | The ares library does not know how to look up addresses of type 63 | .IR family . 64 | .TP 19 65 | .B ARES_ENOTFOUND 66 | The address 67 | .I addr 68 | was not found. 69 | .TP 19 70 | .B ARES_ENOMEM 71 | Memory was exhausted. 72 | .TP 19 73 | .B ARES_EDESTRUCTION 74 | The name service channel 75 | .I channel 76 | is being destroyed; the query will not be completed. 77 | .PP 78 | The callback argument 79 | .I timeouts 80 | reports how many times a query timed out during the execution of the 81 | given request. 82 | .PP 83 | On successful completion of the query, the callback argument 84 | .I hostent 85 | points to a 86 | .B struct hostent 87 | containing the name of the host returned by the query. The callback 88 | need not and should not attempt to free the memory pointed to by 89 | .IR hostent ; 90 | the ares library will free it when the callback returns. If the query 91 | did not complete successfully, 92 | .I hostent 93 | will be 94 | .BR NULL . 95 | .SH SEE ALSO 96 | .BR ares_process (3), 97 | .BR ares_gethostbyname (3) 98 | .SH AUTHOR 99 | Greg Hudson, MIT Information Systems 100 | .br 101 | Copyright 1998 by the Massachusetts Institute of Technology. 102 | -------------------------------------------------------------------------------- /c-ares/ares_gethostbyname_file.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 1998 by the Massachusetts Institute of Technology. 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this 5 | .\" software and its documentation for any purpose and without 6 | .\" fee is hereby granted, provided that the above copyright 7 | .\" notice appear in all copies and that both that copyright 8 | .\" notice and this permission notice appear in supporting 9 | .\" documentation, and that the name of M.I.T. not be used in 10 | .\" advertising or publicity pertaining to distribution of the 11 | .\" software without specific, written prior permission. 12 | .\" M.I.T. makes no representations about the suitability of 13 | .\" this software for any purpose. It is provided "as is" 14 | .\" without express or implied warranty. 15 | .\" 16 | .TH ARES_GETHOSTBYNAME 3 "25 July 1998" 17 | .SH NAME 18 | ares_gethostbyname_file \- Lookup a name in the system's hosts file 19 | .SH SYNOPSIS 20 | .nf 21 | .B #include 22 | .PP 23 | .B int ares_gethostbyname_file(ares_channel \fIchannel\fP, const char *\fIname\fP, 24 | .B int \fIfamily\fP, struct hostent **host) 25 | .fi 26 | .SH DESCRIPTION 27 | The 28 | .B ares_gethostbyname_file 29 | function performs a host lookup by name against the system's hosts file (or equivalent local hostname database). 30 | The 31 | .IR channel 32 | parameter is required, but no asynchronous queries are performed. Instead, the 33 | lookup is done via the same mechanism used to perform 'f' lookups 34 | (see the 35 | .I lookups 36 | options field in \fIares_init_options(3)\fP). 37 | The parameter 38 | .I name 39 | gives the hostname as a NUL-terminated C string, and 40 | .I family 41 | gives the desired type of address for the resulting host entry. 42 | .PP 43 | The return value indicates whether the query succeeded and, if not, how it 44 | failed. It may have any of the following values: 45 | .TP 19 46 | .B ARES_SUCCESS 47 | The host lookup completed successfully and 48 | .I host 49 | now points to the result (and must be freed with \fIares_free_hostent(3)\fP). 50 | .TP 19 51 | .B ARES_ENOTFOUND 52 | The hostname 53 | .I name 54 | was not found. 55 | .TP 19 56 | .B ARES_EFILE 57 | There was a file I/O error while performing the lookup. 58 | .TP 19 59 | .B ARES_ENOMEM 60 | Memory was exhausted. 61 | .PP 62 | On successful completion of the query, the pointer pointed to by 63 | .I host 64 | points to a 65 | .B struct hostent 66 | containing the address of the host returned by the lookup. The user must 67 | free the memory pointed to by 68 | .IR host 69 | when finished with it by calling \fIares_free_hostent(3)\fP. If the lookup did 70 | not complete successfully, 71 | .I host 72 | will be 73 | .BR NULL . 74 | .SH AVAILABILITY 75 | Added in c-ares 1.5.4 76 | .SH SEE ALSO 77 | .BR ares_gethostbyname (3), 78 | .BR ares_free_hostent (3), 79 | .BR ares_init_options (3) 80 | .SH AUTHOR 81 | Brad Spencer 82 | .br 83 | Copyright 1998 by the Massachusetts Institute of Technology. 84 | -------------------------------------------------------------------------------- /c-ares/ares_getopt.h: -------------------------------------------------------------------------------- 1 | #ifndef ARES_GETOPT_H 2 | #define ARES_GETOPT_H 3 | 4 | /* 5 | * Copyright (c) 1987-2001 The Regents of the University of California. 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * A. Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimer. 13 | * B. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * C. Neither the names of the copyright holders nor the names of its 17 | * contributors may be used to endorse or promote products derived from this 18 | * software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS 21 | * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 22 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | * POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | 34 | int ares_getopt(int nargc, char * const nargv[], const char *ostr); 35 | 36 | #undef optarg 37 | #undef optind 38 | #undef opterr 39 | #undef optopt 40 | #undef optreset 41 | 42 | #define optarg ares_optarg 43 | #define optind ares_optind 44 | #define opterr ares_opterr 45 | #define optopt ares_optopt 46 | #define optreset ares_optreset 47 | 48 | extern char *optarg; 49 | extern int optind; 50 | extern int opterr; 51 | extern int optopt; 52 | 53 | #endif /* ARES_GETOPT_H */ 54 | -------------------------------------------------------------------------------- /c-ares/ares_getsock.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 1998 by Daniel Stenberg 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this 5 | .\" software and its documentation for any purpose and without 6 | .\" fee is hereby granted, provided that the above copyright 7 | .\" notice appear in all copies and that both that copyright 8 | .\" notice and this permission notice appear in supporting 9 | .\" documentation, and that the name of M.I.T. not be used in 10 | .\" advertising or publicity pertaining to distribution of the 11 | .\" software without specific, written prior permission. 12 | .\" M.I.T. makes no representations about the suitability of 13 | .\" this software for any purpose. It is provided "as is" 14 | .\" without express or implied warranty. 15 | .\" 16 | .TH ARES_GETSOCK 3 "11 March 2010" 17 | .SH NAME 18 | ares_getsock \- get socket descriptors to wait on 19 | .SH SYNOPSIS 20 | .nf 21 | .B #include 22 | .PP 23 | .B int ares_getsock(ares_channel \fIchannel\fP, ares_socket_t *\fIsocks\fP, 24 | .B int \fInumsocks\fP); 25 | .fi 26 | .SH DESCRIPTION 27 | The 28 | .B ares_getsock 29 | function retrieves the set of socket descriptors which the calling 30 | application should wait on for reading and/or writing for the 31 | processing of name service queries pending on the name service channel 32 | identified by 33 | .IR channel . 34 | Socket descriptors will be set in the socket descriptor array pointed to by 35 | \fIsocks\fP. 36 | \fInumsocks\fP is the size of the given array in number of ints. 37 | 38 | This function can only return information about up to 16 sockets. If more are 39 | in use (however unlikely that is), they are simply not reported back. 40 | .SH RETURN VALUES 41 | \fBares_getsock\fP returns a bitmask for what actions to wait for on the 42 | different sockets. The ares.h header file provides these convenience macros to 43 | extract the information appropriately: 44 | 45 | .nf 46 | #define ARES_GETSOCK_MAXNUM 16 /* ares_getsock() can return info about 47 | this many sockets */ 48 | #define ARES_GETSOCK_READABLE(bits,num) (bits & (1<< (num))) 49 | #define ARES_GETSOCK_WRITABLE(bits,num) (bits & (1 << ((num) + \ 50 | ARES_GETSOCK_MAXNUM))) 51 | .fi 52 | .SH NOTES 53 | This function was added in c-ares 1.3.1 54 | .SH SEE ALSO 55 | .BR ares_timeout (3), 56 | .BR ares_fds (3), 57 | .BR ares_process (3) 58 | -------------------------------------------------------------------------------- /c-ares/ares_getsock.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (C) 2005 - 2010, Daniel Stenberg 3 | * 4 | * Permission to use, copy, modify, and distribute this software and its 5 | * documentation for any purpose and without fee is hereby granted, provided 6 | * that the above copyright notice appear in all copies and that both that 7 | * copyright notice and this permission notice appear in supporting 8 | * documentation, and that the name of M.I.T. not be used in advertising or 9 | * publicity pertaining to distribution of the software without specific, 10 | * written prior permission. M.I.T. makes no representations about the 11 | * suitability of this software for any purpose. It is provided "as is" 12 | * without express or implied warranty. 13 | */ 14 | 15 | #include "ares_setup.h" 16 | 17 | #ifdef HAVE_SYS_TIME_H 18 | #include 19 | #endif 20 | 21 | #include "ares.h" 22 | #include "ares_private.h" 23 | 24 | int ares_getsock(ares_channel channel, 25 | ares_socket_t *socks, 26 | int numsocks) /* size of the 'socks' array */ 27 | { 28 | struct server_state *server; 29 | int i; 30 | int sockindex=0; 31 | int bitmap = 0; 32 | unsigned int setbits = 0xffffffff; 33 | 34 | /* Are there any active queries? */ 35 | int active_queries = !ares__is_list_empty(&(channel->all_queries)); 36 | 37 | for (i = 0; 38 | (i < channel->nservers) && (sockindex < ARES_GETSOCK_MAXNUM); 39 | i++) 40 | { 41 | server = &channel->servers[i]; 42 | /* We only need to register interest in UDP sockets if we have 43 | * outstanding queries. 44 | */ 45 | if (active_queries && server->udp_socket != ARES_SOCKET_BAD) 46 | { 47 | if(sockindex >= numsocks) 48 | break; 49 | socks[sockindex] = server->udp_socket; 50 | bitmap |= ARES_GETSOCK_READABLE(setbits, sockindex); 51 | sockindex++; 52 | } 53 | /* We always register for TCP events, because we want to know 54 | * when the other side closes the connection, so we don't waste 55 | * time trying to use a broken connection. 56 | */ 57 | if (server->tcp_socket != ARES_SOCKET_BAD) 58 | { 59 | if(sockindex >= numsocks) 60 | break; 61 | socks[sockindex] = server->tcp_socket; 62 | bitmap |= ARES_GETSOCK_READABLE(setbits, sockindex); 63 | 64 | if (server->qhead && active_queries) 65 | /* then the tcp socket is also writable! */ 66 | bitmap |= ARES_GETSOCK_WRITABLE(setbits, sockindex); 67 | 68 | sockindex++; 69 | } 70 | } 71 | return bitmap; 72 | } 73 | -------------------------------------------------------------------------------- /c-ares/ares_init_options.3: -------------------------------------------------------------------------------- 1 | .so man3/ares_init.3 2 | -------------------------------------------------------------------------------- /c-ares/ares_ipv6.h: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (C) 2005 by Dominick Meglio 3 | * 4 | * Permission to use, copy, modify, and distribute this 5 | * software and its documentation for any purpose and without 6 | * fee is hereby granted, provided that the above copyright 7 | * notice appear in all copies and that both that copyright 8 | * notice and this permission notice appear in supporting 9 | * documentation, and that the name of M.I.T. not be used in 10 | * advertising or publicity pertaining to distribution of the 11 | * software without specific, written prior permission. 12 | * M.I.T. makes no representations about the suitability of 13 | * this software for any purpose. It is provided "as is" 14 | * without express or implied warranty. 15 | */ 16 | 17 | #ifndef ARES_IPV6_H 18 | #define ARES_IPV6_H 19 | 20 | #ifndef HAVE_PF_INET6 21 | #define PF_INET6 AF_INET6 22 | #endif 23 | 24 | #ifndef HAVE_STRUCT_SOCKADDR_IN6 25 | struct sockaddr_in6 26 | { 27 | unsigned short sin6_family; 28 | unsigned short sin6_port; 29 | unsigned long sin6_flowinfo; 30 | struct ares_in6_addr sin6_addr; 31 | unsigned int sin6_scope_id; 32 | }; 33 | #endif 34 | 35 | #ifndef HAVE_STRUCT_ADDRINFO 36 | struct addrinfo 37 | { 38 | int ai_flags; 39 | int ai_family; 40 | int ai_socktype; 41 | int ai_protocol; 42 | ares_socklen_t ai_addrlen; /* Follow rfc3493 struct addrinfo */ 43 | char *ai_canonname; 44 | struct sockaddr *ai_addr; 45 | struct addrinfo *ai_next; 46 | }; 47 | #endif 48 | 49 | #ifndef NS_IN6ADDRSZ 50 | #if SIZEOF_STRUCT_IN6_ADDR == 0 51 | /* We cannot have it set to zero, so we pick a fixed value here */ 52 | #define NS_IN6ADDRSZ 16 53 | #else 54 | #define NS_IN6ADDRSZ SIZEOF_STRUCT_IN6_ADDR 55 | #endif 56 | #endif 57 | 58 | #ifndef NS_INADDRSZ 59 | #define NS_INADDRSZ SIZEOF_STRUCT_IN_ADDR 60 | #endif 61 | 62 | #ifndef NS_INT16SZ 63 | #define NS_INT16SZ 2 64 | #endif 65 | 66 | #ifndef IF_NAMESIZE 67 | #ifdef IFNAMSIZ 68 | #define IF_NAMESIZE IFNAMSIZ 69 | #else 70 | #define IF_NAMESIZE 256 71 | #endif 72 | #endif 73 | 74 | /* Defined in ares_net_pton.c for no particular reason. */ 75 | extern const struct ares_in6_addr ares_in6addr_any; /* :: */ 76 | 77 | 78 | #endif /* ARES_IPV6_H */ 79 | -------------------------------------------------------------------------------- /c-ares/ares_library_cleanup.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 1998 by the Massachusetts Institute of Technology. 3 | .\" Copyright (C) 2004-2009 by Daniel Stenberg 4 | .\" 5 | .\" Permission to use, copy, modify, and distribute this 6 | .\" software and its documentation for any purpose and without 7 | .\" fee is hereby granted, provided that the above copyright 8 | .\" notice appear in all copies and that both that copyright 9 | .\" notice and this permission notice appear in supporting 10 | .\" documentation, and that the name of M.I.T. not be used in 11 | .\" advertising or publicity pertaining to distribution of the 12 | .\" software without specific, written prior permission. 13 | .\" M.I.T. makes no representations about the suitability of 14 | .\" this software for any purpose. It is provided "as is" 15 | .\" without express or implied warranty. 16 | .\" 17 | .TH ARES_LIBRARY_CLEANUP 3 "19 May 2009" 18 | .SH NAME 19 | ares_library_cleanup \- c-ares library deinitialization 20 | .SH SYNOPSIS 21 | .nf 22 | .B #include 23 | .PP 24 | .B void ares_library_cleanup(void) 25 | .PP 26 | .B cc file.c -lcares 27 | .fi 28 | .SH DESCRIPTION 29 | .PP 30 | The 31 | .B ares_library_cleanup 32 | function uninitializes the c-ares library, freeing all resources 33 | previously acquired by \fIares_library_init(3)\fP when the library 34 | was initialized. 35 | .PP 36 | This function must be called when the program using c-ares will 37 | no longer need any c-ares function. Once the program has called 38 | \fIares_library_cleanup(3)\fP it shall not make any further call to any 39 | c-ares function. 40 | .PP 41 | This function does not cancel any pending c-ares lookups or requests 42 | previously done. Program must use \fIares_cancel(3)\fP for this purpose. 43 | .PP 44 | .B This function is not thread safe. 45 | You have to call it once the program is about to terminate, but this call must 46 | be done once the program has terminated every single thread that it could have 47 | initiated. This is required to avoid potential race conditions in library 48 | deinitialization, and also due to the fact that \fIares_library_cleanup(3)\fP 49 | might call functions from other libraries that are thread unsafe, and could 50 | conflict with any other thread that is already using these other libraries. 51 | .PP 52 | Win32/64 application DLLs shall not call \fIares_library_cleanup(3)\fP from 53 | the DllMain function. Doing so will produce deadlocks and other problems. 54 | .SH AVAILABILITY 55 | This function was first introduced in c-ares version 1.7.0 along with the 56 | definition of preprocessor symbol \fICARES_HAVE_ARES_LIBRARY_CLEANUP\fP as an 57 | indication of the availability of this function. 58 | .PP 59 | Since the introduction of this function, it is absolutely mandatory to call it 60 | for any Win32/64 program using c-ares. 61 | .PP 62 | Non-Win32/64 systems can still use c-ares version 1.7.0 without calling 63 | \fIares_library_cleanup(3)\fP due to the fact that \fIcurrently\fP it is nearly 64 | a do-nothing function on non-Win32/64 platforms. 65 | .SH SEE ALSO 66 | .BR ares_library_init(3), 67 | .BR ares_cancel(3) 68 | .SH AUTHOR 69 | Yang Tse 70 | .PP 71 | Copyright 1998 by the Massachusetts Institute of Technology. 72 | .br 73 | Copyright (C) 2004-2009 by Daniel Stenberg. 74 | -------------------------------------------------------------------------------- /c-ares/ares_library_init.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CARES_LIBRARY_INIT_H 2 | #define HEADER_CARES_LIBRARY_INIT_H 3 | 4 | 5 | /* Copyright 1998 by the Massachusetts Institute of Technology. 6 | * Copyright (C) 2004-2011 by Daniel Stenberg 7 | * 8 | * Permission to use, copy, modify, and distribute this 9 | * software and its documentation for any purpose and without 10 | * fee is hereby granted, provided that the above copyright 11 | * notice appear in all copies and that both that copyright 12 | * notice and this permission notice appear in supporting 13 | * documentation, and that the name of M.I.T. not be used in 14 | * advertising or publicity pertaining to distribution of the 15 | * software without specific, written prior permission. 16 | * M.I.T. makes no representations about the suitability of 17 | * this software for any purpose. It is provided "as is" 18 | * without express or implied warranty. 19 | */ 20 | 21 | #include "ares_setup.h" 22 | 23 | #ifdef USE_WINSOCK 24 | 25 | #include 26 | #include 27 | 28 | typedef DWORD (WINAPI *fpGetNetworkParams_t) (FIXED_INFO*, DWORD*); 29 | typedef BOOLEAN (APIENTRY *fpSystemFunction036_t) (void*, ULONG); 30 | typedef ULONG (WINAPI *fpGetAdaptersAddresses_t) ( ULONG, ULONG, void*, IP_ADAPTER_ADDRESSES*, ULONG* ); 31 | 32 | /* Forward-declaration of variables defined in ares_library_init.c */ 33 | /* that are global and unique instances for whole c-ares library. */ 34 | 35 | extern fpGetNetworkParams_t ares_fpGetNetworkParams; 36 | extern fpSystemFunction036_t ares_fpSystemFunction036; 37 | extern fpGetAdaptersAddresses_t ares_fpGetAdaptersAddresses; 38 | 39 | #endif /* USE_WINSOCK */ 40 | 41 | #endif /* HEADER_CARES_LIBRARY_INIT_H */ 42 | 43 | -------------------------------------------------------------------------------- /c-ares/ares_llist.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright 1998 by the Massachusetts Institute of Technology. 3 | * 4 | * Permission to use, copy, modify, and distribute this 5 | * software and its documentation for any purpose and without 6 | * fee is hereby granted, provided that the above copyright 7 | * notice appear in all copies and that both that copyright 8 | * notice and this permission notice appear in supporting 9 | * documentation, and that the name of M.I.T. not be used in 10 | * advertising or publicity pertaining to distribution of the 11 | * software without specific, written prior permission. 12 | * M.I.T. makes no representations about the suitability of 13 | * this software for any purpose. It is provided "as is" 14 | * without express or implied warranty. 15 | */ 16 | 17 | #include "ares_setup.h" 18 | 19 | #include "ares.h" 20 | #include "ares_private.h" 21 | 22 | /* Routines for managing doubly-linked circular linked lists with a 23 | * dummy head. 24 | */ 25 | 26 | /* Initialize a new head node */ 27 | void ares__init_list_head(struct list_node* head) { 28 | head->prev = head; 29 | head->next = head; 30 | head->data = NULL; 31 | } 32 | 33 | /* Initialize a list node */ 34 | void ares__init_list_node(struct list_node* node, void* d) { 35 | node->prev = NULL; 36 | node->next = NULL; 37 | node->data = d; 38 | } 39 | 40 | /* Returns true iff the given list is empty */ 41 | int ares__is_list_empty(struct list_node* head) { 42 | return ((head->next == head) && (head->prev == head)); 43 | } 44 | 45 | /* Inserts new_node before old_node */ 46 | void ares__insert_in_list(struct list_node* new_node, 47 | struct list_node* old_node) { 48 | new_node->next = old_node; 49 | new_node->prev = old_node->prev; 50 | old_node->prev->next = new_node; 51 | old_node->prev = new_node; 52 | } 53 | 54 | /* Removes the node from the list it's in, if any */ 55 | void ares__remove_from_list(struct list_node* node) { 56 | if (node->next != NULL) { 57 | node->prev->next = node->next; 58 | node->next->prev = node->prev; 59 | node->prev = NULL; 60 | node->next = NULL; 61 | } 62 | } 63 | 64 | /* Swap the contents of two lists */ 65 | void ares__swap_lists(struct list_node* head_a, 66 | struct list_node* head_b) { 67 | int is_a_empty = ares__is_list_empty(head_a); 68 | int is_b_empty = ares__is_list_empty(head_b); 69 | struct list_node old_a = *head_a; 70 | struct list_node old_b = *head_b; 71 | 72 | if (is_a_empty) { 73 | ares__init_list_head(head_b); 74 | } else { 75 | *head_b = old_a; 76 | old_a.next->prev = head_b; 77 | old_a.prev->next = head_b; 78 | } 79 | if (is_b_empty) { 80 | ares__init_list_head(head_a); 81 | } else { 82 | *head_a = old_b; 83 | old_b.next->prev = head_a; 84 | old_b.prev->next = head_a; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /c-ares/ares_llist.h: -------------------------------------------------------------------------------- 1 | #ifndef __ARES_LLIST_H 2 | #define __ARES_LLIST_H 3 | 4 | 5 | /* Copyright 1998 by the Massachusetts Institute of Technology. 6 | * 7 | * Permission to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose and without 9 | * fee is hereby granted, provided that the above copyright 10 | * notice appear in all copies and that both that copyright 11 | * notice and this permission notice appear in supporting 12 | * documentation, and that the name of M.I.T. not be used in 13 | * advertising or publicity pertaining to distribution of the 14 | * software without specific, written prior permission. 15 | * M.I.T. makes no representations about the suitability of 16 | * this software for any purpose. It is provided "as is" 17 | * without express or implied warranty. 18 | */ 19 | 20 | 21 | /* Node definition for circular, doubly-linked list */ 22 | struct list_node { 23 | struct list_node *prev; 24 | struct list_node *next; 25 | void* data; 26 | }; 27 | 28 | void ares__init_list_head(struct list_node* head); 29 | 30 | void ares__init_list_node(struct list_node* node, void* d); 31 | 32 | int ares__is_list_empty(struct list_node* head); 33 | 34 | void ares__insert_in_list(struct list_node* new_node, 35 | struct list_node* old_node); 36 | 37 | void ares__remove_from_list(struct list_node* node); 38 | 39 | void ares__swap_lists(struct list_node* head_a, 40 | struct list_node* head_b); 41 | 42 | #endif /* __ARES_LLIST_H */ 43 | -------------------------------------------------------------------------------- /c-ares/ares_mkquery.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 1998, 2000 by the Massachusetts Institute of Technology. 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this 5 | .\" software and its documentation for any purpose and without 6 | .\" fee is hereby granted, provided that the above copyright 7 | .\" notice appear in all copies and that both that copyright 8 | .\" notice and this permission notice appear in supporting 9 | .\" documentation, and that the name of M.I.T. not be used in 10 | .\" advertising or publicity pertaining to distribution of the 11 | .\" software without specific, written prior permission. 12 | .\" M.I.T. makes no representations about the suitability of 13 | .\" this software for any purpose. It is provided "as is" 14 | .\" without express or implied warranty. 15 | .\" 16 | .TH ARES_MKQUERY 3 "20 Nov 2009" 17 | .SH NAME 18 | ares_mkquery \- Compose a single-question DNS query buffer 19 | .SH SYNOPSIS 20 | .nf 21 | .B #include 22 | .PP 23 | .B int ares_mkquery(const char *\fIname\fP, int \fIdnsclass\fP, int \fItype\fP, 24 | .B unsigned short \fIid\fP, int \fIrd\fP, unsigned char **\fIbuf\fP, 25 | .B int *\fIbuflen\fP) 26 | .fi 27 | .SH DESCRIPTION 28 | The 29 | .B ares_mkquery 30 | function composes a DNS query with a single question. 31 | The parameter 32 | .I name 33 | gives the query name as a NUL-terminated C string of period-separated 34 | labels optionally ending with a period; periods and backslashes within 35 | a label must be escaped with a backlash. The parameters 36 | .I dnsclass 37 | and 38 | .I type 39 | give the class and type of the query using the values defined in 40 | .BR . 41 | The parameter 42 | .I id 43 | gives a 16-bit identifier for the query. The parameter 44 | .I rd 45 | should be nonzero if recursion is desired, zero if not. The query 46 | will be placed in an allocated buffer, a pointer to which will be 47 | stored in the variable pointed to by 48 | .IR buf , 49 | and the length of which will be stored in the variable pointed to by 50 | .IR buflen . 51 | It is the caller's responsibility to free this buffer using 52 | \fIares_free_string(3)\fP when it is no longer needed. 53 | .SH RETURN VALUES 54 | .B ares_mkquery 55 | can return any of the following values: 56 | .TP 15 57 | .B ARES_SUCCESS 58 | Construction of the DNS query succeeded. 59 | .TP 15 60 | .B ARES_EBADNAME 61 | The query name 62 | .I name 63 | could not be encoded as a domain name, either because it contained a 64 | zero-length label or because it contained a label of more than 63 65 | characters. 66 | .TP 15 67 | .B ARES_ENOMEM 68 | Memory was exhausted. 69 | .SH SEE ALSO 70 | .BR ares_expand_name (3), 71 | .BR ares_free_string (3) 72 | .SH AUTHOR 73 | Greg Hudson, MIT Information Systems 74 | .br 75 | Copyright 1998, 2000 by the Massachusetts Institute of Technology. 76 | -------------------------------------------------------------------------------- /c-ares/ares_nowarn.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CARES_NOWARN_H 2 | #define HEADER_CARES_NOWARN_H 3 | 4 | 5 | /* Copyright (C) 2010-2011 by Daniel Stenberg 6 | * 7 | * Permission to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose and without 9 | * fee is hereby granted, provided that the above copyright 10 | * notice appear in all copies and that both that copyright 11 | * notice and this permission notice appear in supporting 12 | * documentation, and that the name of M.I.T. not be used in 13 | * advertising or publicity pertaining to distribution of the 14 | * software without specific, written prior permission. 15 | * M.I.T. makes no representations about the suitability of 16 | * this software for any purpose. It is provided "as is" 17 | * without express or implied warranty. 18 | */ 19 | 20 | int aresx_uztosi(size_t uznum); 21 | 22 | int aresx_sltosi(long slnum); 23 | 24 | int aresx_sztosi(ssize_t sznum); 25 | 26 | unsigned int aresx_sztoui(ssize_t sznum); 27 | 28 | #if defined(__INTEL_COMPILER) && defined(__unix__) 29 | 30 | int aresx_FD_ISSET(int fd, fd_set *fdset); 31 | 32 | void aresx_FD_SET(int fd, fd_set *fdset); 33 | 34 | void aresx_FD_ZERO(fd_set *fdset); 35 | 36 | unsigned short aresx_htons(unsigned short usnum); 37 | 38 | unsigned short aresx_ntohs(unsigned short usnum); 39 | 40 | #ifndef BUILDING_ARES_NOWARN_C 41 | # undef FD_ISSET 42 | # define FD_ISSET(a,b) aresx_FD_ISSET((a),(b)) 43 | # undef FD_SET 44 | # define FD_SET(a,b) aresx_FD_SET((a),(b)) 45 | # undef FD_ZERO 46 | # define FD_ZERO(a) aresx_FD_ZERO((a)) 47 | # undef htons 48 | # define htons(a) aresx_htons((a)) 49 | # undef ntohs 50 | # define ntohs(a) aresx_ntohs((a)) 51 | #endif 52 | 53 | #endif /* __INTEL_COMPILER && __unix__ */ 54 | 55 | #endif /* HEADER_CARES_NOWARN_H */ 56 | -------------------------------------------------------------------------------- /c-ares/ares_parse_a_reply.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 1998 by the Massachusetts Institute of Technology. 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this 5 | .\" software and its documentation for any purpose and without 6 | .\" fee is hereby granted, provided that the above copyright 7 | .\" notice appear in all copies and that both that copyright 8 | .\" notice and this permission notice appear in supporting 9 | .\" documentation, and that the name of M.I.T. not be used in 10 | .\" advertising or publicity pertaining to distribution of the 11 | .\" software without specific, written prior permission. 12 | .\" M.I.T. makes no representations about the suitability of 13 | .\" this software for any purpose. It is provided "as is" 14 | .\" without express or implied warranty. 15 | .\" 16 | .TH ARES_PARSE_A_REPLY 3 "25 July 1998" 17 | .SH NAME 18 | ares_parse_a_reply \- Parse a reply to a DNS query of type A 19 | .SH SYNOPSIS 20 | .nf 21 | .B #include 22 | .PP 23 | .B int ares_parse_a_reply(const unsigned char *\fIabuf\fP, int \fIalen\fP, 24 | .B struct hostent **\fIhost\fP, 25 | .B struct ares_addrttl *\fIaddrttls\fB, int *\fInaddrttls\fB); 26 | .fi 27 | .SH DESCRIPTION 28 | The 29 | .B ares_parse_a_reply 30 | function parses the response to a query of type A into a 31 | .BR "struct hostent" 32 | and/or an array of 33 | .BR "struct ares_addrttls" . 34 | The parameters 35 | .I abuf 36 | and 37 | .I alen 38 | give the contents of the response. The result is stored in allocated 39 | memory and a pointer to it stored into the variable pointed to by 40 | .IR host , 41 | if host is nonnull. 42 | It is the caller's responsibility to free the resulting host structure 43 | using 44 | .BR ares_free_hostent (3) 45 | when it is no longer needed. 46 | .PP 47 | If 48 | .IR addrttls 49 | and 50 | .IR naddrttls 51 | are both nonnull, 52 | then up to *naddrttls 53 | .BR "struct ares_addrttl" 54 | records are stored in the array pointed to by addrttls, 55 | and then *naddrttls is set to the number of records so stored. 56 | Note that the memory for these records is supplied by the caller. 57 | .SH RETURN VALUES 58 | .B ares_parse_a_reply 59 | can return any of the following values: 60 | .TP 15 61 | .B ARES_SUCCESS 62 | The response was successfully parsed. 63 | .TP 15 64 | .B ARES_EBADRESP 65 | The response was malformatted. 66 | .TP 15 67 | .B ARES_ENODATA 68 | The response did not contain an answer to the query. 69 | .TP 15 70 | .B ARES_ENOMEM 71 | Memory was exhausted. 72 | .SH SEE ALSO 73 | .BR ares_gethostbyname (3), 74 | .BR ares_free_hostent (3) 75 | .SH AUTHOR 76 | Greg Hudson, MIT Information Systems 77 | .br 78 | Copyright 1998 by the Massachusetts Institute of Technology. 79 | -------------------------------------------------------------------------------- /c-ares/ares_parse_aaaa_reply.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 2005 by Dominick Meglio. 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this 5 | .\" software and its documentation for any purpose and without 6 | .\" fee is hereby granted, provided that the above copyright 7 | .\" notice appear in all copies and that both that copyright 8 | .\" notice and this permission notice appear in supporting 9 | .\" documentation, and that the name of M.I.T. not be used in 10 | .\" advertising or publicity pertaining to distribution of the 11 | .\" software without specific, written prior permission. 12 | .\" M.I.T. makes no representations about the suitability of 13 | .\" this software for any purpose. It is provided "as is" 14 | .\" without express or implied warranty. 15 | .\" 16 | .TH ARES_PARSE_AAAA_REPLY 3 "20 Nov 2009" 17 | .SH NAME 18 | ares_parse_aaaa_reply \- Parse a reply to a DNS query of type AAAA 19 | .SH SYNOPSIS 20 | .nf 21 | .B #include 22 | .PP 23 | .B int ares_parse_aaaa_reply(const unsigned char *\fIabuf\fP, int \fIalen\fP, 24 | .B struct hostent **\fIhost\fP, 25 | .B struct ares_addr6ttl *\fIaddrttls\fB, int *\fInaddrttls\fB); 26 | .fi 27 | .SH DESCRIPTION 28 | The 29 | .B ares_parse_aaaa_reply 30 | function parses the response to a query of type AAAA into a 31 | .BR "struct hostent" 32 | and/or an array of 33 | .BR "struct ares_addr6ttl" . 34 | The parameters 35 | .I abuf 36 | and 37 | .I alen 38 | give the contents of the response. The result is stored in allocated 39 | memory and a pointer to it stored into the variable pointed to by 40 | .IR host , 41 | if host is nonnull. 42 | It is the caller's responsibility to free the resulting host structure 43 | using 44 | .BR ares_free_hostent (3) 45 | when it is no longer needed. 46 | .PP 47 | If 48 | .IR addrttls 49 | and 50 | .IR naddrttls 51 | are both nonnull, 52 | then up to *naddrttls 53 | .BR "struct ares_addr6ttl" 54 | records are stored in the array pointed to by addrttls, 55 | and then *naddrttls is set to the number of records so stored. 56 | Note that the memory for these records is supplied by the caller. 57 | .SH RETURN VALUES 58 | .B ares_parse_aaaa_reply 59 | can return any of the following values: 60 | .TP 15 61 | .B ARES_SUCCESS 62 | The response was successfully parsed. 63 | .TP 15 64 | .B ARES_EBADRESP 65 | The response was malformatted. 66 | .TP 15 67 | .B ARES_ENODATA 68 | The response did not contain an answer to the query. 69 | .TP 15 70 | .B ARES_ENOMEM 71 | Memory was exhausted. 72 | .SH SEE ALSO 73 | .BR ares_gethostbyname (3), 74 | .BR ares_free_hostent (3) 75 | .SH AUTHOR 76 | Dominick Meglio 77 | .br 78 | Copyright 2005 by Dominick Meglio. 79 | -------------------------------------------------------------------------------- /c-ares/ares_parse_mx_reply.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 1998 by the Massachusetts Institute of Technology. 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this 5 | .\" software and its documentation for any purpose and without 6 | .\" fee is hereby granted, provided that the above copyright 7 | .\" notice appear in all copies and that both that copyright 8 | .\" notice and this permission notice appear in supporting 9 | .\" documentation, and that the name of M.I.T. not be used in 10 | .\" advertising or publicity pertaining to distribution of the 11 | .\" software without specific, written prior permission. 12 | .\" M.I.T. makes no representations about the suitability of 13 | .\" this software for any purpose. It is provided "as is" 14 | .\" without express or implied warranty. 15 | .\" 16 | .TH ARES_PARSE_MX_REPLY 3 "4 August 2009" 17 | .SH NAME 18 | ares_parse_mx_reply \- Parse a reply to a DNS query of type MX 19 | .SH SYNOPSIS 20 | .nf 21 | .B #include 22 | .PP 23 | .B int ares_parse_mx_reply(const unsigned char* \fIabuf\fP, int \fIalen\fP, 24 | .B struct ares_mx_reply** \fImx_out\fP); 25 | .fi 26 | .SH DESCRIPTION 27 | The 28 | .B ares_parse_mx_reply 29 | function parses the response to a query of type MX into a 30 | linked list of 31 | .I struct ares_mx_reply 32 | The parameters 33 | .I abuf 34 | and 35 | .I alen 36 | give the contents of the response. The result is stored in allocated 37 | memory and a pointer to it stored into the variable pointed to by 38 | .IR mx_out . 39 | It is the caller's responsibility to free the resulting 40 | .IR mx_out 41 | structure when it is no longer needed using the function 42 | .B ares_free_data 43 | .PP 44 | The structure 45 | .I ares_mx_reply 46 | contains the following fields: 47 | .sp 48 | .in +4n 49 | .nf 50 | struct ares_mx_reply { 51 | struct ares_mx_reply *next; 52 | char *host; 53 | unsigned short priority; 54 | }; 55 | .fi 56 | .in 57 | .PP 58 | .SH RETURN VALUES 59 | .B ares_parse_mx_reply 60 | can return any of the following values: 61 | .TP 15 62 | .B ARES_SUCCESS 63 | The response was successfully parsed. 64 | .TP 15 65 | .B ARES_EBADRESP 66 | The response was malformatted. 67 | .TP 15 68 | .B ARES_ENODATA 69 | The response did not contain an answer to the query. 70 | .TP 15 71 | .B ARES_ENOMEM 72 | Memory was exhausted. 73 | .SH AVAILABILITY 74 | This function was first introduced in c-ares version 1.7.2. 75 | .SH SEE ALSO 76 | .BR ares_query (3) 77 | .BR ares_free_data (3) 78 | .SH AUTHOR 79 | Written by Jeremy Lal 80 | -------------------------------------------------------------------------------- /c-ares/ares_parse_ns_reply.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 1998 by the Massachusetts Institute of Technology. 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this 5 | .\" software and its documentation for any purpose and without 6 | .\" fee is hereby granted, provided that the above copyright 7 | .\" notice appear in all copies and that both that copyright 8 | .\" notice and this permission notice appear in supporting 9 | .\" documentation, and that the name of M.I.T. not be used in 10 | .\" advertising or publicity pertaining to distribution of the 11 | .\" software without specific, written prior permission. 12 | .\" M.I.T. makes no representations about the suitability of 13 | .\" this software for any purpose. It is provided "as is" 14 | .\" without express or implied warranty. 15 | .\" 16 | .TH ARES_PARSE_NS_REPLY 3 "10 February 2007" 17 | .SH NAME 18 | ares_parse_ns_reply \- Parse a reply to a DNS query of type NS into a hostent 19 | .SH SYNOPSIS 20 | .nf 21 | .B #include 22 | .PP 23 | .B int ares_parse_ns_reply(const unsigned char *\fIabuf\fP, int \fIalen\fP, 24 | .B struct hostent **\fIhost\fP); 25 | .fi 26 | .SH DESCRIPTION 27 | The 28 | .B ares_parse_ns_reply 29 | function parses the response to a query of type NS into a 30 | .BR "struct hostent" . 31 | The parameters 32 | .I abuf 33 | and 34 | .I alen 35 | give the contents of the response. The result is stored in allocated 36 | memory and a pointer to it stored into the variable pointed to by 37 | .IR host . 38 | The nameservers are stored into the 39 | .BR aliases 40 | field of the 41 | .IR host 42 | structure. 43 | It is the caller's responsibility to free the resulting host structure 44 | using 45 | .BR ares_free_hostent (3) 46 | when it is no longer needed. 47 | .SH RETURN VALUES 48 | .B ares_parse_ns_reply 49 | can return any of the following values: 50 | .TP 15 51 | .B ARES_SUCCESS 52 | The response was successfully parsed. 53 | .TP 15 54 | .B ARES_EBADRESP 55 | The response was malformatted. 56 | .TP 15 57 | .B ARES_ENODATA 58 | The response did not contain an answer to the query. 59 | .TP 15 60 | .B ARES_ENOMEM 61 | Memory was exhausted. 62 | .SH SEE ALSO 63 | .BR ares_query (3), 64 | .BR ares_free_hostent (3) 65 | .SH AUTHOR 66 | Written by Vlad Dinulescu , on behalf of AVIRA Gmbh http://www.avira.com 67 | -------------------------------------------------------------------------------- /c-ares/ares_parse_ptr_reply.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 1998 by the Massachusetts Institute of Technology. 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this 5 | .\" software and its documentation for any purpose and without 6 | .\" fee is hereby granted, provided that the above copyright 7 | .\" notice appear in all copies and that both that copyright 8 | .\" notice and this permission notice appear in supporting 9 | .\" documentation, and that the name of M.I.T. not be used in 10 | .\" advertising or publicity pertaining to distribution of the 11 | .\" software without specific, written prior permission. 12 | .\" M.I.T. makes no representations about the suitability of 13 | .\" this software for any purpose. It is provided "as is" 14 | .\" without express or implied warranty. 15 | .\" 16 | .TH ARES_PARSE_PTR_REPLY 3 "25 July 1998" 17 | .SH NAME 18 | ares_parse_ptr_reply \- Parse a reply to a DNS query of type PTR into a hostent 19 | .SH SYNOPSIS 20 | .nf 21 | .B #include 22 | .PP 23 | .B int ares_parse_ptr_reply(const unsigned char *\fIabuf\fP, int \fIalen\fP, 24 | .B const void *\fIaddr\fP, int \fIaddrlen\fP, int \fIfamily\fP, 25 | .B struct hostent **\fIhost\fP); 26 | .fi 27 | .SH DESCRIPTION 28 | The 29 | .B ares_parse_ptr_reply 30 | function parses the response to a query of type PTR into a 31 | .BR "struct hostent" . 32 | The parameters 33 | .I abuf 34 | and 35 | .I alen 36 | give the contents of the response. The parameters 37 | .IR addr , 38 | .IR addrlen , 39 | and 40 | .I family 41 | specify which address was queried for; they are not used to verify the 42 | response, merely used to fill in the address of the 43 | .BR "struct hostent" . 44 | The resulting 45 | .B struct hostent 46 | is stored in allocated memory and a pointer to it stored into the 47 | variable pointed to by 48 | .IR host . 49 | It is the caller's responsibility to free the resulting host structure 50 | using 51 | .BR ares_free_hostent (3) 52 | when it is no longer needed. 53 | .SH RETURN VALUES 54 | .B ares_parse_ptr_reply 55 | can return any of the following values: 56 | .TP 15 57 | .B ARES_SUCCESS 58 | The response was successfully parsed. 59 | .TP 15 60 | .B ARES_EBADRESP 61 | The response was malformatted. 62 | .TP 15 63 | .B ARES_ENODATA 64 | The response did not contain an answer to the query. 65 | .TP 15 66 | .B ARES_ENOMEM 67 | Memory was exhausted. 68 | .SH SEE ALSO 69 | .BR ares_gethostbyaddr (3), 70 | .BR ares_free_hostent (3) 71 | .SH AUTHOR 72 | Greg Hudson, MIT Information Systems 73 | .br 74 | Copyright 1998 by the Massachusetts Institute of Technology. 75 | -------------------------------------------------------------------------------- /c-ares/ares_parse_srv_reply.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 1998 by the Massachusetts Institute of Technology. 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this 5 | .\" software and its documentation for any purpose and without 6 | .\" fee is hereby granted, provided that the above copyright 7 | .\" notice appear in all copies and that both that copyright 8 | .\" notice and this permission notice appear in supporting 9 | .\" documentation, and that the name of M.I.T. not be used in 10 | .\" advertising or publicity pertaining to distribution of the 11 | .\" software without specific, written prior permission. 12 | .\" M.I.T. makes no representations about the suitability of 13 | .\" this software for any purpose. It is provided "as is" 14 | .\" without express or implied warranty. 15 | .\" 16 | .TH ARES_PARSE_SRV_REPLY 3 "4 August 2009" 17 | .SH NAME 18 | ares_parse_srv_reply \- Parse a reply to a DNS query of type SRV 19 | .SH SYNOPSIS 20 | .nf 21 | .B #include 22 | .PP 23 | .B int ares_parse_srv_reply(const unsigned char* \fIabuf\fP, int \fIalen\fP, 24 | .B struct ares_srv_reply** \fIsrv_out\fP); 25 | .fi 26 | .SH DESCRIPTION 27 | The 28 | .B ares_parse_srv_reply 29 | function parses the response to a query of type SRV into a 30 | linked list of 31 | .I struct ares_srv_reply 32 | The parameters 33 | .I abuf 34 | and 35 | .I alen 36 | give the contents of the response. The result is stored in allocated 37 | memory and a pointer to it stored into the variable pointed to by 38 | .IR srv_out . 39 | It is the caller's responsibility to free the resulting 40 | .IR srv_out 41 | structure when it is no longer needed using the function 42 | .B ares_free_data 43 | .PP 44 | The structure 45 | .I ares_srv_reply 46 | contains the following fields: 47 | .sp 48 | .in +4n 49 | .nf 50 | struct ares_srv_reply { 51 | struct ares_srv_reply *next; 52 | unsigned short weight; 53 | unsigned short priority; 54 | unsigned short port; 55 | char *host; 56 | }; 57 | .fi 58 | .in 59 | .PP 60 | .SH RETURN VALUES 61 | .B ares_parse_srv_reply 62 | can return any of the following values: 63 | .TP 15 64 | .B ARES_SUCCESS 65 | The response was successfully parsed. 66 | .TP 15 67 | .B ARES_EBADRESP 68 | The response was malformatted. 69 | .TP 15 70 | .B ARES_ENODATA 71 | The response did not contain an answer to the query. 72 | .TP 15 73 | .B ARES_ENOMEM 74 | Memory was exhausted. 75 | .SH AVAILABILITY 76 | This function was first introduced in c-ares version 1.7.0. 77 | .SH SEE ALSO 78 | .BR ares_query (3) 79 | .BR ares_free_data (3) 80 | .SH AUTHOR 81 | Written by Jakub Hrozek , on behalf of Red Hat, Inc http://www.redhat.com 82 | -------------------------------------------------------------------------------- /c-ares/ares_parse_txt_reply.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 1998 by the Massachusetts Institute of Technology. 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this 5 | .\" software and its documentation for any purpose and without 6 | .\" fee is hereby granted, provided that the above copyright 7 | .\" notice appear in all copies and that both that copyright 8 | .\" notice and this permission notice appear in supporting 9 | .\" documentation, and that the name of M.I.T. not be used in 10 | .\" advertising or publicity pertaining to distribution of the 11 | .\" software without specific, written prior permission. 12 | .\" M.I.T. makes no representations about the suitability of 13 | .\" this software for any purpose. It is provided "as is" 14 | .\" without express or implied warranty. 15 | .\" 16 | .TH ARES_PARSE_TXT_REPLY 3 "27 October 2009" 17 | .SH NAME 18 | ares_parse_txt_reply \- Parse a reply to a DNS query of type TXT 19 | .SH SYNOPSIS 20 | .nf 21 | .B #include 22 | .PP 23 | .B int ares_parse_txt_reply(const unsigned char* \fIabuf\fP, int \fIalen\fP, 24 | .B struct ares_txt_reply **\fItxt_out\fP); 25 | .fi 26 | .SH DESCRIPTION 27 | The 28 | .B ares_parse_txt_reply 29 | function parses the response to a query of type TXT into a 30 | linked list of 31 | .I struct ares_txt_reply 32 | The parameters 33 | .I abuf 34 | and 35 | .I alen 36 | give the contents of the response. The result is stored in allocated 37 | memory and a pointer to it stored into the variable pointed to by 38 | .IR txt_out . 39 | It is the caller's responsibility to free the resulting 40 | .IR txt_out 41 | structure when it is no longer needed using the function 42 | .B ares_free_data 43 | .PP 44 | The structure 45 | .I ares_txt_reply 46 | contains the following fields: 47 | .sp 48 | .in +4n 49 | .nf 50 | struct ares_txt_reply { 51 | struct ares_txt_reply *next; 52 | unsigned int length; 53 | unsigned char *txt; 54 | }; 55 | .fi 56 | .in 57 | .PP 58 | .SH RETURN VALUES 59 | .B ares_parse_txt_reply 60 | can return any of the following values: 61 | .TP 15 62 | .B ARES_SUCCESS 63 | The response was successfully parsed. 64 | .TP 15 65 | .B ARES_EBADRESP 66 | The response was malformatted. 67 | .TP 15 68 | .B ARES_ENODATA 69 | The response did not contain an answer to the query. 70 | .TP 15 71 | .B ARES_ENOMEM 72 | Memory was exhausted. 73 | .SH AVAILABILITY 74 | This function was first introduced in c-ares version 1.7.0. 75 | .SH SEE ALSO 76 | .BR ares_query (3) 77 | .BR ares_free_data (3) 78 | .SH AUTHOR 79 | Written by Jakub Hrozek , on behalf of Red Hat, Inc http://www.redhat.com 80 | 81 | -------------------------------------------------------------------------------- /c-ares/ares_platform.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CARES_PLATFORM_H 2 | #define HEADER_CARES_PLATFORM_H 3 | 4 | 5 | /* Copyright 1998 by the Massachusetts Institute of Technology. 6 | * Copyright (C) 2004 - 2011 by Daniel Stenberg et al 7 | * 8 | * Permission to use, copy, modify, and distribute this 9 | * software and its documentation for any purpose and without 10 | * fee is hereby granted, provided that the above copyright 11 | * notice appear in all copies and that both that copyright 12 | * notice and this permission notice appear in supporting 13 | * documentation, and that the name of M.I.T. not be used in 14 | * advertising or publicity pertaining to distribution of the 15 | * software without specific, written prior permission. 16 | * M.I.T. makes no representations about the suitability of 17 | * this software for any purpose. It is provided "as is" 18 | * without express or implied warranty. 19 | */ 20 | 21 | #include "ares_setup.h" 22 | 23 | #if defined(WIN32) && !defined(MSDOS) 24 | 25 | typedef enum { 26 | WIN_UNKNOWN, 27 | WIN_3X, 28 | WIN_9X, 29 | WIN_NT, 30 | WIN_CE 31 | } win_platform; 32 | 33 | win_platform ares__getplatform(void); 34 | 35 | #endif 36 | 37 | #if defined(_WIN32_WCE) || 1 38 | 39 | struct servent *ares_getservbyport(int port, const char *proto); 40 | 41 | #endif 42 | 43 | #endif /* HEADER_CARES_PLATFORM_H */ 44 | -------------------------------------------------------------------------------- /c-ares/ares_process.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 1998 by the Massachusetts Institute of Technology. 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this 5 | .\" software and its documentation for any purpose and without 6 | .\" fee is hereby granted, provided that the above copyright 7 | .\" notice appear in all copies and that both that copyright 8 | .\" notice and this permission notice appear in supporting 9 | .\" documentation, and that the name of M.I.T. not be used in 10 | .\" advertising or publicity pertaining to distribution of the 11 | .\" software without specific, written prior permission. 12 | .\" M.I.T. makes no representations about the suitability of 13 | .\" this software for any purpose. It is provided "as is" 14 | .\" without express or implied warranty. 15 | .\" 16 | .TH ARES_PROCESS 3 "25 July 1998" 17 | .SH NAME 18 | ares_process \- Process events for name resolution 19 | .SH SYNOPSIS 20 | .nf 21 | .B #include 22 | .PP 23 | .B void ares_process(ares_channel \fIchannel\fP, fd_set *\fIread_fds\fP, 24 | .B fd_set *\fIwrite_fds\fP) 25 | .fi 26 | .PP 27 | .B void ares_process_fd(ares_channel \fIchannel\fP, 28 | .B ares_socket_t \fIread_fd\fP, 29 | .B ares_socket_t \fIwrite_fd\fP) 30 | .fi 31 | .SH DESCRIPTION 32 | The \fBares_process(3)\fP function handles input/output events and timeouts 33 | associated with queries pending on the name service channel identified by 34 | .IR channel . 35 | The file descriptor sets pointed to by \fIread_fds\fP and \fIwrite_fds\fP 36 | should have file descriptors set in them according to whether the file 37 | descriptors specified by \fIares_fds(3)\fP are ready for reading and writing. 38 | (The easiest way to determine this information is to invoke 39 | .B select 40 | with a timeout no greater than the timeout given by \fIares_timeout(3)\fP ). 41 | .PP 42 | The 43 | .B ares_process 44 | function will invoke callbacks for pending queries if they complete 45 | successfully or fail. 46 | 47 | \fBares_process_fd(3)\fP works the same way but acts and operates only on the 48 | specific file descriptors (sockets) you pass in to the function. Use 49 | ARES_SOCKET_BAD for "no action". This function is of course provided to allow 50 | users of c-ares to void select() in their applications and within c-ares. 51 | .SS EXAMPLE 52 | The following code fragment waits for all pending queries on a channel 53 | to complete: 54 | .PP 55 | .RS 56 | .nf 57 | int nfds, count; 58 | fd_set readers, writers; 59 | struct timeval tv, *tvp; 60 | 61 | while (1) 62 | { 63 | FD_ZERO(&readers); 64 | FD_ZERO(&writers); 65 | nfds = ares_fds(channel, &readers, &writers); 66 | if (nfds == 0) 67 | break; 68 | tvp = ares_timeout(channel, NULL, &tv); 69 | count = select(nfds, &readers, &writers, NULL, tvp); 70 | ares_process(channel, &readers, &writers); 71 | } 72 | .fi 73 | .RE 74 | .SH SEE ALSO 75 | .BR ares_fds (3), 76 | .BR ares_timeout (3) 77 | .SH AUTHOR 78 | Greg Hudson, MIT Information Systems 79 | .br 80 | Copyright 1998 by the Massachusetts Institute of Technology. 81 | -------------------------------------------------------------------------------- /c-ares/ares_save_options.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 1998 by the Massachusetts Institute of Technology. 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this 5 | .\" software and its documentation for any purpose and without 6 | .\" fee is hereby granted, provided that the above copyright 7 | .\" notice appear in all copies and that both that copyright 8 | .\" notice and this permission notice appear in supporting 9 | .\" documentation, and that the name of M.I.T. not be used in 10 | .\" advertising or publicity pertaining to distribution of the 11 | .\" software without specific, written prior permission. 12 | .\" M.I.T. makes no representations about the suitability of 13 | .\" this software for any purpose. It is provided "as is" 14 | .\" without express or implied warranty. 15 | .\" 16 | .TH ARES_SAVE_OPTIONS 3 "5 March 2010" 17 | .SH NAME 18 | ares_save_options \- Save configuration values obtained from initialized ares_channel 19 | .SH SYNOPSIS 20 | .nf 21 | .B #include 22 | .PP 23 | .B int ares_save_options(ares_channel \fIchannel\fP, struct ares_options *\fIoptions\fP, int *\fIoptmask\fP) 24 | .fi 25 | .SH DESCRIPTION 26 | The \fBares_save_options(3)\fP function saves the channel data identified by 27 | .IR channel , 28 | into the options struct identified by 29 | .IR options , 30 | and saves the mask of options which are set to the integer 31 | pointer (passed by reference) identified by 32 | .IR optmask . 33 | 34 | The resultant options and optmask are then able to be 35 | passed directly to ares_init_options. When the options 36 | are no longer needed, ares_destroy_options should be called 37 | to free any associated memory. 38 | .SH RETURN VALUES 39 | .B ares_save_options(3) 40 | can return any of the following values: 41 | .TP 15 42 | .B ARES_SUCCESS 43 | The channel data was successfuly stored 44 | .TP 15 45 | .B ARES_ENOMEM 46 | The memory was exhausted 47 | .TP 15 48 | .B ARES_ENODATA 49 | The channel data identified by 50 | .IR channel 51 | were invalid. 52 | .SH NOTE 53 | Since c-ares 1.6.0 the ares_options struct has been "locked" meaning that it 54 | won't be extended to cover new functions. This function will remain 55 | functioning, but it can only return config data that can be represented in 56 | this config struct, which may no longer be the complete set of config 57 | options. \fBares_dup(3)\fP will not have that restriction. 58 | 59 | The ares_options struct can not handle potential IPv6 name servers the 60 | ares_channel might be configured to use. The \fBares_save_options(3)\fP function 61 | will only return IPv4 servers, if any. In order to retrieve all name servers 62 | an ares_channel might be using, the \fBares_get_servers(3)\fP function must be 63 | used instead. 64 | .SH SEE ALSO 65 | .BR ares_destroy_options (3), 66 | .BR ares_init_options (3), 67 | .BR ares_get_servers (3), 68 | .BR ares_dup (3) 69 | .SH AVAILABILITY 70 | ares_save_options(3) was added in c-ares 1.4.0 71 | .SH AUTHOR 72 | Brad House 73 | .br 74 | Copyright 1998 by the Massachusetts Institute of Technology. 75 | -------------------------------------------------------------------------------- /c-ares/ares_set_servers.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 2010 by Ben Greear 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this 5 | .\" software and its documentation for any purpose and without 6 | .\" fee is hereby granted, provided that the above copyright 7 | .\" notice appear in all copies and that both that copyright 8 | .\" notice and this permission notice appear in supporting 9 | .\" documentation, and that the name of M.I.T. not be used in 10 | .\" advertising or publicity pertaining to distribution of the 11 | .\" software without specific, written prior permission. 12 | .\" M.I.T. makes no representations about the suitability of 13 | .\" this software for any purpose. It is provided "as is" 14 | .\" without express or implied warranty. 15 | .\" 16 | .TH ARES_SET_SERVERS 3 "5 March 2010" 17 | .SH NAME 18 | ares_set_servers \- Initialize an ares_channel name servers configuration 19 | .SH SYNOPSIS 20 | .nf 21 | .B #include 22 | .PP 23 | .B int ares_set_servers(ares_channel \fIchannel\fP, struct ares_addr_node *\fIservers\fP) 24 | .fi 25 | .SH DESCRIPTION 26 | The \fBares_set_servers(3)\fP function initializes name servers configuration 27 | for the channel data identified by 28 | .IR channel , 29 | from a 30 | .IR servers 31 | pointer to a linked list of ares_addr_node structs holding name servers 32 | address data. 33 | 34 | The name server linked list pointer argument may be the result of a previous 35 | call to \fBares_get_servers(3)\fP or a linked list of ares_addr_node structs 36 | setup by other means. 37 | 38 | This function replaces any potentially previously configured name servers 39 | with the ones given in the linked list. So, in order to configure a channel 40 | with more than one name server all the desired ones must be specified in a 41 | single list. 42 | 43 | \fBares_set_servers(3)\fP does not take ownership of the linked list argument. 44 | The caller is responsible for freeing the linked list when no longer needed. 45 | 46 | This function is capable of handling IPv4 and IPv6 name server 47 | addresses simultaneously, rendering \fBares_init_options(3)\fP with 48 | optmask \fBARES_OPT_SERVERS\fP functionally obsolete except for 49 | IPv4-only name server usage. 50 | 51 | .SH RETURN VALUES 52 | .B ares_set_servers(3) 53 | may return any of the following values: 54 | .TP 15 55 | .B ARES_SUCCESS 56 | The name servers configuration was successfuly initialized. 57 | .TP 15 58 | .B ARES_ENOMEM 59 | The process's available memory was exhausted. 60 | .TP 15 61 | .B ARES_ENODATA 62 | The channel data identified by 63 | .IR channel 64 | was invalid. 65 | .TP 15 66 | .B ARES_ENOTINITIALIZED 67 | c-ares library initialization not yet performed. 68 | .SH SEE ALSO 69 | .BR ares_set_servers_csv (3), 70 | .BR ares_get_servers (3), 71 | .BR ares_init_options (3), 72 | .BR ares_dup(3) 73 | .SH AVAILABILITY 74 | ares_set_servers(3) was added in c-ares 1.7.1 75 | .SH AUTHOR 76 | Implementation of this function and associated library internals are based 77 | on code, comments and feedback provided in November and December of 2008 by 78 | Daniel Stenberg, Gregor Jasny, Phil Blundell and Yang Tse, December 2009 79 | by Cedric Bail, February 2010 by Jakub Hrozek. On March 2010 Yang Tse 80 | shuffled all the bits and this function popped out. 81 | .br 82 | Copyright 1998 by the Massachusetts Institute of Technology. 83 | .br 84 | Copyright (C) 2008-2010 by Daniel Stenberg 85 | -------------------------------------------------------------------------------- /c-ares/ares_set_socket_callback.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .TH ARES_SET_SOCKET_CALLBACK 3 "20 Nov 2009" 3 | .SH NAME 4 | ares_set_socket_callback \- Set a socket creation callback 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | .PP 9 | .B void ares_set_socket_callback(ares_channel \fIchannel\fP, 10 | ares_sock_create_callback \fIcallback\fP, 11 | void *\fIuserdata\fP) 12 | .PP 13 | .B cc file.c -lcares 14 | .fi 15 | .SH DESCRIPTION 16 | .PP 17 | This function sets a \fIcallback\fP in the given ares channel handle. This 18 | callback function will be invoked after the socket has been created, and 19 | connected to the remote server. The callback must return ARES_SUCCESS if 20 | things are fine, or use the standard ares error codes to signal errors 21 | back. Returned errors will abort the ares operation. 22 | .SH SEE ALSO 23 | .BR ares_init_options (3) 24 | .SH AVAILABILITY 25 | ares_set_socket_callback(3) was added in c-ares 1.6.0 26 | .SH AUTHOR 27 | Gregor Jasny 28 | 29 | -------------------------------------------------------------------------------- /c-ares/ares_strcasecmp.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | /* Copyright 1998 by the Massachusetts Institute of Technology. 4 | * 5 | * Permission to use, copy, modify, and distribute this 6 | * software and its documentation for any purpose and without 7 | * fee is hereby granted, provided that the above copyright 8 | * notice appear in all copies and that both that copyright 9 | * notice and this permission notice appear in supporting 10 | * documentation, and that the name of M.I.T. not be used in 11 | * advertising or publicity pertaining to distribution of the 12 | * software without specific, written prior permission. 13 | * M.I.T. makes no representations about the suitability of 14 | * this software for any purpose. It is provided "as is" 15 | * without express or implied warranty. 16 | */ 17 | 18 | #include "ares_setup.h" 19 | #include "ares_strcasecmp.h" 20 | 21 | #ifndef HAVE_STRCASECMP 22 | int ares_strcasecmp(const char *a, const char *b) 23 | { 24 | #if defined(HAVE_STRCMPI) 25 | return strcmpi(a, b); 26 | #elif defined(HAVE_STRICMP) 27 | return stricmp(a, b); 28 | #else 29 | size_t i; 30 | 31 | for (i = 0; i < (size_t)-1; i++) { 32 | int c1 = ISUPPER(a[i]) ? tolower(a[i]) : a[i]; 33 | int c2 = ISUPPER(b[i]) ? tolower(b[i]) : b[i]; 34 | if (c1 != c2) 35 | return c1-c2; 36 | if (!c1) 37 | break; 38 | } 39 | return 0; 40 | #endif 41 | } 42 | #endif 43 | 44 | #ifndef HAVE_STRNCASECMP 45 | int ares_strncasecmp(const char *a, const char *b, size_t n) 46 | { 47 | #if defined(HAVE_STRNCMPI) 48 | return strncmpi(a, b, n); 49 | #elif defined(HAVE_STRNICMP) 50 | return strnicmp(a, b, n); 51 | #else 52 | size_t i; 53 | 54 | for (i = 0; i < n; i++) { 55 | int c1 = ISUPPER(a[i]) ? tolower(a[i]) : a[i]; 56 | int c2 = ISUPPER(b[i]) ? tolower(b[i]) : b[i]; 57 | if (c1 != c2) 58 | return c1-c2; 59 | if (!c1) 60 | break; 61 | } 62 | return 0; 63 | #endif 64 | } 65 | #endif 66 | 67 | -------------------------------------------------------------------------------- /c-ares/ares_strcasecmp.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CARES_STRCASECMP_H 2 | #define HEADER_CARES_STRCASECMP_H 3 | 4 | 5 | /* Copyright 1998 by the Massachusetts Institute of Technology. 6 | * 7 | * Permission to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose and without 9 | * fee is hereby granted, provided that the above copyright 10 | * notice appear in all copies and that both that copyright 11 | * notice and this permission notice appear in supporting 12 | * documentation, and that the name of M.I.T. not be used in 13 | * advertising or publicity pertaining to distribution of the 14 | * software without specific, written prior permission. 15 | * M.I.T. makes no representations about the suitability of 16 | * this software for any purpose. It is provided "as is" 17 | * without express or implied warranty. 18 | */ 19 | 20 | #include "ares_setup.h" 21 | 22 | #ifndef HAVE_STRCASECMP 23 | extern int ares_strcasecmp(const char *a, const char *b); 24 | #endif 25 | 26 | #ifndef HAVE_STRNCASECMP 27 | extern int ares_strncasecmp(const char *a, const char *b, size_t n); 28 | #endif 29 | 30 | #endif /* HEADER_CARES_STRCASECMP_H */ 31 | -------------------------------------------------------------------------------- /c-ares/ares_strdup.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | /* Copyright 1998 by the Massachusetts Institute of Technology. 4 | * 5 | * Permission to use, copy, modify, and distribute this 6 | * software and its documentation for any purpose and without 7 | * fee is hereby granted, provided that the above copyright 8 | * notice appear in all copies and that both that copyright 9 | * notice and this permission notice appear in supporting 10 | * documentation, and that the name of M.I.T. not be used in 11 | * advertising or publicity pertaining to distribution of the 12 | * software without specific, written prior permission. 13 | * M.I.T. makes no representations about the suitability of 14 | * this software for any purpose. It is provided "as is" 15 | * without express or implied warranty. 16 | */ 17 | 18 | #include "ares_setup.h" 19 | #include "ares_strdup.h" 20 | 21 | #ifndef HAVE_STRDUP 22 | char *ares_strdup(const char *s1) 23 | { 24 | size_t sz; 25 | char * s2; 26 | 27 | if(s1) { 28 | sz = strlen(s1); 29 | if(sz < (size_t)-1) { 30 | sz++; 31 | if(sz < ((size_t)-1) / sizeof(char)) { 32 | s2 = malloc(sz * sizeof(char)); 33 | if(s2) { 34 | memcpy(s2, s1, sz * sizeof(char)); 35 | return s2; 36 | } 37 | } 38 | } 39 | } 40 | return (char *)NULL; 41 | } 42 | #endif 43 | -------------------------------------------------------------------------------- /c-ares/ares_strdup.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CARES_STRDUP_H 2 | #define HEADER_CARES_STRDUP_H 3 | 4 | 5 | /* Copyright 1998 by the Massachusetts Institute of Technology. 6 | * 7 | * Permission to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose and without 9 | * fee is hereby granted, provided that the above copyright 10 | * notice appear in all copies and that both that copyright 11 | * notice and this permission notice appear in supporting 12 | * documentation, and that the name of M.I.T. not be used in 13 | * advertising or publicity pertaining to distribution of the 14 | * software without specific, written prior permission. 15 | * M.I.T. makes no representations about the suitability of 16 | * this software for any purpose. It is provided "as is" 17 | * without express or implied warranty. 18 | */ 19 | 20 | #include "ares_setup.h" 21 | 22 | #ifndef HAVE_STRDUP 23 | extern char *ares_strdup(const char *s1); 24 | #endif 25 | 26 | #endif /* HEADER_CARES_STRDUP_H */ 27 | -------------------------------------------------------------------------------- /c-ares/ares_strerror.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 1998 by the Massachusetts Institute of Technology. 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this 5 | .\" software and its documentation for any purpose and without 6 | .\" fee is hereby granted, provided that the above copyright 7 | .\" notice appear in all copies and that both that copyright 8 | .\" notice and this permission notice appear in supporting 9 | .\" documentation, and that the name of M.I.T. not be used in 10 | .\" advertising or publicity pertaining to distribution of the 11 | .\" software without specific, written prior permission. 12 | .\" M.I.T. makes no representations about the suitability of 13 | .\" this software for any purpose. It is provided "as is" 14 | .\" without express or implied warranty. 15 | .\" 16 | .TH ARES_STRERROR 3 "25 July 1998" 17 | .SH NAME 18 | ares_strerror \- Get the description of an ares library error code 19 | .SH SYNOPSIS 20 | .nf 21 | .B #include 22 | .PP 23 | .B const char *ares_strerror(int \fIcode\fP) 24 | .fi 25 | .SH DESCRIPTION 26 | The 27 | .B ares_strerror 28 | function gets the description of the ares library error code 29 | .IR code , 30 | returning the result as a NUL-terminated C string. 31 | .SH NOTES 32 | This function is not compatible with ares, it takes a different set of 33 | arguments. 34 | .SH AUTHOR 35 | Greg Hudson, MIT Information Systems 36 | .br 37 | Copyright 1998 by the Massachusetts Institute of Technology. 38 | -------------------------------------------------------------------------------- /c-ares/ares_strerror.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright 1998 by the Massachusetts Institute of Technology. 3 | * 4 | * Permission to use, copy, modify, and distribute this 5 | * software and its documentation for any purpose and without 6 | * fee is hereby granted, provided that the above copyright 7 | * notice appear in all copies and that both that copyright 8 | * notice and this permission notice appear in supporting 9 | * documentation, and that the name of M.I.T. not be used in 10 | * advertising or publicity pertaining to distribution of the 11 | * software without specific, written prior permission. 12 | * M.I.T. makes no representations about the suitability of 13 | * this software for any purpose. It is provided "as is" 14 | * without express or implied warranty. 15 | */ 16 | 17 | #include "ares_setup.h" 18 | #include 19 | #include "ares.h" 20 | 21 | const char *ares_strerror(int code) 22 | { 23 | /* Return a string literal from a table. */ 24 | const char *errtext[] = { 25 | "Successful completion", 26 | "DNS server returned answer with no data", 27 | "DNS server claims query was misformatted", 28 | "DNS server returned general failure", 29 | "Domain name not found", 30 | "DNS server does not implement requested operation", 31 | "DNS server refused query", 32 | "Misformatted DNS query", 33 | "Misformatted domain name", 34 | "Unsupported address family", 35 | "Misformatted DNS reply", 36 | "Could not contact DNS servers", 37 | "Timeout while contacting DNS servers", 38 | "End of file", 39 | "Error reading file", 40 | "Out of memory", 41 | "Channel is being destroyed", 42 | "Misformatted string", 43 | "Illegal flags specified", 44 | "Given hostname is not numeric", 45 | "Illegal hints flags specified", 46 | "c-ares library initialization not yet performed", 47 | "Error loading iphlpapi.dll", 48 | "Could not find GetNetworkParams function", 49 | "DNS query cancelled" 50 | }; 51 | 52 | if(code >= 0 && code < (int)(sizeof(errtext) / sizeof(*errtext))) 53 | return errtext[code]; 54 | else 55 | return "unknown"; 56 | } 57 | -------------------------------------------------------------------------------- /c-ares/ares_timeout.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 1998 by the Massachusetts Institute of Technology. 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this 5 | .\" software and its documentation for any purpose and without 6 | .\" fee is hereby granted, provided that the above copyright 7 | .\" notice appear in all copies and that both that copyright 8 | .\" notice and this permission notice appear in supporting 9 | .\" documentation, and that the name of M.I.T. not be used in 10 | .\" advertising or publicity pertaining to distribution of the 11 | .\" software without specific, written prior permission. 12 | .\" M.I.T. makes no representations about the suitability of 13 | .\" this software for any purpose. It is provided "as is" 14 | .\" without express or implied warranty. 15 | .\" 16 | .TH ARES_TIMEOUT 3 "25 July 1998" 17 | .SH NAME 18 | ares_fds \- Get file descriptors to select on for name service 19 | .SH SYNOPSIS 20 | .nf 21 | .B #include 22 | .PP 23 | .B struct timeval *ares_timeout(ares_channel \fIchannel\fP, 24 | .B struct timeval *\fImaxtv\fP, struct timeval *\fItv\fP) 25 | .fi 26 | .SH DESCRIPTION 27 | The 28 | .B ares_timeout 29 | function determines the maximum time for which the caller should wait before 30 | invoking \fIares_process(3)\fP to process timeouts. The parameter 31 | .I maxtv 32 | specifies a existing maximum timeout, or 33 | .B NULL 34 | if the caller does not wish to apply a maximum timeout. The parameter 35 | .I tv 36 | must point to a writable buffer of type 37 | .BR "struct timeval" . 38 | It is valid for 39 | .I maxtv 40 | and 41 | .I tv 42 | to have the same value. 43 | .PP 44 | If no queries have timeouts pending sooner than the given maximum 45 | timeout, 46 | .B ares_timeout 47 | returns the value of 48 | .IR maxtv; 49 | otherwise 50 | .B ares_timeout 51 | stores the appropriate timeout value into the buffer pointed to by 52 | .I tv 53 | and returns the value of 54 | .IR tv . 55 | .SH SEE ALSO 56 | .BR ares_fds (3), 57 | .BR ares_process (3) 58 | .SH AUTHOR 59 | Greg Hudson, MIT Information Systems 60 | .br 61 | Copyright 1998 by the Massachusetts Institute of Technology. 62 | -------------------------------------------------------------------------------- /c-ares/ares_timeout.c: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright 1998 by the Massachusetts Institute of Technology. 3 | * 4 | * Permission to use, copy, modify, and distribute this 5 | * software and its documentation for any purpose and without 6 | * fee is hereby granted, provided that the above copyright 7 | * notice appear in all copies and that both that copyright 8 | * notice and this permission notice appear in supporting 9 | * documentation, and that the name of M.I.T. not be used in 10 | * advertising or publicity pertaining to distribution of the 11 | * software without specific, written prior permission. 12 | * M.I.T. makes no representations about the suitability of 13 | * this software for any purpose. It is provided "as is" 14 | * without express or implied warranty. 15 | */ 16 | 17 | #include "ares_setup.h" 18 | 19 | #ifdef HAVE_SYS_TIME_H 20 | #include 21 | #endif 22 | 23 | #include 24 | 25 | #include "ares.h" 26 | #include "ares_private.h" 27 | 28 | /* WARNING: Beware that this is linear in the number of outstanding 29 | * requests! You are probably far better off just calling ares_process() 30 | * once per second, rather than calling ares_timeout() to figure out 31 | * when to next call ares_process(). 32 | */ 33 | struct timeval *ares_timeout(ares_channel channel, struct timeval *maxtv, 34 | struct timeval *tvbuf) 35 | { 36 | struct query *query; 37 | struct list_node* list_head; 38 | struct list_node* list_node; 39 | struct timeval now; 40 | struct timeval nextstop; 41 | long offset, min_offset; 42 | 43 | /* No queries, no timeout (and no fetch of the current time). */ 44 | if (ares__is_list_empty(&(channel->all_queries))) 45 | return maxtv; 46 | 47 | /* Find the minimum timeout for the current set of queries. */ 48 | now = ares__tvnow(); 49 | min_offset = -1; 50 | 51 | list_head = &(channel->all_queries); 52 | for (list_node = list_head->next; list_node != list_head; 53 | list_node = list_node->next) 54 | { 55 | query = list_node->data; 56 | if (query->timeout.tv_sec == 0) 57 | continue; 58 | offset = ares__timeoffset(&now, &query->timeout); 59 | if (offset < 0) 60 | offset = 0; 61 | if (min_offset == -1 || offset < min_offset) 62 | min_offset = offset; 63 | } 64 | 65 | if(min_offset != -1) { 66 | nextstop.tv_sec = min_offset/1000; 67 | nextstop.tv_usec = (min_offset%1000)*1000; 68 | } 69 | 70 | /* If we found a minimum timeout and it's sooner than the one specified in 71 | * maxtv (if any), return it. Otherwise go with maxtv. 72 | */ 73 | if (min_offset != -1 && (!maxtv || ares__timedout(maxtv, &nextstop))) 74 | { 75 | *tvbuf = nextstop; 76 | return tvbuf; 77 | } 78 | else 79 | return maxtv; 80 | } 81 | -------------------------------------------------------------------------------- /c-ares/ares_version.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" Copyright 2004 by Daniel Stenberg 3 | .\" 4 | .\" Permission to use, copy, modify, and distribute this 5 | .\" software and its documentation for any purpose and without 6 | .\" fee is hereby granted, provided that the above copyright 7 | .\" notice appear in all copies and that both that copyright 8 | .\" notice and this permission notice appear in supporting 9 | .\" documentation, and that the name of M.I.T. not be used in 10 | .\" advertising or publicity pertaining to distribution of the 11 | .\" software without specific, written prior permission. 12 | .\" M.I.T. makes no representations about the suitability of 13 | .\" this software for any purpose. It is provided "as is" 14 | .\" without express or implied warranty. 15 | .\" 16 | .TH ARES_VERSION 3 "29 January 2004" 17 | .SH NAME 18 | ares_version \- Get the version number of the library 19 | .SH SYNOPSIS 20 | .nf 21 | .B #include 22 | .PP 23 | .B const char *ares_version(int *\fIversion\fP) 24 | .fi 25 | .SH DESCRIPTION 26 | The 27 | .B ares_version 28 | function gets the library version as a string and optionally as an integer 29 | stored in the 30 | .IR version , 31 | argument. If you pass a NULL, no integer is attempted to be returned. 32 | 33 | The integer is built up as 24bit number, with 8 separate bits used for major 34 | number, minor number and patch number. This makes a version string such as 35 | 1.2.3 will be returned as the hexadecimal number 0x010203 (decimal 66051). 36 | .SH NOTES 37 | This function is not compatible with ares. 38 | .SH AUTHOR 39 | Daniel Stenberg 40 | 41 | -------------------------------------------------------------------------------- /c-ares/ares_version.c: -------------------------------------------------------------------------------- 1 | 2 | #include "ares_setup.h" 3 | #include "ares.h" 4 | 5 | const char *ares_version(int *version) 6 | { 7 | if(version) 8 | *version = ARES_VERSION; 9 | 10 | return ARES_VERSION_STR; 11 | } 12 | -------------------------------------------------------------------------------- /c-ares/ares_version.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef ARES__VERSION_H 3 | #define ARES__VERSION_H 4 | 5 | /* This is the global package copyright */ 6 | #define ARES_COPYRIGHT "2004 - 2010 Daniel Stenberg, ." 7 | 8 | #define ARES_VERSION_MAJOR 1 9 | #define ARES_VERSION_MINOR 7 10 | #define ARES_VERSION_PATCH 5 11 | #define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\ 12 | (ARES_VERSION_MINOR<<8)|\ 13 | (ARES_VERSION_PATCH)) 14 | #define ARES_VERSION_STR "1.7.5" 15 | 16 | #if (ARES_VERSION >= 0x010700) 17 | # define CARES_HAVE_ARES_LIBRARY_INIT 1 18 | # define CARES_HAVE_ARES_LIBRARY_CLEANUP 1 19 | #else 20 | # undef CARES_HAVE_ARES_LIBRARY_INIT 21 | # undef CARES_HAVE_ARES_LIBRARY_CLEANUP 22 | #endif 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /c-ares/ares_writev.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | /* Copyright 1998 by the Massachusetts Institute of Technology. 4 | * 5 | * Permission to use, copy, modify, and distribute this 6 | * software and its documentation for any purpose and without 7 | * fee is hereby granted, provided that the above copyright 8 | * notice appear in all copies and that both that copyright 9 | * notice and this permission notice appear in supporting 10 | * documentation, and that the name of M.I.T. not be used in 11 | * advertising or publicity pertaining to distribution of the 12 | * software without specific, written prior permission. 13 | * M.I.T. makes no representations about the suitability of 14 | * this software for any purpose. It is provided "as is" 15 | * without express or implied warranty. 16 | */ 17 | 18 | #include "ares_setup.h" 19 | 20 | #ifdef HAVE_LIMITS_H 21 | # include 22 | #endif 23 | 24 | #include "ares.h" 25 | #include "ares_private.h" 26 | 27 | #ifndef HAVE_WRITEV 28 | ssize_t ares_writev(ares_socket_t s, const struct iovec *iov, int iovcnt) 29 | { 30 | char *buffer, *bp; 31 | int i; 32 | size_t bytes = 0; 33 | ssize_t result; 34 | 35 | /* Validate iovcnt */ 36 | if (iovcnt <= 0) 37 | { 38 | SET_ERRNO(EINVAL); 39 | return (-1); 40 | } 41 | 42 | /* Validate and find the sum of the iov_len values in the iov array */ 43 | for (i = 0; i < iovcnt; i++) 44 | { 45 | if (iov[i].iov_len > INT_MAX - bytes) 46 | { 47 | SET_ERRNO(EINVAL); 48 | return (-1); 49 | } 50 | bytes += iov[i].iov_len; 51 | } 52 | 53 | if (bytes == 0) 54 | return (0); 55 | 56 | /* Allocate a temporary buffer to hold the data */ 57 | buffer = malloc(bytes); 58 | if (!buffer) 59 | { 60 | SET_ERRNO(ENOMEM); 61 | return (-1); 62 | } 63 | 64 | /* Copy the data into buffer */ 65 | for (bp = buffer, i = 0; i < iovcnt; ++i) 66 | { 67 | memcpy (bp, iov[i].iov_base, iov[i].iov_len); 68 | bp += iov[i].iov_len; 69 | } 70 | 71 | /* Send buffer contents */ 72 | result = swrite(s, buffer, bytes); 73 | 74 | free(buffer); 75 | 76 | return (result); 77 | } 78 | #endif 79 | 80 | -------------------------------------------------------------------------------- /c-ares/ares_writev.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CARES_WRITEV_H 2 | #define HEADER_CARES_WRITEV_H 3 | 4 | 5 | /* Copyright 1998 by the Massachusetts Institute of Technology. 6 | * 7 | * Permission to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose and without 9 | * fee is hereby granted, provided that the above copyright 10 | * notice appear in all copies and that both that copyright 11 | * notice and this permission notice appear in supporting 12 | * documentation, and that the name of M.I.T. not be used in 13 | * advertising or publicity pertaining to distribution of the 14 | * software without specific, written prior permission. 15 | * M.I.T. makes no representations about the suitability of 16 | * this software for any purpose. It is provided "as is" 17 | * without express or implied warranty. 18 | */ 19 | 20 | #include "ares_setup.h" 21 | #include "ares.h" 22 | 23 | #ifndef HAVE_WRITEV 24 | 25 | /* Structure for scatter/gather I/O. */ 26 | struct iovec 27 | { 28 | void *iov_base; /* Pointer to data. */ 29 | size_t iov_len; /* Length of data. */ 30 | }; 31 | 32 | extern ssize_t ares_writev(ares_socket_t s, const struct iovec *iov, int iovcnt); 33 | 34 | #endif 35 | 36 | #endif /* HEADER_CARES_WRITEV_H */ 37 | -------------------------------------------------------------------------------- /c-ares/bitncmp.c: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") 4 | * Copyright (c) 1996,1999 by Internet Software Consortium. 5 | * 6 | * Permission to use, copy, modify, and distribute this software for any 7 | * purpose with or without fee is hereby granted, provided that the above 8 | * copyright notice and this permission notice appear in all copies. 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 16 | * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 | */ 18 | 19 | #ifndef HAVE_BITNCMP 20 | 21 | #include "ares_setup.h" 22 | #include "bitncmp.h" 23 | 24 | /* 25 | * int 26 | * bitncmp(l, r, n) 27 | * compare bit masks l and r, for n bits. 28 | * return: 29 | * -1, 1, or 0 in the libc tradition. 30 | * note: 31 | * network byte order assumed. this means 192.5.5.240/28 has 32 | * 0x11110000 in its fourth octet. 33 | * author: 34 | * Paul Vixie (ISC), June 1996 35 | */ 36 | int 37 | ares_bitncmp(const void *l, const void *r, int n) { 38 | unsigned int lb, rb; 39 | int x, b; 40 | 41 | b = n / 8; 42 | x = memcmp(l, r, b); 43 | if (x || (n % 8) == 0) 44 | return (x); 45 | 46 | lb = ((const unsigned char *)l)[b]; 47 | rb = ((const unsigned char *)r)[b]; 48 | for (b = n % 8; b > 0; b--) { 49 | if ((lb & 0x80) != (rb & 0x80)) { 50 | if (lb & 0x80) 51 | return (1); 52 | return (-1); 53 | } 54 | lb <<= 1; 55 | rb <<= 1; 56 | } 57 | return (0); 58 | } 59 | #endif 60 | -------------------------------------------------------------------------------- /c-ares/bitncmp.h: -------------------------------------------------------------------------------- 1 | #ifndef __ARES_BITNCMP_H 2 | #define __ARES_BITNCMP_H 3 | 4 | 5 | /* Copyright (C) 2005 by Dominick Meglio 6 | * 7 | * Permission to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose and without 9 | * fee is hereby granted, provided that the above copyright 10 | * notice appear in all copies and that both that copyright 11 | * notice and this permission notice appear in supporting 12 | * documentation, and that the name of M.I.T. not be used in 13 | * advertising or publicity pertaining to distribution of the 14 | * software without specific, written prior permission. 15 | * M.I.T. makes no representations about the suitability of 16 | * this software for any purpose. It is provided "as is" 17 | * without express or implied warranty. 18 | */ 19 | 20 | #ifndef HAVE_BITNCMP 21 | int ares_bitncmp(const void *l, const void *r, int n); 22 | #else 23 | #define ares_bitncmp(x,y,z) bitncmp(x,y,z) 24 | #endif 25 | 26 | #endif /* __ARES_BITNCMP_H */ 27 | -------------------------------------------------------------------------------- /c-ares/buildconf: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #-------------------------------------------------------------------------- 4 | # findtool works as 'which' but we use a different name to make it more 5 | # obvious we aren't using 'which'! ;-) 6 | # 7 | findtool(){ 8 | file="$1" 9 | 10 | old_IFS=$IFS; IFS=':' 11 | for path in $PATH 12 | do 13 | IFS=$old_IFS 14 | # echo "checks for $file in $path" >&2 15 | if test -f "$path/$file"; then 16 | echo "$path/$file" 17 | return 18 | fi 19 | done 20 | IFS=$old_IFS 21 | } 22 | 23 | #-------------------------------------------------------------------------- 24 | # removethis() removes all files and subdirectories with the given name, 25 | # inside and below the current subdirectory at invocation time. 26 | # 27 | removethis(){ 28 | if test "$#" = "1"; then 29 | find . -depth -name $1 -print > buildconf.tmp.$$ 30 | while read fdname 31 | do 32 | if test -f "$fdname"; then 33 | rm -f "$fdname" 34 | elif test -d "$fdname"; then 35 | rm -f -r "$fdname" 36 | fi 37 | done < buildconf.tmp.$$ 38 | rm -f buildconf.tmp.$$ 39 | fi 40 | } 41 | 42 | #-------------------------------------------------------------------------- 43 | # Ensure that buildconf runs from the subdirectory where configure.ac lives 44 | # 45 | if test ! -f configure.ac || 46 | test ! -f ares_init.c || 47 | test ! -f m4/cares-functions.m4; then 48 | echo "Can not run buildconf from outside of c-ares source subdirectory!" 49 | echo "Change to the subdirectory where buildconf is found, and try again." 50 | exit 1 51 | fi 52 | 53 | #-------------------------------------------------------------------------- 54 | # this approach that tries 'glibtool' first is some kind of work-around for 55 | # some BSD-systems I believe that use to provide the GNU libtool named 56 | # glibtool, with 'libtool' being something completely different. 57 | libtool=`findtool glibtool 2>/dev/null` 58 | if test ! -x "$libtool"; then 59 | libtool=`findtool ${LIBTOOL:-libtool}` 60 | fi 61 | 62 | if test -z "$LIBTOOLIZE"; then 63 | # set the LIBTOOLIZE here so that glibtoolize is used if glibtool was found 64 | # $libtool is already the full path 65 | libtoolize="${libtool}ize" 66 | else 67 | libtoolize=`findtool $LIBTOOLIZE` 68 | fi 69 | 70 | #-------------------------------------------------------------------------- 71 | # Remove files generated on previous buildconf/configure run. 72 | # 73 | for fname in .deps \ 74 | .libs \ 75 | *.la \ 76 | *.lo \ 77 | *.a \ 78 | *.o \ 79 | Makefile \ 80 | Makefile.in \ 81 | aclocal.m4 \ 82 | aclocal.m4.bak \ 83 | ares_build.h \ 84 | ares_config.h \ 85 | ares_config.h.in \ 86 | autom4te.cache \ 87 | compile \ 88 | config.guess \ 89 | config.log \ 90 | config.lt \ 91 | config.status \ 92 | config.sub \ 93 | configure \ 94 | depcomp \ 95 | libcares.pc \ 96 | libtool \ 97 | libtool.m4 \ 98 | ltmain.sh \ 99 | ltoptions.m4 \ 100 | ltsugar.m4 \ 101 | ltversion.m4 \ 102 | lt~obsolete.m4 \ 103 | missing \ 104 | stamp-h1 \ 105 | stamp-h2 ; do 106 | removethis "$fname" 107 | done 108 | 109 | #-------------------------------------------------------------------------- 110 | # run the correct scripts now 111 | # 112 | 113 | ${libtoolize} --copy --automake --force 114 | ${ACLOCAL:-aclocal} -I m4 $ACLOCAL_FLAGS 115 | ${AUTOHEADER:-autoheader} 116 | ${AUTOCONF:-autoconf} 117 | ${AUTOMAKE:-automake} --add-missing --copy 118 | -------------------------------------------------------------------------------- /c-ares/cares.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EXALAB/debian-noroot/afd0f723bf6f2bd53a13bbbe9c77dfa6ea11644f/c-ares/cares.rc -------------------------------------------------------------------------------- /c-ares/exports.txt: -------------------------------------------------------------------------------- 1 | { 2 | global: 3 | freeaddrinfo; 4 | getaddrinfo; 5 | gethostbyaddr; 6 | gethostbyaddr_r; 7 | gethostbyname; 8 | gethostbyname2; 9 | gethostbyname2_r; 10 | gethostbyname_r; 11 | getnameinfo; 12 | getservbyport; 13 | 14 | local: *; # hide everything else 15 | }; 16 | -------------------------------------------------------------------------------- /c-ares/get_ver.awk: -------------------------------------------------------------------------------- 1 | # *************************************************************************** 2 | # * Project: c-ares 3 | # * 4 | # *************************************************************************** 5 | # awk script which fetches c-ares version number and string from input 6 | # file and writes them to STDOUT. Here you can get an awk version for Win32: 7 | # http://www.gknw.net/development/prgtools/awk-20070501.zip 8 | # 9 | BEGIN { 10 | if (match (ARGV[1], /ares_version.h/)) { 11 | while ((getline < ARGV[1]) > 0) { 12 | if (match ($0, /^#define ARES_COPYRIGHT "[^"]+"$/)) { 13 | libcares_copyright_str = substr($0, 25, length($0)-25); 14 | } 15 | else if (match ($0, /^#define ARES_VERSION_STR "[^"]+"$/)) { 16 | libcares_ver_str = substr($3, 2, length($3)-2); 17 | } 18 | else if (match ($0, /^#define ARES_VERSION_MAJOR [0-9]+$/)) { 19 | libcares_ver_major = substr($3, 1, length($3)); 20 | } 21 | else if (match ($0, /^#define ARES_VERSION_MINOR [0-9]+$/)) { 22 | libcares_ver_minor = substr($3, 1, length($3)); 23 | } 24 | else if (match ($0, /^#define ARES_VERSION_PATCH [0-9]+$/)) { 25 | libcares_ver_patch = substr($3, 1, length($3)); 26 | } 27 | } 28 | libcares_ver = libcares_ver_major "," libcares_ver_minor "," libcares_ver_patch; 29 | print "LIBCARES_VERSION = " libcares_ver ""; 30 | print "LIBCARES_VERSION_STR = " libcares_ver_str ""; 31 | print "LIBCARES_COPYRIGHT_STR = " libcares_copyright_str ""; 32 | } 33 | } 34 | 35 | 36 | -------------------------------------------------------------------------------- /c-ares/inet_net_pton.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_CARES_INET_NET_PTON_H 2 | #define HEADER_CARES_INET_NET_PTON_H 3 | 4 | /* Copyright (C) 2005-2010 by Daniel Stenberg et al 5 | * 6 | * Permission to use, copy, modify, and distribute this 7 | * software and its documentation for any purpose and without 8 | * fee is hereby granted, provided that the above copyright 9 | * notice appear in all copies and that both that copyright 10 | * notice and this permission notice appear in supporting 11 | * documentation, and that the name of M.I.T. not be used in 12 | * advertising or publicity pertaining to distribution of the 13 | * software without specific, written prior permission. 14 | * M.I.T. makes no representations about the suitability of 15 | * this software for any purpose. It is provided "as is" 16 | * without express or implied warranty. 17 | */ 18 | 19 | #ifdef HAVE_INET_PTON 20 | #define ares_inet_pton(x,y,z) inet_pton(x,y,z) 21 | #else 22 | int ares_inet_pton(int af, const char *src, void *dst); 23 | #endif 24 | 25 | #ifdef HAVE_INET_NET_PTON 26 | #define ares_inet_net_pton(w,x,y,z) inet_net_pton(w,x,y,z) 27 | #else 28 | int ares_inet_net_pton(int af, const char *src, void *dst, size_t size); 29 | #endif 30 | 31 | #endif /* HEADER_CARES_INET_NET_PTON_H */ 32 | -------------------------------------------------------------------------------- /c-ares/inet_ntop.h: -------------------------------------------------------------------------------- 1 | #ifndef __ARES_INET_NTOP_H 2 | #define __ARES_INET_NTOP_H 3 | 4 | 5 | /* Copyright (C) 2005 by Dominick Meglio 6 | * 7 | * Permission to use, copy, modify, and distribute this 8 | * software and its documentation for any purpose and without 9 | * fee is hereby granted, provided that the above copyright 10 | * notice appear in all copies and that both that copyright 11 | * notice and this permission notice appear in supporting 12 | * documentation, and that the name of M.I.T. not be used in 13 | * advertising or publicity pertaining to distribution of the 14 | * software without specific, written prior permission. 15 | * M.I.T. makes no representations about the suitability of 16 | * this software for any purpose. It is provided "as is" 17 | * without express or implied warranty. 18 | */ 19 | 20 | #ifdef HAVE_INET_NTOP 21 | #define ares_inet_ntop(w,x,y,z) inet_ntop(w,x,y,z) 22 | #else 23 | const char *ares_inet_ntop(int af, const void *src, char *dst, size_t size); 24 | #endif 25 | 26 | #endif /* __ARES_INET_NTOP_H */ 27 | -------------------------------------------------------------------------------- /c-ares/libcares.pc.in: -------------------------------------------------------------------------------- 1 | #*************************************************************************** 2 | # Project ___ __ _ _ __ ___ ___ 3 | # / __|____ / _` | '__/ _ \/ __| 4 | # | (_|_____| (_| | | | __/\__ \ 5 | # \___| \__,_|_| \___||___/ 6 | # 7 | prefix=@prefix@ 8 | exec_prefix=@exec_prefix@ 9 | libdir=@libdir@ 10 | includedir=@includedir@ 11 | 12 | Name: c-ares 13 | URL: http://daniel.haxx.se/projects/c-ares/ 14 | Description: asynchronous DNS lookup library 15 | Version: @VERSION@ 16 | Requires: 17 | Requires.private: 18 | Cflags: -I${includedir} 19 | Libs: -L${libdir} -lcares 20 | Libs.private: @CARES_PRIVATE_LIBS@ 21 | -------------------------------------------------------------------------------- /c-ares/m4/cares-system.m4: -------------------------------------------------------------------------------- 1 | #*************************************************************************** 2 | # $Id$ 3 | # 4 | # Copyright (C) 2008 - 2009 by Daniel Stenberg et al 5 | # 6 | # Permission to use, copy, modify, and distribute this software and its 7 | # documentation for any purpose and without fee is hereby granted, provided 8 | # that the above copyright notice appear in all copies and that both that 9 | # copyright notice and this permission notice appear in supporting 10 | # documentation, and that the name of M.I.T. not be used in advertising or 11 | # publicity pertaining to distribution of the software without specific, 12 | # written prior permission. M.I.T. makes no representations about the 13 | # suitability of this software for any purpose. It is provided "as is" 14 | # without express or implied warranty. 15 | # 16 | #*************************************************************************** 17 | 18 | # File version for 'aclocal' use. Keep it a single number. 19 | # serial 3 20 | 21 | 22 | dnl CARES_CHECK_PATH_SEPARATOR 23 | dnl ------------------------------------------------- 24 | dnl Check and compute the path separator for us. This 25 | dnl path separator is the symbol used to diferentiate 26 | dnl or separate paths inside the PATH environment var. 27 | 28 | AC_DEFUN([CARES_CHECK_PATH_SEPARATOR], [ 29 | if test -z "$cares_cv_PATH_SEPARATOR"; then 30 | if test -z "$PATH"; then 31 | AC_MSG_ERROR([PATH not set. Cannot continue without PATH being set.]) 32 | fi 33 | dnl Directory count in PATH when using a colon separator. 34 | tst_dirs_col=0 35 | tst_save_IFS=$IFS; IFS=':' 36 | for tst_dir in $PATH; do 37 | IFS=$tst_save_IFS 38 | test -d "$tst_dir" && tst_dirs_col=`expr $tst_dirs_col + 1` 39 | done 40 | IFS=$tst_save_IFS 41 | dnl Directory count in PATH when using a semicolon separator. 42 | tst_dirs_sem=0 43 | tst_save_IFS=$IFS; IFS=';' 44 | for tst_dir in $PATH; do 45 | IFS=$tst_save_IFS 46 | test -d "$tst_dir" && tst_dirs_sem=`expr $tst_dirs_sem + 1` 47 | done 48 | IFS=$tst_save_IFS 49 | if test $tst_dirs_sem -eq $tst_dirs_col; then 50 | dnl When both counting methods give the same result we do not want to 51 | dnl chose one over the other, and consider auto-detection not possible. 52 | if test -z "$PATH_SEPARATOR"; then 53 | dnl Stop dead until user provides PATH_SEPARATOR definition. 54 | AC_MSG_ERROR([PATH_SEPARATOR not set. Cannot continue without it.]) 55 | fi 56 | else 57 | dnl Separator with the greater directory count is the auto-detected one. 58 | if test $tst_dirs_sem -gt $tst_dirs_col; then 59 | tst_auto_separator=';' 60 | else 61 | tst_auto_separator=':' 62 | fi 63 | if test -z "$PATH_SEPARATOR"; then 64 | dnl Simply use the auto-detected one when not already set. 65 | PATH_SEPARATOR="$tst_auto_separator" 66 | fi 67 | fi 68 | cares_cv_PATH_SEPARATOR="$PATH_SEPARATOR" 69 | fi 70 | AC_SUBST([PATH_SEPARATOR]) 71 | AC_SUBST([PATH]) 72 | ]) 73 | 74 | 75 | dnl CARES_CHECK_PATH_SEPARATOR_REQUIRED 76 | dnl ------------------------------------------------- 77 | dnl Use this to ensure that the path separator check 78 | dnl macro is only expanded and included once. 79 | 80 | AC_DEFUN([CARES_CHECK_PATH_SEPARATOR_REQUIRED], [ 81 | AC_REQUIRE([CARES_CHECK_PATH_SEPARATOR])dnl 82 | ]) 83 | 84 | -------------------------------------------------------------------------------- /c-ares/m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 3293 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3293]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4' 20 | macro_revision='1.3293' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /c-ares/maketgz: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | $version = $ARGV[0]; 4 | 5 | if($version eq "") { 6 | print "Enter version number!\n"; 7 | exit; 8 | } 9 | 10 | if(!-f "ares.h") { 11 | print "run this script in the ares source root dir\n"; 12 | exit; 13 | } 14 | 15 | my ($major, $minor, $patch)=split(/\./, $version); 16 | 17 | $major += 0; 18 | $minor += 0; 19 | $patch += 0; 20 | 21 | open(VER, "ares_version.h.dist"); 24 | while() { 25 | $_ =~ s/^\#define ARES_VERSION_MAJOR .*/\#define ARES_VERSION_MAJOR $major/; 26 | $_ =~ s/^\#define ARES_VERSION_MINOR .*/\#define ARES_VERSION_MINOR $minor/; 27 | $_ =~ s/^\#define ARES_VERSION_PATCH .*/\#define ARES_VERSION_PATCH $patch/; 28 | $_ =~ s/^\#define ARES_VERSION_STR .*/\#define ARES_VERSION_STR \"$version\"/; 29 | 30 | print NEWV $_; 31 | } 32 | close(VER); 33 | close(NEWV); 34 | print "ares_version.h.dist created\n"; 35 | 36 | if(!-f "configure") { 37 | print "running buildconf\n"; 38 | `./buildconf`; 39 | } 40 | print "adding $version in the configure.ac file\n"; 41 | `sed -e 's/AC_INIT.*/AC_INIT([c-ares], [$version],/' < configure.ac > configure.ac.dist`; 42 | 43 | # now make a new configure script with this 44 | print "makes a new configure script\n"; 45 | `autoconf configure.ac.dist >configure`; 46 | 47 | # now run this new configure to get a fine makefile 48 | print "running configure\n"; 49 | `./configure`; 50 | 51 | # generate HTML versions of man pages 52 | # Deactivated for now. It seems that man pages need some adjustments 53 | # relative to paragraph and/or line breaks for proper html formatting. 54 | # EXTRA_DIST will need $(HTMLPAGES) when this is fully activated. 55 | # print "running make html\n"; 56 | # `make -s html`; 57 | 58 | # generate PDF versions of man pages 59 | print "running make pdf\n"; 60 | `make -s pdf`; 61 | 62 | # now make the actual tarball 63 | print "running make dist\n"; 64 | `make dist VERSION=$version`; 65 | 66 | # remove temporay sourced man pages 67 | `make -s clean-sourced-manpages`; 68 | 69 | print "removing temporary configure.ac file\n"; 70 | `rm configure.ac.dist`; 71 | print "removing temporary ares_version.h file\n"; 72 | `rm ares_version.h.dist`; 73 | 74 | print "NOTE: now tag this release!\n"; 75 | -------------------------------------------------------------------------------- /c-ares/mkinstalldirs: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # mkinstalldirs --- make directory hierarchy 3 | # Author: Noah Friedman 4 | # Created: 1993-05-16 5 | # Public domain 6 | 7 | 8 | errstatus=0 9 | 10 | for file 11 | do 12 | set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` 13 | shift 14 | 15 | pathcomp= 16 | for d 17 | do 18 | pathcomp="$pathcomp$d" 19 | case "$pathcomp" in 20 | -* ) pathcomp=./$pathcomp ;; 21 | esac 22 | 23 | if test ! -d "$pathcomp"; then 24 | echo "mkdir $pathcomp" 1>&2 25 | 26 | mkdir "$pathcomp" || lasterr=$? 27 | 28 | if test ! -d "$pathcomp"; then 29 | errstatus=$lasterr 30 | fi 31 | fi 32 | 33 | pathcomp="$pathcomp/" 34 | done 35 | done 36 | 37 | exit $errstatus 38 | 39 | # mkinstalldirs ends here 40 | -------------------------------------------------------------------------------- /c-ares/vc/cares/vc6cares.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "cares"=".\vc6cares.dsp" - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /c-ares/vc/vc6aws.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "cares"=".\cares\vc6cares.dsp" - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Project: "acountry"=".\acountry\vc6acountry.dsp" - Package Owner=<4> 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<4> 25 | {{{ 26 | Begin Project Dependency 27 | Project_Dep_Name cares 28 | End Project Dependency 29 | }}} 30 | 31 | ############################################################################### 32 | 33 | Project: "adig"=".\adig\vc6adig.dsp" - Package Owner=<4> 34 | 35 | Package=<5> 36 | {{{ 37 | }}} 38 | 39 | Package=<4> 40 | {{{ 41 | Begin Project Dependency 42 | Project_Dep_Name cares 43 | End Project Dependency 44 | }}} 45 | 46 | ############################################################################### 47 | 48 | Project: "ahost"=".\ahost\vc6ahost.dsp" - Package Owner=<4> 49 | 50 | Package=<5> 51 | {{{ 52 | }}} 53 | 54 | Package=<4> 55 | {{{ 56 | Begin Project Dependency 57 | Project_Dep_Name cares 58 | End Project Dependency 59 | }}} 60 | 61 | ############################################################################### 62 | 63 | Global: 64 | 65 | Package=<5> 66 | {{{ 67 | }}} 68 | 69 | Package=<3> 70 | {{{ 71 | }}} 72 | 73 | ############################################################################### 74 | 75 | -------------------------------------------------------------------------------- /c-ares/windows_port.c: -------------------------------------------------------------------------------- 1 | #include "ares_setup.h" 2 | 3 | 4 | /* only do the following on windows 5 | */ 6 | #if (defined(WIN32) || defined(WATT32)) && !defined(MSDOS) 7 | 8 | #ifdef __WATCOMC__ 9 | /* 10 | * Watcom needs a DllMain() in order to initialise the clib startup code. 11 | */ 12 | BOOL 13 | WINAPI DllMain (HINSTANCE hnd, DWORD reason, LPVOID reserved) 14 | { 15 | (void) hnd; 16 | (void) reason; 17 | (void) reserved; 18 | return (TRUE); 19 | } 20 | #endif 21 | 22 | #endif /* WIN32 builds only */ 23 | -------------------------------------------------------------------------------- /disableselinux/disableselinux.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | extern int audit_open (void); 5 | int audit_open (void) 6 | { 7 | errno = EPROTONOSUPPORT; 8 | return -1; 9 | } 10 | 11 | extern int is_selinux_enabled (void); 12 | int is_selinux_enabled (void) 13 | { 14 | return 0; 15 | } 16 | 17 | extern int setexecfilecon (const char *filename, const char *fallback_type); 18 | int setexecfilecon (const char *filename, const char *fallback_type) 19 | { 20 | return 0; 21 | } 22 | 23 | extern int setexeccon(const char * con); 24 | int setexeccon(const char * con) 25 | { 26 | return 0; 27 | } 28 | 29 | extern int setfilecon(const char *path, const char * con); 30 | int setfilecon(const char *path, const char * con) 31 | { 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /dist-gimp/root/.config/autostart/gimp.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Encoding=UTF-8 3 | Version=0.9.4 4 | Type=Application 5 | Name=GIMP 6 | Comment= 7 | Exec=/usr/bin/gimp 8 | StartupNotify=false 9 | Terminal=false 10 | Hidden=false 11 | 12 | -------------------------------------------------------------------------------- /dist-gimp/root/.config/autostart/inkscape.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Encoding=UTF-8 3 | Version=0.9.4 4 | Type=Application 5 | Name=Inkscape 6 | Comment= 7 | Exec=/usr/bin/inkscape 8 | StartupNotify=false 9 | Terminal=false 10 | Hidden=false 11 | 12 | -------------------------------------------------------------------------------- /dist-x86/busybox: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EXALAB/debian-noroot/afd0f723bf6f2bd53a13bbbe9c77dfa6ea11644f/dist-x86/busybox -------------------------------------------------------------------------------- /dist-x86/libandroid-shmem.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EXALAB/debian-noroot/afd0f723bf6f2bd53a13bbbe9c77dfa6ea11644f/dist-x86/libandroid-shmem.so -------------------------------------------------------------------------------- /dist-x86/libdisableselinux.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EXALAB/debian-noroot/afd0f723bf6f2bd53a13bbbe9c77dfa6ea11644f/dist-x86/libdisableselinux.so -------------------------------------------------------------------------------- /dist-x86/proot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EXALAB/debian-noroot/afd0f723bf6f2bd53a13bbbe9c77dfa6ea11644f/dist-x86/proot -------------------------------------------------------------------------------- /dist/busybox: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EXALAB/debian-noroot/afd0f723bf6f2bd53a13bbbe9c77dfa6ea11644f/dist/busybox -------------------------------------------------------------------------------- /dist/etc/hostname: -------------------------------------------------------------------------------- 1 | debian 2 | -------------------------------------------------------------------------------- /dist/etc/hosts: -------------------------------------------------------------------------------- 1 | 127.0.0.1 localhost 2 | ::1 localhost ip6-localhost ip6-loopback 3 | fe00::0 ip6-localnet 4 | ff00::0 ip6-mcastprefix 5 | ff02::1 ip6-allnodes 6 | ff02::2 ip6-allrouters 7 | 8 | 127.0.0.1 debian 9 | -------------------------------------------------------------------------------- /dist/etc/resolv.conf: -------------------------------------------------------------------------------- 1 | nameserver 8.8.8.8 2 | nameserver 8.8.4.4 3 | -------------------------------------------------------------------------------- /dist/libandroid-shmem.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EXALAB/debian-noroot/afd0f723bf6f2bd53a13bbbe9c77dfa6ea11644f/dist/libandroid-shmem.so -------------------------------------------------------------------------------- /dist/libdisableselinux.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EXALAB/debian-noroot/afd0f723bf6f2bd53a13bbbe9c77dfa6ea11644f/dist/libdisableselinux.so -------------------------------------------------------------------------------- /dist/postinstall-locales.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 4 | 5 | if /usr/bin/dpkg -s locales >/dev/null 2>&1 ; then 6 | echo "Updating locales for lang $LANG" | tee -a /tmp/postinstall-locales.log 7 | else 8 | echo "No locales package installed, nothing to do" | tee -a /tmp/postinstall-locales.log 9 | exit 10 | fi 11 | 12 | echo "$LANG UTF-8" >> /etc/locale.gen 13 | /usr/bin/fakeroot /usr/sbin/dpkg-reconfigure --frontend=noninteractive locales | tee -a /tmp/postinstall-locales.log 14 | -------------------------------------------------------------------------------- /dist/postinstall.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | 3 | case x$SDCARD in x ) export SDCARD=$EXTERNAL_STORAGE;; esac 4 | echo "SDCARD path: $SDCARD" 5 | case x$SECURE_STORAGE_DIR in x ) echo "Error: no SECURE_STORAGE_DIR envvar defined";; * ) cd $SECURE_STORAGE_DIR/img;; esac 6 | echo "Changing curdir to: $SECURE_STORAGE_DIR/img" 7 | 8 | umask 002 9 | 10 | SDCARD=`./busybox realpath $SDCARD` 11 | UNSECURE_STORAGE_DIR=`./busybox realpath $UNSECURE_STORAGE_DIR` 12 | 13 | ln -s $SDCARD sdcard 14 | mkdir -p .$SDCARD 15 | mkdir -p .$UNSECURE_STORAGE_DIR 16 | 17 | echo "Creating necessary directories" 18 | # Random post-install cmds 19 | mkdir var/run/dbus 20 | mkdir var/run/xauth 21 | mkdir run/dbus 22 | mkdir run/xauth 23 | ln -s /usr/bin/dbus-launch bin/dbus-launch 24 | mkdir var/lib/dbus 25 | mkdir root 26 | mkdir root/Desktop 27 | touch etc/mtab 28 | ln -s $SDCARD root/sdcard 29 | ln -s $SDCARD root/Desktop/sdcard 30 | 31 | # Export GIMP config to SD card 32 | case x$UNSECURE_STORAGE_DIR in x ) echo ... > /dev/null;; * ) ./busybox cp -r root/.gimp-2.8/. $UNSECURE_STORAGE_DIR/gimp/ ; ./busybox rm -rf root/.gimp-2.8 ; ln -s $UNSECURE_STORAGE_DIR/gimp root/.gimp-2.8 ; ln -s $UNSECURE_STORAGE_DIR/gimp/fonts root/.fonts ;; esac 33 | 34 | echo "Adding user $USER ID $USER_ID" 35 | # This command fails on Galaxy Note 3 36 | #./chroot.sh bin/bash usr/bin/fakeroot-sysv usr/sbin/useradd -U -m -G sudo,staff '$1$nFL/I4tz$zHKmBfkaKmRRmWje1Mupm0' -u $USER_ID $USER 2>&1 37 | echo "$USER:x:$USER_ID:" >> etc/group 38 | echo "$USER:!::" >> etc/gshadow 39 | echo "$USER:x:$USER_ID:$USER_ID::/home/$USER:/bin/bash" >> etc/passwd 40 | echo "$USER"':$1$nFL/I4tz$zHKmBfkaKmRRmWje1Mupm0:16019:0:99999:7:::' >> etc/shadow 41 | mkdir home/$USER 42 | ./busybox cp -a -f etc/skel/. home/$USER/ 2>&1 43 | ./busybox cp -a -f root/. home/$USER/ 2>&1 44 | 45 | echo "Updating locales for lang $LANG" 46 | ./proot.sh ./postinstall-locales.sh 47 | 48 | echo "Postinstall script finished" 49 | -------------------------------------------------------------------------------- /dist/proot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EXALAB/debian-noroot/afd0f723bf6f2bd53a13bbbe9c77dfa6ea11644f/dist/proot -------------------------------------------------------------------------------- /dist/proot.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | 3 | case x$SDCARD in x ) SDCARD=/sdcard;; esac 4 | 5 | case x$SECURE_STORAGE_DIR in x ) echo > /dev/null;; * ) cd $SECURE_STORAGE_DIR/img;; esac 6 | 7 | case x$SDCARD in x ) export SDCARD=$EXTERNAL_STORAGE;; esac 8 | 9 | SDCARD=`../busybox realpath $SDCARD` 10 | STORAGE="-b $SDCARD" 11 | for F in 0 1 2 3 4 5 6 7 8 9; do 12 | DIR=`eval echo \\$UNSECURE_STORAGE_DIR_$F` 13 | case x$DIR in x ) echo > /dev/null;; * ) STORAGE="$STORAGE -b $DIR" ; mkdir -p $DIR ;; esac 14 | done 15 | echo "STORAGE $STORAGE" 16 | 17 | export HOME=/home/$USER 18 | export SHELL=/bin/bash 19 | export LD_LIBRARY_PATH= 20 | # Java doesn't work in PRoot when started from /usr/bin/java symlink, so we have to put a path to java binary into PATH, and Java 6 fails on Samsung devices 21 | JAVA_PATH=/usr/lib/jvm/default-java/jre/bin:/usr/lib/jvm/default-java/bin 22 | ls usr/lib/jvm/java-7-openjdk-*/bin > /dev/null 2>&1 && JAVA_PATH=/`echo usr/lib/jvm/java-7-openjdk-*/jre/bin`:/`echo usr/lib/jvm/java-7-openjdk-*/bin` 23 | export PATH=/usr/local/sbin:/usr/local/bin:$JAVA_PATH:/usr/sbin:/usr/bin:/sbin:/bin 24 | export "LD_PRELOAD=/libdisableselinux.so /libandroid-shmem.so" 25 | export PROOT_TMPDIR=`pwd`/tmp 26 | export PROOT_TMP_DIR=$PROOT_TMPDIR 27 | export TZ="`getprop persist.sys.timezone`" 28 | ./proot -r `pwd` -w / -b /dev -b /proc -b /sys -b /system $STORAGE "$@" 29 | -------------------------------------------------------------------------------- /dist/root/.config/user-dirs.dirs: -------------------------------------------------------------------------------- 1 | # This file is written by xdg-user-dirs-update 2 | # If you want to change or add directories, just edit the line you're 3 | # interested in. All local changes will be retained on the next run 4 | # Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped 5 | # homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an 6 | # absolute path. No other format is supported. 7 | # 8 | XDG_DESKTOP_DIR="$HOME/Desktop" 9 | XDG_DOWNLOAD_DIR="$HOME/sdcard/" 10 | XDG_TEMPLATES_DIR="$HOME/sdcard/" 11 | XDG_PUBLICSHARE_DIR="$HOME/sdcard/" 12 | XDG_DOCUMENTS_DIR="$HOME/sdcard/" 13 | XDG_MUSIC_DIR="$HOME/sdcard/" 14 | XDG_PICTURES_DIR="$HOME/sdcard/" 15 | XDG_VIDEOS_DIR="$HOME/sdcard/" 16 | -------------------------------------------------------------------------------- /dist/root/.config/user-dirs.locale: -------------------------------------------------------------------------------- 1 | en_US -------------------------------------------------------------------------------- /dist/root/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /dist/root/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /dist/root/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-session.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /dist/root/.config/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /dist/root/.config/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /dist/root/.dist/Synaptic.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Comment[en_US]= 3 | Comment= 4 | Exec=fakeroot-tcp /usr/bin/env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin /usr/sbin/synaptic 5 | GenericName[en_US]=Synaptic package manager 6 | GenericName=Synaptic package manager 7 | Icon=synaptic 8 | MimeType= 9 | Name=Synaptic 10 | Path= 11 | StartupNotify=true 12 | Terminal=false 13 | TerminalOptions= 14 | Type=Application 15 | Version=1.0 16 | X-DBUS-ServiceName= 17 | X-DBUS-StartupType= 18 | X-KDE-SubstituteUID=false 19 | X-KDE-Username= 20 | -------------------------------------------------------------------------------- /dist/root/.gimp-2.8/brushes/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dist/root/.gimp-2.8/curves/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dist/root/.gimp-2.8/dynamics/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dist/root/.gimp-2.8/environ/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dist/root/.gimp-2.8/fonts/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dist/root/.gimp-2.8/fractalexplorer/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dist/root/.gimp-2.8/gfig/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dist/root/.gimp-2.8/gflare/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dist/root/.gimp-2.8/gimprc: -------------------------------------------------------------------------------- 1 | # GIMP gimprc 2 | # 3 | # This is your personal gimprc file. Any variable defined in this file takes 4 | # precedence over the value defined in the system-wide gimprc: 5 | # /etc/gimp/2.0/gimprc 6 | # Most values can be set within GIMP by changing some options in the 7 | # Preferences dialog. 8 | 9 | (show-brush-outline no) 10 | (cursor-mode tool-crosshair) 11 | (cursor-format bitmap) 12 | (default-view 13 | (show-menubar yes) 14 | (show-statusbar yes) 15 | (show-rulers no) 16 | (show-scrollbars yes) 17 | (show-selection yes) 18 | (show-layer-boundary yes) 19 | (show-guides yes) 20 | (show-grid no) 21 | (show-sample-points yes) 22 | (padding-mode default) 23 | (padding-color (color-rgb 1.000000 1.000000 1.000000))) 24 | (default-fullscreen-view 25 | (show-menubar yes) 26 | (show-statusbar yes) 27 | (show-rulers no) 28 | (show-scrollbars yes) 29 | (show-selection yes) 30 | (show-layer-boundary yes) 31 | (show-guides yes) 32 | (show-grid no) 33 | (show-sample-points yes) 34 | (padding-mode default) 35 | (padding-color (color-rgb 1.000000 1.000000 1.000000))) 36 | 37 | 38 | # end of gimprc 39 | -------------------------------------------------------------------------------- /dist/root/.gimp-2.8/gimpressionist/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dist/root/.gimp-2.8/gradients/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dist/root/.gimp-2.8/interpreters/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dist/root/.gimp-2.8/levels/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dist/root/.gimp-2.8/modules/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dist/root/.gimp-2.8/palettes/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dist/root/.gimp-2.8/patterns/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dist/root/.gimp-2.8/plug-ins/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dist/root/.gimp-2.8/scripts/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dist/root/.gimp-2.8/templates/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dist/root/.gimp-2.8/themes/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dist/root/.gimp-2.8/tmp/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dist/root/.gimp-2.8/tool-options/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dist/root/.gimp-2.8/tool-presets/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dist/root/.local/share/recently-used.xbel: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | Graphics 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Graphics 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /dist/root/Desktop/Root-XTerm.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Comment[en_US]= 3 | Comment= 4 | Encoding=UTF-8 5 | Exec=fakeroot-tcp /usr/bin/env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin /usr/bin/xterm -bg black -fg green -xrm 'XTerm*faceName: DroidSansMono' -xrm 'XTerm*faceSize: 8' -e /bin/bash -l 6 | GenericName[en_US]= 7 | GenericName= 8 | Icon=utilities-terminal 9 | MimeType= 10 | Name[en_US]=Root Terminal 11 | Name=Root Terminal 12 | Path= 13 | StartupNotify=true 14 | Terminal=false 15 | TerminalOptions= 16 | Type=Application 17 | Version=1.0 18 | X-DBUS-ServiceName= 19 | X-DBUS-StartupType= 20 | X-DCOP-ServiceType= 21 | X-KDE-SubstituteUID=false 22 | X-KDE-Username= 23 | -------------------------------------------------------------------------------- /dist/root/Desktop/Synaptic.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Comment[en_US]= 3 | Comment= 4 | Exec=/bin/bash -c "xmessage -fn '-*-*-*-*-*-*-20-*-*-*-*-*-*-*' -buttons ===Install===:0,===Cancel===:1 -default ===Install=== -nearmouse 'Install Synaptic package manager?' && fakeroot-tcp /usr/bin/env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin /usr/bin/xterm -bg black -fg green -xrm 'XTerm*faceName: DroidSansMono' -xrm 'XTerm*faceSize: 8' -e /bin/bash -c 'apt-get update && apt-get -y install python-support synaptic && apt-get -y install apt-xapian-index && /usr/sbin/update-apt-xapian-index && cp -f /root/.dist/Synaptic.desktop $HOME/Desktop/Synaptic.desktop || read'" 5 | GenericName[en_US]=Synaptic 6 | GenericName=Synaptic 7 | Icon=system-installer 8 | MimeType= 9 | Name=Synaptic 10 | Path= 11 | StartupNotify=true 12 | Terminal=false 13 | TerminalOptions= 14 | Type=Application 15 | Version=1.0 16 | X-DBUS-ServiceName= 17 | X-DBUS-StartupType= 18 | X-KDE-SubstituteUID=false 19 | X-KDE-Username= 20 | -------------------------------------------------------------------------------- /dist/root/Desktop/XTerm.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Comment[en_US]= 3 | Comment= 4 | Encoding=UTF-8 5 | Exec=xterm -bg black -fg green -xrm 'XTerm*faceName: DroidSansMono' -xrm 'XTerm*faceSize: 8' -e /bin/bash -l 6 | GenericName[en_US]= 7 | GenericName= 8 | Icon=utilities-terminal 9 | MimeType= 10 | Name[en_US]=Terminal 11 | Name=Terminal 12 | Path= 13 | StartupNotify=true 14 | Terminal=false 15 | TerminalOptions= 16 | Type=Application 17 | Version=1.0 18 | X-DBUS-ServiceName= 19 | X-DBUS-StartupType= 20 | X-DCOP-ServiceType= 21 | X-KDE-SubstituteUID=false 22 | X-KDE-Username= 23 | -------------------------------------------------------------------------------- /dist/startx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | rm -f /var/run/dbus/pid 4 | fakeroot-tcp /usr/bin/env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin dbus-daemon --system 5 | 6 | sleep 1 7 | dbus-launch --exit-with-session sh -c 'xfce4-session ; setsid sh -c "cd /proc/ ; for f in [0-9]* ; do [ \$f = \$\$ ] || kill -9 \$f ; done"' & 8 | 9 | wait 10 | -------------------------------------------------------------------------------- /dist/update-dns.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | 3 | DNS1=`getprop net.dns1` 4 | DNS2=`getprop net.dns2` 5 | DNS3=`getprop net.dns3` 6 | case x$DNS1 in x ) DNS1=8.8.8.8;; esac 7 | case x$DNS2 in x ) DNS2=8.8.8.8;; esac 8 | case x$DNS3 in x ) DNS3=8.8.8.8;; esac 9 | 10 | echo nameserver $DNS1 > etc/resolv.conf 11 | echo nameserver $DNS2 >> etc/resolv.conf 12 | echo nameserver $DNS3 >> etc/resolv.conf 13 | -------------------------------------------------------------------------------- /dist/usr/local/bin/sudo: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Skip arguments 4 | while [ -n "$1" ]; do 5 | case "$1" in 6 | -A|--askpass) 7 | shift;; 8 | -b|--background) 9 | shift;; 10 | -E|--preserve-env) 11 | shift;; 12 | -n|--non-interactive) 13 | shift;; 14 | -p|--prompt) 15 | shift ; shift;; 16 | -S|--stdin) 17 | shift;; 18 | *) 19 | break;; 20 | esac 21 | done 22 | 23 | JAVA_PATH=/usr/lib/jvm/default-java/jre/bin:/usr/lib/jvm/default-java/bin 24 | ls usr/lib/jvm/java-7-openjdk-*/bin > /dev/null 2>&1 && JAVA_PATH=/`echo usr/lib/jvm/java-7-openjdk-*/jre/bin`:/`echo usr/lib/jvm/java-7-openjdk-*/bin` 25 | 26 | /usr/bin/fakeroot-tcp /usr/bin/env PATH=/usr/local/sbin:/usr/local/bin:$JAVA_PATH:/usr/sbin:/usr/bin:/sbin:/bin "$@" 27 | -------------------------------------------------------------------------------- /img/img-cups-jessie.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -x 4 | 5 | APT_CACHER= 6 | [ -e /etc/init.d/apt-cacher* ] && APT_CACHER=/localhost:3142 7 | 8 | DIST=jessie 9 | 10 | for ARCH in i386/x86 armhf/armeabi-v7a; do 11 | ARCH_ANDROID=`echo $ARCH | sed 's@.*/@@'` 12 | ARCH_DEBIAN=`echo $ARCH | sed 's@/.*@@'` 13 | DIR=dist-cups-$DIST/img-$ARCH_ANDROID 14 | sudo rm -r -f $DIR 15 | mkdir -p $DIR 16 | STRIP_LIST=`cat strip.list` 17 | STRIP_LIST=`echo $STRIP_LIST | sed 's/ /,/g'` 18 | # --exclude=$STRIP_LIST \ 19 | sudo qemu-debootstrap --arch=$ARCH_DEBIAN --verbose \ 20 | --components=main,contrib,non-free \ 21 | --include=cups,cups-client,smbclient,printer-driver-all-enforce,cups-filters,foomatic-db-compressed-ppds \ 22 | --exclude=ghostscript-cups,foomatic-filters \ 23 | $DIST $DIR http:/$APT_CACHER/ftp.ua.debian.org/debian/ 2>&1 | tee debootstrap-$ARCH_ANDROID.log \ 24 | && cat sources-jessie.list | sed "s/jessie/$DIST/g" | sudo tee $DIR/etc/apt/sources.list > /dev/null \ 25 | && sudo ./prepare-img-proot.sh --strip "usr/share/X11 usr/share/zoneinfo usr/share/calendar" "ghostscript-cups foomatic-filters" --noarchive $DIR $ARCH_ANDROID \ 26 | | tee -a debootstrap-$ARCH_ANDROID.log 27 | done 28 | cd dist-cups-$DIST 29 | rm -f img-armeabi-v7a/busybox img-x86/busybox 30 | ../merge-dirs.sh img-armeabi-v7a img-x86 img 31 | tar c * | xz -8 > ../dist-cups-$DIST.tar.xz 32 | -------------------------------------------------------------------------------- /img/img-debian-jessie--prepare-obb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | [ -e dist-debian-jessie-armeabi-v7a -a -e dist-debian-jessie-x86 ] || { 4 | echo "Please run scripts img-debian-jessie-x86.sh and img-debian-jessie-armhf.sh first" 5 | exit 1 6 | } 7 | 8 | DIR1=dist-debian-jessie-armeabi-v7a/img 9 | DIR2=dist-debian-jessie-x86/img 10 | OUTDIR=dist-debian-jessie 11 | 12 | rm -rf $OUTDIR 13 | 14 | mkdir -p $OUTDIR/img 15 | cp -a $DIR1 $OUTDIR/img-armeabi-v7a 16 | cp -a $DIR2 $OUTDIR/img-x86 17 | cd $OUTDIR 18 | ../merge-dirs.sh img-armeabi-v7a img-x86 img 19 | tar c * | xz -8 > ../$OUTDIR.tar.xz 20 | -------------------------------------------------------------------------------- /img/img-debian-jessie-armhf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | DIR=dist-debian-jessie-armeabi-v7a/img 4 | CHROOT="qemu-arm-static $DIR/lib/ld-linux-armhf.so.3 --library-path $DIR/lib/arm-linux-gnueabihf $DIR/usr/sbin/chroot $DIR" 5 | sudo rm -r -f $DIR 6 | mkdir -p $DIR 7 | APT_CACHER= 8 | [ -e /etc/init.d/apt-cacher ] && APT_CACHER=/localhost:3142 9 | sudo qemu-debootstrap --arch=armhf --verbose \ 10 | --components=main,contrib,non-free \ 11 | jessie $DIR http:/$APT_CACHER/ftp.de.debian.org/debian/ \ 12 | && cat sources-jessie.list | sudo tee $DIR/etc/apt/sources.list > /dev/null \ 13 | && sudo $CHROOT apt-get update \ 14 | && sudo $CHROOT apt-get upgrade -y \ 15 | && sudo $CHROOT apt-get install -y `cat img-debian-jessie.pkg | sed 's/,/ /g'` \ 16 | && sudo ./prepare-img-proot.sh $DIR 17 | -------------------------------------------------------------------------------- /img/img-debian-jessie-x86.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | DIR=dist-debian-jessie-x86/img 4 | CHROOT="$DIR/usr/sbin/chroot $DIR" 5 | sudo rm -r -f $DIR 6 | mkdir -p $DIR 7 | APT_CACHER= 8 | [ -e /etc/init.d/apt-cacher ] && APT_CACHER=/localhost:3142 9 | sudo qemu-debootstrap --arch=i386 --verbose \ 10 | --components=main,contrib,non-free \ 11 | jessie $DIR http:/$APT_CACHER/ftp.de.debian.org/debian/ \ 12 | && cat sources-jessie.list | sudo tee $DIR/etc/apt/sources.list > /dev/null \ 13 | && sudo $CHROOT apt-get update \ 14 | && sudo $CHROOT apt-get upgrade -y \ 15 | && sudo $CHROOT apt-get install -y `cat img-debian-jessie.pkg | sed 's/,/ /g'` \ 16 | && sudo ./prepare-img-proot.sh $DIR x86 17 | -------------------------------------------------------------------------------- /img/img-debian-jessie.pkg: -------------------------------------------------------------------------------- 1 | fakeroot,x11-xserver-utils,xfce4-panel,xfdesktop4,xfwm4,xfce4-session,thunar,xfconf,xfce4-settings,tango-icon-theme,xfwm4-themes,xterm,locales,fonts-droid,libgl1-mesa-swx11 2 | -------------------------------------------------------------------------------- /img/img-debug-wheezy-proot-armhf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | DIR=dist-debug-wheezy-proot-armeabi-v7a/img 4 | sudo rm -r -f $DIR 5 | mkdir -p $DIR 6 | APT_CACHER= 7 | [ -e /etc/init.d/apt-cacher ] && APT_CACHER=/localhost:3142 8 | sudo qemu-debootstrap --arch=armhf --verbose \ 9 | --components=main,contrib,non-free \ 10 | --include=`cat img-debug-wheezy.pkg` \ 11 | wheezy $DIR http:/$APT_CACHER/ftp.ua.debian.org/debian/ \ 12 | && sudo ./prepare-img-proot.sh --update-packages --save-packages-list $DIR 13 | -------------------------------------------------------------------------------- /img/img-debug-wheezy-proot-x86.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | DIR=dist-debug-wheezy-proot-x86/img 4 | sudo rm -r -f $DIR 5 | mkdir -p $DIR 6 | APT_CACHER= 7 | [ -e /etc/init.d/apt-cacher ] && APT_CACHER=/localhost:3142 8 | sudo qemu-debootstrap --arch=i386 --verbose \ 9 | --components=main,contrib,non-free \ 10 | --include=`cat img-debug-wheezy.pkg` \ 11 | wheezy $DIR http:/$APT_CACHER/ftp.ua.debian.org/debian/ \ 12 | && sudo ./prepare-img-proot.sh --update-packages --save-packages-list $DIR x86 13 | -------------------------------------------------------------------------------- /img/img-debug-wheezy.pkg: -------------------------------------------------------------------------------- 1 | fakeroot,x11-xserver-utils,xfce4-panel,xfdesktop4,xfwm4,xfce4-session,thunar,xfconf,xfce4-settings,tango-icon-theme,xfwm4-themes,xterm,locales,fonts-droid,libgl1-mesa-swx11,synaptic,apt-xapian-index 2 | -------------------------------------------------------------------------------- /img/img-gimp-jessie--prepare-obb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | [ -e dist-gimp-jessie-armeabi-v7a -a -e dist-gimp-jessie-x86 ] || { 4 | echo "Please run scripts img-gimp-jessie-x86.sh and img-gimp-jessie-armhf.sh first" 5 | exit 1 6 | } 7 | 8 | DIR1=dist-gimp-jessie-armeabi-v7a/img 9 | DIR2=dist-gimp-jessie-x86/img 10 | OUTDIR=dist-gimp-jessie 11 | 12 | rm -rf $OUTDIR 13 | 14 | mkdir -p $OUTDIR/img 15 | cp -a $DIR1 $OUTDIR/img-armeabi-v7a 16 | cp -a $DIR2 $OUTDIR/img-x86 17 | cd $OUTDIR 18 | ../merge-dirs.sh img-armeabi-v7a img-x86 img 19 | tar c * | xz -8 > ../$OUTDIR.tar.xz 20 | -------------------------------------------------------------------------------- /img/img-gimp-jessie-armhf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | DIR=dist-gimp-jessie-armeabi-v7a/img 4 | CHROOT="qemu-arm-static $DIR/lib/ld-linux-armhf.so.3 --library-path $DIR/lib/arm-linux-gnueabihf $DIR/usr/sbin/chroot $DIR" 5 | sudo rm -r -f $DIR 6 | mkdir -p $DIR 7 | APT_CACHER= 8 | [ -e /etc/init.d/apt-cacher ] && APT_CACHER=/localhost:3142 9 | sudo qemu-debootstrap --arch=armhf --verbose \ 10 | --components=main,contrib,non-free \ 11 | jessie $DIR http:/$APT_CACHER/ftp.de.debian.org/debian/ \ 12 | && cat sources-jessie.list | sudo tee $DIR/etc/apt/sources.list > /dev/null \ 13 | && sudo $CHROOT apt-get update \ 14 | && sudo $CHROOT apt-get upgrade -y \ 15 | && sudo $CHROOT apt-get install -y `cat img-gimp-wheezy.pkg | sed 's/,/ /g'` \ 16 | && sudo cp ../pkgs/*_armhf.deb $DIR \ 17 | && sudo $CHROOT sh -c "dpkg -i *_armhf.deb" \ 18 | && sudo rm $DIR/*_armhf.deb \ 19 | && sudo ./prepare-img-proot.sh $DIR 20 | -------------------------------------------------------------------------------- /img/img-gimp-jessie-x86.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | DIR=dist-gimp-jessie-x86/img 4 | CHROOT="$DIR/usr/sbin/chroot $DIR" 5 | sudo rm -r -f $DIR 6 | mkdir -p $DIR 7 | APT_CACHER= 8 | [ -e /etc/init.d/apt-cacher ] && APT_CACHER=/localhost:3142 9 | sudo qemu-debootstrap --arch=i386 --verbose \ 10 | --components=main,contrib,non-free \ 11 | jessie $DIR http:/$APT_CACHER/ftp.de.debian.org/debian/ \ 12 | && cat sources-jessie.list | sudo tee $DIR/etc/apt/sources.list > /dev/null \ 13 | && sudo $CHROOT apt-get update \ 14 | && sudo $CHROOT apt-get upgrade -y \ 15 | && sudo $CHROOT apt-get install -y `cat img-gimp-wheezy.pkg | sed 's/,/ /g'` \ 16 | && sudo cp ../pkgs/*_i386.deb $DIR \ 17 | && sudo $CHROOT sh -c "dpkg -i *_i386.deb" \ 18 | && sudo rm $DIR/*_i386.deb \ 19 | && sudo ./prepare-img-proot.sh $DIR x86 20 | -------------------------------------------------------------------------------- /img/img-gimp-wheezy-armhf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | DIR=dist-gimp-wheezy-armeabi-v7a/img 4 | sudo rm -r -f $DIR 5 | mkdir -p $DIR 6 | APT_CACHER= 7 | [ -e /etc/init.d/apt-cacher ] && APT_CACHER=/localhost:3142 8 | sudo qemu-debootstrap --arch=armhf --verbose \ 9 | --components=main,contrib,non-free \ 10 | --include=`cat img-gimp-wheezy.pkg` \ 11 | wheezy $DIR http:/$APT_CACHER/ftp.ua.debian.org/debian/ \ 12 | && cat sources-jessie.list | sed 's/jessie/wheezy/g' | sudo tee $DIR/etc/apt/sources.list > /dev/null \ 13 | && sudo ./prepare-img-proot.sh --update-packages $DIR 14 | -------------------------------------------------------------------------------- /img/img-gimp-wheezy-x86.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | DIR=dist-gimp-wheezy-x86/img 4 | sudo rm -r -f $DIR 5 | mkdir -p $DIR 6 | APT_CACHER= 7 | [ -e /etc/init.d/apt-cacher ] && APT_CACHER=/localhost:3142 8 | sudo qemu-debootstrap --arch=i386 --verbose \ 9 | --components=main,contrib,non-free \ 10 | --include=`cat img-gimp-wheezy.pkg` \ 11 | wheezy $DIR http:/$APT_CACHER/ftp.ua.debian.org/debian/ \ 12 | && cat sources-jessie.list | sed 's/jessie/wheezy/g' | sudo tee $DIR/etc/apt/sources.list > /dev/null \ 13 | && sudo ./prepare-img-proot.sh --update-packages $DIR x86 14 | -------------------------------------------------------------------------------- /img/img-gimp-wheezy.pkg: -------------------------------------------------------------------------------- 1 | fakeroot,x11-xserver-utils,xfce4-panel,xfdesktop4,xfwm4,xfce4-session,thunar,xfconf,xfce4-settings,tango-icon-theme,xfwm4-themes,xterm,locales,fonts-droid,libgl1-mesa-swx11,gimp,inkscape 2 | -------------------------------------------------------------------------------- /img/merge-dirs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "$4" = "--check" ]; then 4 | if [ -e "$2" ] && cmp "$1" "$2" > /dev/null 2>&1; then 5 | mkdir -p `dirname "$3"` 6 | mv "$1" "$3" 7 | rm "$2" 8 | fi 9 | exit 10 | fi 11 | 12 | if [ -z "$1" ]; then 13 | echo "Usage: $0 dir1 dir2 outdir" 14 | echo "Moves identical files in both dir1 and dir2 to outdir" 15 | exit 16 | fi 17 | 18 | IN1="$1" 19 | IN2="$2" 20 | OUT="$3" 21 | THIS="`realpath $0`" 22 | 23 | rm -rf "$OUT" 24 | mkdir -p "$OUT" 25 | 26 | cd "$IN1" 27 | 28 | find . -type f -exec $THIS "{}" "../$IN2/{}" "../$OUT/{}" --check \; 29 | -------------------------------------------------------------------------------- /img/prepare-img-proot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | [ "$USER" = "root" ] || { echo This script needs to be run with superuser privileges; exit 1; } 3 | 4 | set -x 5 | 6 | UPDATE_PACKAGES=false 7 | if [ "$1" = "--update-packages" ]; then 8 | UPDATE_PACKAGES=true 9 | shift 10 | fi 11 | 12 | SAVE_PACKAGES_LIST=false 13 | if [ "$1" = "--save-packages-list" ]; then 14 | SAVE_PACKAGES_LIST=true 15 | shift 16 | fi 17 | 18 | STRIP=false 19 | STRIP_FILES="" 20 | STRIP_PACKAGES="" 21 | if [ "$1" = "--strip" ]; then 22 | STRIP=true 23 | shift 24 | STRIP_FILES="$1" 25 | shift 26 | STRIP_PACKAGES="$1" 27 | shift 28 | fi 29 | 30 | XZ=false 31 | if [ "$1" = "--xz" ]; then 32 | XZ=true 33 | shift 34 | fi 35 | 36 | NOARCHIVE=false 37 | if [ "$1" = "--noarchive" ]; then 38 | NOARCHIVE=true 39 | shift 40 | fi 41 | 42 | DIST=dist-minimal 43 | 44 | [ -z "$1" ] || DIST="$1" 45 | 46 | ARCH="$2" 47 | 48 | CURDIR=`pwd` 49 | 50 | cd $DIST 51 | 52 | CHROOT_CMD="qemu-arm-static lib/ld-linux-armhf.so.3 --library-path lib/arm-linux-gnueabihf usr/sbin/chroot ." 53 | [ "$ARCH" = "x86" ] && CHROOT_CMD="chroot ." 54 | 55 | $UPDATE_PACKAGES && { 56 | echo "--update-packages is actually not needed" 57 | #$CHROOT_CMD usr/bin/apt-get update 58 | #$CHROOT_CMD usr/bin/apt-get upgrade -y 59 | } 60 | 61 | $SAVE_PACKAGES_LIST && { 62 | $CHROOT_CMD usr/sbin/update-apt-xapian-index 63 | } 64 | 65 | $CHROOT_CMD usr/sbin/update-alternatives --set fakeroot /usr/bin/fakeroot-tcp 66 | 67 | rm -f var/cache/apt/archives/*.deb 68 | rm -f var/log/bootstrap.log 69 | 70 | $SAVE_PACKAGES_LIST || { 71 | rm -f var/cache/apt/*.bin 72 | find var/lib/apt/lists/ -type f -delete 73 | cp -a /var/lib/apt/lists/lock var/lib/apt/lists/ 74 | } 75 | 76 | $STRIP && { 77 | #echo 'Yes, do as I say!' | $CHROOT_CMD apt-get remove -y --force-yes --auto-remove `cat $CURDIR/strip.list` 78 | $CHROOT_CMD apt-get remove -y --force-yes --auto-remove `cat $CURDIR/strip.list` $STRIP_PACKAGES 79 | find var/log -type f -delete 80 | rm -rf usr/share/locale/* 81 | rm -rf usr/share/doc/* 82 | rm -rf usr/share/man/* 83 | rm -rf usr/share/info/* 84 | rm -rf var/cache/debconf/* 85 | rm -rf var/cache/apt/*.bin 86 | rm -rf $STRIP_FILES 87 | } 88 | 89 | cp -a $CURDIR/../dist/* . 90 | [ -z "$ARCH" ] || cp -a -f $CURDIR/../dist-$ARCH/* . 91 | 92 | $NOARCHIVE && exit 93 | 94 | ARCHIVE=`echo $DIST | sed 's@/.*@@'` 95 | cd $CURDIR/$ARCHIVE 96 | if $XZ; then 97 | tar c * | pxz -8 > ../$ARCHIVE.tar.xz 98 | else 99 | tar czf ../$ARCHIVE.tar.gz * 100 | fi 101 | -------------------------------------------------------------------------------- /img/sources-jessie.list: -------------------------------------------------------------------------------- 1 | deb http://http.debian.net/debian/ jessie contrib main non-free 2 | #deb-src http://http.debian.net/debian/ jessie main contrib 3 | 4 | deb http://security.debian.org/ jessie/updates contrib main non-free 5 | #deb-src http://security.debian.org/ jessie/updates main contrib 6 | 7 | deb http://http.debian.net/debian/ jessie-updates contrib main non-free 8 | #deb-src http://http.debian.net/debian/ jessie-updates main contrib 9 | 10 | deb http://http.debian.net/debian/ jessie-backports contrib main non-free 11 | #deb-src http://http.debian.net/debian/ jessie-backports contrib main 12 | -------------------------------------------------------------------------------- /img/strip.list: -------------------------------------------------------------------------------- 1 | vim-tiny vim-common manpages info man-db groff-base tasksel tasksel-data 2 | aptitude aptitude-common nano rsyslog libxapian22 debconf-i18n 3 | logrotate cron isc-dhcp-client isc-dhcp-common kmod dmidecode iptables 4 | -------------------------------------------------------------------------------- /img/upload.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | [ -n "$1" ] && rsync -e ssh --progress -h --timeout 10 -a -v $* "pelya@frs.sourceforge.net:/home/frs/project/l/li/libsdl-android/ubuntu/" 4 | -------------------------------------------------------------------------------- /linux-includes/linux/seccomp.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_SECCOMP_H 2 | #define _LINUX_SECCOMP_H 3 | 4 | 5 | #include 6 | 7 | 8 | /* Valid values for seccomp.mode and prctl(PR_SET_SECCOMP, ) */ 9 | #define SECCOMP_MODE_DISABLED 0 /* seccomp is not in use. */ 10 | #define SECCOMP_MODE_STRICT 1 /* uses hard-coded filter. */ 11 | #define SECCOMP_MODE_FILTER 2 /* uses user-supplied filter. */ 12 | 13 | /* 14 | * All BPF programs must return a 32-bit value. 15 | * The bottom 16-bits are for optional return data. 16 | * The upper 16-bits are ordered from least permissive values to most. 17 | * 18 | * The ordering ensures that a min_t() over composed return values always 19 | * selects the least permissive choice. 20 | */ 21 | #define SECCOMP_RET_KILL 0x00000000U /* kill the task immediately */ 22 | #define SECCOMP_RET_TRAP 0x00030000U /* disallow and force a SIGSYS */ 23 | #define SECCOMP_RET_ERRNO 0x00050000U /* returns an errno */ 24 | #define SECCOMP_RET_TRACE 0x7ff00000U /* pass to a tracer or disallow */ 25 | #define SECCOMP_RET_ALLOW 0x7fff0000U /* allow */ 26 | 27 | /* Masks for the return value sections. */ 28 | #define SECCOMP_RET_ACTION 0x7fff0000U 29 | #define SECCOMP_RET_DATA 0x0000ffffU 30 | 31 | /** 32 | * struct seccomp_data - the format the BPF program executes over. 33 | * @nr: the system call number 34 | * @arch: indicates system call convention as an AUDIT_ARCH_* value 35 | * as defined in . 36 | * @instruction_pointer: at the time of the system call. 37 | * @args: up to 6 system call arguments always stored as 64-bit values 38 | * regardless of the architecture. 39 | */ 40 | struct seccomp_data { 41 | int nr; 42 | __u32 arch; 43 | __u64 instruction_pointer; 44 | __u64 args[6]; 45 | }; 46 | 47 | #endif /* _LINUX_SECCOMP_H */ 48 | -------------------------------------------------------------------------------- /pkgs/build-deb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ARCH="`dpkg --print-architecture`" 4 | #ARCH=armhf 5 | #ARCH=i386 6 | [ -z "$ARCH" ] && { 7 | echo "ARCH not defined!" 8 | exit 1 9 | } 10 | 11 | rm -rf $ARCH 12 | mkdir -p $ARCH 13 | cd $ARCH 14 | apt-get source gimp libgc1c2 || exit 1 15 | cd libgc-7.2d 16 | patch -p1 < ../../libgc-disable-dev-zero.patch || exit 1 17 | env DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -us -uc -j4 || exit 1 18 | cd .. 19 | cd gimp-2.8.14 || exit 1 20 | patch -p1 < ../../gimp-limit-redraw-rate.patch || exit 1 21 | dpkg-buildpackage -us -uc -b -j4 || exit 1 22 | cd .. 23 | cd .. 24 | -------------------------------------------------------------------------------- /pkgs/gimp-limit-redraw-rate.patch: -------------------------------------------------------------------------------- 1 | --- gimp-2.8.14/debian/patches/decrease-screen-redraw-rate.patch 1970-01-01 00:00:00.000000000 +0000 2 | +++ gimp-2.8.14/debian/patches/decrease-screen-redraw-rate.patch 2015-03-26 19:16:48.000000000 +0000 3 | @@ -0,0 +1,26 @@ 4 | +Description: Decrease screen redraw rate to 10FPS 5 | + Decrease screen redraw rate to 10FPS, to match slow 6 | + video memory speed on mobile devices, otherwise 7 | + GIMP will be stuck in constant redraw loop 8 | + and will become unresponsible. 9 | + . 10 | + gimp (2.8.14-1) unstable; urgency=low 11 | + . 12 | +Author: Sergii Pylypenko 13 | + 14 | +--- 15 | + 16 | +--- gimp-2.8.14.orig/app/tools/gimpdrawtool.c 17 | ++++ gimp-2.8.14/app/tools/gimpdrawtool.c 18 | +@@ -59,9 +59,9 @@ 19 | + #include "gimpdrawtool.h" 20 | + 21 | + 22 | +-#define DRAW_TIMEOUT 4 23 | ++#define DRAW_TIMEOUT 80 24 | + #define USE_TIMEOUT 1 25 | +-#define MINIMUM_DRAW_INTERVAL 50000 /* 50000 microseconds == 20 fps */ 26 | ++#define MINIMUM_DRAW_INTERVAL 100000 /* 50000 microseconds == 20 fps */ 27 | + 28 | + 29 | + static void gimp_draw_tool_dispose (GObject *object); 30 | diff -u -r --unidirectional-new-file x86/gimp-2.8.14/debian/patches/series armhf/gimp-2.8.14/debian/patches/series 31 | --- gimp-2.8.14/debian/patches/series 2014-09-20 17:32:54.000000000 +0000 32 | +++ gimp-2.8.14/debian/patches/series 2015-03-26 19:13:22.000000000 +0000 33 | @@ -1,2 +1,3 @@ 34 | disable-internal-help-browser 35 | 01_hurd_ftbfs.patch 36 | +decrease-screen-redraw-rate.patch 37 | --- gimp-2.8.14/debian/changelog 2015-03-27 17:09:01.000000000 +0000 38 | +++ gimp-2.8.14/debian/changelog 2015-03-27 17:08:48.000000000 +0000 39 | @@ -1,3 +1,10 @@ 40 | +gimp (2.8.14-1+b1) UNRELEASED; urgency=medium, binary-only=yes 41 | + 42 | + * Binary-only non-maintainer upload for armhf; no source changes. 43 | + * Decrease screen redraw rate to 10FPS 44 | + 45 | + -- pelya Fri, 27 Mar 2015 17:05:50 +0000 46 | + 47 | gimp (2.8.14-1) unstable; urgency=medium 48 | 49 | * Imported Upstream version 2.8.14 50 | -------------------------------------------------------------------------------- /pkgs/gimp_2.8.14-1+b1_armhf.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EXALAB/debian-noroot/afd0f723bf6f2bd53a13bbbe9c77dfa6ea11644f/pkgs/gimp_2.8.14-1+b1_armhf.deb -------------------------------------------------------------------------------- /pkgs/gimp_2.8.14-1+b1_i386.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EXALAB/debian-noroot/afd0f723bf6f2bd53a13bbbe9c77dfa6ea11644f/pkgs/gimp_2.8.14-1+b1_i386.deb -------------------------------------------------------------------------------- /pkgs/libgc-disable-dev-zero.patch: -------------------------------------------------------------------------------- 1 | --- libgc-7.2d/debian/rules 2014-07-03 00:28:14.000000000 +0000 2 | +++ libgc-7.2d/debian/rules 2015-03-26 18:02:13.000000000 +0000 3 | @@ -14,6 +14,7 @@ 4 | [ ! -d libatomic_ops-1.2 ] || mv libatomic_ops-1.2 libatomic_ops-1.2.bak 5 | autoconf 6 | EXTRA_TEST_LIBS="-lpthread" \ 7 | + CFLAGS="-DUSE_MMAP_ANON=1" \ 8 | ./configure \ 9 | $(CONFIG_OPTS) \ 10 | --enable-cplusplus \ 11 | -------------------------------------------------------------------------------- /pkgs/libgc1c2_7.2d-6.4_armhf.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EXALAB/debian-noroot/afd0f723bf6f2bd53a13bbbe9c77dfa6ea11644f/pkgs/libgc1c2_7.2d-6.4_armhf.deb -------------------------------------------------------------------------------- /pkgs/libgc1c2_7.2d-6.4_i386.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EXALAB/debian-noroot/afd0f723bf6f2bd53a13bbbe9c77dfa6ea11644f/pkgs/libgc1c2_7.2d-6.4_i386.deb -------------------------------------------------------------------------------- /proot-android.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/loader/assembly-arm.h b/src/loader/assembly-arm.h 2 | index 365b822..5ae3d74 100644 3 | --- a/src/loader/assembly-arm.h 4 | +++ b/src/loader/assembly-arm.h 5 | @@ -29,13 +29,13 @@ 6 | */ 7 | #define BRANCH(stack_pointer, destination) do { \ 8 | asm volatile ( \ 9 | - "// Restore initial stack pointer. \n\t" \ 10 | + "/* Restore initial stack pointer. */ \n\t" \ 11 | "mov sp, %0 \n\t" \ 12 | " \n\t" \ 13 | - "// Clear rtld_fini. \n\t" \ 14 | + "/* Clear rtld_fini. */ \n\t" \ 15 | "mov r0, #0 \n\t" \ 16 | " \n\t" \ 17 | - "// Start the program. \n\t" \ 18 | + "/* Start the program. */ \n\t" \ 19 | "mov pc, %1 \n" \ 20 | : /* no output */ \ 21 | : "r" (stack_pointer), "r" (destination) \ 22 | diff --git a/src/path/temp.c b/src/path/temp.c 23 | index bbcfb5f..b0d1b53 100644 24 | --- a/src/path/temp.c 25 | +++ b/src/path/temp.c 26 | @@ -10,6 +10,17 @@ 27 | 28 | #include "cli/note.h" 29 | 30 | +static const char *proot_tmpdir = P_tmpdir; 31 | + 32 | +/* __attribute__((constructor)) is GCC-specific extension */ 33 | +__attribute__((constructor)) static void init_tmpdir() 34 | +{ 35 | + if (getenv("PROOT_TMPDIR") != NULL) 36 | + proot_tmpdir = getenv("PROOT_TMPDIR"); 37 | +} 38 | + 39 | +#define P_tmpdir proot_tmpdir 40 | + 41 | /** 42 | * Remove recursively the content of the current working directory. 43 | * This latter has to lie in P_tmpdir (ie. "/tmp" on most systems). 44 | --------------------------------------------------------------------------------